Crypto
2 min read

Wei

The smallest unit of Ether, equal to 10⁻¹⁸ ETH. All EVM calculations are denominated in wei to avoid floating-point math; gas prices are typically expressed in gwei (one billion wei).

Ether denominations

The unit hierarchy:

  • Wei — smallest; 10⁻¹⁸ ETH.
  • Gwei — 10⁹ wei = 10⁻⁹ ETH; common for gas prices.
  • Ether (ETH) — 10¹⁸ wei.

There are intermediate denominations (Kwei, Mwei, etc.) but they're rarely used.

Why wei matters

Several uses:

  • Smart contract values — internally everything in wei.
  • Precision — avoids floating-point errors.
  • Gas calculation — gas × gas-price both in wei units.
  • Programming — Solidity uses wei by default.

Working with wei avoids precision issues that plague decimal arithmetic.

Practical examples

Common conversions:

  • 1 ETH = 1,000,000,000,000,000,000 wei.
  • 1 gwei = 1,000,000,000 wei.
  • 20 gwei gas price = 20,000,000,000 wei.
  • Typical transfer cost ≈ 21,000 gas × 20 gwei = 420,000 gwei = 0.00042 ETH.

The numbers get unwieldy quickly, hence intermediate denominations.

Why such small units

The rationale:

  • Future-proofing — if ETH price reaches very high levels, micro-payments still possible.
  • Precision in computation — integer arithmetic avoids errors.
  • Smart contract values can be arbitrarily small.

Bitcoin makes similar choice with satoshis (10⁻⁸ BTC).

Wei vs. satoshi

Comparison:

  • Wei — 10⁻¹⁸ ETH; much smaller relative unit than satoshi.
  • Satoshi — 10⁻⁸ BTC.
  • Difference reflects different design philosophies.

Wei provides more precision; satoshi is more practically useful as user-facing unit.

Common confusion

Frequent issues:

  • Decimal places — easy to miscount zeros.
  • Display vs. internal — wallets show ETH; contracts use wei.
  • Forgetting unit — sending wei when meaning ETH (or vice versa) creates massive errors.
  • Gas price units — usually quoted in gwei, sometimes in wei.

Off-by-decimal errors are catastrophic in crypto.

What individuals should know

For users:

  • Wei is mostly invisible — wallets handle conversion.
  • Gas prices in gwei are the practical denomination.
  • Verify decimal places when entering values manually.

For developers:

  • Always use wei in contracts to avoid precision issues.
  • Convert to display units at UI layer only.
  • BigNumber libraries essential for handling wei values in JavaScript.
  • Test with edge cases — zero, max uint, near boundaries.

Wei is the foundational unit of Ethereum economics. End users rarely interact directly with it, but understanding its existence helps interpret gas calculations and avoid decimal errors.