Try it Live
Run Denomination examples in the interactive playground
Gwei
Ethereum gas price denomination, equal to 1 billion (10^9) Wei.Overview
Gwei (gigawei) is the standard unit for gas prices and transaction fees.Gwei.Type is a branded Uint256 preventing accidental unit mixing.
Common usage: Gas prices, transaction fees, network congestion pricing.
Type Definition
Construction
Gwei.from(value)
Create Gwei from numeric value.
value: bigint | number | string- Value to convert to Gwei
Gwei.Type
Note: Uses Uint.from internally for conversion.
Defined in: primitives/Denomination/Gwei.ts:10
Conversions From Other Units
Gwei.fromWei(wei)
Convert Wei to Gwei (divide by 10^9).
wei: Wei.Type- Wei value
Gwei.Type
Formula: gwei = wei / 1_000_000_000 (integer division)
Defined in: primitives/Denomination/Gwei.ts:14
Gwei.fromEther(ether)
Convert Ether to Gwei (multiply by 10^9).
ether: Ether.Type- Ether value
Gwei.Type
Formula: gwei = ether * 1_000_000_000
Defined in: primitives/Denomination/Gwei.ts:19
Conversions To Other Units
Gwei.toWei(gwei)
Convert Gwei to Wei (multiply by 10^9).
gwei: Gwei.Type- Gwei value
Wei.Type
Formula: wei = gwei * 1_000_000_000
Defined in: primitives/Denomination/Gwei.ts:24
Gwei.toEther(gwei)
Convert Gwei to Ether (divide by 10^9).
gwei: Gwei.Type- Gwei value
Ether.Type
Formula: ether = gwei / 1_000_000_000 (integer division)
Defined in: primitives/Denomination/Gwei.ts:29
Conversions To Base Type
Gwei.toU256(gwei)
Convert Gwei to raw Uint256 (removes branding).
gwei: Gwei.Type- Gwei value
Uint.Type
Note: Removes type safety. Use for arithmetic operations requiring Uint.Type.
Defined in: primitives/Denomination/Gwei.ts:34
Usage Examples
Gas Price Calculations
EIP-1559 Transaction
Gas Price Comparison
Gas Price Tracking
Conversion Constants
Common Gwei Values
Type Safety
Gwei type prevents mixing with other denominations:Display Formatting
Gwei is human-readable for gas prices:WASM Acceleration
Gwei conversions available in WebAssembly for performance:Related
- Wei - Smallest denomination
- Ether - User-facing denomination
- Conversions - Converting between units
- Usage Patterns - Common patterns
- Uint256 - Underlying numeric type

