Branded Wei, Gwei, and Ether bigint types preventing accidental ETH unit mismatches at compile time.
Denomination exports three distinct branded bigint types — Wei, Gwei, and Ether — so gas prices, transaction values, and balances cannot be mixed across scales without an explicit conversion.
Scale Table
Type
Wei Equivalent
Precision
Primary Use
Wei
1
Base atomic unit
Transaction value, balances, EVM CALLVALUE
Gwei
10^9 (1_000_000_000n)
10−9 ETH
Gas prices (baseFeePerGas, maxFeePerGas, priority fees)
Import from @tevm/voltaire or @tevm/voltaire/Denomination.
API Reference
Wei
Method
Signature
Description
Wei / Wei.from
(value: bigint | number | string) => Wei
Construct branded Wei
Wei.fromGwei
(gwei: Gwei) => Wei
Multiply by 10^9
Wei.fromEther
(ether: Ether) => Wei
Multiply by 10^18
Wei.toGwei
(wei: Wei) => Gwei
Integer divide by 10^9 (truncates sub-gwei remainder)
Wei.toEther
(wei: Wei) => Ether
Integer divide by 10^18 (truncates sub-ether remainder)
Wei.toU256
(wei: Wei) => Uint256Type
Convert to Uint256Type
Gwei
Method
Signature
Description
Gwei / Gwei.from
(value: bigint | number | string) => Gwei
Construct branded Gwei
Gwei.fromWei
(wei: Wei) => Gwei
Integer divide by 10^9
Gwei.fromEther
(ether: Ether) => Gwei
Multiply by 10^9
Gwei.toWei
(gwei: Gwei) => Wei
Multiply by 10^9
Gwei.toEther
(gwei: Gwei) => Ether
Integer divide by 10^9
Gwei.toU256
(gwei: Gwei) => Uint256Type
Convert to Uint256Type
Ether
Method
Signature
Description
Ether / Ether.from
(value: bigint | number | string) => Ether
Construct branded Ether
Ether.fromWei
(wei: Wei) => Ether
Integer divide by 10^18
Ether.fromGwei
(gwei: Gwei) => Ether
Integer divide by 10^9
Ether.toWei
(ether: Ether) => Wei
Multiply by 10^18
Ether.toGwei
(ether: Ether) => Gwei
Multiply by 10^9
Ether.toU256
(ether: Ether) => Uint256Type
Convert to Uint256Type
Downward conversions (Wei.toGwei, Wei.toEther, Gwei.toEther) perform integer division and truncate fractional remainders. Keep calculations in Wei until final display.
Related
FeeMarket — EIP-1559 and EIP-4844 gas fee calculations