hardhat deploying application to sepolia testnet

To deploy to a testnet, let's use this endpoint as my testnet -https://eth-sepolia.g.alchemy.com/v2/xxxxxxxxxxxxxxxxxxxxxxxxx. Please register and create a free account

and select all the testnet



And we also need to set the wallet private keys (please do not share actual private key). This account here must have some $$$$. If you don't have you can use sepolia to send this over to your MetaMask or any other wall. 

https://cloud.google.com/application/web3/faucet/ethereum/sepolia

Once you have the account you can paste your wallet id to the url above. To get the wallet id, click on "receive" as shown here


 


 

Why use google? Others like Alchemy requires atleast some $$$ in your wallet before you can deploy anything.Ensure that we have the followings configurations:-

    hardhatOp:
{
      type: "edr-simulated",
      chainType: "op",
    },
    sepolia: {
      type: "http",
      chainType: "l1",
      url: configVariable(SEPOLIA_RPC_URL),
      accounts: [configVariable("SEPOLIA_PRIVATE_KEY")],
    },
  },
});

In the following setups, we need to setup our keystore 

pnpm hardhat keystore set SEPOLIA_RPC_URL --force

pnpm hardhat keystore set SEPOLIA_PRIVATE_KEY --force

You will be prompted to enter password to your store. Please set this up before issuing command above. Finally to deploy run the following command

pnpm hardhat ignition deploy ignition/modules/Counter.ts --network sepolia

And if everything goes well, you would get your contract deployed as shown here:



And if you want to verify it, please ensure you use the following configuration:- 


   networks: {
    hardhatMainnet: {
      type: "edr-simulated",
      chainType: "l1",
    },
    hardhatOp: {
      type: "edr-simulated",
      chainType: "op",
    },
    sepolia: {
      type: "http",
      chainType: "l1",
      url: configVariable("SEPOLIA_RPC_URL"),
      accounts: [configVariable("SEPOLIA_PRIVATE_KEY")],
    }
  },
  verify: {
    etherscan: {
      apiKey: configVariable("ETHERSCAN_API_KEY"),
    },
  },
});



And after you run  

pnpm hardhat ignition deploy ignition/modules/Counter.ts --network sepolia --verify


If you getting error like "Error HHE10115 in plugin hardhat-ignition: Could not find a module file at the path: "ignition/modules/Apollo.ts". By right this shouldn't happened but if it does, please check your configuration again to ensure it matches something above. 

And you can verify your contract by looking at it here:-




Or replace the address with your deployed transaction id you get earlier

https://sepolia.etherscan.io/address/0x62D6a1681e20cB502e85886939CAFA380Dc0d4e6#code

Interacting with your contract

To do this, first click on contract and the write as shown here




Next click on "connect to web3" and select Metamask. Your account should have some faucet. 


Click on the "inc" command and then confirm with metamask





And you can see the transactions here 







Comments

Popular posts from this blog

vllm : Failed to infer device type

NodeJS: Error: spawn EINVAL in window for node version 20.20 and 18.20

android studio kotlin source is null error