Skip to content

Deploying contracts

Course: Ganache, Trufle, Hardhat and Foundry - chapter 12

Ref - https://book.getfoundry.sh/forge/deploying

To deploy a contract, use the forge create command.

You will need some ETH to be able to deploy it.

forge create --rpc-url <your_rpc_url> --private-key <your_private_key> src/MyContract.sol:MyContract
  1. RPC URL - You can get one from Alchemy
  2. Private key - Export from Metamask
  3. Balance ETH - ‣
forge create --rpc-url https://eth-sepolia.g.alchemy.com/v2/nnY0qPUQLYsUvb5BKJM5bh81sI6O0PQG --private-key fba7342ef6879df2c735644c734ea69c140f423d84eb2d53fbdfd53fd5d7c586 src/Token.sol:MyToken --legacy

https://sepolia.etherscan.io/tx/0xdd82ea46c582aa492b05e2c3340308aad06d5778e4b32950d8ea28c2dd457c03

Contract - https://sepolia.etherscan.io/address/0x1974d184240f5ff9cfb37f32da22d82fc6b66aa8

You can also go to etherscan and verify the contract.