Try it Live
Run Denomination examples in the interactive playground
Conceptual Guide - For API reference and method documentation, see Denomination API.
What are Denominations?
Denominations are units of value in Ethereum. All values are internally stored as Wei (the smallest unit), but expressed in different units for readability:- Wei - Base unit for precise calculations (like cents)
- Gwei - Gas price unit (like dollars)
- Ether - User-facing unit (like thousands of dollars)
The Three Units
- Wei
- Gwei
- Ether
Conversion Scale
Understanding the relationships between units:- Visual Scale
- Real-World Analogy
Converting Between Units
- Ether → Gwei → Wei
- Wei → Gwei → Ether
- Gwei Conversions
Complete Example: Gas Cost Calculation
Calculate total transaction cost from gas price and gas used:Gas Price Examples
- Different Gas Prices
- Complex Transaction
Formatting for Display
When displaying values to users, convert to appropriate units:Common Use Cases
- Wallet Balance
- Gas Price Display
- Precise Calculations
Precision Considerations
- Always Use BigInt
- Integer Division
- Avoid Floating Point
Type Safety
Tevm prevents accidental unit mixing at compile time:Resources
- Ethereum Units - Official Ethereum documentation
- EIP-1559 - Fee market and gas pricing
- Etherscan Gas Tracker - Real-time gas prices in Gwei
- Uint Documentation - Underlying 256-bit integer type
Next Steps
- Overview - Type definitions and API reference
- Wei - Base unit operations
- Gwei - Gas price unit
- Ether - User-facing unit
- Conversions - Converting between units

