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.
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
Example Response
sha3
Returns Keccak-256 (not the standardized SHA3-256) of the given data.
Parameters
DATA
- the data to convert into a SHA3 hash
Returns
DATA
- The SHA3 result of the given string.
Example Request
Example Response
net
The net module provides network information.
netVersion
Returns the current network id.
Parameters
None
Returns
String
- The current client version
Example Request
Example Response
netListening
Returns true if client is actively listening for network connections.
Parameters
None
Returns
Boolean
- true when listening, otherwise false.
Example Request
Example Response
peerCount
Returns number of peers currently connected to the client.
Parameters
None
Returns
QUANTITY
- integer of the number of connected peers.
Example Request
Example Response
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
Example Response
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
Example Response
coinbase
Returns the client coinbase address.
Parameters
None
Returns
DATA
, 20 Bytes - the current coinbase address.
Example Request
Example Response
gasPrice
Returns the current price per gas in wei.
Parameters
None
Returns
QUANTITY
- integer of the current gas price in wei.
Example Request
Example Response
blockNumber
Returns the number of most recent block.
Parameters
None
Returns
QUANTITY
- integer of the current block number the client is on.
Example Request
Example Response
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
Example Response
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
Example Response
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
Example Response
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
Example Response
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
Example Response
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
Example Response
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
Example Response
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
Example Response
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
Example Response
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
Example Response
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
Example Response
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
Example Response
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
Example Response
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
Example Response
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, otherwisenull
.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
Example Response
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 BytesDATA
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
Example Response
txpool
Returns information about the transaction pool.
content
Returns the content of the transaction pool.
Parameters
None
Returns
Object
- An array of pending transactions.
Example Request
Example Response
debug
Returns debug information about transaction execution.
traceTransaction
Attempts to run the transaction in the exact same manner as it was executed on the network. It will replay any transaction that may have been executed prior to this one before it and will then attempt to execute the transaction that corresponds to the given hash.
Parameters
hash
:DATA
, 32 Bytes - Hash of a transaction.options
:Object
- (optional) Options object with the following possible properties:disableMemory
:Boolean
- (optional) If true it returns the full memory of theVM
instead of just the code with the following opcodes:PUSH
,DUP
,SWAP
,CREATE
,CALL
,CALLCODE
,RETURN
,DELEGATECALL
,STATICCALL
,REVERT
,INVALID
,SELFDESTRUCT
.disableStack
:Boolean
- (optional) If true it returns the full stack of theVM
instead of just the first 4 values.disableStorage
:Boolean
- (optional) If true it returns the full storage of theVM
instead of just the storage that changed.tracer
:String
- (optional) If specified, it will return the structured logs created by the specified tracer.timeout
:String
- (optional) If specified, it will abort the trace after the specified number of nanoseconds.
Returns
Object
- The result of the trace.
Example Request
Example Response
Last updated