format_ether

Human-readable helper for wei balances. Equivalent to format_units(amount, 18). Returns VARCHAR without introducing floating point conversion.

Example

Local

1
-- Display a raw wei balance as ETH
2
SELECT format_ether(420000000000000000::UINT256) AS eth;
3
-- => [{"eth":"0.42"}]
Notebook ready in readonly mode.

API reference

Exact signatures with descriptions, requirements, inputs, returns, and examples.

format_ether(UINT256) #

Formats a UINT256 wei value using the fixed 18-decimal Ether scale.

Inputs

Name Type Use
wei UINT256

Raw wei amount to display using 18 decimals.

required positional

Returns

Name Type
eth VARCHAR

Ether amount string. Returns a VARCHAR decimal Ether representation without floating point conversion.

Guidance

Display wei values

format_ether is format_units with decimals fixed at 18. Use it when a raw ETH or WETH balance should be shown to a human.

  • The returned VARCHAR is for display; keep UINT256 wei values for calldata, simulation, and comparisons.
  • Use parse_ether when converting a human ETH string back to wei.

Local SQL

1
SELECT format_ether(parse_ether('1.25')) AS eth;
Notebook ready in readonly mode.

Additional overloads

Show 1 more overload
format_ether(INT256) #

Formats a signed INT256 wei delta using the fixed 18-decimal Ether scale.

Inputs

Name Type Use
wei INT256

Raw wei amount to display using 18 decimals.

required positional

Returns

Name Type
eth VARCHAR

Ether amount string. Returns a VARCHAR decimal Ether representation without floating point conversion.

Related functions

Category and tags

Category
EVM utilities
Tag
Types
Tag
EVM