Sidechain API

Sidechain

get_account_deposits(account, type)

Returns all deposits, for the given account id.

Parameters

Option
Description
account_id_type account
the id of the account to provide information about
string type
the type of the deposits may be "", "eth" or "btc"

Example

1
{
2
"id": 4,
3
"method": "call",
4
"params": [
5
DATABASE_API_ID,
6
"get_account_deposits",
7
[
8
"1.2.21",
9
""
10
]
11
]
12
}
Copied!

Returns

The all public deposits data stored in the blockchain.
1
{
2
"id": 4,
3
"jsonrpc": "2.0",
4
"result": [
5
{
6
"id": "1.15.0",
7
"deposit_id": 0,
8
"account": "1.2.21",
9
"value": 1000,
10
"is_approved": true,
11
"is_sent": false,
12
"echo_block_number": 1654,
13
"approves": [],
14
"extensions": []
15
},
16
{
17
"id": "1.22.0",
18
"account": "1.2.21",
19
"intermediate_deposit_id": "1.21.0",
20
"tx_info": {
21
"block_number": 156,
22
"out": {
23
"tx_id": "dcab5ff32590b8385ef89d1b4c07f08260b3be921f56e78dbd11685cca0be1ff",
24
"index": 0,
25
"amount": 1000
26
}
27
},
28
"block_number": 1654,
29
"is_approved": true,
30
"approves": [],
31
"extensions": []
32
}
33
]
34
}
Copied!

get_account_withdrawals(account, type)

Returns all withdrawals, for the given account id.

Parameters

Option
Description
account_id_type account
the id of the account to provide information about
string type
the type of the withdrawals may be "", "eth" or "btc"

Example

1
{
2
"id": 4,
3
"method": "call",
4
"params": [
5
DATABASE_API_ID,
6
"get_account_withdrawals",
7
[
8
"1.2.21",
9
""
10
]
11
]
12
}
Copied!

get_account_stake_objects(account, type)

Returns all stake objects, for the given account id.

Parameters

Option
Description
account_id_type account
the id of the account to provide information about
string type
the type of the withdrawals may be "", "eth" or "btc"

Example

1
{
2
"id": 4,
3
"method": "call",
4
"params": [
5
DATABASE_API_ID,
6
"get_account_stake_objects",
7
[
8
"1.2.21",
9
""
10
]
11
]
12
}
Copied!

Returns

The all public withdrawals data stored in the blockchain.
1
{
2
"id": 4,
3
"jsonrpc": "2.0",
4
"result": [
5
{
6
"id": "1.16.0",
7
"withdraw_id": 0,
8
"account": "1.2.21",
9
"eth_addr": "1AFeEcE88325110488570146f2635C8615Ad0613",
10
"value": 1000,
11
"is_approved": true,
12
"is_sent": false,
13
"echo_block_number": 1654,
14
"approves": [],
15
"extensions": []
16
},
17
{
18
"id": "1.23.0",
19
"account": "1.2.21",
20
"btc_addr": "mxhWhgx46cqvpHYzTMuGL9eir59V7vqM9c",
21
"value": 12,
22
"block_number": 561,
23
"is_approved": true,
24
"approves": [],
25
"extensions": []
26
}
27
]
28
}
Copied!

Sidechain Bitcoin

get_btc_address(account)

Returns information about generated bitcoin address, if exist, for the given account id.

Parameters

Option
Description
std::string account
the account name or id to provide information about

Example

1
{
2
"id": 4,
3
"method": "call",
4
"params": [
5
DATABASE_API_ID,
6
"get_btc_address",
7
[
8
"nathan"
9
]
10
]
11
}
Copied!

Returns

The public bitcoin address data stored in the blockchain
1
{
2
"id": 4,
3
"jsonrpc": "2.0",
4
"result": {
5
"id": "1.19.0",
6
"account": "1.2.26",
7
"deposit_address": {
8
"address": "2N7zdBmx9RBMk2Lb6xt6S18Wc4xteE8zPst"
9
},
10
"committee_member_ids_in_script": [[
11
"1.2.6",
12
"024c1705f188828553da9cc3a0983b11c447a00009f84582b642fd0efd210bf197"
13
],[
14
"1.2.7",
15
"026e89f955990a7d6773535fade4b15ea86313d6057b89d36460301f61e1873923"
16
],[
17
"1.2.8",
18
"038360571d18a4eada8353278494a2336ed824be36ae690885aca8edfaa0df8cef"
19
],[
20
"1.2.9",
21
"02fdf1ca88a271753ce2001fa58fe26c86183ead98e479f5d813fa73a0cb56a1b3"
22
],[
23
"1.2.10",
24
"03e621a92197013f899b73b500280b8fb7b9de614767bc5d2e40eef7516475d98a"
25
]
26
],
27
"is_relevant": true,
28
"backup_address": "n4cLNDfyVPGoNFUpUEyBP8TzDPRNaVBm6E",
29
"extensions": []
30
}
31
}
Copied!

get_btc_deposit_script(address)

Returns bitcoin script for generated bitcoin address, if exist, for the given address id.

Parameters

Option
Description
btc_address_id_type address
the id of the bitcoin address to provide script

Example

1
{
2
"id": 4,
3
"method": "call",
4
"params": [
5
DATABASE_API_ID,
6
"get_btc_deposit_script",
7
[
8
"1.19.21"
9
]
10
]
11
}
Copied!

Returns

The bitcoin script for deposit for generated bitcoin address
1
{
2
"id": 4,
3
"jsonrpc": "2.0",
4
"result": "03e621a92197013f899b73b500280b8fb7b9de614767bc5d2e40eef7516475d98a"
5
}
6
}
Copied!

get_btc_sidechain_fees()

Returns information about min withdrawal value and withdrawal fee used in bitcoin sidechain

Example

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

Returns

Pair of uints where the first element is min withdrawal value and the second is the withdrawal fee in satoshis
1
{
2
"id": 4,
3
"jsonrpc": "2.0",
4
"result": [
5
0,
6
0
7
]
8
}
Copied!

get_btc_stake_address(account)

Returns information about generated bitcoin stake address, if exist, for the given account id.

Parameters

Option
Description
std::string account
the account name or id to provide information about

Example

1
{
2
"id": 4,
3
"method": "call",
4
"params": [
5
DATABASE_API_ID,
6
"get_btc_stake_address",
7
[
8
"nathan"
9
]
10
]
11
}
Copied!

Returns

The public bitcoin address data stored in the blockchain
1
{
2
"id": "1.26.0",
3
"account": "1.2.26",
4
"stake_script": "76a9146334edf1175678f7905763e6b24361ab998aa23288ac52755675",
5
"p2sh_address": "2N92ShU1GRnkMwMtqN86WVUEw5NwjXrJYHC",
6
"extensions": []
7
}
Copied!

Sidechain Ethereum

get_eth_address(account)

Returns information about generated ethereum address, if exist and approved, for the given account id.

Parameters

Option
Description
account_id_type account
the id of the account to provide information about

Example

1
{
2
"id": 4,
3
"method": "call",
4
"params": [
5
DATABASE_API_ID,
6
"get_eth_address",
7
[
8
"1.2.21"
9
]
10
]
11
}
Copied!

Returns

The public ethereum address data stored in the blockchain
1
{
2
"id": 4,
3
"jsonrpc": "2.0",
4
"result": {
5
"id": "1.14.0",
6
"account": "1.2.21",
7
"eth_addr": "1134464B537884EE89cb298eEd674C9B14BCce47",
8
"is_approved": true,
9
"approves": [],
10
"extensions": []
11
}
12
}
Copied!

get_eth_sidechain_fees()

Returns information about min withdrawal value and withdrawal fee used in ethereum sidechain

Example

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

Returns

Pair of uints where the first element is min withdrawal value and the second is the withdrawal fee in Wei
1
{
2
"id": 4,
3
"jsonrpc": "2.0",
4
"result": [
5
0,
6
0
7
]
8
}
Copied!

Sidechain ERC20

get_erc20_token(eth_addr_or_id)

Returns information about erc20 token, if exist.

Parameters

Option
Description
string eth_addr_or_id
the ethereum address of token in Ethereum network or the id in ECHO

Example

1
{
2
"id": 4,
3
"method": "call",
4
"params": [
5
DATABASE_API_ID,
6
"get_erc20_token",
7
[
8
"8B5D021C528Cb0ADb9dA277D109c039dEdFd6871"
9
]
10
]
11
}
12
13
{
14
"id": 4,
15
"method": "call",
16
"params": [
17
DATABASE_API_ID,
18
"get_erc20_token",
19
[
20
"1.16.156"
21
]
22
]
23
}
Copied!

Returns

The public erc20 token data stored in the blockchain.
1
{
2
"id": 4,
3
"jsonrpc": "2.0",
4
"result": {
5
"id": "1.17.0",
6
"owner": "1.2.0",
7
"eth_addr": "8B5D021C528Cb0ADb9dA277D109c039dEdFd6871",
8
"contract": "1.11.0",
9
"name": "erc20",
10
"symbol": "ERC",
11
"decimals": 0
12
}
13
}
Copied!

check_erc20_token(id)

Return true if the contract exists and is ERC20 token contract registered by register_erc20_contract operation.

Parameters

Option
Description
contract_id_type id
ID of the contract to get erc20 token

Example

1
{
2
"id": 4,
3
"method": "call",
4
"params": [
5
DATABASE_API_ID,
6
"check_erc20_token",
7
[
8
"1.11.0"
9
]
10
]
11
}
Copied!

Returns

true if the contract exists and is ERC20 token contract registered by register_erc20_contract operation, else false.
1
{
2
"id": 4,
3
"jsonrpc": "2.0",
4
"result": true
5
}
Copied!

get_erc20_account_deposits(account)

Returns all deposits, for the given account id.

Parameters

Option
Description
account_id_type account
the id of the account to provide information about

Example

1
{
2
"id": 4,
3
"method": "call",
4
"params": [
5
DATABASE_API_ID,
6
"get_erc20_account_deposits",
7
[
8
"1.2.0"
9
]
10
]
11
}
Copied!

Returns

The all public erc20 deposits data stored in the blockchain.
1
{
2
"id": 4,
3
"jsonrpc": "2.0",
4
"result": [
5
{
6
"id": "1.18.0",
7
"account": "1.2.0",
8
"erc20_addr": "8B5D021C528Cb0ADb9dA277D109c039dEdFd6871",
9
"value": "1",
10
"transaction_hash": "9742f2d928365be7591107b0d8afa701f24104acd8d5ecc32516dfab410f9c4e",
11
"is_approved": true,
12
"is_sent": false,
13
"echo_block_number": 1654,
14
"approves": []
15
}
16
]
17
}
Copied!

get_erc20_account_withdrawals(account)

Returns all approved withdrawals, for the given account id.

Parameters

Option
Description
account_id_type account
the id of the account to provide information about

Example

1
{
2
"id": 4,
3
"method": "call",
4
"params": [
5
DATABASE_API_ID,
6
"get_erc20_account_withdrawals",
7
[
8
"1.2.0"
9
]
10
]
11
}
Copied!

Returns

The all public erc20 withdrawals data stored in the blockchain.
1
{
2
"id": 4,
3
"jsonrpc": "2.0",
4
"result": [
5
{
6
"id": "1.19.0",
7
"withdraw_id": 0,
8
"account": "1.2.0",
9
"to": "1AFeEcE88325110488570146f2635C8615Ad0613",
10
"erc20_token": "1.17.0",
11
"value": "1",
12
"is_approved": true,
13
"is_sent": false,
14
"echo_block_number": 1654,
15
"approves": []
16
}
17
]
18
}
Copied!
Last modified 10mo ago