RPC Calls
There are two types of RPCs available:
web3_clientVersion
net_version
eth_blockNumber
eth_chainId
eth_getTransactionCount
eth_getCode
eth_call
eth_getBalance
eth_getBlockByHash
eth_getBlockByNumber
eth_gasPrice
eth_accounts
eth_getStorageAt
eth_getBlockTransactionCountByHash
eth_getBlockTransactionCountByNumber
eth_sendRawTransaction
eth_estimateGas
eth_getTransactionByHash
eth_getTransactionReceipt
eth_getTransactionByBlockHashAndIndex
eth_getTransactionByBlockNumberAndIndex
eth_getUncleCountByBlockHash
eth_getUncleCountByBlockNumber
eth_getUncleByBlockHashAndIndex
eth_getUncleByBlockNumberAndIndex
eth_getLogs
eth_subscribe
eth_unsubscribe
eth_newFilter
eth_newBlockFilter
eth_getFilterLogs
(doesn't support unfinalized logs yet)eth_getFilterChanges
(doesn't support unfinalized logs yet)eth_uninstallFilter
eth_getEthGas
: calculate eth transaction gas params from substrate gas params. More details please refer hereeth_getEthResources
: calculate eth transaction gas params from transaction details, params: TransactionRequestnet_indexer
: get subql indexer metadatanet_cacheInfo
: get the cache infonet_isSafeMode
: check if this RPC is running in safe modenet_health
: check the health of the RPC endpointnet_runtimeVersion
: check the current runtime version of the underlying polkadot.js apieth_isTransactionFinalized
: check if a transaction is finalized, note that it also returns false for non-exist tx, params: string
This is an example on how to use the
eth_getEthGas
call in order to get the gas parameters for the transaction.So for Truffle, to get the right gas price and limit. Let's ask the RPC:
curl https://eth-rpc-mandala.aca-staging.network \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"eth_getEthGas","params": [], "id": 1}'
You should get this for an answer:
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"gasPrice": "0x2f955803e9",
"gasLimit": "0x3293440"
}
}
So in your truffle-config.js you can adjust the gas parameters with the values returned:
mandala: {
provider: () => new HDWalletProvider(mnemonic, "https://eth-rpc-mandala.aca-staging.network"),
network_id: 595,
gasPrice: 0x2f955803e9,
gas: 0x3293440
},
Last modified 3mo ago