Try it Live
Run Hardfork examples in the interactive playground
Canonical Names
Returns canonical name (not aliases):Alias Mapping
| Input Alias | Canonical Output |
|---|---|
| paris | merge |
| constantinoplefix | petersburg |
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
- Single word (no spaces)
- Examples: “cancun”, “shanghai”, “tangerinewhistle”
Normalization
Always usetoString 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 callSee Also
- fromString - Parse hardfork from string (inverse)
- allNames - Get all hardfork names
- isValidName - Validate hardfork name

