About
evm-gateway is a standalone Injective EVM JSON-RPC server.
It reads block data from CometBFT RPC, uses Injective gRPC for module queries, indexes EVM-relevant data into a local KV store, and serves Ethereum-style RPC from that local indexed state where possible.
Operationally, it is meant to be run beside an Injective node, not inside it. It replaces the internal JSON-RPC server that was not intended to be run in production environments.
Properties:
- cache-first for indexed EVM blocks, receipts, transactions, and logs
- historical gap fill and forward sync
- no keyring-backed
personal_*API - HTTP and WebSocket JSON-RPC
Installing
Source and releases: github.com/InjectiveLabs/evm-gateway/releases Requirements to runevm-gateway:
- Go toolchain and
make, when building from source - Access to a running Injective node:
- CometBFT RPC endpoint
- gRPC endpoint
- archival node access for historical backfill
Using the repository
Pre-built Docker image
Configuration
Configuration is environment-driven with theWEB3INJ_ prefix. The repository’s .env.example is the reference.
Minimum practical configuration:
injectived, do not bind on the same ports. A typical sidecar setup is:
On the first run, the service syncs historical data from
WEB3INJ_EARLIEST_BLOCK to the current chain tip. Use an archival node for the first backfill and size rate limits accordingly.Virtualized Cosmos Bank Transfers
By default,evm-gateway exposes the EVM view of Injective blocks. Native Cosmos x/bank transfers are not EVM transactions, so an EVM-only JSON-RPC index would otherwise miss native bank activity such as standard Cosmos transfers, minting, burning, and module-level balance movements.
Set WEB3INJ_VIRTUALIZE_COSMOS_EVENTS=true to enable the optional virtualization layer:
evm-gateway parses supported Cosmos x/bank events and projects them into Ethereum-style JSON-RPC transactions and logs. This makes native bank transfer activity discoverable through familiar methods such as eth_getBlockByNumber, eth_getTransactionByHash, eth_getTransactionReceipt, eth_getLogs, and filter APIs.
The gateway currently virtualizes these Cosmos bank event types:
transfercoin_spentcoin_receivedcoinbaseburn
bytes32 values. This allows both 20-byte EVM addresses and longer Cosmos addresses to fit the same ABI.
Virtual transaction behavior
Virtualized Cosmos events are represented as synthetic Ethereum-style transactions:- non-EVM Cosmos transaction events use a virtual hash derived from
keccak256(cosmos_tx_hash) - begin-block and end-block events use deterministic hashes derived from the block height
- virtual transactions use empty
input, zero gas and value defaults, andto = 0x0000000000000000000000000000000000000800 - virtual transactions and logs include
virtual: truemetadata - when the source Cosmos transaction hash is available, virtual transaction and log results include
cosmos_hash - begin-block and end-block virtual transactions do not include
cosmos_hash
- begin-block virtual transaction, when applicable
- normal EVM transactions and virtualized Cosmos transactions in block order
- end-block virtual transaction, when applicable
Querying virtualized transfers
You can query the reserved pseudo-contract address witheth_getLogs:
eth_getTransactionByHash or eth_getTransactionReceipt to inspect the virtual transaction and its logs.
For a complete indexed history, enable
WEB3INJ_VIRTUALIZE_COSMOS_EVENTS=true before the initial sync. If you already synced an existing data directory with virtualization disabled, rebuild or reindex the data directory before relying on historical virtualized bank logs.Quick checking functionality with curl
Version:debug is enabled, transaction tracing:
Configuring state persistence
State persistence is controlled primarily by:WEB3INJ_DATA_DIRWEB3INJ_DB_BACKEND
Glossary of implemented methods by namespace
Default namespaces:ethnetweb3
debuginj
personaltxpoolminer
eth
eth_blockNumber, eth_getBlockByNumber, eth_getBlockByHash, eth_getBlockTransactionCountByHash, eth_getBlockTransactionCountByNumber, eth_getTransactionByHash, eth_getTransactionCount, eth_getTransactionReceipt, eth_getTransactionByBlockHashAndIndex, eth_getTransactionByBlockNumberAndIndex, eth_sendRawTransaction, eth_getBalance, eth_getStorageAt, eth_getCode, eth_getProof, eth_call, eth_protocolVersion, eth_gasPrice, eth_estimateGas, eth_feeHistory, eth_maxPriorityFeePerGas, eth_chainId, eth_getUncleByBlockHashAndIndex, eth_getUncleByBlockNumberAndIndex, eth_getUncleCountByBlockHash, eth_getUncleCountByBlockNumber, eth_hashrate, eth_mining, eth_syncing, eth_coinbase, eth_getTransactionLogs, eth_fillTransaction, eth_getPendingTransactions
Filter methods under the same namespace:
eth_newPendingTransactionFilter, eth_newBlockFilter, eth_newFilter, eth_getFilterChanges, eth_getFilterLogs, eth_getLogs, eth_uninstallFilter
net
net_version, net_listening, net_peerCount
web3
web3_clientVersion, web3_sha3
debug
Tracing and block inspection:
debug_traceTransaction, debug_traceBlockByNumber, debug_traceBlockByHash, debug_traceCall, debug_getHeaderRlp, debug_getBlockRlp, debug_printBlock, debug_intermediateRoots
Runtime and profiling:
debug_blockProfile, debug_cPUProfile, debug_gcStats, debug_goTrace, debug_memStats, debug_setBlockProfileRate, debug_stacks, debug_startCPUProfile, debug_stopCPUProfile, debug_writeBlockProfile, debug_writeMemProfile, debug_mutexProfile, debug_setMutexProfileFraction, debug_writeMutexProfile, debug_freeOSMemory, debug_setGCPercent, debug_startGoTrace, debug_stopGoTrace
inj
inj_getTxHashByEthHash