Home Node RPC API
Post
Cancel

RPC API

Getting Started

You can access the SASEUL node with HTTP or HTTPS and use RPC in the GET or POST method.

In case of GET method, provide request parameters in query string.

  • URL: {host}/{RPC_API_NAME}?{request parameters}

In case of POST method, provide request parameters in form-data with key-value format.

  • URL: {host}/{RPC_API_NAME}
  • Body: {request parameters}


Basic Operation

Ping

  • URL: {host}/ping

Check that the SASEUL node is active.

Return Value

1
2
3
4
{
    "code": 200,
    "data": []
}


Info

  • URL: {host}/info

Get the SASEUL node’s process status and the latest main and resource block information.

Return Value

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

{
  "code": 200,
  "data": {
    "chain_maker_policy": true,
    "resource_miner_policy": true,
    "peer_searcher_policy": true,
    "collector_policy": true,
    "mining": false,
    "last_block": {
      ...
    },
    "last_resource_block": {
      ...
    }
  }
}


Tracker Operation

Peer

  • URL: {host}/peer

Get the list of nodes on the network that are associated with the SASEUL node.

Request Parameters

Parameter Requirements Type Maxlength Description
register optional Boolean(int)   Determines whether to send a request to the target node to register itself.
host optional String   If the ‘register’ variable is true, enter the host variable to register.
authentication optional Boolean(int)   Requests the network information of the target node.
height optional Int   If the ‘authentication’ variable is true, add the verification block number to be registered.

Return value

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
{
    "code": 200,
    "data": {
        "peers": {
            ...
        },
        "known_hosts": [
            ...
        ],
        "node": {
            ...
        }
    },
    "register": true,
    "registerResult": true,
    "authentication": true
}


Round Operation

Round

  • URL: {host}/round

Get information of a specific block height.

Request Parameters

Parameter Requirements Type Maxlength Description
chain_type optional String   main
height optional int   height of recent block

Return value

1
2
3
4
5
6
7
8
9
10
{
    "code": 200,
    "data": {
        "block": {
            ...
        },
    "sync_limit": 40362,
    "timestamp": 1656048496844843
    }
}


Broadcast

  • URL: {host}/broadcast

Get consensus information of the current round.

Request Parameters

Parameter Requirements Type Maxlength Description
chain_type optional String   main
round_key optional String   block_hash(latest)

Return value

1
2
3
4
5
6
7
8
9
10
11
12
13
14
{
    "code": 200,
    "data": {
        "transactions": {
            ...
        },
        "chunks": {
            ...
        },
        "hypotheses": {
            ...
        }
    }
}


Smart Contracts and Requests

Request

  • Execute the method of a smart contract based on data stored in the current node, and display the information

Request Parameters

Parameter Requirements Type Maxlength Description
request mandatory String   {“type”:”", ...}
public_key optional String   ””
signature optional String   ””

Example

1
curl -X POST main.saseul.net/request --data 'request={"type":"GetBalance","address":"<address>"}'


RawRequest

  • Execute the method of a smart contract based on data stored in the current node, and display the information
  • Execute a registered reqeust code with raw data.

Request Parameter

Parameter Requirements Type Maxlength Description
body mandatory Object   {“request”:{“type”:”", ...}, "public_key":...}

Example

1
curl -X POST main.saseul.net/rawrequest --data '{"request":{"type":"GetBalance","address":"<address>"}}'


SendTransaction

  • Execute the method of the smart contract to create a transaction and broadcast it.

Request Parameters

Parameter Requirements Type Maxlength Description
transaction mandatory String   {“type”:”", ...}
public_key optional String   ””
signature optional String   ””

Example

1
2
curl -X POST main.saseul.net/sendtransaction --data \
'transaction={"type":"Send","to":"<address>","amount":"<amount>"}&public_key=<public_key>&signature=<signature>'


SendRawTransaction

  • Execute the method of the smart contract to create a transaction and broadcast it.
  • Execute a registered contract code with raw data.

Request Parameters

Parameter Requirements Type Maxlength Description
body mandatory String   {“transaction”:{“type”:”", ...}, "public_key":...}

Example

1
2
curl -X POST main.saseul.net/sendrawtransaction --data \
'{"transaction":{"type":"Send","to":"<address>","amount":"<amount>"},"public_key":"<public_key>","signature":"<signature>"}'
This post is licensed under CC BY 4.0 by the author.