Skip to main content

Documentation Index

Fetch the complete documentation index at: https://voltaire.tevm.sh/llms.txt

Use this file to discover all available pages before exploring further.

Try it Live

Run Hardfork examples in the interactive playground

    Chronological Ordering

    Hardforks are ordered chronologically by deployment date:
    FRONTIER (0) < HOMESTEAD (1) < DAO (2) < ... < CANCUN (16) < PRAGUE (17)
    
    Comparison uses array index lookup, making it O(1) constant time.

    Usage Patterns

    Feature Gating

    Check minimum version requirements:
    import { Hardfork, LONDON } from 'tevm'
    
    const fork = Hardfork(config.hardfork)
    
    if (!fork.isAtLeast(LONDON)) {
      throw new Error("EIP-1559 requires London or later")
    }
    
    // Safe to use EIP-1559 features
    

    Network Configuration

    Validate network compatibility:
    import { Hardfork, SHANGHAI } from 'tevm'
    
    function validateNetworkConfig(clientFork: BrandedHardfork, networkFork: BrandedHardfork) {
      if (!clientFork.isAtLeast(networkFork)) {
        throw new Error(
          `Client must support at least ${Hardfork.toString(networkFork)}, ` +
          `but only supports ${Hardfork.toString(clientFork)}`
        )
      }
    }
    
    validateNetworkConfig(SHANGHAI, LONDON)  // OK
    validateNetworkConfig(LONDON, SHANGHAI)  // Throws error
    

    Transaction Type Selection

    Select appropriate transaction format:
    import { Hardfork, LONDON, CANCUN } from 'tevm'
    
    function selectTxType(fork: BrandedHardfork): number {
      if (fork.isAtLeast(CANCUN)) {
        return 3  // Blob transaction
      }
      if (fork.isAtLeast(LONDON)) {
        return 2  // EIP-1559
      }
      return 0  // Legacy
    }
    

    EIP References

    Common minimum version checks:
    FeatureMinimum VersionEIP
    EIP-1559 base feeLondonEIP-1559
    PUSH0 opcodeShanghaiEIP-3855
    Blob transactionsCancunEIP-4844
    Transient storageCancunEIP-1153
    Proof of StakeMergeEIP-3675

    Performance

    Time Complexity: O(1) - Array index comparison Typical Time: ~10-20ns per call

    See Also

    • isBefore - Check if strictly less than
    • isAfter - Check if strictly greater than
    • compare - Three-way comparison
    • gte - Alias for isAtLeast