Skip to main content

Overview

SnarkVM supports multiple network configurations for different deployment scenarios. Understanding network types and how to configure them is essential for development, testing, and production deployments.

Built-in Networks

SnarkVM includes three pre-configured networks:

MainnetV0

The production Aleo blockchain network.
Network Parameters:
  • Network ID: 0
  • Genesis timestamp: 1731484800 (2024-11-13 08:00:00 UTC)
  • Genesis coinbase target: 4611686018427387903
  • Genesis proof target: 281474976710655
  • Starting supply: 1.5B credits
  • Maximum supply: 5B credits

TestnetV0

Public test network for development and testing.
Network Parameters:
  • Network ID: 1
  • Genesis timestamp: 1715778000 (2024-05-15 13:00:00 UTC)
  • Genesis coinbase target: 4611686018427387903
  • Genesis proof target: 281474976710655
  • Same supply parameters as mainnet

CanaryV0

Pre-production testing network for new features.
Network Parameters:
  • Network ID: 2
  • Genesis timestamp: 1717329600 (2024-06-02 12:00:00 UTC)
  • Genesis coinbase target: 4611686018427387903
  • Genesis proof target: 281474976710655

Network Trait

All networks implement the Network trait:

Creating a Custom Network

Custom networks are primarily for development and testing. Production deployments should use the official networks. Custom networks are not compatible with the official Aleo blockchain.

Define Your Network

Create a new network type implementing the Network trait:

Initialize Cryptographic Parameters

Set up hash functions and cryptographic primitives:

Configure Environment

Implement the Environment trait for curve and field configuration:

Network Selection

At Compile Time

Use type parameters for compile-time network selection:

At Runtime

Use enums or trait objects for runtime selection:

Consensus Configuration

SnarkVM uses version-based consensus configuration:

Consensus Parameters

Key consensus parameters include:
  • max_certificates: Maximum batch certificates per subdag
  • anchor_time: Target time between anchor blocks (seconds)
  • max_gc_rounds: Maximum garbage collection rounds
  • max_array_elements: Maximum elements in arrays
  • max_instructions: Maximum instructions per finalize

Storage Configuration

Configure storage for your custom network:
See Storage Modes for detailed storage configuration.

Testing Your Network

Unit Tests

Integration Tests

Best Practices

Network ID Selection

  • Use IDs >= 1000 for custom networks
  • Document your network ID to avoid conflicts
  • Never reuse official network IDs (0, 1, 2)

Parameter Configuration

  • Start with parameters from an official network
  • Adjust only necessary parameters for your use case
  • Document all parameter changes
  • Test thoroughly before deployment

Security Considerations

  • Custom networks do not inherit security properties of official networks
  • Cryptographic parameters must be generated securely
  • Genesis block must be carefully constructed
  • Never use custom networks with real value

Performance Tuning

  • Adjust block time targets for your use case
  • Configure transaction limits based on expected load
  • Set appropriate storage parameters
  • Monitor consensus behavior under load

Common Use Cases

Local Development

Integration Testing

Private Networks

Troubleshooting

Network ID Conflicts

If you see network ID errors:

Genesis Block Issues

Verify genesis block validity:

Parameter Mismatches

Ensure all cryptographic parameters are properly initialized: