Wei

The smallest denomination of Ether (ETH) on the Ethereum network.

Detailed Explanation

Wei is the smallest unit of Ether (ETH), named after Wei Dai, a computer scientist who contributed to the development of cryptographic concepts. One ETH equals 1,000,000,000,000,000,000 (10^18) wei. Common denominations include gwei (gigawei, or 1 billion wei), which is used to express gas prices on Ethereum. Understanding wei is important for developers working with Ethereum smart contracts, as the EVM (Ethereum Virtual Machine) performs all calculations in wei to avoid floating-point arithmetic issues. Users typically interact with gwei when setting gas prices for transactions.

Why It Matters

Wei is the base unit Ethereum uses internally. Amounts on-chain, in smart contracts and in block explorers are often shown in wei, so converting to ETH (divide by 10^18) helps you read them correctly.

Key Considerations

Wei is primarily relevant for developers working with Ethereum smart contracts, where calculations are performed in wei to avoid floating-point precision errors. Regular users rarely interact with wei directly but may see it in transaction details on block explorers. Understanding the ETH denomination scale helps interpret on-chain data.

Real-World Usage and Tips

Wei is the smallest denomination of Ether (ETH), named after Wei Dai, a computer scientist known for contributions to cryptography. One ETH equals one quintillion wei (10 to the 18th power). While users rarely interact with wei directly when making transfers, it is the standard unit used internally by the Ethereum Virtual Machine and in smart contract code. Gas prices are often denominated in gwei (gigawei), which equals one billion wei, making fee calculations more manageable.

Understanding wei denominations is particularly important for developers writing smart contracts, as all value calculations in Solidity are performed in wei to avoid floating-point precision errors. When a smart contract specifies an amount, it always means wei unless explicitly converted. Misunderstanding this can lead to costly bugs, such as sending a million times more or less value than intended in a transaction or token distribution.

For non-developers, the most common encounter with wei-based units is through gas fees, which are priced in gwei. A gas price of 20 gwei means each unit of gas costs 20 billion wei. Multiplying the gas price by the gas units consumed by a transaction gives the total fee in gwei, which can then be converted to ETH. Wallet interfaces typically handle these conversions automatically, but understanding the underlying math helps when manually setting gas prices.

Related Terms

Frequently Asked Questions

What is Wei?
Wei is the smallest unit of ether (ETH). One ETH equals 10^18 wei.
Why is wei important in crypto?
Ethereum calculates all values in whole numbers of wei, which avoids rounding errors.

Why does Wei matter in crypto?

Misreading wei as ETH can mean sending a million times too much or too little in a contract call. Gas prices are quoted in gwei, which is one billion wei.