Seele Doc
Search…
json-rpc NV <= 1.2.7
( node version <= v1.2.7 )
JSON is a lightweight data exchange format. It can represent numbers, strings, ordered value sequences and key-value pairs.
JSON-RPC is a stateless, lightweight Remote Procedure Call (RPC) protocol. It defines several data structures and the relevant rules to handle them. JSON-RPC is transmission-agnostic, because it can be used in situations like process, socket, HTTP, or different message transmission environments. It uses JSON(RFC 4627) as the data format.

Curl Examples Explained

The curl options below might return a response where the node complains about the content type, this is because the --data option sets the content type to application/x-www-form-urlencoded .

JSON-RPC Support

Type
Supported?
JSON-RPC 1.0
JSON-RPC 2.0
Batch Requests
HTTP
WS

JSON-RPC Port

Default port:
Client
Type
Address
Go
jsonrpc-2.0
Go
websocket

JSON-RPC List

Currently, there are several RPCs with different namespaces:
  • seele:node data manipulation and procurement / acquisition
  • txpool:transaction pool management
  • download:RPC collection provided for internal inquiry of blockchain node synchronization state.
  • network:connection management
  • miner:miner manipulation
  • debug:node debugging
  • monitor:node monitor

JSON-RPC Contents

Command
Full
Light
public
private
GetInfo
AddTx
GetBlock
Call
GetLogs
Command
Full
Light
public
private
Command
Full
Light
public
private
GetStatus
Command
Full
Light
public
private
Command
Full
Light
public
private
Start
Stop
Status
Command
Full
Light
public
private
DumpHeap
GetTPS
Command
Full
Light
public
private
NodeInfo
NodeStats

seele

RPC collection provided for public for blockchain node and transaction manipulation.

GetInfo

This method returns the node information.
Type
Template
RPC
{"jsonrpc":"2.0","method":"seele_getInfo","params":[],"id":2}
Parameters
none
Returns
  • Coinbase:string - node address
  • CurrentBlockHeight:uint64 - current block height
  • HeaderHash:string - block hash
  • MinerStatus:string - miner status
  • Shard:int - shard number
Example
  • Request
    curl -H "Content-Type: application/json" -X POST --data '{"jsonrpc":"2.0","method":"seele_getInfo","params":[],"id":1}' localhost:8037
  • Result
    {
    "jsonrpc": "2.0",
    "id": 1,
    "result": {
    "Coinbase": "0x4c10f2cd2159bb432094e3be7e17904c2b4aeb21",
    "CurrentBlockHeight": 1722,
    "HeaderHash": "0x000001fa4cb11751fea2d4f7f9356303d44d2a02f37c3e62e657ffe29e5cb5fe",
    "Shard": 1,
    "MinerStatus": "Running"
    }
    }

GetBalance

This method returns the account balance give the account address.
Type
Template
RPC
{"jsonrpc":"2.0","method":"seele_getBalance","params":[string,string ,uint64],"id":1}
Parameters
  • Account:string - account
  • hexHash:string - hex form of a block hash, set to "" for the latest balance
  • height :uint64 - height of a block, set to -1 for the latest balance
    Returns
  • Account:string - account
  • Balance:big.Int - account balance
Example
  • Request
    curl -H "Content-Type: application/json" -X POST --data '{"jsonrpc":"2.0","method":"seele_getBalance","params":["0x4c10f2cd2159bb432094e3be7e17904c2b4aeb21","",-1],"id":1}' localhost:8037
  • Result
    {
    "jsonrpc": "2.0",
    "id": 1,
    "result": {
    "Account": "0x4c10f2cd2159bb432094e3be7e17904c2b4aeb21",
    "Balance": 265499990000
    }
    }

AddTx

This method submits a transaction to the node.
Type
Template
RPC
{"jsonrpc":"2.0","method":"seele_addTx","params":[types.Transaction],"id":1}
Parameters
  • tx:types.Transaction - transaction struct (client command sign could be used to get transaction hash and signature)
    • Hash:string - transaction hash
    • Data:json - transaction data
      • From:string - transaction sender
      • To:string - transaction receiver
      • Amount:uint64 - amount value, unit is fan
      • Fee:uint64 - transaction fee
      • Payload:string - transaction payload
      • AccountNonce:uint64 - transaction nonce
    • Signature : crypto.Signature - transaction signature struct
      type Signature struct {
      Sig []byte // [R || S || V] format signature in 65 bytes.
      }
Returns
  • result:bool - transaction send result
Example
  • Request
    curl -H "Content-Type: application/json" -X POST --data '{"jsonrpc":"2.0","method":"seele_addTx","params":[{"Hash": "0x3393e5566cb905d714599f2f888ecc6d223b83403887460fa5b2771e89a0436e","Data": {"From": "0x3b691130ec4166bfc9ec7240217fc8d08903cf21","To":"0x2a87b6504cd00af95a83b9887112016a2a991cf1","Amount": 1,"AccountNonce":0,"Fee": 0,"GasPrice":10, "GasLimit":21000},"Signature":{"Sig":"fAvgVTXDyJZbfv07NYBK4aSolfY4ycBPQRwnQFpHRMc7ooOZw27U50o4TBoRelYX3QCRyvKpbxVlxhu7AnSB6QE="}}],"id":1}' localhost:8037
  • Result
    {
    "jsonrpc": "2.0",
    "id": 1,
    "result": true
    }

GetAccountNonce

This method is used to obtain the account nonce.
Type
Template
RPC
{"jsonrpc":"2.0","method":"seele_getAccountNonce","params":[string,string ,uint64],"id":1}
Parameters
  • account:string - account
  • hexHash:string - hex form of a block hash, set to "" for the latest nonce
  • height :uint64 - height of a block, set to -1 for the latest nonce
    Returns
  • result:uint64 - account nonce
Example
  • Request
    curl -H "Content-Type: application/json" -X POST --data '{"jsonrpc":"2.0","method":"seele_getAccountNonce","params":["0x4c10f2cd2159bb432094e3be7e17904c2b4aeb21","",-1],"id":1}' localhost:8037
  • Result
    {
    "jsonrpc": "2.0",
    "id": 1,
    "result": 3
    }

GetBlockHeight

This method is used to obtain the height of the blockchain.
Type
Template
RPC
{"jsonrpc":"2.0","method":"seele_getBlockHeight","params":[string],"id":1}
Parameters
none
Returns
  • result:uint64 - block height
Example
  • Request
    curl -H "Content-Type: application/json" -X POST --data '{"jsonrpc":"2.0","method":"seele_getBlockHeight","params":[],"id":1}' localhost:8037
  • Result
    {
    "jsonrpc": "2.0",
    "id": 1,
    "result": 1928
    }

GetBlock

This method is used to obtain the block content based on block height or block hash.
Type
Template
RPC
{"jsonrpc":"2.0","method":"seele_getBlock","params":[string,string,bool],"id":1}
Parameters
  • hash:string - block hash
  • height:string - block height
  • fulltx, f:bool - whether to include detailed transaction information
Returns
  • debts:array - debts in block
    • Hash:string - debts hash
    • Data:json - debts data
    • TxHash:string - txhash in debt
    • Shard:int - shard number of seele node where debts on
    • Account:array - debt account
    • Amount:int64 - debt amount
    • Fee:int64 - debt fee
    • Code:string - debt code
  • hash:string - block hash
  • header:json - block header
    • PreviousBlockHash:string - previous block hash
    • Creator:string - creator address
    • TxHash:string - tx hash
    • ReceiptHash:string - Receipts hash
    • stateHash:string - state tree hash
    • TxDebtHash:string - debts hash
    • DebtHash:string - debts hash
    • Difficulty:big.Int - block difficulty
    • Height:unit64 - block height
    • CreateTimestamp:uint64 - create timestamp
    • Witness:string - block nonce
    • Consensus:int - consensus algorithm
    • ExtraData:string - extra data
  • totalDifficulty:big.Int - total difficulty
  • transactions:array - transaction array
    • accountNonce:unit64 - account nonce
    • amount:Int - transaction amount
    • from:string - transaction provider
    • gasLimit:Int - transaction gas limit
    • gasPrice:Int - transaction gas price
    • hash:string - transaction hash
    • payload:array - transaction payload
    • to:string - transaction receiver
  • txDebts:array - transaction debts
    • Hash:string - txDebts hash
    • Data:json - txDebts data
      • TxHash:string - transaction hash
      • From:string - transaction sender
      • Nonce:unit64 - sender nonce
      • Account:string - transaction account
      • Amount:int - transaction amount
      • Price:int - transaction gas price
      • Code:string - transaction code
Example
  • Request
    curl -H "Content-Type: application/json" -X POST --data '{"jsonrpc":"2.0","method":"seele_getBlock","params":["",19018,true],"id":1}' localhost:8037
  • Result
    {
    "jsonrpc": "2.0",
    "id": 1,
    "result": {
    "debts": [],
    "hash": "0x000002f75910694bf33a9a2f3e0cab454ac4b14ff9d32aee7b59efc20260f00c",
    "header": {
    "PreviousBlockHash": "0x000005f39610211ad1e888940a0e6affb538ea2397f73e08f1f894537997118c",
    "Creator": "0x4c10f2cd2159bb432094e3be7e17904c2b4aeb21",
    "StateHash": "0xde119fb11c8c74b34a71ce376589a1711af5acef99aaf36827fbaafaeb9fe617",
    "TxHash": "0xa5dea280e6e880af7547ffea5c54526b0a3fae9dcd977a0a5a00e14852eb08ce",
    "ReceiptHash": "0xd6efdf2db85d6a5ab3fdc14925f67b9c97fb7ebdb733e5b2bb5776c694bc9073",
    "TxDebtHash": "0x8fde2b990967a9e51cb5218acc3318faea7a50429760cef37867b12c62f30b78",
    "DebtHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "Difficulty": 2258387,
    "Height": 19018,
    "CreateTimestamp": 1548821456,
    "Witness": "MTI4ODU5Njk2MTcyODI5NzQ3MzM=",
    "Consensus": 0,
    "ExtraData": ""
    },
    "totalDifficulty": 52970343102,
    "transactions": [
    {
    "accountNonce": 0,
    "amount": 1200000000,
    "from": "0x0000000000000000000000000000000000000000",
    "gasLimit": 0,
    "gasPrice": 0,
    "hash": "0x0071c67a94f3619d9c7acb6fd40750956df24beb5dfaa5372e87a83bc06e219c",
    "payload": "",
    "to": "0x4c10f2cd2159bb432094e3be7e17904c2b4aeb21"
    },
    {
    "accountNonce": 100,
    "amount": 88,
    "from": "0x3b691130ec4166bfc9ec7240217fc8d08903cf21",
    "gasLimit": 63000,
    "gasPrice": 10,
    "hash": "0xf7288fbc1ab3bea992dd5f311644f220b1accf8011f59df4778ca526843d1f68",
    "payload": "",
    "to": "0x007d1b1ea335e8e4a74c0be781d828dc7db934b1"
    }
    ],
    "txDebts": [
    {
    "Hash": "0xa0089462915e0a1b99ce3d75f6b51cdd5caf9a52691f327c9a27d222e0e38d57",
    "Data": {
    "TxHash": "0xf7288fbc1ab3bea992dd5f311644f220b1accf8011f59df4778ca526843d1f68",
    "From": "0x3b691130ec4166bfc9ec7240217fc8d08903cf21",
    "Nonce": 100,
    "Account": "0x007d1b1ea335e8e4a74c0be781d828dc7db934b1",
    "Amount": 88,
    "Price": 10,
    "Code": ""
    }
    }
    ]
    }
    }

GetBlockByHash

This method is used to obtain the block content based on block hash.
Type
Template
RPC
{"jsonrpc":"2.0","method":"seele_getBlockByHash","params":[string,bool],"id":1}
Parameters
  • hash:string - block hash
  • fulltx, f:bool - whether to include detailed transaction information
Returns
  • debts:array - debts in block
    • Hash:string - debts hash
    • Data:json - debts data
    • TxHash:string - txhash in debt
    • Shard:int - shard number of seele node where debts on
    • Account:array - debt account
    • Amount:int64 - debt amount
    • Fee:int64 - debt fee
    • Code:string - debt code
  • hash:string - block hash
  • header:json - block header
    • PreviousBlockHash:string - previous block hash
    • Creator:string - creator address
    • TxHash:string - tx hash
    • ReceiptHash:string - Receipts hash
    • stateHash:string - state tree hash
    • TxDebtHash:string - debts hash
    • DebtHash:string - debts hash
    • Difficulty:big.Int - block difficulty
    • Height:unit64 - block height
    • CreateTimestamp:uint64 - create timestamp
    • Witness:string - block nonce
    • Consensus:int - consensus algorithm
    • ExtraData:string - extra data
  • totalDifficulty:big.Int - total difficulty
  • transactions:array - transaction array
    • accountNonce:unit64 - account nonce
    • amount:Int - transaction amount
    • from:string - transaction provider
    • gasLimit:Int - transaction gas limit
    • gasPrice:Int - transaction gas price
    • hash:string - transaction hash
    • payload:array - transaction payload
    • to:string - transaction receiver
  • txDebts:array - transaction debts
    • Hash:string - txDebts hash
    • Data:json - txDebts data
      • TxHash:string - transaction hash
      • From:string - transaction sender
      • Nonce:unit64 - sender nonce
      • Account:string - transaction account
      • Amount:int - transaction amount
      • Price:int - transaction gas price
      • Code:string - transaction code
Example
  • Request
    curl -H "Content-Type: application/json" -X POST --data '{"jsonrpc":"2.0","method":"seele_getBlockByHash","params":["0x000002f75910694bf33a9a2f3e0cab454ac4b14ff9d32aee7b59efc20260f00c",true],"id":1}' localhost:8037
  • Result
    {
    "jsonrpc": "2.0",
    "id": 1,
    "result": {
    "debts": [],
    "hash": "0x000002f75910694bf33a9a2f3e0cab454ac4b14ff9d32aee7b59efc20260f00c",
    "header": {
    "PreviousBlockHash": "0x000005f39610211ad1e888940a0e6affb538ea2397f73e08f1f894537997118c",
    "Creator": "0x4c10f2cd2159bb432094e3be7e17904c2b4aeb21",
    "StateHash": "0xde119fb11c8c74b34a71ce376589a1711af5acef99aaf36827fbaafaeb9fe617",
    "TxHash": "0xa5dea280e6e880af7547ffea5c54526b0a3fae9dcd977a0a5a00e14852eb08ce",
    "ReceiptHash": "0xd6efdf2db85d6a5ab3fdc14925f67b9c97fb7ebdb733e5b2bb5776c694bc9073",
    "TxDebtHash": "0x8fde2b990967a9e51cb5218acc3318faea7a50429760cef37867b12c62f30b78",
    "DebtHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "Difficulty": 2258387,
    "Height": 19018,
    "CreateTimestamp": 1548821456,
    "Witness": "MTI4ODU5Njk2MTcyODI5NzQ3MzM=",
    "Consensus": 0,
    "ExtraData": ""
    },
    "totalDifficulty": 52970343102,
    "transactions": [
    {
    "accountNonce": 0,
    "amount": 1200000000,
    "from": "0x0000000000000000000000000000000000000000",
    "gasLimit": 0,
    "gasPrice": 0,
    "hash": "0x0071c67a94f3619d9c7acb6fd40750956df24beb5dfaa5372e87a83bc06e219c",
    "payload": "",
    "to": "0x4c10f2cd2159bb432094e3be7e17904c2b4aeb21"
    },
    {
    "accountNonce": 100,
    "amount": 88,
    "from": "0x3b691130ec4166bfc9ec7240217fc8d08903cf21",
    "gasLimit": 63000,
    "gasPrice": 10,
    "hash": "0xf7288fbc1ab3bea992dd5f311644f220b1accf8011f59df4778ca526843d1f68",
    "payload": "",
    "to": "0x007d1b1ea335e8e4a74c0be781d828dc7db934b1"
    }
    ],
    "txDebts": [
    {
    "Hash": "0xa0089462915e0a1b99ce3d75f6b51cdd5caf9a52691f327c9a27d222e0e38d57",
    "Data": {
    "TxHash": "0xf7288fbc1ab3bea992dd5f311644f220b1accf8011f59df4778ca526843d1f68",
    "From": "0x3b691130ec4166bfc9ec7240217fc8d08903cf21",
    "Nonce": 100,
    "Account": "0x007d1b1ea335e8e4a74c0be781d828dc7db934b1",
    "Amount": 88,
    "Price": 10,
    "Code": ""
    }
    }
    ]
    }
    }

GetBlockByHeight

This method is used to obtain the block content based on block height.
Type
Template
RPC
{"jsonrpc":"2.0","method":"seele_getBlockByHeight","params":[string,bool],"id":1}
Parameters
  • height:string - block height
  • fulltx, f:bool - whether to include detailed transaction information
Returns
  • debts:array - debts in block
    • Hash:string - debts hash
    • Data:json - debts data
    • TxHash:string - txhash in debt
    • Shard:int - shard number of seele node where debts on
    • Account:array - debt account
    • Amount:int64 - debt amount
    • Fee:int64 - debt fee
    • Code:string - debt code
  • hash:string - block hash
  • header:json - block header
    • PreviousBlockHash:string - previous block hash
    • Creator:string - creator address
    • TxHash:string - tx hash
    • ReceiptHash:string - Receipts hash
    • stateHash:string - state tree hash
    • TxDebtHash:string - debts hash
    • DebtHash:string - debts hash
    • Difficulty:big.Int - block difficulty
    • Height:unit64 - block height
    • CreateTimestamp:uint64 - create timestamp
    • Witness:string - block nonce
    • Consensus:int - consensus algorithm
    • ExtraData:string - extra data
  • totalDifficulty:big.Int - total difficulty
  • transactions:array - transaction array
    • accountNonce:unit64 - account nonce
    • amount:Int - transaction amount
    • from:string - transaction provider
    • gasLimit:Int - transaction gas limit
    • gasPrice:Int - transaction gas price
    • hash:string - transaction hash
    • payload:array - transaction payload
    • to:string - transaction receiver
  • txDebts:array - transaction debts
    • Hash:string - txDebts hash
    • Data:json - txDebts data
      • TxHash:string - transaction hash
      • From