JSON RPC API
The Mova chain is fully compatible with the Ethereum ecosystem, including smart contracts, core JSON RPC APIs, block explorers, wallets, and SDKs. It supports calls from Ethereum wallets, enabling seamless migration of Ethereum DApps to the Mova chain. Developers can refer to the supported Ethereum APIs listed below.
${RPC_URL} as follow is the RPC link: Mova Beta Network: https://mars.rpc.movachain.com
Account API
eth_getBalance
Returns the balance of the account at the specified address.
parameter
- DATA - 20 bytes, the address to check the balance
- QUANTITY|TAG - Integer block number, or string "latest", "earliest" or "pending"
[
"0xF60a4716edAbDc1479C9b2562989a9cA106063dA",
"latest"
]return value
QUANTITY - Current balance, unit: wei
Sample code
request:
curl --location ${RPC_URL} -H "Content-Type:application/json" -X POST --data
'{
"jsonrpc":"2.0",
"method":"eth_getBalance",
"params":[
"0xF60a4716edAbDc1479C9b2562989a9cA106063dA",
"latest"
],
"id":1
}'response:
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x52b7d2dcbef4847150bdc0"
}eth_getTransactionCount
Returns the number of transactions sent from an address.
parameter
DATA - 20 bytes, address QUANTITY|TAG - Integer block number, or string "latest", "earliest" or "pending"
params: [
'0xF60a4716edAbDc1479C9b2562989a9cA106063dA',
'latest' // state at the latest block
]return value
QUANTITY - The number of transactions sent from the specified address, integer
Sample code
request:
curl --location ${RPC_URL} -H "Content-Type:application/json" -X POST --data
'{
"jsonrpc":"2.0",
"method":"eth_getTransactionCount",
"params":[
"0xF60a4716edAbDc1479C9b2562989a9cA106063dA",
"latest"
],
"id":1
}'response:
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x3"
}Block API
eth_getBlockByHash
Returns information about a block by block hash.
parameter
DATA, 32 bytes-block hash
Boolean - If true, return the complete transaction object, otherwise only return the transaction hash
params: [
'0x5f5d529ca8439907834fad33cad684b2e316df4ea16865610b55cc54a4833088',
true
]return value
Object - The matching block object, if the block is not found, returns null, the structure is as follows:
- number: QUANTITY - Block number, pending block is null
- hash: DATA, 32 Bytes - Block hash, pending block is null
- parentHash: DATA, 32 Bytes - The hash of the parent block
- nonce: DATA, 8 Bytes - The generated pow hash, the pending block is null
- sha3Uncles: DATA, 32 Bytes - SHA3 hash of the uncle data in the block
- logsBloom: DATA, 256 Bytes - Bloom filter of fast log, pending block is null
- transactionsRoot: DATA, 32 Bytes - The root node of the transaction tree in the block
- stateRoot: DATA, 32 Bytes - The root node of the block final state tree
- receiptsRoot: DATA, 32 Bytes - The root node of the block transaction receipt tree
- miner: DATA, 20 Bytes - Receiving account for mining rewards
- difficulty: QUANTITY - Block difficulty, integer
- totalDifficulty: QUANTITY - Total difficulty on the chain as of this block
- extraData: DATA - Block extra data
- size: QUANTITY - Number of bytes in this block
- gasLimit: QUANTITY - Maximum gas usage allowed in this block
- gasUsed: QUANTITY - The total amount of gas used by all transactions in this block
- timestamp: QUANTITY - Block timestamp
- transactions: Array - Transaction object array, or 32-byte transaction hash array
- uncles: Array - Uncle hash array
The following fields are only in Ethereum's response: parentHash: DATA, 32 Bytes - The hash of the parent block receiptsRoot: DATA, 32 Bytes - The root node of the block transaction receipt tree
Sample code
request:
curl --location ${RPC_URL} -H "Content-Type:application/json" -X POST --data
'{
"jsonrpc":"2.0",
"method":"eth_getBlockByHash",
"params":[
"0x5f5d529ca8439907834fad33cad684b2e316df4ea16865610b55cc54a4833088",
true
],
"id":1
}' response:
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"difficulty": null,
"extraData": null,
"gasLimit": "0xffffffff",
"gasUsed": "0x9184e72a0000",
"hash": "0x5f5d529ca8439907834fad33cad684b2e316df4ea16865610b55cc54a4833088",
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"miner": "0x0000000000000000000000000000000000000000",
"nonce": null,
"number": "0xb960",
"sha3Uncles": null,
"size": "0x2b1",
"stateRoot": "0x3d78925971ba8cdc4581f6e0aea30ce2a3e1193f2e3bc03a17080383a01dc4b3",
"timestamp": "0x5fd07e18",
"totalDifficulty": null,
"transactions": [
{
"blockHash": "0x5f5d529ca8439907834fad33cad684b2e316df4ea16865610b55cc54a4833088",
"blockNumber": "0xb960",
"from": "0xf60a4716edabdc1479c9b2562989a9ca106063da",
"gas": "0x10000",
"gasPrice": "0x9184e72a",
"hash": "0x579c0bca0a06a5cece62605324ef437865df7f7070b46a29fde978d8e6de53cc",
"input": "0x",
"nonce": "0x5",
"to": "0x5f9e2ff5bfcc135bbea6aa9587ae88564d35c1b4",
"transactionIndex": "0x0",
"value": "0x200000000",
"v": "0x4593",
"r": "0x9f96a63d4127f7b7a8175c34cc88cd508704898ad955e167f0d0292be26c3bf3",
"s": "0x1e7fa24c30ad6020b20439cabd902f5dac2c1cb9e7098b1d94db1524a5fa8c77"
}
],
"transactionsRoot": "0x640ba1c7242e49b6523b0b583763640e3376179822ec77dbbca930c0ab63fe7a",
"uncles": null
}
}eth_getBlockByNumber
Returns information about a block by block number.
parameter
QUANTITY|TAG - Integer block number, or string "earliest", "latest" or "pending" Boolean - If true, return the complete transaction object, otherwise only return the transaction hash.
params: [
'0xb960',
true
]return value
Object - The matching block object, if the block is not found, returns null, the structure is as follows:
- difficulty: QUANTITY - Ether square represents a "block difficulty", Mova chains are not taken to make the block by miners right difficult, so this value is null.
- extraData: DATA - Block extra data
- gasLimit: QUANTITY - The maximum amount of gas allowed in this block
- gasUsed: QUANTITY - The total amount of gas used by all transactions in this block
- hash: DATA, 32 Bytes - Block hash
- logsBloom: DATA, 256 Bytes - Bloom filter for fast log
- miner: DATA, 20 Bytes - Receiving account for mining rewards
- nonce: DATA, 8 Bytes - Pow hash generated
- number: QUANTITY - Block number
- sha3Uncles: DATA, 32 Bytes - SHA3 hash of the uncle data in the block
- size: QUANTITY - Number of bytes in this block
- stateRoot: DATA, 32 Bytes - The root node of the block final state tree
- timestamp: QUANTITY - Block timestamp
- totalDifficulty: QUANTITY - Ether Square represents "off the chains of the block to the total difficulty", Mova no such demand chain.
- transactions: Transaction object array, or 32-byte transaction hash array
- transactionsRoot: DATA, 32 Bytes - The root node of the transaction tree in the block
- uncles: Array - Ether square indicates "tertiary Bo Haxi array", Mova no such demand chain.
- parentHash: DATA, 32 Bytes - Ethereum stands for "the hash of the parent block". The consensus algorithm of this chain is different from Ethereum, and there is no such requirement.
- receiptsRoot: DATA, 32 Bytes - Ethereum stands for "the root node of the block transaction receipt tree". The consensus algorithm of this chain is different from Ethereum, and there is no such requirement.
The following fields are only in Ethereum's response: parentHash: DATA, 32 Bytes - The hash of the parent block receiptsRoot: DATA, 32 Bytes - The root node of the block transaction receipt tree
Sample code
request:
curl --location ${RPC_URL} -H "Content-Type:application/json" -X POST --data
'{
"jsonrpc":"2.0",
"method":"eth_getBlockByNumber",
"params":["0xb960",true],
"id":1
}'response:
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"difficulty": null,
"extraData": null,
"gasLimit": "0xffffffff",
"gasUsed": "0x9184e72a0000",
"hash": "0x5f5d529ca8439907834fad33cad684b2e316df4ea16865610b55cc54a4833088",
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"miner": "0x0000000000000000000000000000000000000000",
"nonce": null,
"number": "0xb960",
"sha3Uncles": null,
"size": "0x2b1",
"stateRoot": "0x3d78925971ba8cdc4581f6e0aea30ce2a3e1193f2e3bc03a17080383a01dc4b3",
"timestamp": "0x5fd07e18",
"totalDifficulty": null,
"transactions": [
{
"blockHash": "0x5f5d529ca8439907834fad33cad684b2e316df4ea16865610b55cc54a4833088",
"blockNumber": "0xb960",
"from": "0xf60a4716edabdc1479c9b2562989a9ca106063da",
"gas": "0x10000",
"gasPrice": "0x9184e72a",
"hash": "0x579c0bca0a06a5cece62605324ef437865df7f7070b46a29fde978d8e6de53cc",
"input": "0x",
"nonce": "0x5",
"to": "0x5f9e2ff5bfcc135bbea6aa9587ae88564d35c1b4",
"transactionIndex": "0x0",
"value": "0x200000000",
"v": "0x4593",
"r": "0x9f96a63d4127f7b7a8175c34cc88cd508704898ad955e167f0d0292be26c3bf3",
"s": "0x1e7fa24c30ad6020b20439cabd902f5dac2c1cb9e7098b1d94db1524a5fa8c77"
}
],
"transactionsRoot": "0x640ba1c7242e49b6523b0b583763640e3376179822ec77dbbca930c0ab63fe7a",
"uncles": null
}
}Trasaction API
eth_sendRawTransaction
Creates new message call transaction or a contract creation for the signed transaction.
parameter
- signed transaction message
the Original transaction object is:
- from: DATA, 20 bytes-the source address of the transaction sent
- to: DATA, 20 bytes - The target address of the transaction, optional when creating a new contract
- gas: QUANTITY - The amount of gas available for transaction execution, optional integer, the default value is 90000, unused gas will be returned.
- gasPrice: QUANTITY - Gas price, optional, default value: To-Be-Determined
- value: QUANTITY - Amount sent by the transaction, optional integer
"params":[
"0xf86b04849184e72a83010000945f9e2ff5bfcc135bbea6aa9587ae88564d35c1b485010000000080824594a0ced51bb5f4f9eda5b533787ffc5dcc4e54201153ecd912ca37b3c080cbc7cd7ca04f91d891b9415173ec0b7c7ef975ad8c6b271ba52f557a2c154c066af9d5747d"
]return value
DATA - 32 bytes, transaction hash, if the transaction is not valid, all 0 hashes are returned. When creating a contract, use eth_getTransactionReceipt to obtain the contract address after the transaction takes effect.
Sample code
request:
curl --location ${RPC_URL} -H "Content-Type:application/json" -X POST --data
'{
"jsonrpc":"2.0",
"method":"eth_sendRawTransaction",
"params":[
"0xf86b04849184e72a83010000945f9e2ff5bfcc135bbea6aa9587ae88564d35c1b485010000000080824594a0ced51bb5f4f9eda5b533787ffc5dcc4e54201153ecd912ca37b3c080cbc7cd7ca04f91d891b9415173ec0b7c7ef975ad8c6b271ba52f557a2c154c066af9d5747d"
],
"id":1
}'response:
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x92c1c7403bf9a5880f3531b76e55e0bfe3f7db458483428128f9a91253bf673a"
}eth_getTransactionByHash
Returns the information about a transaction requested by transaction hash.
parameter
DATA, 32 bytes-transaction hash
params: [
'0x733f9ab3683b63ccd0ec0d6f990cfbea33c8bc414837bfecf462085122bb84e7'
]return value
Object - The object of the transaction receipt, or null if the receipt does not exist. The structure of the transaction object is as follows:
- hash: DATA, 32 bytes-transaction hash
- nonce: QUANTITY - The number of transactions that the sender has generated before this transaction
- blockHash: DATA, 32 bytes-the hash of the exchange in the block, for the pending block, the value is null
- blockNumber: QUANTITY - The number of the exchange in the block, for the pending block, the value is null
- transactionIndex: QUANTITY - The index position of the transaction in the block, the value of the pending block is null
- from: DATA, 20 bytes-transaction sender address
- to: DATA, 20 bytes-the address of the transaction recipient. For contract creation transactions, the value is null
- value: QUANTITY - The amount of ether sent, unit: wei
- gasPrice: QUANTITY - Gas price provided by the sender, unit: wei
- gas: QUANTITY - The amount of gas available from the sender
- input: DATA - Data sent with the transaction
- v:
- r:
- s:
Sample code
request:
curl --location ${RPC_URL} -H "Content-Type:application/json" -X POST --data
'{
"jsonrpc":"2.0",
"method":"eth_getTransactionByHash",
"params":["0x733f9ab3683b63ccd0ec0d6f990cfbea33c8bc414837bfecf462085122bb84e7"],
"id":1
}'response:
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"blockHash": "0x5f5d529ca8439907834fad33cad684b2e316df4ea16865610b55cc54a4833088",
"blockNumber": "0xb960",
"from": "0xf60a4716edabdc1479c9b2562989a9ca106063da",
"gas": "0x10000",
"gasPrice": "0x9184e72a",
"hash": "0x733f9ab3683b63ccd0ec0d6f990cfbea33c8bc414837bfecf462085122bb84e7",
"input": "0x",
"nonce": "0x5",
"to": "0x5f9e2ff5bfcc135bbea6aa9587ae88564d35c1b4",
"transactionIndex": "0x0",
"value": "0x200000000",
"v": "0x4593",
"r": "0x9f96a63d4127f7b7a8175c34cc88cd508704898ad955e167f0d0292be26c3bf3",
"s": "0x1e7fa24c30ad6020b20439cabd902f5dac2c1cb9e7098b1d94db1524a5fa8c77"
}
}eth_getTransactionByBlockHashAndIndex
Returns information about a transaction by block hash and transaction index position.
parameter
DATA, 32 bytes-transaction hash QUANTITY - The index number of the transaction in the block
params: [
'0x5f5d529ca8439907834fad33cad684b2e316df4ea16865610b55cc54a4833088',
'0x0'
]return value
Object - The object of the transaction receipt, or null if the receipt does not exist. The structure of the transaction object is as follows:
- hash: DATA, 32 bytes-transaction hash
- nonce: QUANTITY - The number of transactions that the sender has generated before this transaction
- blockHash: DATA, 32 bytes-the hash of the exchange in the block, for the pending block, the value is null
- blockNumber: QUANTITY - The number of the exchange in the block, for the pending block, the value is null
- transactionIndex: QUANTITY - The index position of the transaction in the block, the value of the pending block is null
- from: DATA, 20 bytes-transaction sender address
- to: DATA, 20 bytes-the address of the transaction recipient. For contract creation transactions, the value is null
- value: QUANTITY - The amount of ether sent, unit: wei
- gasPrice: QUANTITY - Gas price provided by the sender, unit: wei
- gas: QUANTITY - The amount of gas available from the sender
- input: DATA - Data sent with the transaction
- v:
- r:
- s:
Sample code
request:
curl --location ${RPC_URL} -H "Content-Type:application/json" -X POST --data
'{
"jsonrpc":"2.0",
"method":"eth_getTransactionByBlockHashAndIndex",
"params":["0x5f5d529ca8439907834fad33cad684b2e316df4ea16865610b55cc54a4833088","0x0"],
"id":1
}' response:
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"blockHash": "0x5f5d529ca8439907834fad33cad684b2e316df4ea16865610b55cc54a4833088",
"blockNumber": "0xb960",
"from": "0xf60a4716edabdc1479c9b2562989a9ca106063da",
"gas": "0x10000",
"gasPrice": "0x9184e72a",
"hash": "0x579c0bca0a06a5cece62605324ef437865df7f7070b46a29fde978d8e6de53cc",
"input": "0x",
"nonce": "0x5",
"to": "0x5f9e2ff5bfcc135bbea6aa9587ae88564d35c1b4",
"transactionIndex": "0x0",
"value": "0x200000000",
"v": "0x4593",
"r": "0x9f96a63d4127f7b7a8175c34cc88cd508704898ad955e167f0d0292be26c3bf3",
"s": "0x1e7fa24c30ad6020b20439cabd902f5dac2c1cb9e7098b1d94db1524a5fa8c77"
}
}eth_getTransactionByBlockNumberAndIndex
Returns information about a transaction by block number and transaction index position.
parameter
QUANTITY|TAG - Integer block number, or string "earliest", "latest" or "pending" QUANTITY - Transaction index number
params: [
'0xb960',
'0x0'
]return value
Object - The object of the transaction receipt, or null if the receipt does not exist. The structure of the transaction object is as follows:
- hash: DATA, 32 bytes-transaction hash
- nonce: QUANTITY - The number of transactions that the sender has generated before this transaction
- blockHash: DATA, 32 bytes-the hash of the exchange in the block, for the pending block, the value is null
- blockNumber: QUANTITY - The number of the exchange in the block, for the pending block, the value is null
- transactionIndex: QUANTITY - The index position of the transaction in the block, the value of the pending block is null
- from: DATA, 20 bytes-transaction sender address
- to: DATA, 20 bytes-the address of the transaction recipient. For contract creation transactions, the value is null
- value: QUANTITY - The amount of ether sent, unit: wei
- gasPrice: QUANTITY - Gas price provided by the sender, unit: wei
- gas: QUANTITY - The amount of gas available from the sender
- input: DATA - Data sent with the transaction
- v:
- r:
- s:
Sample code
request:
curl --location ${RPC_URL} -H "Content-Type:application/json" -X POST --data
'{
"jsonrpc":"2.0",
"method":"eth_getTransactionByBlockNumberAndIndex",
"params":["0xb960","0x0"],
"id":1
}' response:
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"blockHash": "0x5f5d529ca8439907834fad33cad684b2e316df4ea16865610b55cc54a4833088",
"blockNumber": "0xb960",
"from": "0xf60a4716edabdc1479c9b2562989a9ca106063da",
"gas": "0x10000",
"gasPrice": "0x9184e72a",
"hash": "0x579c0bca0a06a5cece62605324ef437865df7f7070b46a29fde978d8e6de53cc",
"input": "0x",
"nonce": "0x5",
"to": "0x5f9e2ff5bfcc135bbea6aa9587ae88564d35c1b4",
"transactionIndex": "0x0",
"value": "0x200000000",
"v": "0x4593",
"r": "0x9f96a63d4127f7b7a8175c34cc88cd508704898ad955e167f0d0292be26c3bf3",
"s": "0x1e7fa24c30ad6020b20439cabd902f5dac2c1cb9e7098b1d94db1524a5fa8c77"
}
}eth_getTransactionReceipt
Returns the receipt of a transaction by transaction hash. It should be pointed out that the receipt of pending transactions is invalid.
parameter
DATA, 32 bytes-transaction hash
params: [
'0x733f9ab3683b63ccd0ec0d6f990cfbea33c8bc414837bfecf462085122bb84e7'
]return value
Object - The object of the transaction receipt, or null if the receipt does not exist. The structure of the transaction object is as follows:
- transactionHash: DATA, 32 bytes-transaction hash
- transactionIndex: QUANTITY - The index number of the transaction in the block
- blockHash: DATA, 32 bytes - The hash of the exchange in the block
- blockNumber: QUANTITY - The number of the exchange in the block
- from: DATA, 20 bytes - Transaction sender address
- to: DATA, 20 bytes - The address of the transaction recipient. For contract creation transactions, the value is null
- cumulativeGasUsed: QUANTITY - The total amount of gas consumed by the exchange in the block
- gasUsed: QUANTITY - The amount of gas consumed by the transaction
- contractAddress: DATA, 20 bytes-For contract creation transactions, the value is the newly created contract address, otherwise it is null
- logs: Array - The array of log objects generated by this transaction
- logsBloom: DATA, 256 bytes-bloom filter, light client used to quickly extract related logs
Sample code
request:
curl --location ${RPC_URL} -H "Content-Type:application/json" -X POST --data
'{
"jsonrpc":"2.0",
"method":"eth_getTransactionReceipt",
"params":["0x733f9ab3683b63ccd0ec0d6f990cfbea33c8bc414837bfecf462085122bb84e7"],
"id":1
}' response:
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"blockHash": "0x5f5d529ca8439907834fad33cad684b2e316df4ea16865610b55cc54a4833088",
"blockNumber": "0xb960",
"contractAddress": null,
"cumulativeGasUsed": null,
"from": "0xf60a4716edabdc1479c9b2562989a9ca106063da",
"gasUsed": "0x0",
"logs": null,
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"status": "0x1",
"to": "0x5f9e2ff5bfcc135bbea6aa9587ae88564d35c1b4",
"transactionHash": "0x733f9ab3683b63ccd0ec0d6f990cfbea33c8bc414837bfecf462085122bb84e7",
"transactionIndex": "0x0"
}
}eth_getLogs
Returns an array of all logs matching a given filter object.
Parameters
Object - The filter options:
- fromBlock: QUANTITY|TAG - (optional, default: "latest") Integer block number, or "latest" for the last mined block or "pending", "earliest" for not yet mined transactions.
- toBlock: QUANTITY|TAG - (optional, default: "latest") Integer block number, or "latest" for the last mined block or "pending", "earliest" for not yet mined transactions. The value(toBlock - fromBlock) must be less than 200.
- address: DATA|Array, 20 Bytes - (optional) Contract address or a list of addresses from which logs should originate.
- topics: Array of DATA, - (optional) Array of 32 Bytes DATA topics. Topics are order-dependent. Each topic can also be an array of DATA with "or" options.
- blockhash: DATA, 32 Bytes - (optional, future) With the addition of EIP-234, blockHash will be a new filter option which restricts the logs returned to the single block with the 32-byte hash blockHash. Using blockHash is equivalent to fromBlock = toBlock = the block number with hash blockHash. If blockHash is present in in the filter criteria, then neither fromBlock nor toBlock are allowed.
params: [
{
topics: [
"0x000000000000000000000000a94f5374fce5edbc8e2a8697c15331677e6ebf0b",
],
},
]return value
DATA - Returns Array - Array of log objects, or an empty array if nothing has changed since last poll.
Sample code
request:
curl --location ${RPC_URL} -X POST -H "Content-Type:application/json" --data
'{
"jsonrpc":"2.0",
"method":"eth_getLogs",
"params":[
{
"topics":[
"0x59ebeb90bc63057b6515673c3ecf9438e5058bca0f92585014eced636878c9a5"
]
}
],
"id":1
}'response:
{
"id":1,
"jsonrpc":"2.0",
"result": [{
"logIndex": "0x1",
"blockNumber":"0x1b4",
"blockHash": "0x8216c5785ac562ff41e2dcfdf5785ac562ff41e2dcfdf829c5a142f1fccd7d",
"transactionHash": "0xdf829c5a142f1fccd7d8216c5785ac562ff41e2dcfdf5785ac562ff41e2dcf",
"transactionIndex": "0x0",
"address": "0x16c5785ac562ff41e2dcfdf829c5a142f1fccd7d",
"data":"0x0000000000000000000000000000000000000000000000000000000000000000",
"topics": ["0x59ebeb90bc63057b6515673c3ecf9438e5058bca0f92585014eced636878c9a5"]
}]
}Contract API
eth_call
Executes a new message call immediately without creating a transaction on the block chain.
parameter
Object - Transaction call object
- from: DATA, 20 Bytes - The original address to send the transaction, optional
- to: DATA, 20 Bytes - Transaction target address
- gas: QUANTITY - The amount of gas available for the transaction, optional. eth_call does not consume gas, but some execution links require this parameter
- gasPrice: QUANTITY - gas price, optional
- data: DATA - Method signature and hash of encoding parameters, optional
return value
DATA - The return value of the executed contract
Sample code
request:
curl --location ${RPC_URL} -H "Content-Type:application/json" -X POST --data
'{
jsonrpc":"2.0","method":"eth_call",
"params":[
{
"from":"0xF60a4716edAbDc1479C9b2562989a9cA106063dA",
"to":"0x506fb30eeac47da87503a0c12223c9482b06891e",
"gas":"0x10000",
"gasPrice":"0x9184e72a",
"data":"0x55551669"
},
"latest"
],
"id":1
}'response:
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x0000000000000000000000000000000000000000000000000000000000009855"
}eth_getCode
Returns the code of the specified contract.
parameter
- DATA - 20 bytes, address
- QUANTITY|TAG - Integer block number, or string "latest", "earliest" or "pending"
params:[
"0xF60a4716edAbDc1479C9b2562989a9cA106063dA",
"latest"
]return value
DATA - Code at specified address
Sample code
request:
curl --location ${RPC_URL} -H "Content-Type:application/json" -X POST --data
'{
"jsonrpc":"2.0",
"method":"eth_getCode",
"params":[
"0xF60a4716edAbDc1479C9b2562989a9cA106063dA",
"latest"
],
"id":1
}'response:
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x"
}Gas API
eth_gasPrice
Returns the current gas price, unit: wei.
parameter
no
return value
QUANTITY - Integer, the current gas price in wei
Sample code
request:
curl --location ${RPC_URL} -H "Content-Type:application/json" -X POST --data
'{
"jsonrpc":"2.0",
"method":"eth_gasPrice",
"params":[],
"id":73
}'response:
{
"jsonrpc": "2.0",
"id": 73,
"result": "0x14"
}eth_estimateGas
Makes a call or transaction, which won't be added to the blockchain and returns the used gas, which can be used for estimating the used gas.
parameter
Refer to the parameters of the eth_call call, all attributes are optional. If the upper limit of gas usage is not specified, geth will use the upper gas limit of the pending block. In this case, the gas estimate returned may not be enough to execute the actual transaction.
return value
QUANTITY - Estimated gas usage
Sample code
request:
curl --location ${RPC_URL} -H "Content-Type:application/json" -X POST --data
'{
"jsonrpc":"2.0",
"method":"eth_estimateGas",
"params":
[
{
"from":"0xF60a4716edAbDc1479C9b2562989a9cA106063dA",
"to":"0x506fb30eeac47da87503a0c12223c9482b06891e",
"gas":"0x10000",
"gasPrice":"0x9184e72a",
"data":"0x55551669"
}
],
"id":1
}'response:
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x989680"
}