JSON-RPC Specification

Pegasus Testnet and Phoenix Mainnet are currently running on the following endpoints.

LightLink utilizes the convenient Geth (go-ethereum) RPC and most of its API methods without any changes.

For example, using the JSON RPC API, developers can download a block by its hash by calling the getBlockByHash method, or invoke a smart contract using the call method with JSON or cURL.

See the complete JSON specification for more details.

Subscriptions

LightLink supports real-time event notifications via a subscription mechanism in Geth v1.4. Subscriptions are part of the LightLink JSON-RPC API and are a type of Pub/Sub (Publish/Subscribe) system. With subscriptions enabled, the app receives notifications about selected events, such as new block headers, new transactions, new contract calls, etc. Please refer to the subscription documentation for more details.

Specification

Version 0.0.1 (2023-03-28)

This is the official specification for the LightLink Node JSON RPC server.

All requests and responses are in JSON format. The JSON-RPC version is 2.0.

HEADERS
Content-Type
application/json

web3

The web3 module provides information about the current client.


clientVersion

Returns the current client version.

Parameters

None

Returns

String - The current client version

Example Request

{
  "jsonrpc": "2.0",
  "method": "web3_clientVersion",
  "params": [],
  "id": 1
}

Example Response

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "Geth/v1.10.23-omnibus-b38477ec/linux-amd64/go1.18.5"
}

sha3

Returns Keccak-256 (not the standardized SHA3-256) of the given data.

Parameters

  1. DATA - the data to convert into a SHA3 hash

  params: [
    "0x68656c6c6f20776f726c64"
  ]

Returns

DATA - The SHA3 result of the given string.

Example Request

{
  "jsonrpc": "2.0",
  "method": "web3_sha3",
  "params": [
      "0x68656c6c6f20776f726c64"
  ],
  "id": 64
}

Example Response

{
    "jsonrpc": "2.0",
    "id": 64,
    "result": "0x5b2c76da96136d193336fad3fbc049867b8ca157da22f69ae0e4923648250acc"
}

net

The net module provides network information.


netVersion

Returns the current network id.

Parameters

None

Returns

String - The current client version

Example Request

{
    "jsonrpc": "2.0",
    "method": "net_version",
    "params": [],
    "id": 67
}

Example Response

{
    "jsonrpc": "2.0",
    "id": 67,
    "result": "1891"
}

netListening

Returns true if client is actively listening for network connections.

Parameters

None

Returns

Boolean - true when listening, otherwise false.

Example Request

{
    "jsonrpc": "2.0",
    "method": "net_listening",
    "params": [],
    "id": 67
}

Example Response

{
    "jsonrpc": "2.0",
    "id": 67,
    "result": true
}

peerCount

Returns number of peers currently connected to the client.

Parameters

None

Returns

QUANTITY - integer of the number of connected peers.

Example Request

{
    "jsonrpc": "2.0",
    "method": "net_peerCount",
    "params": [],
    "id": 74
}

Example Response

{
    "jsonrpc": "2.0",
    "id": 74,
    "result": "0x2"
}


eth

The eth module provides information about the Ethereum protocol.


protocolVersion

Returns the current LightLink protocol version.

Parameters

None

Returns

String - The current LightLink protocol version

Example Request

{
    "jsonrpc": "2.0",
    "method": "eth_protocolVersion",
    "params": [],
    "id": 67
}

Example Response

{
    "jsonrpc": "2.0",
    "id": 67,
    "result": "0x3f"
}

syncing

Returns an object with data about the sync status or false.

Parameters

None

Returns

Boolean - false when not syncing, true when syncing

Example Request

{
    "jsonrpc": "2.0",
    "method": "eth_syncing",
    "params": [],
    "id": 67
}

Example Response

{
    "jsonrpc": "2.0",
    "id": 67,
    "result": false
}

coinbase

Returns the client coinbase address.

Parameters

None

Returns

DATA, 20 Bytes - the current coinbase address.

Example Request

{
    "jsonrpc": "2.0",
    "method": "eth_coinbase",
    "params": [],
    "id": 67
}

Example Response

{
    "jsonrpc": "2.0",
    "id": 67,
    "result": "0x99d3f3a83a68b3c3bb923d86387dc91340c53304"
}

gasPrice

Returns the current price per gas in wei.

Parameters

None

Returns

QUANTITY - integer of the current gas price in wei.

Example Request

{
    "jsonrpc": "2.0",
    "method": "eth_gasPrice",
    "params": [],
    "id": 67
}

Example Response

{
    "jsonrpc": "2.0",
    "id": 67,
    "result": "0x3b9aca00"
}

blockNumber

Returns the number of most recent block.

Parameters

None

Returns

QUANTITY - integer of the current block number the client is on.

Example Request

{
    "jsonrpc": "2.0",
    "method": "eth_blockNumber",
    "params": [],
    "id": 67
}

Example Response

{
    "jsonrpc": "2.0",
    "id": 67,
    "result": "0x5daf3b"
}

getBalance

Returns the balance of the account of given address.

Parameters

DATA, 20 Bytes - address to check for balance.

QUANTITY|TAG - integer block number, or the string "latest" or "pending".

Returns

QUANTITY - integer of the current balance in wei.

Example Request

{
    "jsonrpc": "2.0",
    "method": "eth_getBalance",
    "params": [
        "0x99d3f3a83a68b3c3bb923d86387dc91340c53304",
        "latest"
    ],
    "id": 67
}

Example Response

{
    "jsonrpc": "2.0",
    "id": 67,
    "result": "0x0"
}

getStorageAt

Returns the value from a storage position at a given address.

Parameters

DATA, 20 Bytes - address of the storage.

QUANTITY - integer of the position in the storage.

QUANTITY|TAG - integer block number, or the string "latest" or "pending".

Returns

DATA - the value at this storage position.

Example Request

{
    "jsonrpc": "2.0",
    "method": "eth_getStorageAt",
    "params": [
        "0x99d3f3a83a68b3c3bb923d86387dc91340c53304",
        "0x0",
        "latest"
    ],
    "id": 67
}

Example Response

{
    "jsonrpc": "2.0",
    "id": 67,
    "result": "0x0"
}

getTransactionCount

Returns the number of transactions sent from an address.

Parameters

DATA, 20 Bytes - address.

QUANTITY|TAG - integer block number, or the string "latest" or "pending".

Returns

QUANTITY - integer of the number of transactions sent from this address.

Example Request

{
    "jsonrpc": "2.0",
    "method": "eth_getTransactionCount",
    "params": [
        "0x99d3f3a83a68b3c3bb923d86387dc91340c53304",
        "latest"
    ],
    "id": 67
}

Example Response

{
    "jsonrpc": "2.0",
    "id": 67,
    "result": "0x0"
}

getBlockTransactionCountByHash

Returns the number of transactions in a block from a block matching the given block hash.

Parameters

DATA, 32 Bytes - hash of a block.

Returns

QUANTITY - integer of the number of transactions in this block.

Example Request

{
    "jsonrpc": "2.0",
    "method": "eth_getBlockTransactionCountByHash",
    "params": [
        "0x99d3f3a83a68b3c3bb923d86387dc91340c53304"
    ],
    "id": 67
}

Example Response

{
    "jsonrpc": "2.0",
    "id": 67,
    "result": "0x0"
}

getBlockTransactionCountByNumber

Returns the number of transactions in a block from a block matching the given block number.

Parameters

QUANTITY|TAG - integer of a block number, or the string "latest" or "pending".

Returns

QUANTITY - integer of the number of transactions in this block.

Example Request

{
    "jsonrpc": "2.0",
    "method": "eth_getBlockTransactionCountByNumber",
    "params": [
        "latest"
    ],
    "id": 67
}

Example Response

{
    "jsonrpc": "2.0",
    "id": 67,
    "result": "0x0"
}

getCode

Returns code at a given address.

Parameters

DATA, 20 Bytes - address.

QUANTITY|TAG - integer block number, or the string "latest" or "pending".

Returns

DATA - the code from the given address.

Example Request

{
    "jsonrpc": "2.0",
    "method": "eth_getCode",
    "params": [
        "0x99d3f3a83a68b3c3bb923d86387dc91340c53304",
        "latest"
    ],
    "id": 67
}

Example Response

{
    "jsonrpc": "2.0",
    "id": 67,
    "result": "0x0"
}

sendRawTransaction

Creates new message call transaction or a contract creation, if the data field contains code.

Parameters

DATA, The signed transaction data.

Returns

DATA, 32 Bytes - the transaction hash, or the zero hash if the transaction is not yet available.

Example Request

{
    "jsonrpc": "2.0",
    "method": "eth_sendRawTransaction",
    "params": [
        "0xf86c808504a817c80082520894e7f1725e7734ce288f8367e1bb143e866665d794880de0"
    ],
    "id": 67
}

Example Response

{
    "jsonrpc": "2.0",
    "id": 67,
    "result": "0x0"
}

call

Executes a new message call immediately without creating a transaction on the block chain.

Parameters

Object - The transaction call object

from: DATA, 20 Bytes - (optional) The address the transaction is sent from.

to: DATA, 20 Bytes - The address the transaction is directed to.

gas: QUANTITY - (optional) Integer of the gas provided for the transaction execution. eth_call consumes zero gas, but this parameter may be needed by some executions.

gasPrice: QUANTITY - (optional) Integer of the gasPrice used for each paid gas

value: QUANTITY - (optional) Integer of the value sent with this transaction

data: DATA - (optional) Hash of the method signature and encoded parameters. For details see [Ethereum Contract ABI]

QUANTITY|TAG - integer block number, or the string "latest" or "pending".

Returns

DATA - the return value of executed contract.

Example Request

{
    "jsonrpc": "2.0",
    "method": "eth_call",
    "params": [
        {
            "from": "0x99d3f3a83a68b3c3bb923d86387dc91340c53304",
            "to": "0x99d3f3a83a68b3c3bb923d86387dc91340c53304",
            "gas": "0x76c0",
            "gasPrice": "0x9184e72a000",
            "value": "0x9184e72a",
            "data": "0x7f74657374"
        },
        "latest"
    ],
    "id": 67
}

Example Response

{
    "jsonrpc": "2.0",
    "id": 67,
    "result": "0x0"
}

estimateGas

Generates and returns an estimate of how much gas is necessary to allow the transaction to complete. The transaction will not be added to the blockchain. Note that the estimate may be significantly more than the amount of gas actually used by the transaction, for a variety of reasons including EVM mechanics and node performance.

Parameters

Object - The transaction call object

from: DATA, 20 Bytes - (optional) The address the transaction is sent from.

to: DATA, 20 Bytes - The address the transaction is directed to.

gas: QUANTITY - (optional) Integer of the gas provided for the transaction execution. eth_call consumes zero gas, but this parameter may be needed by some executions.

gasPrice: QUANTITY - (optional) Integer of the gasPrice used for each paid gas

value: QUANTITY - (optional) Integer of the value sent with this transaction

data: DATA - (optional) Hash of the method signature and encoded parameters. For details see [Ethereum Contract ABI]

QUANTITY|TAG - integer block number, or the string "latest" or "pending".

Returns

QUANTITY - integer of the estimated gas used.

Example Request

{
    "jsonrpc": "2.0",
    "method": "eth_estimateGas",
    "params": [
        {
            "from": "0x99d3f3a83a68b3c3bb923d86387dc91340c53304",
            "to": "0x99d3f3a83a68b3c3bb923d86387dc91340c53304",
            "gas": "0x76c0",
            "gasPrice": "0x9184e72a000",
            "value": "0x9184e72a",
            "data": "0x7f74657374"
        },
        "latest"
    ],
    "id": 67
}

Example Response

{
    "jsonrpc": "2.0",
    "id": 67,
    "result": "0x5208"
}

getBlockByHash

Returns information about a block by hash.

Parameters

DATA, 32 Bytes - hash of a block.

Boolean - If true it returns the full transaction objects, if false only the hashes of the transactions.

Returns

Object - A block object, or null when no block was found:

number: QUANTITY - the block number. null when its pending block.

hash: DATA, 32 Bytes - hash of the block. null when its pending block.

parentHash: DATA, 32 Bytes - hash of the parent block.

nonce: DATA, 8 Bytes - hash of the generated proof-of-work. null when its pending block.

sha3Uncles: DATA, 32 Bytes - SHA3 of the uncles data in the block.

logsBloom: DATA, 256 Bytes - the bloom filter for the logs of the block. null when its pending block.

transactionsRoot: DATA, 32 Bytes - the root of the transaction trie of the block.

stateRoot: DATA, 32 Bytes - the root of the final state trie of the block.

receiptsRoot: DATA, 32 Bytes - the root of the receipts trie of the block.

miner: DATA, 20 Bytes - the address of the beneficiary to whom the mining rewards were given.

difficulty: QUANTITY - integer of the difficulty for this block.

totalDifficulty: QUANTITY - integer of the total difficulty of the chain until this block.

extraData: DATA - the "extra data" field of this block.

size: QUANTITY - integer the size of this block in bytes.

gasLimit: QUANTITY - the maximum gas allowed in this block.

gasUsed: QUANTITY - the total used gas by all transactions in this block.

timestamp: QUANTITY - the unix timestamp for when the block was collated.

transactions: Array - Array of transaction objects, or 32 Bytes transaction hashes depending on the last given parameter.

uncles: Array - Array of uncle hashes.

Example Request

{
    "jsonrpc": "2.0",
    "method": "eth_getBlockByHash",
    "params": [
        "0x74c1f99cb9c9f2f0dd496114a3cb63b7c9222e0e094eda6e78fd045748f41dcd",
        true
    ],
    "id": 67
}

Example Response

{
    "jsonrpc": "2.0",
    "id": 1,
    "result": {
        "difficulty": "0x0",
        "extraData": "0x0000000000000000000000000000000000000000000000000000000000000000",
        "gasLimit": "0xe4e1c0",
        "gasUsed": "0x0",
        "hash": "0x74c1f99cb9c9f2f0dd496114a3cb63b7c9222e0e094eda6e78fd045748f41dcd",
        "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
        "miner": "0x224f11BB809e122b17D6A5f237bc7B12Cd672F0E",
        "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
        "nonce": "0xc9e41bfa0b90b3aa",
        "number": "0x1",
        "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
        "receiptsRoot": "0x0000000000000000000000000000000000000000000000000000000000000000",
        "sha3Uncles": "0x0000000000000000000000000000000000000000000000000000000000000000",
        "size": "0x0",
        "stateRoot": "0xd5b5abb95168813ddda62000bf701b6187e11cf83c2b7f210a95defc96e4eebf",
        "timestamp": "0x63bc44f7",
        "totalDifficulty": "0x0",
        "transactions": [
            {
                "blockHash": "0x74c1f99cb9c9f2f0dd496114a3cb63b7c9222e0e094eda6e78fd045748f41dcd",
                "blockNumber": "0x1",
                "from": "0x224f11bb809e122b17d6a5f237bc7b12cd672f0e",
                "gas": "0x186a0",
                "gasPrice": "0x1",
                "hash": "0xf561a2b949a6dd5c9d27924810f5baeb6546ca77336d7f3544cd593ebb0093de",
                "input": "0x",
                "nonce": "0x1",
                "r": "0xcb1318e432ee312b16f87668b137f62e7cd320de7214cb653934d6d01519f95",
                "s": "0x724e333520563874b1f94e6b65adf46f8bcfe8b5d18f4f8df99f587443d7c3ed",
                "to": "0x224f11bb809e122b17d6a5f237bc7b12cd672f0e",
                "transactionIndex": "0x0",
                "type": "0x0",
                "v": "0xeea",
                "value": "0x7c13bc4b2c133c56000000"
            }
        ],
        "transactionsRoot": "0x845f830b101a98ddb3773e676a270a888d8b0e50410ba89232620b1966b96d66",
        "uncles": []
    }
}

getBlockByNumber

Returns information about a block by block number.

Parameters

QUANTITY|TAG - integer of a block number, or the string "earliest", "latest" or "pending".

BOOLEAN - If true it returns the full transaction objects, if false only the hashes of the transactions.

Returns

Object - A block object, or null when no block was found:

  • number: QUANTITY - the block number. null when its pending block.

  • hash: DATA, 32 Bytes - hash of the block. null when its pending block.

  • parentHash: DATA, 32 Bytes - hash of the parent block.

  • nonce: DATA, 8 Bytes - hash of the generated proof-of-work. null when its pending block.

  • sha3Uncles: DATA, 32 Bytes - SHA3 of the uncles data in the block.

  • logsBloom: DATA, 256 Bytes - the bloom filter for the logs of the block. null when its pending block.

  • transactionsRoot: DATA, 32 Bytes - the root of the transaction trie of the block.

  • stateRoot: DATA, 32 Bytes - the root of the final state trie of the block.

  • receiptsRoot: DATA, 32 Bytes - the root of the receipts trie of the block.

  • miner: DATA, 20 Bytes - the address of the beneficiary to whom the mining rewards were given.

  • difficulty: QUANTITY - integer of the difficulty for this block.

  • totalDifficulty: QUANTITY - integer of the total difficulty of the chain until this block.

  • extraData: DATA - the "extra data" field of this block.

  • size: QUANTITY - integer the size of this block in bytes.

  • gasLimit: QUANTITY - the maximum gas allowed in this block.

  • gasUsed: QUANTITY - the total used gas by all transactions in this block.

  • timestamp: QUANTITY - the unix timestamp for when the block was collated.

  • transactions: Array - Array of transaction objects, or 32 Bytes transaction hashes depending on the last given parameter.

  • uncles: Array - Array of uncle hashes.

Example Request

{
    "jsonrpc": "2.0",
    "method": "eth_getBlockByNumber",
    "params": [
        "0x99d3f3a83a68b3c3bb923d86387dc91340c53304",
        true
    ],
    "id": 67
}

Example Response

{
    "jsonrpc": "2.0",
    "id": 67,
    "result": {
        "number": "0x1b4",
        "hash": "0x99d3f3a83a68b3c3bb923d86387dc91340c53304",
        "parentHash": "0x99d3f3a83a68b3c3bb923d86387dc91340c53304",
        "nonce": "0x99d3f3a83a68b3c3bb923d86387dc91340c53304",
        "sha3Uncles": "0x99d3f3a83a68b3c3bb923d86387dc91340c53304",
        "logsBloom": "0x99d3f3a83a68b3c3bb923d86387dc91340c53304",
        "transactionsRoot": "0x99d3f3a83a68b3c3bb923d86387dc91340c53304",
        "stateRoot": "0x99d3f3a83a68b3c3bb923d86387dc91340c53304",
        "receiptsRoot": "0x99d3f3a83a68b3c3bb923d86387dc91340c53304",
        "miner": "0x99d3f3a83a68b3c3bb923d86387dc91340c53304",
        "difficulty": "0x99d3f3a83a68b3c3bb923d86387dc91340c53304",
        "totalDifficulty": "0x99d3f3a83a68b3c3bb923d86387dc91340c53304",
        "extraData": "0x99d3f3a83a68b3c3bb923d86387dc91340c53304",
        "size": "0x99d3f3a83a68b3c3bb923d86387dc91340c53304",
        "gasLimit": "0x99d3f3a83a68b3c3bb923d"
      }
}
{
    "jsonrpc": "2.0",
    "id": 67,
    "result": {
        "number": "0x1b4",
        "hash": "0x99d3f3a83a68b3c3bb923d86387dc91340c53304",
        "parentHash": "0x99d3f3a83a68b3c3bb923d86387dc91340c53304",
        "nonce": "0x99d3f3a83a68b3c3bb923d86387dc91340c53304",
        "sha3Uncles": "0x99d3f3a83a68b3c3bb923d86387dc91340c53304",
        "logsBloom": "0x99d3f3a83a68b3c3bb923d86387dc91340c53304",
        "transactionsRoot": "0x99d3f3a83a68b3c3bb923d86387dc91340c53304",
        "stateRoot": "0x99d3f3a83a68b3c3bb923d86387dc91340c53304",
        "receiptsRoot": "0x99d3f3a83a68b3c3bb923d86387dc91340c53304",
        "miner": "0x99d3f3a83a68b3c3bb923d86387dc91340c53304",
        "difficulty": "0x99d3f3a83a68b3c3bb923d86387dc91340c53304",
        "totalDifficulty": "0x99d3f3a83a68b3c3bb923d86387dc91340c53304",
        "extraData": "0x99d3f3a83a68b3c3bb923d86387dc91340c53304",
        "size": "0x99d3f3a83a68b3c3bb923d86387dc91340c53304",
        "gasLimit": "0x99d3f3a83a68b3c3bb923d"
      }
}

getTransactionByBlockHashAndIndex

Returns information about a transaction by block hash and transaction index position.

Parameters

DATA, 32 Bytes - hash of a block.

QUANTITY - integer of the transaction index position.

Returns

Object - A transaction object, or null when no transaction was found:

  • hash: DATA, 32 Bytes - hash of the transaction.

  • nonce: QUANTITY - the number of transactions made by the sender prior to this one.

  • blockHash: DATA, 32 Bytes - hash of the block where this transaction was in. null when its pending.

  • blockNumber: QUANTITY - block number where this transaction was in. null when its pending.

  • transactionIndex: QUANTITY - integer of the transactions index position in the block. null when its pending.

  • from: DATA, 20 Bytes - address of the sender.

  • to: DATA, 20 Bytes - address of the receiver. null when its a contract creation transaction.

  • value: QUANTITY - value transferred in Wei.

  • gasPrice: QUANTITY - gas price provided by the sender in Wei.

  • gas: QUANTITY - gas provided by the sender.

  • input: DATA - the data send along with the transaction.

Example Request

{
    "jsonrpc": "2.0",
    "method": "eth_getTransactionByBlockHashAndIndex",
    "params": [
        "0x99d3f3a83a68b3c3bb923d86387dc91340c53304",
        "0x0"
    ],
    "id": 67
}

Example Response

{
    "jsonrpc": "2.0",
    "id": 67,
    "result": {
        "hash": "0x99d3f3a83a68b3c3bb923d86387dc91340c53304",
        "nonce": "0x0",
        "blockHash": "0x99d3f3a83a68b3c3bb923d86387dc91340c53304",
        "blockNumber": "0x0",
        "transactionIndex": "0x0",
        "from": "0x99d3f3a83a68b3c3bb923d86387dc91340c53304",
        "to": "0x99d3f3a83a68b3c3bb923d86387dc91340c53304",
        "value": "0x0",
        "gasPrice": "0x0",
        "gas": "0x0",
        "input": "0x0"
    }
}

getTransactionByHash

Returns the information about a transaction requested by transaction hash.

Parameters

DATA, 32 Bytes - hash of a transaction

Returns

Object - A transaction object, or null when no transaction was found:

  • hash: DATA, 32 Bytes - hash of the transaction.

  • nonce: QUANTITY - the number of transactions made by the sender prior to this one.

  • blockHash: DATA, 32 Bytes - hash of the block where this transaction was in. null when its pending.

  • blockNumber: QUANTITY - block number where this transaction was in. null when its pending.

  • transactionIndex: QUANTITY - integer of the transactions index position in the block. null when its pending.

  • from: DATA, 20 Bytes - address of the sender.

  • to: DATA, 20 Bytes - address of the receiver. null when its a contract creation transaction.

  • value: QUANTITY - value transferred in Wei.

  • gasPrice: QUANTITY - gas price provided by the sender in Wei.

  • gas: QUANTITY - gas provided by the sender.

  • input: DATA - the data send along with the transaction.

Example Request

{
    "jsonrpc": "2.0",
    "method": "eth_getTransactionByHash",
    "params": [
        "0x99d3f3a83a68b3c3bb923d86387dc91340c53304"
    ],
    "id": 67
}

Example Response

{
    "jsonrpc": "2.0",
    "id": 67,
    "result": {
        "hash": "0x99d3f3a83a68b3c3bb923d86387dc91340c53304",
        "nonce": "0x0",
        "blockHash": "0x99d3f3a83a68b3c3bb923d86387dc91340c53304",
        "blockNumber": "0x0",
        "transactionIndex": "0x0",
        "from": "0x99d3f3a83a68b3c3bb923d86387dc91340c53304",
        "to": "0x99d3f3a83a68b3c3bb923d86387dc91340c53304",
        "value": "0x0",
        "gasPrice": "0x0",
        "gas": "0x0",
        "input": "0x0"
    }
}

getTransactionByBlockNumberAndIndex

Returns information about a transaction by block number and transaction index position.

Parameters

QUANTITY|TAG - integer of a block number, or the string "latest" or "pending".

QUANTITY - integer of the transaction index position.

Returns

Object - A transaction object, or null when no transaction was found:

  • hash: DATA, 32 Bytes - hash of the transaction.

  • nonce: QUANTITY - the number of transactions made by the sender prior to this one.

  • blockHash: DATA, 32 Bytes - hash of the block where this transaction was in. null when its pending.

  • blockNumber: QUANTITY - block number where this transaction was in. null when its pending.

  • transactionIndex: QUANTITY - integer of the transactions index position in the block. null when its pending.

  • from: DATA, 20 Bytes - address of the sender.

  • to: DATA, 20 Bytes - address of the receiver. null when its a contract creation transaction.

  • value: QUANTITY - value transferred in Wei.

  • gasPrice: QUANTITY - gas price provided by the sender in Wei.

  • gas: QUANTITY - gas provided by the sender.

  • input: DATA - the data send along with the transaction.

Example Request

{
    "jsonrpc": "2.0",
    "method": "eth_getTransactionByBlockNumberAndIndex",
    "params": [
        "0x0",
        "0x0"
    ],
    "id": 67
}

Example Response

{
    "jsonrpc": "2.0",
    "id": 67,
    "result": {
        "hash": "0x99d3f3a83a68b3c3bb923d86387dc91340c53304",
        "nonce": "0x0",
        "blockHash": "0x99d3f3a83a68b3c3bb923d86387dc91340c53304",
        "blockNumber": "0x0",
        "transactionIndex": "0x0",
        "from": "0x99d3f3a83a68b3c3bb923d86387dc91340c53304",
        "to": "0x99d3f3a83a68b3c3bb923d86387dc91340c53304",
        "value": "0x0",
        "gasPrice": "0x0",
        "gas": "0x0",
        "input": "0x0"
    }
}

getTransactionReceipt

Returns the receipt of a transaction by transaction hash.

Parameters

DATA, 32 Bytes - hash of a transaction.

Returns

Object - A transaction receipt object, or null when no receipt was found:

  • transactionHash: DATA, 32 Bytes - hash of the transaction.

  • transactionIndex: QUANTITY - integer of the transactions index position in the block.

  • blockHash: DATA, 32 Bytes - hash of the block where this transaction was in.

  • blockNumber: QUANTITY - block number where this transaction was in.

  • from: DATA, 20 Bytes - address of the sender.

  • to: DATA, 20 Bytes - address of the receiver. null when its a contract creation transaction.

  • cumulativeGasUsed: QUANTITY - The total amount of gas used when this transaction was executed in the block.

  • gasUsed: QUANTITY - The amount of gas used by this specific transaction alone.

  • contractAddress: DATA, 20 Bytes - The contract address created, if the transaction was a contract creation, otherwise null.

  • logs: Array - Array of log objects, which this transaction generated.

  • logsBloom: DATA, 256 Bytes - Bloom filter for light clients to quickly retrieve related logs.

Example Request

{
    "jsonrpc": "2.0",
    "method": "eth_getTransactionReceipt",
    "params": [
        "0x99d3f3a83a68b3c3bb923d86387dc91340c53304"
    ],
    "id": 67
}

Example Response

{
    "jsonrpc": "2.0",
    "id": 67,
    "result": {
        "transactionHash": "0x99d3f3a83a68b3c3bb923d86387dc91340c53304",
        "transactionIndex": "0x0",
        "blockHash": "0x99d3f3a83a68b3c3bb923d86387dc91340c53304",
        "blockNumber": "0x0",
        "from": "0x99d3f3a83a68b3c3bb923d86387dc91340c53304",
        "to": "0x99d3f3a83a68b3c3bb923d86387dc91340c53304",
        "cumulativeGasUsed": "0x0",
        "gasUsed": "0x0",
        "contractAddress": "0x99d3f3a83a68b3c3bb923d86387dc91340c53304",
        "logs": [],
        "logsBloom": "0x0"
    }
}

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 "earliest" or "latest".

    • toBlock: QUANTITY|TAG - (optional, default: "latest") Integer block number, or "earliest" or "latest".

    • 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) With the addition of EIP-234, blockHash is 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.

    • limit: QUANTITY - (optional) An integer representing the maximum number of logs to return.

Returns

Array - Array of log objects, or an empty array if no logs were found.

Example Request

{
    "jsonrpc": "2.0",
    "method": "eth_getLogs",
    "params": [
        {
            "fromBlock": "0x1",
            "toBlock": "0x2",
            "address": "0x99d3f3a83a68b3c3bb923d86387dc91340c53304",
            "topics": [