API Methods
OpenGPU API Interface Documentation
eth_blockNumber
Returns the number of the most recent block.
Request
{
"jsonrpc": "2.0",
"method": "eth_blockNumber",
"params": [],
"id": 1
}Response
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x10d4f"
}eth_call
Executes a new message call immediately without creating a transaction on the blockchain.
Request
{
"jsonrpc": "2.0",
"method": "eth_call",
"params": [
{
"to": "0xAddress",
"data": "0x..."
},
"latest"
],
"id": 1
}Response
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x..."
}eth_chainId
Returns the chain ID of the current network.
Request
{
"jsonrpc": "2.0",
"method": "eth_chainId",
"params": [],
"id": 1
}Response
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x1"
}eth_estimateGas
Estimates the gas necessary to complete a transaction.
Request
{
"jsonrpc": "2.0",
"method": "eth_estimateGas",
"params": [
{
"to": "0xAddress",
"data": "0x..."
}
],
"id": 1
}Response
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x5208"
}eth_gasPrice
Returns the current gas price in wei.
Request
{
"jsonrpc": "2.0",
"method": "eth_gasPrice",
"params": [],
"id": 1
}Response
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x09184e72a000"
}eth_getBalance
Returns the balance of the account.
Request
{
"jsonrpc": "2.0",
"method": "eth_getBalance",
"params": ["0xAddress", "latest"],
"id": 1
}Response
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x0234c8a3397aab58"
}eth_getBlockByHash
Request
{
"jsonrpc": "2.0",
"method": "eth_getBlockByHash",
"params": ["0xBlockHash", true],
"id": 1
}eth_getBlockByNumber
Request
{
"jsonrpc": "2.0",
"method": "eth_getBlockByNumber",
"params": ["0x10d4f", true],
"id": 1
}eth_getBlockTransactionCountByHash
Request
{
"jsonrpc": "2.0",
"method": "eth_getBlockTransactionCountByHash",
"params": ["0xBlockHash"],
"id": 1
}eth_getBlockTransactionCountByNumber
Request
{
"jsonrpc": "2.0",
"method": "eth_getBlockTransactionCountByNumber",
"params": ["latest"],
"id": 1
}eth_getCode
Returns the contract code at a given address.
Request
{
"jsonrpc": "2.0",
"method": "eth_getCode",
"params": ["0xAddress", "latest"],
"id": 1
}Response
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x..."
}eth_getLogs
Request
{
"jsonrpc": "2.0",
"method": "eth_getLogs",
"params": [
{
"fromBlock": "0x1",
"toBlock": "latest",
"address": "0xContractAddress",
"topics": []
}
],
"id": 1
}eth_getProof
Request
{
"jsonrpc": "2.0",
"method": "eth_getProof",
"params": [
"0xAddress",
["0x0", "0x1"],
"latest"
],
"id": 1
}eth_getStorageAt
Request
{
"jsonrpc": "2.0",
"method": "eth_getStorageAt",
"params": ["0xAddress", "0x0", "latest"],
"id": 1
}eth_getTransactionByBlockHashAndIndex
Request
{
"jsonrpc": "2.0",
"method": "eth_getTransactionByBlockHashAndIndex",
"params": ["0xBlockHash", "0x0"],
"id": 1
}eth_getTransactionByBlockNumberAndIndex
Request
{
"jsonrpc": "2.0",
"method": "eth_getTransactionByBlockNumberAndIndex",
"params": ["latest", "0x0"],
"id": 1
}eth_getTransactionByHash
Request
{
"jsonrpc": "2.0",
"method": "eth_getTransactionByHash",
"params": ["0xTxHash"],
"id": 1
}eth_getTransactionCount
Request
{
"jsonrpc": "2.0",
"method": "eth_getTransactionCount",
"params": ["0xAddress", "latest"],
"id": 1
}eth_getTransactionReceipt
Request
{
"jsonrpc": "2.0",
"method": "eth_getTransactionReceipt",
"params": ["0xTxHash"],
"id": 1
}eth_sendRawTransaction
Request
{
"jsonrpc": "2.0",
"method": "eth_sendRawTransaction",
"params": ["0xSignedTransactionData"],
"id": 1
}eth_syncing
Request
{
"jsonrpc": "2.0",
"method": "eth_syncing",
"params": [],
"id": 1
}Response (syncing)
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"startingBlock": "0x384",
"currentBlock": "0x386",
"highestBlock": "0x454"
}
}Response (not syncing)
{
"jsonrpc": "2.0",
"id": 1,
"result": false
}net_version
Request
{
"jsonrpc": "2.0",
"method": "net_version",
"params": [],
"id": 1
}Response
{
"jsonrpc": "2.0",
"id": 1,
"result": "1"
}web3_clientVersion
Request
{
"jsonrpc": "2.0",
"method": "web3_clientVersion",
"params": [],
"id": 1
}Response
{
"jsonrpc": "2.0",
"id": 1,
"result": "Geth/v1.11.5-stable-..."
}web3_sha3
Request
{
"jsonrpc": "2.0",
"method": "web3_sha3",
"params": ["0x68656c6c6f20776f726c64"],
"id": 1
}Response
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x47173285a8d7341e5e972fc677286384f802f8ef42a5ec5f03bbfa254cb01fad"
}Last updated