EVM adapter for Hedera Smart Contract Services
The Hedera Smart Contract Service supports Solidity contracts with pragma solidity <=0.5.9, where the semantics of a transaction sent to a Hedera Solidity contract are largely equivalent to the semantics of a transaction sent to an Ethereum smart contract. This equivalence derives from reuse of the ethereumj EVM implementation, with a handful of adaptations.
The adaptations are as follows:
- Extend the
org.ethereum.core.AccountStatetype to include properties used by the Hedera network. - Suppress the loading and persistence of (key-scoped) contract storage from the
org.ethereum.datasource.Sources that back storage caches used byorg.ethereum.db.RepositoryRoot; instead, use anorg.ethereum.datasource.StoragePersistenceto perform (contract-scoped) storage loading and persistence upon creation of each storage cache. - Modify the gas cost calculation for the
SSTOREandLOG{0-4}EVM opcodes to reflect the active Hedera resource prices for disk and RAM, respectively. - Generate new contract addresses using an injected
org.ethereum.vm.program.NewAccountCreateAdapterrather than the hash of the creator address and nonce. - Delegate the
CREATE2opcode to theCREATEopcode (the semantics introduced withCREATE2are irrelevant given the preceding item). - Change
slf4jbinding toorg.apache.logging.log4j.
For a complete view of the Hedera adaptations, please perform a git diff of this branch and the 1.12.0 tag.
License
ethereumj is released under the LGPL-V3 license.