Documentation
Guides

CodeNut Devnet

Learn about CodeNut's dedicated development chain for seamless smart contract development and testing

CodeNut Devnet is a specialized development blockchain designed to streamline smart contract development and testing. It provides a frictionless development experience with zero setup required and automatic contract deployment.

What is CodeNut Devnet?

CodeNut Devnet is a hosted development blockchain that serves as your primary testing environment. Here's what makes it special:

🌐 Ethereum Mainnet Fork

  • Real-world Data: Fork of Ethereum mainnet as of August 2024
  • Familiar Environment: Contains all common smart contracts and tokens from Ethereum
  • Realistic Testing: Test against actual DeFi protocols, NFT collections, and other mainnet contracts

⚡ Zero Setup Required

  • Default Network: Automatically used for all development work
  • No Configuration: No network setup, RPC configuration, or wallet connections needed
  • Instant Access: Start building immediately without any preliminary steps

🤖 Automatic Deployment

  • AI-Powered: Smart contracts generated by AI are automatically compiled and deployed
  • No Signing Required: No wallet signatures or user interaction needed during development
  • Instant Deployment: Contracts are deployed immediately as they're created

How CodeNut Devnet Works

Automatic Contract Deployment

When you ask the AI to create smart contracts, here's what happens automatically:

  1. Contract Generation: AI writes your smart contract code
  2. Auto Compilation: Contract is compiled automatically with optimized settings
  3. Instant Deployment: Contract deploys to devnet without user interaction
  4. Address Display: Contract address and network info appear in the chat
  5. Metadata Storage: Deployment info is saved to contracts/metadata.json

Contract Information Display

After deployment, you'll see:

  • Contract address on devnet
  • Network information and chain ID
  • Transaction hash for the deployment
  • ABI and other contract details

Metadata Management

All deployment information is automatically stored in your project:

// contracts/metadata.json
{
  "devnet": {
    "MyContract": {
      "address": "0x1234...",
      "deploymentTx": "0xabcd...",
      "abi": [...],
      "deployedAt": "2024-08-15T10:30:00Z"
    }
  }
}

Getting Assets on Devnet

Built-in Devnet Faucet

CodeNut Devnet includes an integrated faucet for all your testing needs:

How to Access the Faucet

  • Location: Upper right corner of the preview UI
  • Easy Access: Click the faucet button when testing your DApp
  • No External Sites: Everything happens within CodeNut

Available Assets

Claim any assets you need for testing:

  • ETH: For gas fees and transactions
  • USDT: Tether stablecoin for DeFi testing
  • USDC: USD Coin for financial applications
  • Common Tokens: Any popular ERC-20 tokens from Ethereum mainnet
  • Custom Tokens: Tokens specific to your DApp testing needs

How to Claim Assets

  • Open the DevNet Faucet dialog
  • Select one of the tokens
  • For custom token, you need to provide the token address
  • Provide the amount to claim, there will be some daily upper limit for the amount depending on the type of the token.

Development Workflow with CodeNut Devnet

1. Development Phase (Devnet)

All development work happens automatically on devnet:

"Create an NFT marketplace smart contract"
"Build a DeFi staking protocol"
"Make a DAO governance system"

What happens automatically:

  • Smart contract is written by AI
  • Contract compiles automatically
  • Deploys instantly to devnet
  • Contract address displayed in chat
  • Frontend connects to devnet contract
  • Test with unlimited devnet assets

2. Testing Phase (Devnet)

Test your DApp thoroughly on devnet by interacting with the dApp and smart contract.

Testing Benefits:

  • Instant Transactions: No waiting for block confirmations
  • Free Assets: Claim unlimited tokens for testing
  • Real Mainnet Data: Test against actual Ethereum protocols
  • Risk-Free: No real money involved

3. Production Deployment (Mainnet)

When ready, deploy to production using the publish dialog.

Deployment Process:

  • Choose your target mainnet (ETH, BSC, Arbitrum, etc.)
  • Review gas estimation before deployment
  • Sign transaction with your wallet
  • Pay gas fees for deployment
  • Contract deploys to selected mainnet
  • Published DApp uses mainnet addresses

Preview vs Published DApp

Preview Mode (Uses Devnet)

When you're developing and testing:

  • Preview URL: Your DApp preview always uses devnet contracts
  • Fast Testing: Instant transactions and free assets
  • Safe Environment: No real money, unlimited experimentation
  • Devnet Contracts: All interactions use devnet-deployed contracts

Published DApp (Uses Mainnet)

When you publish your DApp:

  • Production Ready: Published DApp uses mainnet contracts
  • Real Transactions: Users interact with real blockchain
  • Custom Domain: Available on your .codenut.xyz subdomain or custom domain
  • Mainnet Addresses: Automatically switches to mainnet contract addresses

Dual Environment Benefits

  • Seamless Development: Build and test without any blockchain complexity
  • Easy Deployment: One command moves from devnet to mainnet
  • Safe Testing: Always test on devnet before mainnet deployment
  • Cost Effective: No gas fees during development phase

Devnet vs Traditional Testnets

CodeNut Devnet Advantages

Compared to traditional testnets like Sepolia or Mumbai:

Zero Friction Development

  • No Setup: Works immediately without any configuration
  • No Faucets: Built-in assets, no external faucet websites
  • No Wallet Signing: Automatic deployment without user interaction
  • No Gas Fees: All development operations are free

Better Development Experience

  • Instant Deployment: Contracts deploy immediately
  • Real Data: Fork of actual Ethereum mainnet with real protocols
  • Unlimited Assets: Get any amount of any token for testing
  • Always Available: No network downtime or congestion

Streamlined Workflow

  • Automatic: Everything happens without user intervention
  • Integrated: Faucet and deployment built into the interface
  • Persistent: Your contracts stay deployed for extended testing
  • Metadata Tracking: All deployment info automatically saved

Best Practices with CodeNut Devnet

Development Best Practices

1. Thorough Devnet Testing

  • Test All Features: Ensure every function works on devnet first
  • Edge Case Testing: Try extreme values and error conditions
  • User Flow Testing: Test complete user journeys on devnet
  • Integration Testing: Test how contracts interact with each other

2. Asset Management

  • Claim What You Need: Use the faucet to get appropriate test tokens
  • Test Different Scenarios: Try with various token amounts
  • Simulate Real Conditions: Test with realistic token quantities

3. Pre-Deployment Checklist

  • Security Review: Have your contracts reviewed for vulnerabilities
  • Gas Optimization: Ensure contracts are gas-efficient
  • Documentation: Document all contract functions and features
  • Final Testing: Do comprehensive testing before mainnet deployment

Ready to Build?

CodeNut Devnet removes all the complexity from blockchain development. No configuration, no setup, no hassle - just describe what you want to build and start testing immediately.

Try creating your first smart contract and experience the future of Web3 development!