Quick Start
Welcome to the WowChain deployment quickstart guide! This comprehensive walkthrough will help you set up your environment and deploy smart contracts on WowChain. Whether you’re a seasoned developer or just starting out, this guide has got you covered.
What You’ll Achieve
By the end of this quickstart, you’ll be able to:
Set up your development environment to deploy on WowChain
Deploy your smart contracts to WowChain
Connect your frontend to your smart contracts
Set Up Your Development Environment
Create a new project directory
mkdir my-wow-project && cd my-wow-project
Install Foundry, a powerful framework for smart contract development
curl -L https://foundry.paradigm.xyz | bash
foundryup
This installs Foundry and updates it to the latest version.
Initialize a new Solidity project
forge init
Your Foundry project is now ready. You'll find an example contract in the src
directory, which you can replace with your own contracts. For the purposes of this guide, we'll use the Counter contract provided in /src/Counter.sol
Configure Foundry
To deploy your smart contracts to WowChain, you need two key components:
A node connection to interact with the WowChain network
A funded private key to deploy the contract
Let's set up both of these:
1. Set up your node connection
Create a
.env
file in your project's root directoryAdd the WowChain network RPC URL to your
.env
file
WOW_RPC_URL="https://rpc.wowchain.io"
Load your environment variables
source .env
2. Secure your private key
Store your private key in Foundry's secure keystore
cast wallet import deployer --interactive
When prompted enter your private key and a password.
Your private key is stored in ~/.foundry/keystores
which is not tracked by git.
Deploy Your Contracts
Now that your environment is set up, let's deploy your contracts to WowChain Mainnet.
Use the following command to compile and deploy your contract
forge create ./src/Counter.sol:Counter --rpc-url $WOW_RPC_URL --account deployer
Note the format of the contract being deployed is <contract-path>:<contract-name>
.
After successful deployment, the transaction hash will be printed to the console output
Copy the deployed contract address and add it to your
.env
file
COUNTER_CONTRACT_ADDRESS="0x..."
Load the new environment variable
source .env
Verify Your Deployment
To ensure your contract was deployed successfully:
Check the transaction on WowChain Explorer.
Use the
cast
command to interact with your deployed contract from the command line
cast call $COUNTER_CONTRACT_ADDRESS "number()(uint256)" --rpc-url $WOW_RPC_URL
This will return the initial value of the Counter contract's number
storage variable, which will be 0
.
Congratulations! You've deployed your smart contracts to WowChain Mainnet!
Last updated