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 node’s status, version, mining state, and latest block information.

Return Value

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
{
  "code": 200,
  "data": {
    "status": "is_running",
    "version": "2.2.0.3",
    "mining": false,
    "last_block": {
      "height": 3410254,
      "s_timestamp": 1773050473000000,
      "previous_blockhash": "064c947b1358...",
      "blockhash": "064c947b9cac...",
      "transaction_count": 1
    },
    "last_resource_block": {
      "height": 2036292,
      "blockhash": "064c9478eb77...",
      "previous_blockhash": "064c94722363...",
      "nonce": "08e5b4126a3f...",
      "timestamp": 1773050427832196,
      "difficulty": "720140924964913",
      "main_height": 3410247,
      "main_blockhash": "064c9471e57d...",
      "validator": "b910526bb3a8...",
      "miner": "bd4f109b6a96...",
      "receipt_count": 0
    }
  }
}
FieldDescription
statusNode process status (e.g. is_running).
versionSASEUL version string.
miningWhether mining is active.
last_blockLatest main chain block.
last_resource_blockLatest resource chain block.


Tracker Operation

Peer

  • URL: {host}/peer

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

Request Parameters

ParameterRequirementsTypeMaxlengthDescription
registeroptionalBoolean(int) Determines whether to send a request to the target node to register itself.
hostoptionalString If the ‘register’ variable is true, enter the host variable to register.
authenticationoptionalBoolean(int) Requests the network information of the target node.
heightoptionalInt 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

ParameterRequirementsTypeMaxlengthDescription
chain_typeoptionalString main
heightoptionalint 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
    }
}


Smart Contracts and Requests

Request

  • URL: {host}/request

Execute a smart contract read method using data stored in the local node.

Request Parameters

ParameterRequiredTypeDescription
requestYesStringJSON-encoded method call: {"type":"<method_name>", ...}
public_keyNoStringPublic key for signed requests.
signatureNoStringSignature for signed requests.

Example

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


RawRequest

  • URL: {host}/rawrequest

Same as request, but accepts a single JSON body instead of form-data parameters.

Request Parameters

ParameterRequiredTypeDescription
bodyYesObject{"request":{"type":"<method_name>", ...}, "public_key":"...", "signature":"..."}

Example

1
2
3
curl -X POST main.saseul.net/rawrequest \
  -H 'Content-Type: application/json' \
  --data '{"request":{"type":"GetBalance","address":"<address>"}}'


SendTransaction

  • URL: {host}/sendtransaction

Execute a smart contract method to create and broadcast a transaction.

Request Parameters

ParameterRequiredTypeDescription
transactionYesStringJSON-encoded method call: {"type":"<method_name>", ...}
public_keyYesStringPublic key of the signer.
signatureYesStringSignature of the transaction.

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

  • URL: {host}/sendrawtransaction

Same as sendtransaction, but accepts a single JSON body instead of form-data parameters.

Request Parameters

ParameterRequiredTypeDescription
bodyYesObject{"transaction":{"type":"<method_name>", ...}, "public_key":"...", "signature":"..."}

Example

1
2
3
curl -X POST main.saseul.net/sendrawtransaction \
  -H 'Content-Type: application/json' \
  --data '{"transaction":{"type":"Send","to":"<address>","amount":"<amount>"},"public_key":"<public_key>","signature":"<signature>"}'


Weight

  • URL: {host}/weight

Calculate the fee weight of a transaction before broadcasting. Use this to estimate the transaction cost in advance.

Request Parameters

Same parameters as SendTransaction or SendRawTransaction.


Data Inspection

Inspect

  • URL: {host}/inspect

Query contract status data directly by status key. This allows low-level access to on-chain state values.

Request Parameters

ParameterRequiredTypeDescription
typeYesStringStatus type: universal or local.
keyYesStringStatus key to look up.

Example

1
2
curl -X POST main.saseul.net/inspect \
  --data 'type=universal&key=<status_key>'

How to compute a status key

A status key is derived from the contract code. For example, if a contract reads a universal status like this:

1
let total_supply = op.read_universal('total_supply', SASEUL.Enc.ZERO_ADDRESS, '0');

You can compute the corresponding status key using SASEUL JS:

1
2
3
4
5
let zero_address = SASEUL.Enc.ZERO_ADDRESS;
let system_nonce = '<nonce from ini file>';
let space = SASEUL.Enc.hash(system_nonce);
let key = 'total_supply';
let status_key = SASEUL.Enc.hash(zero_address + space + key) + zero_address;

The key format is: hash(writer + space + attr) + id, where writer is the contract deployer address, space is the hashed contract nonce (the nonce value is defined in the contract’s ini file), attr is the status field name, and id is the target address.

This post is licensed under CC BY 4.0 by the author.