Skip to main content

Compatibility with the Ethereum Virtual Machine (EVM)

The Aurora Engine implements an Ethereum Virtual Machine (EVM) on top of the NEAR Protocol.

Balances

EVM address balances are denominated in ether (ETH) for compatibility with Ethereum.

Gas

See notes on gas.

Precompiles

Standard precompiles

AddressIDNameSpecStatus
0x01ECRecoverECDSA public key recoveryYellow Paper
0x02SHA256SHA-2 256-bit hash functionYellow Paper
0x03RIPEMD160RIPEMD 160-bit hash functionYellow Paper
0x04IdentityIdentity functionYellow Paper
0x05ModExpBig integer modular exponentiationEIP-198
0x06BN128AddElliptic curve additionEIP-196
0x07BN128MulElliptic curve scalar multiplicationEIP-196
0x08BN128PairElliptic curve pairing checkEIP-197
0x09Blake2FBLAKE2b F compression functionEIP-152

Opcodes

BLOCKHASH

This opcode currently does not return a real blockhash. However, it does respect the logic that a non-zero value is returned for the most recent 256 blocks (not including the current block). For all other inputs it returns zero. The non-zero value that is returned is computed based on the block height and properties of the Aurora Engine contract (chain ID and account ID). Concretely, as of #213, the value returned is

BLOCKHASH(h: u64) = sha256( 0x00 || h || chain_id || account_id )

where || is byte concatenation and it is assumed h (a 64-bit number) is converted to bytes in big endian encoding. The leading zero byte in the concatenation is a version byte which may change if a new blockhash scheme is introduced in the future. The chain_id depends on the network the Aurora Engine contract is deployed to (see networks table). The account_id is the name of the NEAR account where the contract is deployed (see the Engine ID column in the networks table).

COINBASE

This opcode returns the EVM address of the Aurora Engine.

For example, for the Aurora Engine deployment on the aurora account, COINBASE returns 0x4444588443C3a91288c5002483449Aba1054192b.

DIFFICULTY

This opcode always returns zero, since NEAR is not a proof-of-work (PoW) network.

GASLIMIT

This opcode always returns 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff (2^256-1).

Limitations

  • The Berlin hard fork is not yet supported. The EVM currently supports the feature set of the Istanbul hard fork.

  • The BLOCKHASH opcode does not return the hash of an actual block (see above for details).

Source Code

The Aurora Engine source code repository is at: github.com/aurora-is-near/aurora-engine.