This guide covers testing and deploying Star World Order contracts on the Monad Testnet.
| Property | Value |
|---|---|
| Chain ID | 143 (0x8f) |
| Currency | MON |
| Block Gas Limit | 200,000,000 |
| RPC URL | https://rpc.monad.xyz |
| Explorer | https://monadscan.com |
| Property | Value |
|---|---|
| Chain ID | 10143 (0x279f) |
| Currency | MON (testnet) |
| RPC URL | https://testnet-rpc.monad.xyz |
| Explorer | https://testnet.monadscan.com |
| Faucet | https://faucet.monad.xyz |
Copy .env.example to .env.local and update for testnet:
cp .env.example .env.localEdit .env.local:
# Switch to testnet
NEXT_PUBLIC_MONAD_CHAIN_ID=10143
NEXT_PUBLIC_MONAD_RPC_URL=https://testnet-rpc.monad.xyz
# Enable dev access for testing (optional)
NEXT_PUBLIC_DEV_ACCESS_ENABLED=true- Go to Monad Faucet
- Connect your wallet or enter your address
- Request testnet MON tokens
- Wait for tokens to arrive (usually within seconds)
curl -L https://foundry.paradigm.xyz | bash
foundryup# Set your deployer private key
export DEPLOYER_PRIVATE_KEY=0x...
export DAO_TREASURY_ADDRESS=0x... # Your treasury address
# Deploy to testnet
forge create --rpc-url https://testnet-rpc.monad.xyz \
--private-key $DEPLOYER_PRIVATE_KEY \
contracts/StarSkrumpeyMarketplace.sol:StarSkrumpeyMarketplace \
--constructor-args \
0x0000000000000000000000000000000000000000 \ # Test NFT contract (deploy your own)
$DAO_TREASURY_ADDRESS \
250 # 2.5% feeforge create --rpc-url https://testnet-rpc.monad.xyz \
--private-key $DEPLOYER_PRIVATE_KEY \
contracts/StarSkrumpeyStaking.sol:StarSkrumpeyStaking \
--constructor-args \
0x0000000000000000000000000000000000000000 \ # Test NFT contract
$DAO_TREASURY_ADDRESS \
1000000000000000 \ # 0.001 MON per second reward rate
86400 # 1 day cooldownforge create --rpc-url https://testnet-rpc.monad.xyz \
--private-key $DEPLOYER_PRIVATE_KEY \
contracts/StarWorldOrderGovernor.sol:StarWorldOrderGovernor \
--constructor-args \
0x0000000000000000000000000000000000000000 \ # Test NFT contract
5000 \ # Voting period (~5 hours on Monad)
100 \ # Voting delay (~6 minutes)
1 \ # Quorum threshold
1 # Proposal thresholdforge verify-contract \
--chain-id 10143 \
--compiler-version v0.8.20 \
$DEPLOYED_ADDRESS \
contracts/StarSkrumpeyMarketplace.sol:StarSkrumpeyMarketplace \
--verifier-url https://testnet.monadscan.com/apiAfter deployment, update .env.local with the deployed contract addresses:
NEXT_PUBLIC_MARKETPLACE_CONTRACT=0x...
NEXT_PUBLIC_GOVERNANCE_CONTRACT=0x...
NEXT_PUBLIC_STAKING_CONTRACT=0x...
NEXT_PUBLIC_DAO_TREASURY_ADDRESS=0x...You can also interact with contracts using ethers.js:
const { ethers } = require('ethers');
// Connect to Monad Testnet
const provider = new ethers.JsonRpcProvider('https://testnet-rpc.monad.xyz');
// Create wallet from private key
const wallet = new ethers.Wallet(process.env.DEPLOYER_PRIVATE_KEY, provider);
// Check balance
const balance = await provider.getBalance(wallet.address);
console.log('Balance:', ethers.formatEther(balance), 'MON');- Start the development server:
npm run dev-
Connect your wallet (MetaMask, etc.)
-
Switch to Monad Testnet in your wallet:
- Network Name: Monad Testnet
- RPC URL: https://testnet-rpc.monad.xyz
- Chain ID: 10143
- Currency Symbol: MON
- Block Explorer: https://testnet.monadscan.com
- Try alternative RPC endpoint:
https://monad-testnet.drpc.org - Check if your IP is rate-limited
- Get more testnet MON from the faucet
- Reduce gas limit if transaction fails
- Ensure you have enough MON for deployment
- Check constructor arguments match expected types
- Verify OpenZeppelin contracts version compatibility
- Never use testnet wallets with mainnet funds
- Never commit private keys to version control
- Use environment variables for sensitive data
- Test thoroughly before mainnet deployment