Time to read: 1 min
Rootstock RPC API Methods
Find below a list of methods available on the Rootstock RPC Service. See how to setup the Rootstock RPC Service.
eth_accounts
- Method:
eth_accounts
- Returns a list of addresses owned by the client. Since Rootstock RPC Service does not store keys, this will always return empty.
- Params: None
curl --location 'https://rpc.testnet.rootstock.io/<api-key>' \
--request POST \
--header 'accept: application/json' \
--header 'Content-Type: application/json' \
--data '{
"jsonrpc":"2.0",
"method":"eth_accounts",
"params":[],
"id":0
}'
- Example Response:
{
"jsonrpc": "2.0",
"id": 0,
"result": []
}
eth_blockNumber
- Method:
eth_blockNumber
- Returns the number of the most recent block.
- Params: None
curl --location 'https://rpc.testnet.rootstock.io/<api-key>' \
--request POST \
--header 'accept: application/json' \
--header 'Content-Type: application/json' \
--data '{
"jsonrpc":"2.0",
"method":"eth_blockNumber",
"params":[],
"id":0
}'
- Example Response:
{
"jsonrpc": "2.0",
"id": 0,
"result": "0x4bdcfb"
}
eth_call
- Executes a new message call immediately without creating a transaction on the blockchain.
- Params:
transaction
: object, the transaction call object which contains the following fields:- from: String, the address from which the transaction is sent
- to: String, required, the address to which the transaction is addressed
- gas: String, the integer of gas provided for the transaction execution
- gasPrice: String, the integer of the
gasPrice
used for each paid gas, encoded as a hexadecimal - value: String, the integer of value sent with this transaction encoded as hexadecimal
- data: string, the hash of the method signature and encoded parameters. For more information, see the Contract ABI description in the Solidity documentation
blockNumber
: String, required. The number of the block (in hex) from which the number of transactions is required, OR one of the following block tags:- latest: the most recent block the client has available.
- earliest: the lowest numbered block the client has available.
- pending: A sample next block built by the client on top of latest and containing the set of transactions usually taken from a local mempool. Intuitively, you can think of these as blocks that have not been mined yet.
- Example:
curl --location 'https://rpc.testnet.rootstock.io/<api-key>' \
--request POST \
--header 'accept: application/json' \
--header 'Content-Type: application/json' \
--data '{
"jsonrpc":"2.0",
"method":"eth_call",
"params":[{"from": "0xb60e8dd61c5d32be8058bb8eb970870f07233155",
"to": "0xd46e8dd67c5d32be8058bb8eb970870f07244567",
"gas": "0x76c0",
"gasPrice": "0x9184e72a000",
"value": "0x9184e72a",
"data": "0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675"},
"latest"
],
"id":0
}'
- Example Response:
{
"jsonrpc": "2.0",
"id": 0,
"result": "0x"
}