The JSON-RPC server provides an API that allows you to connect to a Cosmos EVM-enabled blockchain and interact with the EVM. This gives you direct access to reading Ethereum-formatted transactions or sending them to the network.
app.toml
configuration file. It uses JSON (RFC 4627) as data format.
More on Ethereum JSON-RPC:
eth_getTransactionLogs
- Returns logs for a specific transactioneth_getPendingTransactions
- Returns all pending transactions (currently not working)eth_getBlockReceipts
- Returns all receipts for a given blockdebug_freeOSMemory
- Forces garbage collectiondebug_setGCPercent
- Sets garbage collection percentagedebug_memStats
- Returns detailed memory statisticsdebug_setBlockProfileRate
- Sets block profiling ratedebug_writeBlockProfile
- Writes block profile to filedebug_writeMemProfile
- Writes memory profile to filedebug_writeMutexProfile
- Writes mutex contention profile to fileeth_fillTransaction
- Transaction filling utilitydebug_getRaw*
methods - Raw data access not implementedeth_subscribe
syncing events - Only newHeads, logs, and newPendingTransactions worktrace_*
methods - Parity/OpenEthereum trace namespaceengine_*
methods - Post-merge Engine APIapp.toml
configuration file or via command-line flags.
app.toml
:
eth_call
method resides in the eth namespace. Access to RPC methods can be enabled on a per-namespace basis.
Namespace | Description | Supported | Enabled by Default |
---|---|---|---|
eth | Core Ethereum JSON-RPC methods for interacting with the EVM | Y | Y |
web3 | Utility functions for the web3 client | Y | Y |
net | Network information about the node | Y | Y |
txpool | Transaction pool inspection | Y | N |
debug | Debugging and tracing functionality | Y | N |
personal | Private key management | Y | N |
admin | Node administration | Y | N |
miner | Mining operations (stub for PoS) | Y | N |
clique | Proof-of-Authority consensus | N | N |
les | Light Ethereum Subprotocol | N | N |
eth_getFilterChanges
call:
--json-rpc.ws-address
flag when starting the node (default "0.0.0.0:8546"
):
ws
wscat
or ws
to connect to the WebSocket endpoint.
eth_subscribe
request. The parameter newHeads
tells the server you want to listen for new blocks.
"0x"
"0x0"
0x41
(65 in decimal)0x400
(1024 in decimal)0x
(should always have at least one digit - zero is "0x0"
)0x0400
(no leading zeroes allowed)ff
(must be prefixed 0x
)"0x"
0x41
(size 1, "A"
)0x004200
(size 3, "\0B\0"
)0x
(size 0, ""
)0xf0f0f
(must be even number of digits)004200
(must be prefixed 0x
)defaultBlock
parameter:
0xC9B3C0
)"latest"
- The most recently mined block"pending"
- The pending state, including transactions not yet mined"earliest"
- The genesis block