Registration API

request_registration_task

Request connected node to register account.

Example

This query return data needed for calculating pow algorithm.
1
{
2
"id": 1,
3
"method": "call",
4
"params": [
5
REGISTRATION_API_ID,
6
"request_registration_task",
7
[
8
]
9
]
10
}
Copied!

Response

Option
Description
block_id_type block_id
gives a block_id for sha256 calculating
uint64_t rand_num
gives a salt for sha256 calculating
uint16_t difficulty
gives a pow complexity
1
{
2
"id": 1,
3
"jsonrpc": "2.0",
4
"result":
5
{
6
"block_id": "00000a82ec7bc3735ae45a3e5d75dc06c740b04d",
7
"rand_num": "3323422951117619593",
8
"difficulty": 20
9
}
10
}
Copied!

submit_registration_solution callback name active echorand_key evm_address nonce rand_num

Submit PoW task solution to register account.
You need to calcualte hash = sha256(block_id.to_bytes() + rand_num.to_bytes() + nonce.to_bytes()) untill you get first difficulty bits of hash equal to 0. Only nonce should be changed. After you get suitable nonce you can form a request. difficulty, block_id and rand_num is taken from request_registration_task response.

Parameters

Option
Description
variant_callback_t callback
gives a notification whenever transaction for registation account broadcasted
string name
name of account
public_key_t active
active ed25519 key
public_key_t echorand_key
ed25519 key for echorand
optinal<eth_address_t> evm_address
evm address that will be assosiated with account. could be specified as null
uint64_t nonce
used for verification of pow algorithm
uint64_t rand_num
used as salt for sha256 and id for request_registration_task query

Example

1
{
2
"id": 1,
3
"method": "call",
4
"params": [
5
REGISTRATION_API_ID,
6
"submit_registration_solution",
7
[
8
CALLBACK_ID,
9
"account_name",
10
"ECHODvHDsAfk2M8LhYcxLZTbrNJRWT3UH5zxdaWimWc6uZkH",
11
"ECHODvHDsAfk2M8LhYcxLZTbrNJRWT3UH5zxdaWimWc6uZkH",
12
"517CF26a16127c4A58072FB7C24D1140F1b63A67"
13
NONCE,
14
RAND_NUM
15
]
16
]
17
}
Copied!

Response example

true means that client sends correct nonce. If result is false it means nonce or rand_num is incorrect or time for calculating is expired.
1
{
2
"id":0,
3
"jsonrpc":"2.0",
4
"result":true
5
}
Copied!

Notice example

1
{
2
"method": "notice",
3
"params": [
4
CALLBACK_ID,
5
[
6
{
7
"block_num": 1248363,
8
"tx_id": "8b5172b6c95db447ee4b1ca4cd076651189442dd",
9
"registered_account_id": "1.2.17"
10
}
11
]
12
]
13
}
Copied!

get_registrar

Get the registrar account.

Example

1
{
2
"id": 1,
3
"method": "call",
4
"params": [
5
REGISTRATION_API_ID,
6
"get_registrar",
7
[
8
]
9
]
10
}
Copied!

Response example

Account ID of the registrant.
1
{
2
"id": 4,
3
"jsonrpc": "2.0",
4
"result": "1.2.15"
5
}
Copied!
Last modified 1yr ago