Hedera EVM uses tinybar internally, not weibar — a silent bug that always returns SUCCESS
A developer building a Hedera smart contract subscription service lost a full day to a unit denomination bug that never triggered a failure or revert. Hedera's EVM stores msg.value and address(this).balance in tinybar — not weibar as Ethereum developers might expect — meaning the 1e10 conversion factor many apply inside contracts is unnecessary and wrong. Because both the correct and incorrect implementations produce identical SUCCESS receipts on Hedera, the bug was undetectable through standard testing, including local Hardhat environments which simulate Ethereum rather than Hedera. The developer confirmed via a probe contract on Hedera testnet that 2 HBAR sent on the wire equals 200,000,000 in msg.value — pure tinybar — and that a call with value 1e8 moves exactly 1 HBAR. The key takeaway: on Hedera, unit conversion should happen once in JavaScript at the network boundary, with Solidity contracts working entirely in tinybar.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.


Discussion (0)
Log in to join the discussion and vote.
Log in