Skip to main content

Try it Live

Run Hardfork examples in the interactive playground

    Canonical Names

    Returns canonical name (not aliases):

    Alias Mapping

    Usage Patterns

    Display Names

    Convert for user display:

    Logging

    Log current hardfork:

    Configuration Serialization

    Normalize for storage:

    API Responses

    Serialize for API:

    Comparison Keys

    Use as map keys:

    Format

    Lowercase:
    • All names lowercase
    • Consistent formatting
    No Spaces:
    • Single word (no spaces)
    • Examples: “cancun”, “shanghai”, “tangerinewhistle”
    Complete List:

    Normalization

    Always use toString for storage/comparison:

    Inverse Operation

    fromString is the inverse:

    Performance

    Time Complexity: O(1) - Direct return (hardforks are already strings internally) Typical Time: ~20-40ns per call

    See Also