Skip to main content
The exchange rate system contract exposes the network’s active HBAR/USD rate to your EVM contracts. If you want to price something in USD but settle in HBAR, this is what you call.

At a glance

The contract is implemented by consensus nodes, so calls are deterministic and don’t depend on an off-chain feed. The rate comes from the network’s exchange rate file (0.0.112), which is the same source the network uses internally to charge transaction fees.

Why it exists

Hedera fees are quoted in USD but paid in HBAR at the current network rate. The contract gives Solidity code access to the same conversion. If you want to charge a flat 10 cents, you compute the HBAR amount at call time. No hard-coded prices, no oracle fee. Units to keep straight:
  • 1 tinycent = 10⁻⁸ US cents = 10⁻¹⁰ USD
  • 1 tinybar = 10⁻⁸ HBAR

Solidity interface

Example: charge a flat USD fee

This contract charges $0.10 worth of HBAR per call. The HBAR amount is computed against the live rate, so it doesn’t matter if HBAR moves.
tinycentsToTinybars returns tinybars (8 decimals). msg.value is in wei (18 decimals). You have to multiply by 10**10 to compare them. This is the most common bug when wiring up the precompile.

When to reach for it

Useful when you need stable USD pricing on-chain: subscription fees, paywalled functions, auction reserve prices, or a guard that rejects transactions above a USD-equivalent cap. Also useful for any contract that wants to mirror Hedera’s own fee model (quote in USD, settle in HBAR) instead of building a Chainlink integration.

Things to know

The interface marks both functions as non-view, so calls cost gas even though they read state. Budget for that when batching conversions. The rate updates roughly once an hour from the network exchange rate file. It is not a live market feed; for anything that needs second-by-second tracking, layer an oracle on top. The rate is what the network uses for fee calculation. It tends to track exchange spot prices closely but isn’t guaranteed to match.

See also

HTS System Contract

The token-service precompile at 0x167 for creating, minting, and transferring HTS tokens from Solidity.