Links

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
JSON
cURL
{
"jsonrpc": "2.0",
"method": "web3_clientVersion",
"params": [],
"id": 1
}
curl --location 'https://replicator-01.pegasus.lightlink.io/rpc/v1' \
--header 'Content-Type: application/json' \
--data '{
"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. 1.
    DATA - the data to convert into a SHA3 hash
params: [
"0x68656c6c6f20776f726c64"
]

Returns

DATA - The SHA3 result of the given string.
Example Request
JSON
cURL
{
"jsonrpc": "2.0",
"method": "web3_sha3",
"params": [
"0x68656c6c6f20776f726c64"
],
"id": 64
}
curl --location 'https://replicator-01.pegasus.lightlink.io/rpc/v1' \
--header 'Content-Type: application/json' \
--data '{
"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
JSON
cURL
{
"jsonrpc": "2.0",
"method": "net_version",
"params": [],
"id": 67
}
curl --location 'https://replicator-01.pegasus.lightlink.io/rpc/v1' \
--header 'Content-Type: application/json' \
--data '{
"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
JSON
cURL
{
"jsonrpc": "2.0",
"method": "net_listening",
"params": [],
"id": 67
}
curl --location 'https://replicator-01.pegasus.lightlink.io/rpc/v1' \
--header 'Content-Type: application/json' \
--data '{
"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
JSON
cURL
{
"jsonrpc": "2.0",
"method": "net_peerCount",
"params": [],
"id": 74
}
curl --location 'https://replicator-01.pegasus.lightlink.io/rpc/v1' \
--header 'Content-Type: application/json' \
--data '{
"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
JSON
cURL
{
"jsonrpc": "2.0",
"method": "eth_protocolVersion",
"params": [],
"id": 67
}
curl --location 'https://replicator-01.pegasus.lightlink.io/rpc/v1' \
--header 'Content-Type: application/json' \
--data '{
"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
JSON
cURL
{
"jsonrpc": "2.0",
"method": "eth_syncing",
"params": [],
"id": 67
}
curl --location 'https://replicator-01.pegasus.lightlink.io/rpc/v1' \
--header 'Content-Type: application/json' \
--data '{
"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
JSON
cURL
{
"jsonrpc": "2.0",
"method": "eth_coinbase",
"params": [],
"id": 67
}
curl --location 'https://replicator-01.pegasus.lightlink.io/rpc/v1' \
--header 'Content-Type: application/json' \
--data '{
"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
JSON
cURL
{
"jsonrpc": "2.0",
"method": "eth_gasPrice",
"params": [],
"id": 67
}
curl --location 'https://replicator-01.pegasus.lightlink.io/rpc/v1' \
--header 'Content-Type: application/json' \
--data '{
"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
JSON
cURL
{
"jsonrpc": "2.0",
"method": "eth_blockNumber",
"params": [],
"id": 67
}
curl --location 'https://replicator-01.pegasus.lightlink.io/rpc/v1' \
--header 'Content-Type: application/json' \
--data '{
"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
JSON
cURL
{
"jsonrpc": "2.0",
"method": "eth_getBalance",
"params": [
"0x99d3f3a83a68b3c3bb923d86387dc91340c53304",
"latest"
],
"id": 67
}
curl --location 'https://replicator-01.pegasus.lightlink.io/rpc/v1' \
--header 'Content-Type: application/json' \
--data '{
"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
JSON
cURL
{
"jsonrpc": "2.0",
"method": "eth_getStorageAt",
"params": [
"0x99d3f3a83a68b3c3bb923d86387dc91340c53304",
"0x0",
"latest"
],
"id": 67
}
curl --location 'https://replicator-01.pegasus.lightlink.io/rpc/v1' \
--header 'Content-Type: application/json' \
--data '{
"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
JSON
cURL
{
"jsonrpc": "2.0",
"method": "eth_getTransactionCount",
"params": [
"0x99d3f3a83a68b3c3bb923d86387dc91340c53304",
"latest"
],
"id": 67
}
curl --location 'https://replicator-01.pegasus.lightlink.io/rpc/v1' \
--header 'Content-Type: application/json' \
--data '{
"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
JSON
cURL
{
"jsonrpc": "2.0",
"method": "eth_getBlockTransactionCountByHash",
"params": [
"0x99d3f3a83a68b3c3bb923d86387dc91340c53304"
],
"id": 67
}
curl --location 'https://replicator-01.pegasus.lightlink.io/rpc/v1' \
--header 'Content-Type: application/json' \
--data '{
"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
JSON
cURL
{
"jsonrpc": "2.0",
"method": "eth_getBlockTransactionCountByNumber",
"params": [
"latest"
],
"id": 67
}
curl --location 'https://replicator-01.pegasus.lightlink.io/rpc/v1' \
--header 'Content-Type: application/json' \
--data '{
"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
JSON
cURL
{
"jsonrpc": "2.0",
"method": "eth_getCode",
"params": [
"0x99d3f3a83a68b3c3bb923d86387dc91340c53304",
"latest"
],
"id": 67
}
curl --location 'https://replicator-01.pegasus.lightlink.io/rpc/v1' \
--header 'Content-Type: application/json' \
--data '{
"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
JSON
cURL
{
"jsonrpc": "2.0",
"method": "eth_sendRawTransaction",
"params": [
"0xf86c808504a817c80082520894e7f1725e7734ce288f8367e1bb143e866665d794880de0"
],
"id": 67
}
curl --location 'https://replicator-01.pegasus.lightlink.io/rpc/v1' \
--header 'Content-Type: application/json' \
--data '{
"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
JSON
cURL
{
"jsonrpc": "2.0",
"method": "eth_call",
"params": [
{
"from": "0x99d3f3a83a68b3c3bb923d86387dc91340c53304",
"to": "0x99d3f3a83a68b3c3bb923d86387dc91340c53304",
"gas": "0x76c0",
"gasPrice": "0x9184e72a000",
"value": "0x9184e72a",
"data": "0x7f74657374"
},
"latest"
],
"id": 67
}
curl --location 'https://replicator-01.pegasus.lightlink.io/rpc/v1' \
--header 'Content-Type: application/json' \
--data '{
"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