deploy smart contracts on testnet

~ 5 min.

25.03.2023
edit
image

clone this repo + install -- maintained by your fellow shipper :)

Terminal
git clone https://github.com/shipends/deploy-testnet .
npm install

  • Create an Alchemy account from here
  • Go to dashboard from here, then click on Create App
  • Go to dashboard again, then click on View Key + copy the HTTPS url
  • Create .env file + paste the copied URL there
  • .env
    ALCHEMY_RPC_URL = https://polygon-mumbai.g.alchemy.com/v2/HXjU_LEQGsJdorj0WvERDM33FLGv5tnk
  • Now, copy your Metamask private key (don't know where it is? -- refer from here) + paste it in .env as well
  • .env
    PRIVATE_KEY = 0754508311e37c1c3e98aff90cae665ac797666a8e983059cb05022257aa9f33
  • drop your smart contract in contracts folder
  • open the file deploy.js under scripts folder
  • replace Hello with your smart contract name + if you got constructor arguments, replace them too or else just leave em' blank
  • ./scripts/deploy.js
    ...
    const contractFactory = await hre.ethers.getContractFactory("Hello");
    const contract = await contractFactory.deploy("Helu Shipper", "Shipends");
    ...
  • Finally, run the below command in terminal
  • Terminal
    npx hardhat run scripts/deploy.js --network mumbai

    Go to Polygonscan Mumbai from here + paste your deployed contract address in search bar -- voila, your smart contract is live for anyone to use, isn't that cool!

    think like this, why would i connect my wallet to a random website which only god knows what the heck it does ??? -- 99% will just bounce, no matter how good your idea is.

    But, what if you drop a link to your verified smart contract on Etherscan where anyone can go + check out your actual code -- suddenly, you are legit. Click here & get your smart contract verified -- within 5 min.

    p.s., after verifying, you'll get a green check on Etherscan -- all for free :)