Chain Management

Master multi-chain operations including switching networks, working with built-in chains, and understanding cross-chain considerations.

Understanding Blockchain Networks

What are Blockchain Networks?

Blockchain networks (or "chains") are independent blockchain systems that:

  • Process Transactions - Each chain validates and records transactions

  • Store State - Account balances, contract data, NFTs

  • Use Native Currency - ETH, POL, BNB, etc. for gas fees

  • Run Smart Contracts - DApps and protocols specific to each chain

EVM Compatibility

WalletAgent supports EVM-compatible chains that:

  • Use Ethereum Virtual Machine

  • Support Ethereum-style addresses (0x...)

  • Allow Solidity smart contracts

  • Use similar transaction formats

Supported Chains

Built-in Chains

WalletAgent includes these chains by default:

Chain
Chain ID
Native Currency
Purpose

Anvil

31337

ETH

Local development

Ethereum

1

ETH

Mainnet (view-only)

Sepolia

11155111

ETH

Ethereum testnet

Polygon

137

POL

Polygon PoS mainnet

Chain Details

Get Current Chain Information

Example Output:

Switching Chains

Switch by Name

Change to any supported chain:

Example Output:

Switch by Chain ID

Use numeric chain identifiers:

Switch Back to Default

Return to Anvil for testing:

Example Output:

Current Chain Information

Get Chain Status

Check your current network and available options:

Example Output:

The tool shows:

  • Your currently connected chain

  • Native currency symbol

  • RPC endpoint being used

  • All available chains you can switch to

Built-in Chain Support

Supported Networks

WalletAgent includes built-in support for major EVM networks:

  • Anvil (Chain ID: 31337) - Local development network with unlimited test funds

  • Ethereum (Chain ID: 1) - Ethereum mainnet (view-only for safety)

  • Sepolia (Chain ID: 11155111) - Ethereum testnet

  • Polygon (Chain ID: 137) - Polygon PoS mainnet

These networks are pre-configured and ready to use without additional setup.

Network Information

Get Network Details

The chain info tool provides all essential network information in one command.

Example usage:

Shows current chain, currency, RPC endpoint, and all available chains for easy switching.

Multi-Chain Operations

Balance Checking Across Chains

Check balances on different networks:

This shows how the same wallet address can have different balances on each chain.

Token Management Across Chains

Understand how tokens work on different chains:

Important: USDC on Ethereum β‰  USDC on Polygon

  • Different contract addresses

  • Require bridging to move between chains

  • May have different names (USDC vs USDC.e)

Cross-Chain Considerations

Chain-Specific Features

Gas Management by Chain

Each chain has different gas characteristics:

Chain
Gas Token
Typical Cost
Speed

Ethereum

ETH

High ($5-50+)

12 sec blocks

Polygon

POL

Very Low ($0.01)

2 sec blocks

Anvil

ETH

Free

Instant

Sepolia

ETH

Free (testnet)

12 sec blocks

Network-Specific Operations

Ethereum Features:

  • ENS domain resolution

  • Highest security and decentralization

  • Most DeFi protocols

Polygon Features:

  • Extremely low fees

  • Fast transactions

  • Gaming and NFT focus

Anvil Features:

  • Instant transactions

  • Unlimited test funds

  • Perfect for development

Error Handling

Common Chain Errors

Chain Not Supported

RPC Connection Failed

Insufficient Gas for Chain

Chain Switching Issues

Wallet Not Connected

Unsupported Chain

Best Practices

Chain Selection Strategy

  1. Development: Start with Anvil

  2. Testing: Use appropriate testnets

  3. Production: Use mainnet only when ready

Multi-Chain Portfolio Management

  1. Track Balances: Regularly check all chains

  2. Gas Planning: Keep native tokens for fees

  3. Bridge Strategy: Plan token movement between chains

  4. Security: Verify chain configuration before transactions

Network Safety

  1. Test First: Always test on Anvil or testnet before mainnet

  2. Verify Network: Confirm you're on the intended network

  3. Start Small: Try small operations before large transactions

  4. Monitor Status: Check network health before important operations

Advanced Features

Network Performance

Built-in networks are configured with reliable RPC endpoints:

  • Anvil: Local network with instant transactions

  • Built-in Networks: Pre-configured with reliable public endpoints

  • Load Balancing: Automatic failover to backup endpoints when needed

  • Optimized: Performance-tuned for common operations

Chain Monitoring

Check network health and statistics:

Example Output:

Troubleshooting

Connection Issues

Network Timeout: Try alternative network

Chain Not Responding: Use backup network

Network Problems

Network Unavailable: Switch to working network

Connection Issues: Use local development

Next Steps

Now that you understand chain management, explore advanced topics:

πŸ‘‰ Security β†’ - Multi-chain security practices πŸ‘‰ Developer Guide β†’ - Building multi-chain applications πŸ‘‰ Advanced Topics β†’ - Custom chain development

Practice Exercises

  1. Chain Switching

    • Switch between all supported chains

    • Compare balances and gas costs

    • Practice network information retrieval

  2. Development Workflow

    • Start development on Anvil

    • Test on Sepolia testnet

    • Compare mainnet networks

  3. Multi-Chain Strategy

    • Plan token distribution across chains

    • Compare transaction costs

    • Understand bridge requirements


You now have comprehensive knowledge of multi-chain operations! ⛓️

Last updated