Wei, Gwei, Ether — Ethereum Unit Ladder Reference
Ether is divisible down to the wei, and several named intermediate units exist between them. This reference lists the full ladder and the exact power-of-ten factor of each.
The unit ladder
wei = 10^0 (the smallest unit). kwei = 10^3 wei. mwei = 10^6 wei. gwei = 10^9 wei. szabo = 10^12 wei. finney = 10^15 wei. ether = 10^18 wei. Each step up the ladder multiplies by 1000, except the ether unit which sits at 10^18.
Where each unit is used
wei is the base integer unit that the protocol and JSON-RPC actually use for all balances and values. gwei (10^9 wei) is the conventional unit for expressing gas prices and priority fees, since typical fees are small fractions of an ether. ether (10^18 wei) is the human-facing unit for account balances.
Converting safely
Because one ether is 10^18 wei, conversions exceed the safe integer range of ordinary floating-point numbers. Do conversions with big-integer or fixed-point arithmetic to avoid rounding errors: to go from ether to wei multiply by 10^18; to go from wei to ether divide by 10^18.
常见问题
How many wei are in one ether?
One ether equals 10^18 wei — that is, 1 followed by eighteen zeros. This large factor is why balances are handled as big integers rather than floating-point numbers.
Why are gas prices quoted in gwei?
Gwei is 10^9 wei, a convenient scale for gas prices which are otherwise tiny fractions of an ether. Quoting a fee as, say, 20 gwei is far more readable than the equivalent value in wei or ether.
相关工具
充值、拿密钥、上线。
自助开通。支持加密货币或银行卡。按额度计费——重型原语更贵,简单调用很便宜。
获取 API 密钥