RPC API
CHAIN
get_info
return the object includes each detail info of blockchain.
1 | POST http://127.0.0.1:8870/v1/chain/get_info |
Example:
1 | curl --request POST \ |
Results:
1 | { |
get_code
Returns an object containing the smart contract WASM code.
1 | POST http://127.0.0.1:8870/v1/chain/get_code |
Example:
1 | curl --request POST \ |
params | type | description | |
---|---|---|---|
account_name | string | Provide an account name | REQUIRED |
code_as_wasm | integer | 1 | REQUIRED |
Results:
1 | { |
get_block
Returns an object containing various details about a specific block on the blockchain.
1 | POST http://127.0.0.1:8870/v1/chain/get_block |
Example:
1 | curl --request POST \ |
params | type | description | |
---|---|---|---|
block_num_or_id | string | Provide a block number or a block id |
REQUIRED |
Results:
1 | { |
get_block_header_state
Retrieves the glock header state.
1 | POST http://127.0.0.1:8870/v1/chain/get_block_header_state |
Example:
1 | curl --request POST \ |
params | type | description | |
---|---|---|---|
block_num_or_id | string | Provide a block number or a block id |
REQUIRED |
Results: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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157{
"block_num": 533611,
"dpos_proposed_irreversible_blocknum": 533588,
"dpos_irreversible_blocknum": 533564,
"active_schedule": {
"version": 3,
"producers": [
{
"producer_name": "dmcdevbppa11",
"authority": [
0,
{
"threshold": 1,
"keys": [
{
"key": "DM5o7ccNUPgdTdiJvT3ytQ87AkiMmwhLb2VwM9JijFpxn877EyEk",
"weight": 1
}
]
}
]
},
{
"producer_name": "dmcdevbppa12",
"authority": [
0,
{
"threshold": 1,
"keys": [
{
"key": "DM5o7ccNUPgdTdiJvT3ytQ87AkiMmwhLb2VwM9JijFpxn877EyEk",
"weight": 1
}
]
}
]
},
{
"producer_name": "speakfool123",
"authority": [
0,
{
"threshold": 1,
"keys": [
{
"key": "DM6iTKfTV3LmLMcoBAXvfsYnAnHnbztnEDdoswivCvgyHnvTLEmK",
"weight": 1
}
]
}
]
}
]
},
"blockroot_merkle": {
"_active_nodes": [
"10beb144529bf08cdc975bc6a23bbe0269e26cef17d8762b5ec8c8214fef6a2c",
"32402d6b019bb100bdb2e919853282e73cee3f9eba5975142994ee1b438aaf10",
"2d3488d432360c3066eaf295e33af8c749ff0951182c3dc40477e4e2ced1ef90",
"f7e2e5fc90558c82b17f5cbb5e7dc59379a6d0f7f5095600474eadcaf8484165",
"49f4ab6c9245a8f0ac690e28845beee6ca64701817a61b8a4429477f93a81077",
"32e13b99ff6c55522206bc5b22910daf8c1e94c121af45be62c9f05f0dd9cf2a",
"174baa3f5b18dfa06468de5525b1f78b038a9c4b8137a6afbb07fad18684b73d",
"50f9c5a5169167a7c48a51972678af645fae2e151b8a9eaec8903be5d6e98952"
],
"_node_count": 533610
},
"producer_to_last_produced": [
[
"dmcdevbppa11",
533611
],
[
"dmcdevbppa12",
533588
],
[
"speakfool123",
533600
]
],
"producer_to_last_implied_irb": [
[
"dmcdevbppa11",
533588
],
[
"dmcdevbppa12",
533564
],
[
"speakfool123",
533576
]
],
"valid_block_signing_authority": [
0,
{
"threshold": 1,
"keys": [
{
"key": "DM5o7ccNUPgdTdiJvT3ytQ87AkiMmwhLb2VwM9JijFpxn877EyEk",
"weight": 1
}
]
}
],
"confirm_count": [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
],
"id": "0008246bca35e3fb110fa13a1fc7c3dfb138c50a02a25f2ed845d20902fd22b0",
"header": {
"timestamp": "2023-06-15T08:08:47.000",
"producer": "dmcdevbppa11",
"confirmed": 0,
"previous": "0008246ab505eb679bde02dc93a45a871b479fa55fa61353dc968c2c100ec3a1",
"transaction_mroot": "0000000000000000000000000000000000000000000000000000000000000000",
"action_mroot": "9eb45feeba91070f9a1d9b130175b37fd6075f7eeeea816fd5f544caf600391a",
"schedule_version": 3,
"header_extensions": [],
"producer_signature": "SIG_K1_K8W1Dw7xcVL2TfCSAWpdz1yXgNuRkMEdCyg4SG1D1hFgBMtzmJqDmAdVzB1n4FhyQZM6S2sLnYRiudY4L6rHGvHhULf6A2"
},
"pending_schedule": {
"schedule_lib_num": 765,
"schedule_hash": "de34ff1b7b649601eb74a34c02ba0cff6f6c670c743432ff6e33f4a510a98b5a",
"schedule": {
"version": 3,
"producers": []
}
},
"activated_protocol_features": {
"protocol_features": []
},
"additional_signatures": []
}
get_block_info
Similar to get_block
but returns a fixed-size smaller subset of the block data.
1 | POST http://127.0.0.1:8870/v1/chain/get_block_info |
Example:
1 | curl --request POST \ |
params | type | description | |
---|---|---|---|
block_num | integer | Provide a block num | REQUIRED |
Results:
1 | { |
get_account
Returns an object containing various details about a specific account on the blockchain.
1 | POST http://127.0.0.1:8870/v1/chain/get_account |
Example:
1 | curl --request POST \ |
params | type | description | |
---|---|---|---|
account_name | string | Provide an account name | REQUIRED |
Results:
1 | { |
get_abi
Retrieves the ABI for a contract based on its account name.
1 | POST http://127.0.0.1:8870/v1/chain/get_abi |
Example:
1 | curl --request POST \ |
params | type | description | |
---|---|---|---|
account_name | string | name of account to retrieve ABI for | REQUIRED |
Results:
1 | { |
get_raw_abi
Returns an object containing the smart contract abi.
1 | POST http://127.0.0.1:8870/v1/chain/get_raw_abi |
Example:
1 | curl --request POST \ |
params | type | description | |
---|---|---|---|
account_name | string | Account name to get code and abi for | REQUIRED |
Results:
1 | { |
get_raw_code_and_abi
Retrieves raw code and ABI for a contract based on account name.
1 | POST http://127.0.0.1:8870/v1/chain/get_raw_code_and_abi |
Example:
1 | curl --request POST \ |
params | type | description | |
---|---|---|---|
account_name | string | Account name to get code and abi for | REQUIRED |
Results:
1 | { |
get_table_rows
Returns an object containing rows from the specified table.
1 | POST http://127.0.0.1:8870/v1/chain/get_table_rows |
Example:
1 | curl --request POST \ |
params | type | description | |
---|---|---|---|
scope | string | Provide the account name | REQUIRED |
code | string | Provide the smart contract name | REQUIRED |
table | string | Provide the table name | REQUIRED |
index_position | string | Provide the index position | / |
key_type | string | Provide the type of key | / |
encode_type | string | Provide the type of ecoding | / |
lower_bound | int32 | Provide the lower bound | / |
upper_bound | int32 | Provide the upper bound | / |
limit | int32 | Provide the limit | / |
reverse | boolean | Provide true or false to reverse the result | / |
show_payer | boolean | Provide true or false to show the payer of RAM | / |
Results:
1 | { |
get_table_by_scope
Retrieves table scope.
1 | POST http://127.0.0.1:8870/v1/chain/get_table_by_scope |
Example:
1 | curl --request POST \ |
params | type | description | |
---|---|---|---|
code | string | Provide the contract name | REQUIRED |
table | string | Provide the table name | / |
lower_bound | string | Provide the lower bound | / |
upper_bound | string | Provide the upper bound | / |
limit | integer | limit number | / |
reverse | boolean | true or false | / |
show_payer | boolean | true or false | / |
Results:
1 | { |
abi_json_to_bin
Returns an object containing the serialized action data.
1 | POST http://127.0.0.1:8870/v1/chain/abi_json_to_bin |
Example:
1 | curl --request POST \ |
params | type | description | |
---|---|---|---|
code | string | Provide the account name | / |
action | string | Provide the action arguments | / |
args | json | Provide the json arguments | / |
Results:
1 | { |
abi_bin_to_json
Returns an object containing the deserialized action data.
1 | POST http://127.0.0.1:8870/v1/chain/abi_bin_to_json |
Example:
1 | curl --request POST \ |
params | type | description | |
---|---|---|---|
code | string | Provide the smart contract account name | REQUIRED |
action | string | Provide the action name | REQUIRED |
binargs | string | Provide the binary arguments | REQUIRED |
Results:
1 | { |
get_producers
Retrieves producers list.
1 | POST http://127.0.0.1:8870/v1/chain/get_producers |
Example:
1 | curl --request POST \ |
params | type | description | |
---|---|---|---|
limit | string | total number of producers to retrieve | REQUIRED |
lower_bound | string | REQUIRED | |
json | boolean | return result in JSON format? | / |
Results
1 | { |
get_activated_protocol_features
Retreives the activated protocol features for producer node.
1 | POST http://127.0.0.1:8870/v1/chain/get_activated_protocol_features |
Example:
1 | curl --request POST \ |
params | type | description | |
---|---|---|---|
params | object | Defines the filters to retreive the protocol features by | REQUIRED |
Results:
1 | { |
get_accounts_by_authorizers
Given a set of account names and public keys, find all account permission authorities that are, in part or whole, satisfiable.
1 | POST http://127.0.0.1:8870/v1/chain/get_accounts_by_authorizers |
Example:
1 | curl --request POST \ |
params | type | description | |
---|---|---|---|
accounts | list | List of authorizing accounts and/or actor/permissions | REQUIRED |
keys | list | List of authorizing keys | REQUIRED |
push_transaction
This method expects a transaction in JSON format and will attempt to apply it to the blockchain.
1 | POST http://127.0.0.1:8870/v1/chain/push_transaction |
Example:
1 | curl --request POST \ |
params | type | description | |
---|---|---|---|
signatures | array of strings | array of signatures required to authorize transaction | / |
compression | boolean | compression used, usually false | / |
packed_context_free_data | string | json to hex | / |
packed_trx | string | json to hex | / |
Results:
1 | { |
Example
Note
The values of ref_block_num
and ref_block_prefix
are obtained from the last_irreversible_block
field in the result of the /v1/chain/get_block
API call. You can find the last_irreversible_block
by making a request to /v1/chain/get_info
. Additionally, you need to use /v1/wallet/sign_transaction
to obtain the correct signature.
send_transaction
This method expects a transaction in JSON format and will attempt to apply it to the blockchain.
1 | POST http://127.0.0.1:8870/v1/chain/send_transaction |
Example:
1 | curl --request POST \ |
params | type | description | |
---|---|---|---|
body | json | Provide the authorizations for the transaction | REQUIRED |
Results:
1 | { |
push_transactions
This method expects a transaction in JSON format and will attempt to apply it to the blockchain.
1 | POST http://127.0.0.1:8870/v1/chain/push_transaction |
Example:
1 | curl --request POST \ |
params | type | description | |
---|---|---|---|
body | json | Provide the authorizations for the transaction | REQUIRED |
Results:
1 | { |
Example
Note
The values of ref_block_num
and ref_block_prefix
are obtained from the last_irreversible_block
field in the result of the /v1/chain/get_block
API call. You can find the last_irreversible_block
by making a request to /v1/chain/get_info
. Additionally, you need to use /v1/wallet/sign_transaction
to obtain the correct signature.
TRACE
Note: It is required to enable the trace-api plugin.
get_block
Returns a block trace object containing retired actions and related metadata.
1 | POST http://127.0.0.1:8801/v1/trace_api/get_block |
Example:
1 | curl --request POST \ |
params | type | |
---|---|---|
block_num | integer | REQUIRED |
Results:
1 | { |
NET
Note: It is required to enable the net_api plugin.
connections
Returns an array of all peer connection statuses.
1 | POST http://127.0.0.1:8870/v1/net/connections |
Example:
1 | curl --request POST \ |
PRODUCER
Note: It is required to enable the prodcuer_api plugin.
get_runtime_options
Retreives run time options for producer node.
1 | POST http://127.0.0.1:8870/v1/producer/get_runtime_options |
Example:
1 | curl --request POST \ |
create_snapshot
Creates a snapshot for producer node.
1 | POST http://127.0.0.1:8870/v1/producer/create_snapshot |
Example:
1 | curl --request POST \ |
params | type | |
---|---|---|
head_block_id | string | / |
head_block_num | integer | / |
head_block_time | string | / |
version | integer | / |
snapshot_name | string | / |
get_integrity_hash
Retreives the integrity hash for producer node.
1 | POST http://127.0.0.1:8870/v1/producer/get_integrity_hash |
Example:
1 | curl --request POST \ |
get_supported_protocol_features
Retreives supported protocol features for producer node.
1 | POST http://127.0.0.1:8870/v1/producer/get_supported_protocol_features |
Example:
1 | curl --request POST \ |
params | type | description | |
---|---|---|---|
exclude_disabled | boolean | Exclude disabled protocol features | / |
exclude_unactivatable | boolean | Exclude unactivatable protocol features | / |