WHBAR (ERC) in the Hedera Ecosystem
Wrapped HBAR (WHAR) is an ERC-compatible wrapper that follows the ERC20 standard for Hedera’s native HBAR token. Built on widely adopted wrapper contract principles, WHBAR makes it easier for developers and users to integrate Hedera’s native token into decentralized applications (dApps). This contract enables users to seamlessly convert HBAR into an ERC20 token and vice versa, making it easier to integrate with the broader web3 and DeFi ecosystems.Core Functionalities
-
Deposit & Mint:
When you call the
deposit()function and send HBAR, the contract mints an equivalent amount of WHBAR. Each unit of HBAR (represented in tinybars with 8 decimals) is matched with one unit of WHBAR. This ensures that the wrapped token maintains parity with the native token. -
Withdraw & Burn:
To redeem your underlying HBAR, you call the
withdraw(amount)function. The contract burns the specified WHBAR tokens and releases the corresponding HBAR back to your wallet. This burn mechanism is crucial for maintaining the correct token supply and preserving the peg between HBAR and WHBAR. -
ERC20 Standard Compliance:
WHBAR implements all standard ERC20 functions (e.g.,
transfer,approve,transferFrom), ensuring seamless interaction with wallets, exchanges, and various DeFi protocols that support ERC20 tokens.

HBAR wrapping/unwrapping flow from user wallet
Implementation Guide
Developers can integrate WHBAR into their applications by leveraging the following functions.Wrapping HBAR
To convert HBAR into its ERC20 representation (WHBAR), call thedeposit() function and send HBAR with the call. deposit() mints WHBAR equal to msg.value, one WHBAR unit per tinybar:
- Native HBAR: 8 decimal places (tinybars).
- WHBAR (ERC20): 8 decimal places (
decimals = 8), 1:1 with tinybars.
- From Solidity (another contract calls WHBAR):
msg.valueis in tinybars, so 10 HBAR is10 * 10**8. - From a client through the JSON-RPC relay (ethers, viem, a wallet): the transaction
valueis in 18-decimal weibars, so 10 HBAR isparseEther("10"). The network converts it to tinybars beforedeposit()runs.
deposit() credits msg.sender. When another contract calls it, that contract receives the WHBAR, not the user who sent the HBAR, so pass the WHBAR on:
Unwrapping WHBAR
When you want to convert back to redeem WHBAR for native HBAR, the WHBAR holder calls thewithdraw() function with amount in tinybars (10⁸ per HBAR). The value in WHBAR is directly mapped back to HBAR with the same 8 decimal places. amount is a function argument, not a transaction value, so the relay does not convert it, even when you call from ethers:
withdraw() always pays msg.sender: if a contract calls it, the HBAR goes to that contract, which needs a payable receive() function to accept it.
Important Note: Decimal Nuance
When depositing HBAR, keep the two scales apart.- Native HBAR, WHBAR, and
msg.valueinside the EVM: 8 decimals (tinybars). - Transaction
valuesent through the JSON-RPC relay: 18 decimals (weibars). The network converts it to tinybars before the EVM runs.
withdraw() amounts all use 8 decimals, identical to native HBAR in tinybars. See HBAR decimal places.Standard ERC20 Functions
WHBAR supports all standard ERC20 operations:| Function | Description | Example |
|---|---|---|
transfer | Send WHBAR directly to another address | whbar.transfer(recipient, amount) |
approve | Authorize a third party to spend your WHBAR | whbar.approve(spender, amount) |
transferFrom | Transfer WHBAR as an authorized spender | whbar.transferFrom(owner, recipient, amount) |
balanceOf | Check WHBAR balance of an address | whbar.balanceOf(address) |
totalSupply | Get the total amount of WHBAR in circulation | whbar.totalSupply() |
Contract Deployments
The WHBAR contract implementation is available on GitHub in the Hedera Smart Contracts repository.| Network | Contract ID | EVM Address |
|---|---|---|
| ✅ Hedera Mainnet | 0.0.8840785 | 0xb1F616b8134F602c3Bb465fB5b5e6565cCAd37Ed |
| ✅ Hedera Testnet | 0.0.5816542 | 0xb1F616b8134F602c3Bb465fB5b5e6565cCAd37Ed |
| 🔜 Other Networks | Coming soon | Coming soon |
Security Considerations:Audit and Testing
- Audit and Review:
Although the WHBAR contract has been independently reviewed, developers and users should conduct their own security assessments. Even small oversights in smart contracts may lead to vulnerabilities. - Test in a Sandbox:
Always test interactions in a testnet environment before deploying or integrating with mainnet contracts. This helps ensure the behavior matches expectations. - Follow Best Practices:
Double-check function inputs and transaction amounts. Always use the designated functions (deposit()andwithdraw()) to prevent unintended fund loss.
Integration Best Practices
- Check allowances: Before attempting
transferFromoperations, verify that sufficient allowance has been granted. - Verify contract addresses: Always double-check you’re interacting with the official WHBAR contract addresses listed in the documentation.
- Handle decimals properly: HBAR and WHBAR both use 8 decimals, so on-chain calculations are straightforward. Use 18-decimal weibars only for the
valueof a deposit sent from a client through the JSON-RPC relay.
Critical: HBAR sent to the contract with a native HAPI
CryptoTransfer (for example, an SDK or wallet HBAR transfer to the contract’s account ID) is permanently locked, because no EVM code runs to credit you WHBAR. EVM value transfers are safe: the contract’s receive() and fallback() both call deposit().