Skip to main content

EVM Compatibility

Technical details on Circle Layer's Ethereum Virtual Machine compatibility, migration strategies, and implementation considerations for developers.

Technical Implementation​

Bytecode & Execution Compatibility​

  • 100% Bytecode Compatibility: Identical instruction set and execution environment as Ethereum
  • Gas Model: Standard Ethereum gas calculation (gas price Γ— gas amount)
  • State Management: Compatible state tree and account structure
  • Smart Contract ABI: Full Application Binary Interface compatibility

Network Integration​

Circle Layer testnet provides full EVM compatibility with:

  • Chain ID: 28525 for testnet distinction
  • JSON-RPC API: Complete Ethereum RPC method support
  • WebSocket Events: Real-time blockchain event streaming
  • Block Structure: Ethereum-compatible block and transaction format

Migration Strategies​

From Ethereum Mainnet​

Zero-Code Migration Process:

  1. Deploy Existing Contracts: Use same bytecode and deployment scripts
  2. Update Network Configuration: Change RPC endpoint and chain ID
  3. Configure Gas Token: Use CLAYER instead of ETH for gas fees
  4. Test Integration: Verify functionality on Circle Layer testnet

Network Configuration Update:

// Hardhat configuration example
module.exports = {
networks: {
circleLayerTestnet: {
url: "https://testnet-rpc.circlelayer.com",
chainId: 28525,
accounts: [process.env.PRIVATE_KEY],
gasPrice: 21000000000, // 0.000021 CLAYER
}
}
};

From Other EVM Chains (Polygon, BSC, Avalanche)​

Migration from other EVM-compatible chains follows identical patterns:

  • Contract Deployment: Same deployment tools and processes
  • Library Integration: Existing Web3 libraries work without modification
  • Wallet Connection: Standard MetaMask/WalletConnect integration
  • Gas Management: Only difference is CLAYER token for gas fees

Development Environment Setup​

Library Integration Examples​

Web3.js Implementation:

const Web3 = require('web3');
const web3 = new Web3('https://testnet-rpc.circlelayer.com');

// Standard Ethereum API usage
const balance = await web3.eth.getBalance(address);
const gasPrice = await web3.eth.getGasPrice();
const blockNumber = await web3.eth.getBlockNumber();

Ethers.js Integration:

const { ethers } = require('ethers');
const provider = new ethers.providers.JsonRpcProvider('https://testnet-rpc.circlelayer.com');

// Same patterns as Ethereum development
const signer = new ethers.Wallet(privateKey, provider);
const contract = new ethers.Contract(address, abi, signer);

Viem Integration:

import { createPublicClient, http } from 'viem';
import { defineChain } from 'viem';

const circleLayer = defineChain({
id: 28525,
name: 'Circle Layer Testnet',
network: 'circle-layer-testnet',
nativeCurrency: { name: 'CLAYER', symbol: 'CLAYER', decimals: 18 },
rpcUrls: {
default: { http: ['https://testnet-rpc.circlelayer.com'] }
}
});

const client = createPublicClient({
chain: circleLayer,
transport: http()
});

Wallet Integration​

MetaMask Configuration​

// Programmatic network addition
await window.ethereum.request({
method: 'wallet_addEthereumChain',
params: [{
chainId: '0x6F75', // 28525 in hex
chainName: 'Circle Layer Testnet',
nativeCurrency: {
name: 'CLAYER',
symbol: 'CLAYER',
decimals: 18
},
rpcUrls: ['https://testnet-rpc.circlelayer.com'],
blockExplorerUrls: ['https://explorer-testnet.circlelayer.com/']
}]
});

WalletConnect Integration​

// Standard WalletConnect setup works with Circle Layer
import { WalletConnect } from '@walletconnect/client';

const connector = new WalletConnect({
bridge: "https://bridge.walletconnect.org",
qrcodeModal: QRCodeModal,
});

// Network switching handled through standard EIP-3326
await connector.request({
method: 'wallet_switchEthereumChain',
params: [{ chainId: '0x6F75' }]
});

Performance Advantages​

Circle Layer Benefits over Ethereum​

  • 3s Block Time: vs Ethereum's 12s average
  • 1-3s Finality: vs Ethereum's 6-10 minute finality
  • Predictable Gas: Stable CLAYER pricing vs volatile ETH gas
  • 99.95% Uptime: Consistent network availability
  • Energy Efficiency: 99.9% less energy consumption

Development Experience Improvements​

  • Faster Testing: 3-second blocks for rapid iteration
  • Cost-Effective: Free testnet tokens via faucet
  • Reliable Performance: Consistent block times and gas prices
  • Standard Tooling: No learning curve for Ethereum developers

Testing & Verification​

Contract Verification Process​

  1. Deploy to Testnet: Use standard deployment tools
  2. Verify Source Code: Submit to Circle Layer block explorer
  3. Test Interactions: Validate all contract functions
  4. Performance Testing: Measure gas usage and execution time

Integration Testing Checklist​

  • βœ… Contract deployment successful
  • βœ… Web3 library connectivity verified
  • βœ… Wallet interactions functioning
  • βœ… Event listening operational
  • βœ… Gas estimation accurate
  • βœ… Transaction confirmations reliable

Reference Implementation​

Example Contract Address: 0xfCb4Ce5953dE22cbF04d015df88a3a9895E86bEB

Best Practices​

Gas Optimization for CLAYER​

  • Estimate Gas Carefully: Use eth_estimateGas for accurate calculations
  • Batch Operations: Combine multiple calls to reduce gas overhead
  • Storage Optimization: Minimize state changes for cost efficiency
  • Test Gas Usage: Verify gas consumption on testnet before mainnet

Security Considerations​

  • Same Security Model: Standard EVM security practices apply
  • Testnet Testing: Thorough testing recommended before mainnet deployment
  • Audit Compatibility: Existing Ethereum audit reports remain valid
  • Network Effects: Consider Circle Layer's DPoS consensus in security design

Next Steps​

For detailed implementation guidance: