DEV Community

Geeloko.eth
Geeloko.eth

Posted on

Deploy smart contracts to any EVM chain w/ ThirdWeb

Deploying contracts with VS Code can feel very daunting especially because you have to expose your private Keys. The slightest mishap will have your keys exposed and your projects and wallets compromised. ThirdWeb provides a link in vs code that leads to their dashboard where you can easily connect your Dev wallet & deploy on any EVM chain.

ThirdWeb, is the first chain-agnostic web3 framework & now works out-of-the-box with any smart contract on any EVM-compatible blockchain. This means that you can use their best-in-class tools to deploy, manage, and interact with smart contracts and web3 applications, no matter which blockchain you are using. In this blog post, I will show you how to deploy a contract with ThirdWeb, step-by-step.

Prerequisites

  • vs code
  • basic solidity knowledge to build a custom contract
  • third web account

if you don't know solidity you are better of using ThirdWeb to find a contract that suites your demand

if you still reading then you have vs code installed basic solidity contract stored in a directory ProjectName/contracts/test.sol. Great now lets carry on

NB: If your test contracts imports from OpenZeppelin contracts this for other npm sources this will be the best time to install or directly import them

Open the ProjectName Folder in VS Code and then access the Terminal with keyboard shorcut "CTRL+Shift+`" and paste the following in the terminal: "npx thirdweb deploy"

NB: At this point make sure your ProjectName Folder has a folder called "contracts" with solidity contracts inside of it other you will see this "No contracts detected in this directory" and dependencies will not get the deploy link instead before this You will receive a prompt asking you to install the dependencies.

After the process is done you will be hit with a prompt
Image description

hit enter to continue and allow for contracts to compile

Image description

All done with compiling now wait a few seconds for the link to deploy

Image description

(https://thirdweb.com/contracts/deploy/Qme6eB8pDG9u3HNuGgUjdyXNaQCGFbVXXQTT85JyuhKyh9)
PS: this link can deploy the same instance several times across several EVM chains for any wallet, pretty cool right?!
now you can click on the link or paste the link a browser with dev MetaMask wallet extension

and you should end up here
Image description

from here you just need to make sure the network in your wallet matches the configuration in the dashboard. You can change this at will to customs or default EVM chains

Image description

Image description

confirm deployment & listing on ThirdWeb dashboard and your all set to verify your contract and more!!

Image description
Image description

contract:
https://thirdweb.com/sepolia/0xA07f49794E93f203bBE7Ad0F200B052275c8AeEF

source:
https://blog.thirdweb.com/any-contract-any-evm-chain/

Top comments (0)