Welcome to the Shibarium deployment quickstart! This guide will help you set up your environment and deploy smart contracts on Shibarium, the L2 for the Shiba Inu ecosystem. Whether you’re a seasoned developer or just starting out, you’ll find everything you need to get your contracts live on Shibarium.
Overview
Shibarium is a fast, low-cost, EVM-compatible L2 built for the Shiba Inu ecosystem. You can use all the familiar Ethereum tools—Remix, Hardhat, Truffle, Web3js, and more. Shibarium supports both mainnet and Puppynet (testnet).
If you know how to deploy on Ethereum, you already know how to deploy on Shibarium!
1. Set Up Your Wallet
You need an Ethereum-compatible wallet (e.g., MetaMask) to interact with Shibarium. Add the Shibarium network to your wallet:
Mainnet RPC:
https://rpc.shibarium.shib.io
Chain ID: 109
Explorer: https://shibariumscan.io
Puppynet RPC:
https://rpc.puppynet.shib.io
Chain ID: 157
Explorer: https://puppyscan.shib.io
2. Deploy a Smart Contract with Remix
You can quickly deploy contracts using the Remix IDE and MetaMask.
Write your contract
Create a new Solidity file in Remix and paste:// SPDX-License-Identifier: MIT
pragma solidity >=0.4.0 <0.7.0;
contract SimpleStorage {
uint storedData;
function set(uint x) public {
storedData = x;
}
function get() public view returns (uint) {
return storedData;
}
}
Compile the contract
Click the Solidity logo in Remix and compile your contract.
Connect your wallet
Select Injected Web3 and connect MetaMask (set to Shibarium network). Make sure you have test BONE tokens (get them from the Shibarium faucet). Deploy and interact
Deploy the contract. After deployment, expand the contract in Remix to call get (should return 0), then use set to update the value and verify with get again.
3. Deploy and Verify with Hardhat
You can also use Hardhat for more advanced workflows, including contract verification.
Prerequisites
- Node.js
- MetaMask wallet (add Shibarium network)
- Hardhat (install globally):
Set up your project
mkdir shibarium-smart-contract
cd shibarium-smart-contract
npx hardhat
npm install --save-dev @nomiclabs/hardhat-ethers ethers
Write your contract
Create contracts/SimpleStorage.sol:// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract SimpleStorage {
uint256 private storedData;
function set(uint256 x) public {
storedData = x;
}
function get() public view returns (uint256) {
return storedData;
}
}
Configure Hardhat for Shibarium
Edit hardhat.config.js:require("@nomiclabs/hardhat-ethers");
module.exports = {
solidity: "0.8.0",
networks: {
shibarium: {
url: "https://rpc.shibarium.shib.io",
accounts: [process.env.PRIVATE_KEY]
}
}
};
Create a .env file and add your private key:PRIVATE_KEY=your_private_key_here
Write the deployment script
Create scripts/deploy.js:async function main() {
const [deployer] = await ethers.getSigners();
console.log("Deploying contracts with the account:", deployer.address);
const SimpleStorage = await ethers.getContractFactory("SimpleStorage");
const simpleStorage = await SimpleStorage.deploy();
console.log("SimpleStorage deployed to:", simpleStorage.address);
}
main()
.then(() => process.exit(0))
.catch(error => {
console.error(error);
process.exit(1);
});
Deploy the contract
npx hardhat run scripts/deploy.js --network shibarium
Verify the contract (optional)
Install the verification plugin:npm install --save-dev @nomiclabs/hardhat-etherscan
Update hardhat.config.js:require("@nomiclabs/hardhat-ethers");
require("@nomiclabs/hardhat-etherscan");
module.exports = {
solidity: "0.8.0",
networks: {
shibarium: {
url: "https://rpc.shibarium.shib.io",
accounts: [process.env.PRIVATE_KEY]
}
},
etherscan: {
apiKey: {
shibarium: "shib",
},
customChains: [
{
network: "shibarium",
chainId: 109,
urls: {
apiURL: "https://shibariumscan.io/api/",
browserURL: "https://shibariumscan.io/"
}
},
]
},
};
Verify your contract:npx hardhat verify --network shibarium <DEPLOYED_CONTRACT_ADDRESS>