Skip to main content

EVM Compatibility

Orbinum provides full EVM compatibility through Frontier, enabling Ethereum dApps and tooling to work seamlessly.


Table of Contents


Overview

Frontier is a set of Substrate pallets that implement:

  • EVM execution - Full Ethereum Virtual Machine
  • Ethereum RPC - Web3-compatible JSON-RPC
  • Transaction format - Ethereum transaction types
  • Account model - Unified Substrate/Ethereum accounts

Architecture

Pallets

PalletPurpose
pallet-evmEVM execution environment
pallet-ethereumEthereum transaction handling
pallet-base-feeEIP-1559 base fee calculation
pallet-dynamic-feeDynamic fee adjustment
pallet-evm-chain-idChain ID configuration

Account Mapping

Substrate and Ethereum accounts are unified:

Ethereum Address (20 bytes) <-> Substrate AccountId (32 bytes)

Mapping strategy:

// Ethereum address from Substrate account
fn to_ethereum_address(account: AccountId32) -> H160 {
H160::from_slice(&account.as_ref()[0..20])
}

// Substrate account from Ethereum address
fn to_substrate_account(address: H160) -> AccountId32 {
let mut data = [0u8; 32];
data[0..20].copy_from_slice(address.as_bytes());
AccountId32::from(data)
}

Supported Features

EIPs Implemented

EIPNameStatus
EIP-155Replay protectionImplemented
EIP-1559Fee marketImplemented
EIP-2930Access listsImplemented
EIP-2718Typed transactionsImplemented
EIP-3855PUSH0 opcodeImplemented

Transaction Types

TypeEIPSupport
LegacyPre-EIP-2718Yes
EIP-2930Access listYes
EIP-1559Dynamic feeYes

Opcodes

Full EVM opcode support including:

  • All arithmetic operations
  • Memory/storage operations
  • Control flow
  • Environmental information
  • Block information
  • Logging (LOG0-LOG4)
  • System operations (CREATE, CALL, etc.)

Gas and Fees

EIP-1559 Implementation

Base Fee Adjustment

// From pallet-base-fee
fn next_base_fee(
current: U256,
gas_used: U256,
gas_target: U256,
) -> U256 {
if gas_used > gas_target {
// Increase base fee
current + (current * (gas_used - gas_target)) / gas_target / 8
} else {
// Decrease base fee
current - (current * (gas_target - gas_used)) / gas_target / 8
}
}

Fee Parameters

ParameterValueDescription
Gas limit15MPer-block gas limit
Gas target7.5MTarget utilization
Min base fee1 GweiMinimum base fee
Max fee change12.5%Per-block change limit

Precompiles

Standard Precompiles

AddressNameGas
0x01ecRecover3000
0x02SHA25660 + 12/word
0x03RIPEMD160600 + 120/word
0x04Identity15 + 3/word
0x05ModexpVariable
0x06BN254 Add150
0x07BN254 Mul6000
0x08BN254 Pairing34000 + 45000/pair
0x09Blake2Variable

Custom Precompiles

Orbinum extends precompiles for privacy features:

AddressNamePurpose
0x800PoseidonPoseidon hash
0x801ShieldedPoolPrivacy operations
0x802ZKVerifierProof verification
WIP

Custom precompiles are under development. Interface may change.

Using ZK Precompile

interface IZKVerifier {
function verifyProof(
bytes calldata proof,
bytes32[] calldata publicInputs
) external view returns (bool);
}

contract PrivateVault {
IZKVerifier constant verifier = IZKVerifier(0x802);

function withdraw(
bytes calldata proof,
bytes32[] calldata inputs
) external {
require(verifier.verifyProof(proof, inputs), "Invalid proof");
// Process withdrawal
}
}

Developer Integration

Network Configuration

// MetaMask / ethers.js configuration
const network = {
chainId: '0x1234', // Orbinum chain ID
chainName: 'Orbinum Testnet',
nativeCurrency: {
name: 'ORB',
symbol: 'ORB',
decimals: 18
},
rpcUrls: ['https://rpc.orbinum.network'],
blockExplorerUrls: ['https://explorer.orbinum.network']
};

Hardhat Configuration

// hardhat.config.js
module.exports = {
networks: {
orbinum: {
url: 'https://rpc.orbinum.network',
chainId: 0x1234,
accounts: [process.env.PRIVATE_KEY],
gas: 15000000,
gasPrice: 'auto'
}
},
solidity: {
version: '0.8.20',
settings: {
optimizer: {
enabled: true,
runs: 200
}
}
}
};

Deployment Example

const { ethers } = require('hardhat');

async function main() {
const Token = await ethers.getContractFactory('MyToken');
const token = await Token.deploy('My Token', 'MTK');
await token.waitForDeployment();

console.log('Token deployed to:', await token.getAddress());
}

main().catch(console.error);

Limitations

LimitationDescriptionWorkaround
Block time~6s vs Ethereum ~12sAccount for in dApps
Gas meteringSubstrate weight-basedUse gas estimates
State sizeTrie differencesOptimize storage