Deploying Contracts
Deploying contracts can be done with familiar EVM tools like Hardhat and Foundry. Make sure to configure these tools with the correct chain ID and RPC URL to deploy smart contracts to Zora Network Goerli and Zora Network Mainnet. See the Network Details section for more information.
#
Foundry#
SetupSee the Foundry documentation to initialize your project with Foundry.
#
DeployingTo deploy smart contracts to Zora Network with Foundry, remember to use the --rpc-url and --chain-id flags with the correct values for the Zora network you are deploying to. For example, to deploy to Zora Goerli:
forge create src/MyContract.sol:MyContract --chain-id 999 --rpc-url https://testnet.rpc.zora.energy/ --private-key $PRIVATE_KEY
You can use the same flags for more complicated deploy commands, such as with constructor arguments or a deploy script.
#
VerifyingTo deploy and verify your contract in one command, use Foundry's verification flags configured with Blockscout and Zora Network's Blockscout API:
forge create src/MyContract.sol:MyContract --chain-id 999 --rpc-url https://testnet.rpc.zora.energy/ --private-key $PRIVATE_KEY --verify --verifier blockscout --verifier-url https://testnet.explorer.zora.energy/api\?
You can also verify a pre-existing contract with the forge verify-contract
command using the same flags (--verifier
and --verifier-url
).
Note: Zora uses Blockscout which requires apending \?
to the end of the API url like in the example above. More details here.
#
Hardhat#
SetupRefer to Hardhat's Quick Start guide to install Hardhat and initialize your project.
To configure your project, add the Zora Network information in hardhat.config.js
:
import { HardhatUserConfig } from 'hardhat/config';import '@nomicfoundation/hardhat-toolbox';
require('dotenv').config();
const config: HardhatUserConfig = { solidity: { version: '0.8.17', }, networks: { // for testnet 'zora-goerli': { url: 'https://testnet.rpc.zora.energy/', accounts: [process.env.WALLET_KEY as string], }, // for mainnet 'zora-mainnet': { url: 'https://rpc.zora.energy/', accounts: [process.env.WALLET_KEY as string], }, }, defaultNetwork: 'hardhat',};
export default config;
#
DeployingOnce you've configured your Hardhat project to work with Zora Network, you can proceed with the Hardhat guide to compile, test, and deploy your contracts.
#
VerifyingZora Network uses Blockscout for chain exploration and contract verification. See Blockscout's Hardhat plugin guide to verify contracts with Hardhat and Blockscout.