What Is Wei?
Wei is the smallest denomination of Ether (ETH), named after Wei Dai, a cryptography pioneer. One ETH equals 10^18 (one quintillion) wei. Just as a dollar is divisible into 100 cents, Ether is divisible into many smaller units, with wei being the atomic unit. Wei is critical for smart contract development and precise gas fee calculations, where fractional ETH amounts must be represented as whole numbers.
Table of Contents
What Is Wei?
Wei is the base unit of Ether, representing the smallest indivisible amount of ETH. All ETH values in smart contracts and at the protocol level are stored and calculated in wei. When you see a transaction value of 50000000000000000 wei, that equals 0.05 ETH. This system ensures precision in calculations, as floating-point arithmetic is unreliable in deterministic smart contract execution.
Ethereum Denominations
Ethereum has several named denominations between wei and ETH. Gwei (gigawei, or 10^9 wei) is the most commonly used intermediate denomination, as gas prices are expressed in gwei. One gwei equals 0.000000001 ETH. Other denominations include szabo (10^12 wei), finney (10^15 wei), and ether (10^18 wei). In practice, users encounter only ETH and gwei in daily interactions.
Why Wei Matters
Smart contracts cannot use decimal numbers. All token balances, transfer amounts, and calculations use integer arithmetic in wei. When Solidity code processes a transfer of 1.5 ETH, it actually handles 1500000000000000000 wei. This integer-based approach prevents rounding errors that could be exploited in financial contracts. Developers must be careful with wei-to-ETH conversions to avoid precision loss or overflow errors.
Common Conversions
Key conversions to remember: 1 ETH = 10^18 wei = 10^9 gwei. 1 gwei = 10^9 wei. A gas price of 30 gwei means each gas unit costs 30,000,000,000 wei. Online tools like eth-converter.com make it easy to convert between denominations. Most development frameworks like ethers.js and web3.js provide built-in utility functions for denomination conversion to prevent manual calculation errors.
Frequently Asked Questions
Why is the smallest unit called wei?
Wei is named after Wei Dai, the creator of b-money, a precursor to Bitcoin. Ethereum's other denominations are also named after notable computer scientists and cryptographers: gwei after Claude Shannon (Shannon), finney after Hal Finney, and szabo after Nick Szabo.
Do I need to know about wei as a regular user?
For everyday use, no. Wallets display amounts in ETH or gwei. However, understanding wei helps when reading smart contract code, debugging transactions, or working with developer tools. When a transaction shows a value like 1000000000000000000, that is simply 1 ETH expressed in wei.