How to Use Dogechain: Writing, Deploying, and Verifying Smart Contracts
Building on Dogechain is just so easy, you can deploy that dApp within a few minutes of trying. That is why it is a blockchain for memecoins — simple, easy, and less technical.
Dogechain is an innovative L2 blockchain built to supercharge the capabilities of Dogecoin by bringing smart contract functionality to the meme coin ecosystem.
Built using Ethereum-compatible technology, Dogechain bridges the gap between the simplicity of Dogecoin and the big rich world of dApps, NFTs, and DeFi in general.
With Dogechain zkEVM, developers have ease of access to a highly scalable and secure platform that supports zero-knowledge rollups with swift transaction speeds and significantly low gas fees.
It is fully compatible with Ethereum tooling, making it easy for developers to port their already existing Solidity-based applications to Dogechain.
What sets it apart even further is the ability to use Dogecoin as gas, giving real utility to DOGE and tying it into a broader smart contract ecosystem.
All-in-all, whether you are building a simple NFT or a complex DeFi protocol, Dogechain zkEVM provides a powerful and cost-effective foundation for your smart contract development.
This guide is a walk through the essential steps of getting on writing a contract using OpenZeppelin Wizard, deploying it with Foundry, and verifying the contract on Dogechain’s explorer.
Let’s begin.
Writing a Smart Contract Using OpenZeppelin Wizard
To write a smart contract quickly, Dogechain developers can rely on the OpenZeppelin Wizard, a user-friendly tool for generating smart contract templates in Solidity or Cairo.
Step 1: Open the Wizard
Visit the OpenZeppelin Wizard in your browser. Choose between “Solidity Wizard” for EVM-based chains like Dogechain or “Cairo Wizard” mainly for Starknet contracts.
Step 2: Select a Contract Template
Choose from one of the following tabs:
➤ ERC20 — for fungible token contracts.
➤ ERC721 — for NFTs.
➤ ERC1155 — for multi-token contracts.
➤ Governor — for DAO frameworks.
➤ Custom — for user-defined smart contracts.
Step 3: Configure Your Contract
To create an ERC721 NFT contract:
Click on the ERC721 tab.
Provide a Name and Symbol for your NFT.
Tick relevant checkboxes like:
Mintable
Burnable
Auto Increment IDs
Choose a license (MIT by default or any other).
Each selection adds Solidity code automatically. You can copy this code to your IDE or click “Open in Remix” to begin development immediately.
Deploying the Contract with Foundry
Dogechain zkEVM is compatible with Ethereum development tools. One of the most efficient ways to deploy on it is using Foundry.
Step 1: Install Foundry
Visit the official Foundry installation page and follow the setup instructions using Foundryup via https://foundry-book.zksync.io/getting-started/installation.
If there are errors regarding libraries, run:
Install Rust if you’ve not already done that.
Step 2: Create and Build a Project
Initialize a new Foundry project:
Build the project:
Test the build:
To open the project in VSCode:
Step 3: Add Your Smart Contract
Get & paste the contract code from OpenZeppelin Wizard into a new .sol file within your project.
To install OpenZeppelin dependencies:
Generate remappings:
Modify remappings.txt to reflect:
Step 4: Add Transfer Restrictions
Using Soulbound, for example, to make your token non-transferable:
Step 5: Attach Token Metadata
Use a service like NFT.storage to upload an image and a JSON file for metadata. The JSON file should include fields like:
Upload the file and use the IPFS URI in your contract.
Setting Environment Variables for Deployment
Create a .env.sample file with the following:
Copy to .env:
Ensure .env is listed in .gitignore to protect your private key.
Deploying the Contract to Dogechain zkEVM
Load your environment variables:
Check if variables are correctly read:
Deploy your contract using:
The console will return the address of the deployed contract.
Verifying the Contract on Dogechain
Visit the Dogechain zkEVM Explorer. Paste your contract address into the search bar.
To manually verify:
- Click the Code tab.
- Select Verify and Publish.
- Choose Flattened Source Code and click Next.
If using Remix, right-click your contract file and select “Flatten”, then paste the flattened code and complete the verification process.
I think that’s all.
You’re done.
Without much ado about nothing, dive into the Explorer and do what you can.
Follow my blog and for more updates.