JSON-RPC API Methods¶
Standard Ethereum JSON-RPC Methods¶
As Tanssi's EVM Compatibility is derived from Frontier and closely modeled after Moonbeam's Ethereum compatibility, Tanssi nodes support a wide variety of standard supported Ethereum JSON-RPC methods.
Nevertheless, not all Ethereum JSON-RPC methods are supported; some of those supported return default values (those related to Ethereum's PoW consensus mechanism in particular). This guide provides a comprehensive list of supported Ethereum JSON-RPC methods on Tanssi. Developers can quickly reference this list to understand the available functionality for interfacing with Tanssi EVM Appchains.
The basic JSON-RPC methods from the Ethereum API supported by Tanssi are:
- eth_protocolVersion — returns
1
by default - eth_syncing — returns an object with data about the sync status or
false
- eth_hashrate — returns
"0x0"
by default - eth_coinbase — returns the latest block author. Not necessarily a finalized block
- eth_mining — returns
false
by default - eth_chainId — returns the chain ID used for signing at the current block
- eth_gasPrice — returns the base fee per unit of gas used. This is currently the minimum gas price for each network
- eth_accounts — returns a list of addresses owned by the client
- eth_blockNumber — returns the highest available block number
- eth_getBalance — returns the balance of the given address
- eth_getStorageAt — returns the content of the storage at a given address
- eth_getBlockByHash — returns information about the block of the given hash, including
baseFeePerGas
on post-London blocks - eth_getBlockByNumber — returns information about the block specified by block number, including
baseFeePerGas
on post-London blocks - eth_getBlockReceipts — returns all transaction receipts for a given block
- eth_getTransactionCount — returns the number of transactions sent from the given address (nonce)
- eth_getBlockTransactionCountByHash — returns the number of transactions in a block with a given block hash
- eth_getBlockTransactionCountByNumber — returns the number of transactions in a block with a given block number
- eth_getUncleCountByBlockHash — returns
"0x0"
by default - eth_getUncleCountByBlockNumber — returns
"0x0"
by default - eth_getCode — returns the code at the given address at the given block number
- eth_sendTransaction — creates a new message call transaction or a contract creation, if the data field contains code. Returns the transaction hash or the zero hash if the transaction is not yet available
- eth_sendRawTransaction — creates a new message call transaction or a contract creation for signed transactions. Returns the transaction hash or the zero hash if the transaction is not yet available
- eth_call — executes a new message call immediately without creating a transaction on the blockchain, returning the value of the executed call
- eth_estimateGas — returns an estimated amount of gas necessary for a given transaction to succeed. You can optionally specify a
gasPrice
ormaxFeePerGas
andmaxPriorityFeePerGas
- eth_feeHistory — returns
baseFeePerGas
,gasUsedRatio
,oldestBlock
, andreward
for a specified range of up to 1024 blocks - eth_getTransactionByHash — returns the information about a transaction with a given hash. EIP-1559 transactions have
maxPriorityFeePerGas
andmaxFeePerGas
fields - eth_getTransactionByBlockHashAndIndex — returns information about a transaction at a given block hash and a given index position. EIP-1559 transactions have
maxPriorityFeePerGas
andmaxFeePerGas
fields - eth_getTransactionByBlockNumberAndIndex — returns information about a transaction at a given block number and a given index position. EIP-1559 transactions have
maxPriorityFeePerGas
andmaxFeePerGas
fields - eth_getTransactionReceipt — returns the transaction receipt of a given transaction hash
- eth_getUncleByBlockHashAndIndex — returns
null
by default - eth_getUncleByBlockNumberAndIndex — returns
null
by default - eth_getLogs — returns an array of all logs matching a given filter object
- eth_newFilter — creates a filter object based on the input provided. Returns a filter ID
- eth_newBlockFilter — creates a filter in the node to notify when a new block arrives. Returns a filter ID
- eth_getFilterChanges — polling method for filters (see methods above). Returns an array of logs that occurred since the last poll
- eth_getFilterLogs — returns an array of all the logs matching the filter with a given ID
- eth_uninstallFilter — uninstall a filter with a given ID. It should be used when polling is no longer needed. Filters timeout when they are not requested using
eth_getFilterChanges
after some time
Custom JSON-RPC Methods¶
Tanssi nodes support two custom JSON-RPC endpoints: frnt_isBlockFinalized
and frnt_isTxFinalized
. Tanssi features deterministic finality (as opposed to probabilistic like Bitcoin's finality), which means that at any point of time, the answer to whether a block or transaction is finalized or not can be answered with a definitive yes or no. Tanssi has built these two custom endpoints to provide valuable functionality for checking the finality of on-chain events.
frnt_isBlockFinalized - checks for the finality of the block given by its block hash
block_hash
string - the hash of the block, accepts either Substrate-style or Ethereum-style block hash as its input
boolean - true
if the block is finalized, false
if the block is not finalized or not found
curl -H "Content-Type: application/json" -X POST --data '{
"jsonrpc": "2.0",
"id": "1",
"method": "frnt_isBlockFinalized",
"params": ["INSERT_BLOCK_HASH"]
}' https://fraa-dancebox-3001-rpc.a.dancebox.tanssi.network
frnt_isTxFinalized - checks for the finality of a transaction given its EVM transaction hash
tx_hash
string - the EVM transaction hash of the transaction
boolean - true
if the transaction is finalized, false
if the transaction is not finalized or not found
curl -H "Content-Type: application/json" -X POST --data '{
"jsonrpc": "2.0",
"id": "1",
"method": "frnt_isTxFinalized",
"params": ["INSERT_TRANSACTION_HASH"]
}' https://fraa-dancebox-3001-rpc.a.dancebox.tanssi.network
| Created: July 24, 2024