Deploying Smart Contracts
The thirdweb CLI comes with a command called deploy
; accessible from the /contracts
directory by running
the following command:
This command will perform the following:
- Find all smart contracts from the
/contracts
directory - Compile the smart contracts using Hardhat
- Generate a URL for you to deploy them via the browser
From the browser, you can choose any EVM chain to deploy to or input the information for a custom chain using the thirdweb dashboard.
Using A Local Network (Optional)
When you’re testing out your smart contracts, you can use free test networks like Polygon’s Mumbai, Ethereum’s Sepolia, or any other EVM-compatible test network.
These are great for testing, but sometimes they’re a little slower than you’d like.
You might prefer using a local network that allows you to deploy the smart contracts
to your local machine and still connect to them from the /application
directory. The local network has a few benefits:
- Near instant transaction times
- Easy access to test funds
- Faster iteration cycles
The suggested approach to this is to open a third terminal in your IDE; responsible for running your local network, by running the following command (from the /contracts
directory):
This will allow you to deploy smart contracts to your local node, by using the yarn deploy
command, and selecting Localhost
as the chain to deploy to
on the thirdweb dashboard.