Installation

Crypto Token Escrow is actually a package of two different applications. One is smart contracts for EVM blockchains. Another is web3 app interface to interact with the blockchain. Please follow below sections step by step carefully.

Prerequisites

  1. Basic Ethereum knowledge and a couple of minutes to follow this doc.

  2. The latest nodeJS LTS (v18 recommended) installed locally and node and npm are accessible from terminal/cmd/Powershell. References: Windows 10, Ubuntu, macOS

  3. An API key from Alchemy. Reference: Alchemy API Key. Do not worry about pricing. Start with the free plan. They won't force you to pay.

    • Please ensure you collected the only API Key. Not Http or Websocket url. Alchemy Key
    • Advance: If you have your own node and RPC or other RPC, please feel free to contact us. We will guide you to use those with Crypto Token Escrow.
  4. A WalletConnect Cloud project id to enable WalletConnect V2 SDK. Head over to WalletConnect Cloud to sign in or sign up. Create (or use an existing) project and copy its associated project id.

  5. KEY, SECRET and Bucket name from Filebase. Just sign up and get the KEY and SECRET from the sidebar "Access Keys" menu. Also create a Bucket and remember it. Follow the links Creating a Bucket and Access Keys. Don't worry about pricing. It's providing an insane amount of resources for free.

  6. A Chain ID of a network where you want to deploy the smart contract. Supported networks and chain ids...

    NetworkChain ID
    Ethereum1
    Goerli5
    OP Mainnet10
    Flare Mainnet14
    Coston16
    Songbird Mainnet19
    Cronos25
    Telos40
    Telos41
    XinFin Network50
    Apothem Network51
    BNB Smart Chain56
    Syscoin Mainnet57
    OKC66
    Binance Smart Chain Testnet97
    Gnosis100
    Coston2114
    Polygon137
    Nexilix Smart Chain240
    Fantom250
    zkSync Era Testnet280
    Boba Network288
    Filecoin Mainnet314
    zkSync Era324
    Cronos Testnet338
    PulseChain369
    Optimism Goerli420
    Metis Goerli599
    Taraxa Mainnet841
    Taraxa Testnet842
    Wanchain888
    PulseChain V4943
    5ireChain Thunder Testnet997
    Zora Goerli Testnet999
    Bronos Testnet1038
    Bronos1039
    Metis1088
    Polygon zkEVM1101
    Moonbeam1284
    Moonriver1285
    Moonbase Alpha1287
    Localhost1337
    Polygon zkEVM Testnet1442
    Dogechain2000
    Edgeware EdgeEVM Mainnet2021
    Beresheet BereEVM Testnet2022
    Filecoin Hyperspace3141
    Crossbell3737
    Fantom Testnet4002
    Nexi4242
    IoTeX4689
    IoTeX Testnet4690
    MEVerse Chain Testnet4759
    BlackFort Exchange Network Testnet4777
    BlackFort Exchange Network4999
    Mantle5000
    Mantle Testnet5001
    MEVerse Chain Mainnet7518
    Canto7700
    Shardeum Sphinx8082
    Klaytn8217
    Base8453
    Evmos Testnet9000
    Evmos9001
    Gnosis Chiado10200
    HAQQ Mainnet11235
    Fibo Chain12306
    Cannoli17323
    Hardhat31337
    Arbitrum One42161
    Celo42220
    Avalanche Fuji43113
    Avalanche43114
    Alfajores44787
    DFK Chain53935
    HAQQ Testedge 254211
    Linea Goerli Testnet59140
    Polygon Mumbai80001
    Base Goerli84531
    Taiko (Alpha-3 Testnet)167005
    Filecoin Calibration314159
    Arbitrum Goerli421613
    Scroll Testnet534353
    Zhejiang1337803
    Zora7777777
    Sepolia11155111
    SKALE - Razor Network278611351
    SKALE - Calypso NFT Hub Testnet344106930
    SKALE - Block Brawlers391845894
    SKALE - Europa Liquidity Hub Testnet476158412
    SKALE - Nebula Gaming Hub Testnet503129905
    SKALE - CryptoBlades1026062157
    SKALE - Human Protocol1273227453
    Aurora1313161554
    Aurora Testnet1313161555
    SKALE - Titan Community Hub1350216234
    SKALE - Chaos Testnet1351057110
    SKALE - Nebula Gaming Hub1482601649
    SKALE - Titan Community Hub Testnet1517929550
    SKALE - Calypso NFT Hub1564830818
    Harmony One1666600000
    SKALE - Europa Liquidity Hub2046399126
    SKALE - Exorde2139927552
  7. A Crypto Wallet is installed and the address and private key of an account. That will be used to deploy the smart contract. That account will be the Owner. Please make sure you have a couple of ether to pay the gas fee upon contract deployment. You must remove the private key after you successfully deployed the contract to a network. That will not be disclosed to the front end. Only the owner's public address will be public. So no worry. How to export the private key from MetaMask

  8. A Tawk.to account and property URL. We prefer using this free but powerful service to enable communication between the buyer/seller and the application owner/admin.

Steps

After purchasing Crypto Token Escrow, you will get a compressed zip file named erc20-escrow-v2.0.0.zip or something similar. Just extract that file at a suitable location on your local computer. You will get 3 more zip file in extracted folder. One is for Documents, one zip containing smart contracts application, and the other one is for web3 app. You have to work on smart contracts application. Extract the smart-contracts.zip and web3-app.zip file.

Smart Contract Deployment (smart-contracts folder)

  1. Open up a terminal/cmd/PowerShell and navigate to the smart-contracts directory. Where you should get a .env.setup file. Please make sure that your file explorer application shows you the hidden/dotfiles.

  2. After navigating to that directory run below commands...

    pnpm install
    
    cp .env.setup .env
    
  3. Open up the .env file into one of your text editors and change a couple of things as below.

    • Replace __APP_CHAIN_ID__ with the chain id you choose from the above chaininfo table. Ex: 11155111

    • Replace __ERC20_BEP20_TRC20_TOKEN_ADDRESS__ with the token address you want your application should interact to (erc20, bep20, trc20) Ex: 0x337610d27c682E347C9cD60BD4b3b107C9d34dDd

    • Replace __MINIMUM_ESCROW_AMOUNT_IN_ETHER__ with the minimum escrow amount allowed to create an escrow. In Ether. Ex: 0.001

    • Replace __ESCROW_FEE_IN_PERCENT__ with the escrow fee the owner/you want to be paid upon escrow clearance. In %. Ex: 5

    • Replace __ALCHEMY_KEY_HERE__ with the Alchemy API key. Ex: sdfasdfasdfsdfsdgffhgfghdgf

    • Replace __DEPLOYER_PRIVATE_KEY_HERE__ with the owner account private key.

  4. If you followed all the above points carefully then you are now ready to build and deploy the contract. Run the below commands one by one carefully. Please make sure you have some ether into your deployer/owner address/account to pay the gas fee.

    pnpm build-contract
    
    pnpm deploy-contract
    

    Wait some minutes after the above commands. Time depends on the network and other things. So, no worries. The deployment will be a success if you have enough ether to pay the gas fee. If you get a response from the deploy command like below then the deployment is successful. In case you face any issues, please feel free to contact us.

    EscrowHub deployed to: 0x421F67801BDa8a0eA4B2BC9D564b5C62Ca599734

We3 App Deployment (web3-app folder)

  1. Open up a terminal/cmd/PowerShell and navigate to the web3-app directory. Where you should get a .env.setup file. Please make sure that your file explorer application shows you the hidden/dotfiles.

  2. After navigating to that directory run below command...

    cp .env.setup .env
    
  3. Open up the .env file into one of your text editors and change a couple of things as below.

    • Replace __APP_NAME__ with your app title. Ex: Crypto Token Escrow.
    • Replace __APP_LIVE_BASEURL__ with the app live base url. You can skip this in your local machine. But in live server, it is required.
    • Replace __AUTH_SECRET__ with a randomly generated string. You can quickly generate a good secret on the command line via this openssl command. Ex: +oRxySo9vvloyCb4fZO/MqCe465zr7gwxK328b71eYM=
      openssl rand -base64 32
      
    • Replace __FILEBASE_KEY_HERE__ with the Filebase Access key. Ex: C3LB3BL93D1C0F687A66
    • Replace __FILEBASE_SECRET_HERE__ with the Filebase Access secret. Ex: VM0pRmuAKe41urmfZWTV9MiKyUgN5WgJn1npn5NK
    • Replace __FILEBASE_BUCKET_HERE__ with the Filebase bucket name you created before. Ex: cescrow-v2
    • Replace __WALLETCONNECT_PROJECT_ID__ with the WalletConnect Cloud project id.
    • Replace __TOKEN_SYMBOL_HERE__ with the ERC20/BEP20/TRC20 token symbol. You can get the symbol from that token etherscan. EX: USDT
    • Replace __TOKEN_DECIMALS_HERE__ with the ERC20/BEP20/TRC20 token decimals points. EX: 18
    • Replace __DEPLOYER_ADDRESS_HERE__ with the owner's account address. Ex: 0xFe5e946EcccB0f59542D5B99740fa432423F2F63
    • Replace __TAWK_TO_URL__ with Tawk.to property chat box URL. Check the example in the .env file.
  4. Copy the whole content of smart-contracts/.env file and paste at the end of web3-app/.env file.

  5. Remove DEPLOYER variable and its value from web3-app/.env file

Production Deployment

We recommend Vercel as a serverless no hassle deployment server. They have really great support for NextJS-based application deployment.

Vercel Deployment

You must need git installed into your local machine to deploy using this method. Please check this Youtube Video at least 3 times if you are not an expert. Then try to deploy to Vercel.

On Environment Variables section of Vercel build settings, copy the whole local .env file content using CMD/CTRL+A and paste into the variable input. Remove DEPLOYER variable.

VPS, DO Droplet deployment

This way of deployment is not so much easy. We recommend hiring an expert and spending some penny if you are not an expert. However, we are providing the guide. Please check this Youtube Video to learn this way.

Please ensure you upload the local .env file to the server also.

For more references, please check out this tutorial.