-
Notifications
You must be signed in to change notification settings - Fork 363
API Reference
Client | URL |
---|---|
Go | http://localhost:9888 |
curl
example:
// curl -X POST url/method -d data
curl -X POST http://localhost:9888/create-key -d '{"alias": "alice", "password": "123456", "language": "en"}'
// response
{
"status": "success",
"data": {
"alias": "alice",
"xpub": "66008ba54d0fb103e075c0ab403f2ac1527a3b9d23dc16312dede67c85199423f912c4f84c9515e87e14874bd405953abfced87f66926c25ba8c31968094c05b",
"file": "/home/.bytom/keystore/UTC--2018-11-01T06-44-28.250301455Z--6c794d3a-53b3-4c79-92d0-7b0e216667ae",
"mnemonic": "ocean exotic route sad volume grace knock frame pumpkin fetch december capital orange cake copper exercise elephant sound aware shiver silver donate pool interest"
}
}
create-key
list-keys
update-key-alias
delete-key
check-key-password
reset-key-password
create-account
list-accounts
update-account-alias
delete-account
create-account-receiver
list-addresses
validate-address
get-mining-address
set-mining-address
list-pubkeys
create-asset
get-asset
list-assets
update-asset-alias
list-balances
list-unspent-outputs
backup-wallet
restore-wallet
rescan-wallet
recovery-wallet
wallet-info
sign-message
decode-program
get-transaction
list-transactions
build-transaction
build-chain-transactions
sign-transaction
sign-transactions
list-account-votes
submit-transaction
submit-transactions
estimate-transaction-gas
create-access-token
list-access-tokens
delete-access-token
check-access-token
get-unconfirmed-transaction
list-unconfirmed-transactions
decode-raw-transaction
get-block-count
get-block-hash
get-block
get-block-header
net-info
is-mining
set-mining
gas-rate
verify-message
list-peers
disconnect-peer
connect-peer
get-vote-result
create-contract
update-contract-alias
get-contract
list-contracts
chain-status
It is to create private key essentially, returns the information of key. The private key is encrypted in the file and not visible to the user.
Object
:
-
String
- alias, name of the key. -
String
- password, password of the key. -
String
- language, mnemonic language of the key.
Optional:
-
String
- mnemonic, mnemonic of the key, create key by specified mnemonic.
Object
:
-
String
- status, status information -
Object
- data, key information-
String
- alias, name of the key -
String
- xpub, root pubkey of the key -
String
- file, path to the file of key
-
Optional:
-
String
- mnemonic, mnemonic of the key, exist when the request mnemonic is null.
create key by random pattern:
// Request
curl -X POST create-key -d '{"alias": "alice", "password": "123456", "language": "en"}'
// Result
{
"status": "success",
"data": {
"alias": "alice",
"xpub": "6f9d945cd03cce033f4a2a9fd5659d3ddfa58e2d32f8c711baca0de0aae83ff6d67f4f4e53f3ff0b3c11bac2a11123c26c7c32e0478e6cf802ca1109941bb45b",
"file": "/home/yang/.bytom/keystore/UTC--2018-10-10T07-09-17.509894697Z--341695b9-9223-470c-a26d-bea210f8e1bb",
"mnemonic": "price put soldier kitten beef garlic release burden symptom jump purity flower"
}
}
create key by specified mnemonic:
// Request
curl -X POST create-key -d '{"alias":"jack", "password":"123456", "mnemonic":"please observe raw beauty blue sea believe then boat float beyond position", "language":"en"}'
// Result
{
"status": "success",
"data": {
"alias": "jack",
"xpub": "c7bcb65febd31c6d900bc84c386d95c3d5b047090628d9bf5c51a848945b6986e99ff70388018a7681fa37a240dbd8df39a994c86f9314a61e75feb33563ca72",
"file": "/home/yang/.bytom/keystore/UTC--2018-10-10T07-08-51.815030323Z--46ee932e-88d3-4680-a5c1-dd9e63918fcc"
}
}
Returns the list of all available keys.
none
-
String
- status, status information -
Array of Object
, keys owned by the client.-
Object
- data,key information-
String
- alias, name of the key. -
String
- xpub, pubkey of the key. -
String
- file,path to the file of key
-
-
// Request
curl -X POST list-keys
// Result
{
"status": "success",
"data": [
{
"alias": "alice",
"xpub": "6f9d945cd03cce033f4a2a9fd5659d3ddfa58e2d32f8c711baca0de0aae83ff6d67f4f4e53f3ff0b3c11bac2a11123c26c7c32e0478e6cf802ca1109941bb45b",
"file": "/Path/To/Library/Bytom/keystore/UTC--2018-04-21T02-35-15.035935116Z--4f2b8bd7-0576-4b82-8941-6cc6da05efe3"
},
{
"alias": "bob",
"xpub": "c7bcb65febd31c6d900bc84c386d95c3d5b047090628d9bf5c51a848945b6986e99ff70388018a7681fa37a240dbd8df39a994c86f9314a61e75feb33563ca72",
"file": "/Path/To/Library/Bytom/keystore/UTC--2018-04-22T06-30-27.609315219Z--0e34293c-8856-4f5f-b934-37456a3820fa"
}
]
}
Update alias for the existed key.
Object
:
-
String
- xpub, pubkey of the key. -
String
- new_alias, new alias of the key.
-
String
- status, status information
// Request
curl -X POST update-key-alias -d '{"xpub": "a7dae957c2d35b42efe7e6871cf5a75ebd2a0d0e51caffe767db42d3e6d69dbe211d1ca492ecf05908fe6fa625ad61b3253375ea744c9442dd5551613ba50aea", "new_alias": "new_key"}'
// Result
{
"status": "success"
}
Delete existed key, please make sure that there is no balance in the related accounts.
Object
:
-
String
- xpub, pubkey of the key. -
String
- password, password of the key.
-
String
- status, status information
// Request
curl -X POST delete-key -d '{"xpub": "a7dae957c2d35b42efe7e6871cf5a75ebd2a0d0e51caffe767db42d3e6d69dbe211d1ca492ecf05908fe6fa625ad61b3253375ea744c9442dd5551613ba50aea", "password": "123456"}'
// Result
{
"status": "success"
}
Check key password.
Object
:
-
String
- xpub, pubkey of the key. -
String
- password, password of the key.
-
String
- status, status information -
Object
- data-
Boolean
- check_result, result of check key password, true is check successfully, otherwise is false.
-
// Request
curl -X POST check-key-password -d '{"xpub": "a7dae957c2d35b42efe7e6871cf5a75ebd2a0d0e51caffe767db42d3e6d69dbe211d1ca492ecf05908fe6fa625ad61b3253375ea744c9442dd5551613ba50aea", "password": "123456"}'
// Result
{
"status": "success",
"data": {
"check_result": true
}
}
Reset key password.
Object
:
-
String
- xpub, pubkey of the key. -
String
- old_password, old password of the key. -
String
- new_password, new password of the key.
-
String
- status, status information -
Object
- data -
Boolean
- changed, result of reset key password, true is reset successfully, otherwise is false.
// Request
curl -X POST reset-key-password -d '{"xpub": "a7dae957c2d35b42efe7e6871cf5a75ebd2a0d0e51caffe767db42d3e6d69dbe211d1ca492ecf05908fe6fa625ad61b3253375ea744c9442dd5551613ba50aea", "old_password": "123456", "new_password": "654321"}'
// Result
{
"status": "success",
"data": {
"changed": true
}
}
Create account to manage addresses. single sign account contain only one root_xpubs and quorum; however multi sign account contain many number of root_xpubs and quorum, quorum is the number of verify signature, the range is [1, len(root_xpubs)].
Object
:
-
Array of String
- root_xpubs, pubkey array. -
String
- alias, name of the account. -
Integer
- quorum, the default value is1
, threshold of keys that must sign a transaction to spend asset units controlled by the account.
-
String
- status, status information -
Object
-data-
String
- id, account id. -
String
- alias, name of account. -
Integer
- key_index, key index of account. -
Integer
- quorom, threshold of keys that must sign a transaction to spend asset units controlled by the account. -
Array of Object
- xpubs, pubkey array. -
String
- derive_rule, 0- BIP32,1 - BIP44
-
// Request
curl -X POST create-account -d '{"root_xpubs":["2d6c07cb1ff7800b0793e300cd62b6ec5c0943d308799427615be451ef09c0304bee5dd492c6b13aaa854d303dc4f1dcb229f9578786e19c52d860803efa3b9a"],"quorum":1,"alias":"alice"}'
// Result
{
"status": "success",
"data": {
"id": "4b5d460c-7773-4b6e-94ee-4d074df31729",
"alias": "alice",
"xpubs": [
"6f9d945cd03cce033f4a2a9fd5659d3ddfa58e2d32f8c711baca0de0aae83ff6d67f4f4e53f3ff0b3c11bac2a11123c26c7c32e0478e6cf802ca1109941bb45b"
],
"quorum": 1,
"key_index": 1,
"derive_rule": 1
}
}
Returns the list of all available accounts.
Optional:
-
String
- id, account id. -
String
- alias, name of account.
-
String
- status, status information -
Array of Object
, account array.-
Object
, data-
String
- id, account id. -
String
- alias, name of account. -
Integer
- key_index, key index of account. -
Integer
- quorom, threshold of keys that must sign a transaction to spend asset units controlled by the account. -
Array of Object
- xpubs, pubkey array. -
String
- derive_rule, 0- BIP32,1 - BIP44
-
-
list all the available accounts:
// Request
curl -X POST list-accounts -d '{"alias":"alice"}'
// Result
{
"status": "success",
"data": [
{
"id": "4b5d460c-7773-4b6e-94ee-4d074df31729",
"alias": "alice",
"xpubs": [
"6f9d945cd03cce033f4a2a9fd5659d3ddfa58e2d32f8c711baca0de0aae83ff6d67f4f4e53f3ff0b3c11bac2a11123c26c7c32e0478e6cf802ca1109941bb45b"
],
"quorum": 1,
"key_index": 1,
"derive_rule": 1
}
]
}
Update alias for the existed account.
-
String
- new_alias, new alias of account.
optional:
-
String
- account_alias, alias of account. -
String
- account_id, id of account.
-
String
- status, status information
// Request
curl -X POST update-account-alias -d '{"account_id": "65a47ef1-40f3-40a2-82d6-6c40e3e84e6c", "new_alias": "new_account"}'
or
curl -X POST update-account-alias -d '{"account_alias": "alice", "new_alias": "new_account"}'
// Result
{
"status": "success"
}
Delete existed account, please make sure that there is no balance in the related addresses.
optional:
-
String
- account_alias, alias of account. -
String
- account_id, id of account.
-
String
- status, status information
// Request
curl -X POST delete-account -d '{"account_id": "65a47ef1-40f3-40a2-82d6-6c40e3e84e6c"}'
or
curl -X POST delete-account -d '{"account_alias": "alice"}'
// Result
{
"status": "success"
}
create address and control program, the address and control program is are one to one relationship.
optional:
-
String
- account_alias, alias of account. -
String
- account_id, id of account.
-
String
- status, status information -
Object
- data-
String
- address, address of account. -
String
- control_program, control program of account.
-
//Request
curl -X POST create-account-receiver -d '{"account_alias": "alice", "account_id": "65a47ef1-40f3-40a2-82d6-6c40e3e84e6c"}'
// Result
{
"status": "success",
"data": {
"control_program": "00141e36aad4971c019c4602e6fb463bd7d7c7137e66",
"address": "bn1qrcm244yhrsqec3szuma5vw7h6lr3xlnxk6l84h"
}
}
Returns the sub list of all available addresses by account.
-
String
- account_alias, alias of account. -
String
- account_id, id of account.
optional:
-
Integer
- from, the start position of first address -
Integer
- count, the number of returned
-
String
- status, status information -
Array of Object
, account address array.-
Object
:-
String
- account_alias, alias of account. -
String
- account_id, id of account. -
String
- address, address of account. -
String
- control_program, control program of account. -
Boolean
- change, whether the account address is change. -
Int
- key_index, the index of the key generation
-
-
list three addresses from first position by account_id or account_alias:
// Request
curl -X POST list-addresses -d '{"account_alias": "alice", "account_id": "65a47ef1-40f3-40a2-82d6-6c40e3e84e6c", "from": 0, "count": 3}'
// Result
{
"status": "success",
"data": [
{
"account_alias": "alice",
"account_id": "2e91a178-9447-4984-b80b-d4f4b8360ae0",
"address": "bn1qn7nv4pq0z6xavgkwfnsa02mg08l8thjmzn23av",
"control_program": "00149fa6ca840f168dd622ce4ce1d7ab6879fe75de5b",
"change": false,
"key_index": 1
},
{
"account_alias": "alice",
"account_id": "2e91a178-9447-4984-b80b-d4f4b8360ae0",
"address": "bn1q9j0kzs72pxc68jeva44su5mkw3p8eu85n75pxv",
"control_program": "00142c9f6143ca09b1a3cb2ced6b0e537674427cf0f4",
"change": false,
"key_index": 2
},
{
"account_alias": "alice",
"account_id": "2e91a178-9447-4984-b80b-d4f4b8360ae0",
"address": "bn1qrcm244yhrsqec3szuma5vw7h6lr3xlnxk6l84h",
"control_program": "00141e36aad4971c019c4602e6fb463bd7d7c7137e66",
"change": false,
"key_index": 3
}
]
}
Verify the address is valid, and judge the address is own.
-
string
- address, address of account.
-
String
- status, status information -
Object
- data-
Boolean
- valid, whether the account address is valid. -
Boolean
- is_local, whether the account address is local.
-
// Request
curl -X POST validate-address -d '{"address": "bn1q9j0kzs72pxc68jeva44su5mkw3p8eu85n75pxv"}'
// Result
{
"status": "success",
"data": {
"valid": true,
"is_local": true
}
}
Query the current mining address.
none
-
String
- status, status information -
Object
- data-
String
- mining_address, the current mining address being used.
-
// Request
curl -X POST get-mining-address
// Result
{
"status": "success",
"data": {
"mining_address": "tn1qcxwuqjgrsr9chwupqm5upexxtf0hg5n5a488ff"
}
}
Set the current mining address, no matter whethere the address is a local one. It returns an error message if the address format is incorrect.
-
String
- mining_address, mining address to set.
-
String
- status, status information -
Object
- data-
String
- mining_address, the new mining address.
-
// Request
curl -X POST set-mining-address -d '{"mining_address":"bn1qkyfkwgjwa84wfmtfccgp5msuka9hpqhl2afjuj"}'
// Result
{
"status": "success",
"data": {
"mining_address": "bn1qkyfkwgjwa84wfmtfccgp5msuka9hpqhl2afjuj"
}
}
Returns the list of all available pubkeys by account.
optional:
-
String
- account_alias, alias of account. -
String
- account_id, id of account. -
string
- public_key, public key.
-
String
- status, status information -
Object
- data-
String
- root_xpub, root xpub. -
Array of Object
-pubkey_infos, public key array.-
String
- pubkey, public key. -
Object
- derivation_path, derivated path
-
-
// Request
curl -X POST list-pubkeys -d '{"account_id": "65a47ef1-40f3-40a2-82d6-6c40e3e84e6c"}'
// Result
{
"status": "success",
"data": {
"root_xpub": "bec1040aa05d7da3c1fc7deeedaecf74e548d84588804f2bddf8d6cce0367d95bb0c180bb62449eb0e580499ee9955244b606a17664f46be6d23f3a65fe304e6",
"pubkey_infos": [
{
"pubkey": "e14d663c7f02be9cbdaf2f2dc8263aa00c177239866f1be8eb30e041b5a50a99",
"derivation_path": [
"2c000000",
"99000000",
"01000000",
"00000000",
"01000000"
]
},
{
"pubkey": "07edc2df1f8af18dd0f0254f35a57ee870ae9dce121e02b31edd10e6cbaec8f1",
"derivation_path": [
"2c000000",
"99000000",
"01000000",
"00000000",
"02000000"
]
},
{
"pubkey": "01bdf0d40a9b9c7b38f570360f3147a30362c124551dc9fa9bac9ae6097316e0",
"derivation_path": [
"2c000000",
"99000000",
"01000000",
"00000000",
"03000000"
]
},
{
"pubkey": "65ffffa87b338828119adb6cca0de02869e02f92a088bc82c4be54a083d88271",
"derivation_path": [
"2c000000",
"99000000",
"01000000",
"00000000",
"04000000"
]
}
]
}
}
Create asset definition, it prepares for the issuance of asset.
-
String
- alias, name of the asset. -
Object
- definition, definition of asset.
Optional:(please pick one form the following two ways)
-
Array of String
- root_xpubs, xpub array. -
Integer
- quorum, the default value is1
, threshold of keys that must sign a transaction to spend asset units controlled by the account.
or
-
String
- issuance_program, user-defined contract program.
-
String
- status, status information -
Object
- data-
String
- id, asset id. -
String
- alias, name of the asset. -
String
- issuance_program, control program of the issuance of asset. -
Array of Object
- xpubs, information of asset pubkey. -
String
- definition, definition of asset -
Integer
- quorum, threshold of keys that must sign a transaction to spend asset units controlled by the account. -
String
- type, asset type,asset
,internal
-
Integer
- key_index, asset index -
Integer
- derive_rule, 0- BIP32,1 - BIP44 -
Integer
- vm_version, vm version -
String
- raw_definition_byte, definition hex -
Integer
- limit_height, can not issue asset when high than this height
-
create asset by xpubs:
// Request
curl -X POST create-asset -d '{"alias": "GOLD", "root_xpubs": ["f6a16704f745a168642712060e6c5a69866147e21ec2447ae628f87d756bb68cc9b91405ad0a95f004090e864fde472f62ba97053ea109837bc89d63a64040d5"], "quorum":1}'
// Result
{
"status": "success",
"data": {
"type": "asset",
"xpubs": [
"25bd0d1cefc98661c51dcd0174105775bc1357a76393cf4f85c14c69716e26c02c98550eb9ea10b851e34de6b2814a447b077b57e3ee56fc6d8a29715788e9c7"
],
"quorum": 1,
"key_index": 1,
"derive_rule": 0,
"id": "4de79606de7845a979ebff195ced79a33eca25af55cf7ab06981d33fda7f2f99",
"alias": "GOLD",
"vm_version": 1,
"issue_program": "ae20993984e9b86cea381424a3a1213fcd72cbeb3cddc8f34536ee979a27fe867c7d5151ad",
"raw_definition_byte": "7b7d",
"definition": {},
"limit_height": 0
}
}
create asset by issuance_program:
// Request
curl -X POST create-asset -d '{"alias": "TESTASSET","issuance_program": "20e9108d3ca8049800727f6a3505b3a2710dc579405dde03c250f16d9a7e1e6e78160014c5a5b563c4623018557fb299259542b8739f6bc20163201e074b22ed7ae8470c7ba5d8a7bc95e83431a753a17465e8673af68a82500c22741a547a6413000000007b7b51547ac1631a000000547a547aae7cac00c0", "definition":{"name":"TESTASSET","symbol":"TESTASSET","decimals":8,"description":{}}}'
// Result
{
"status": "success",
"data": {
"type": "",
"xpubs": null,
"quorum": 0,
"key_index": 0,
"derive_rule": 0,
"id": "0e11c2fa26623b3b1580d2b04a9cebb1ed13e04c18929fc1ac8c11ae62b87db5",
"alias": "TESTASSET",
"vm_version": 1,
"issue_program": "20e9108d3ca8049800727f6a3505b3a2710dc579405dde03c250f16d9a7e1e6e78160014c5a5b563c4623018557fb299259542b8739f6bc20163201e074b22ed7ae8470c7ba5d8a7bc95e83431a753a17465e8673af68a82500c22741a547a6413000000007b7b51547ac1631a000000547a547aae7cac00c0",
"raw_definition_byte": "7b0a202022646563696d616c73223a20382c0a2020226465736372697074696f6e223a207b7d2c0a2020226e616d65223a2022544553544153534554222c0a20202273796d626f6c223a2022544553544153534554220a7d",
"definition": {
"decimals": 8,
"description": {},
"name": "TESTASSET",
"symbol": "TESTASSET"
},
"limit_height": 0
}
}
Query detail asset by asset ID.
Object
:
-
String
- id, id of asset.
-
String
- status, status information -
Object
- data-
String
- id, asset id. -
String
- alias, name of the asset. -
String
- issuance_program, control program of the issuance of asset. -
Array of Object
- xpubs, information of asset pubkey. -
String
- definition, definition of asset -
Integer
- quorum, threshold of keys that must sign a transaction to spend asset units controlled by the account. -
String
- type, asset type,asset
,internal
-
Integer
- key_index, asset index -
Integer
- derive_rule, 0- BIP32,1 - BIP44 -
Integer
- vm_version, vm version -
String
- raw_definition_byte, definition hex -
Integer
- limit_height, can not issue asset when high than this height
-
get asset by assetID.
// Request
curl -X POST get-asset -d '{"id": "0e11c2fa26623b3b1580d2b04a9cebb1ed13e04c18929fc1ac8c11ae62b87db5"}'
// Result
{
"status": "success",
"data": {
"type": "",
"xpubs": null,
"quorum": 0,
"key_index": 0,
"derive_rule": 0,
"id": "0e11c2fa26623b3b1580d2b04a9cebb1ed13e04c18929fc1ac8c11ae62b87db5",
"alias": "TESTASSET",
"vm_version": 1,
"issue_program": "20e9108d3ca8049800727f6a3505b3a2710dc579405dde03c250f16d9a7e1e6e78160014c5a5b563c4623018557fb299259542b8739f6bc20163201e074b22ed7ae8470c7ba5d8a7bc95e83431a753a17465e8673af68a82500c22741a547a6413000000007b7b51547ac1631a000000547a547aae7cac00c0",
"raw_definition_byte": "7b0a202022646563696d616c73223a20382c0a2020226465736372697074696f6e223a207b7d2c0a2020226e616d65223a2022544553544153534554222c0a20202273796d626f6c223a2022544553544153534554220a7d",
"definition": {
"decimals": 8,
"description": {},
"name": "TESTASSET",
"symbol": "TESTASSET"
},
"limit_height": 0
}
}
Returns the list of all available assets.
none
-
Array of Object
, asset array.-
Object
:-
String
- id, asset id. -
String
- alias, name of the asset. -
String
- issuance_program, control program of the issuance of asset. -
Integer
- key_index, index of key for xpub. -
Integer
- quorum, threshold of keys that must sign a transaction to spend asset units controlled by the account. -
Array of Object
- xpubs, pubkey array. -
Object
- definition, asset definition -
String
- type, asset type,asset
,internal
-
Integer
- key_index, asset index -
Integer
- derive_rule, 0- BIP32,1 - BIP44 -
Integer
- vm_version, vm version -
String
- raw_definition_byte, definition hex -
Integer
- limit_height, can not issue asset when high than this height
-
-
list all the available assets:
// Request
curl -X POST list-assets -d {}
// Result
{
"status": "success",
"data": [
{
"type": "internal",
"xpubs": null,
"quorum": 0,
"key_index": 0,
"derive_rule": 0,
"id": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"alias": "BTM",
"vm_version": 1,
"issue_program": "",
"raw_definition_byte": "7b0a202022646563696d616c73223a20382c0a2020226465736372697074696f6e223a20224279746f6d204f6666696369616c204973737565222c0a2020226e616d65223a202242544d222c0a20202273796d626f6c223a202242544d220a7d",
"definition": {
"decimals": 8,
"description": "Bytom Official Issue",
"name": "BTM",
"symbol": "BTM"
},
"limit_height": 0
},
{
"type": "",
"xpubs": null,
"quorum": 0,
"key_index": 0,
"derive_rule": 0,
"id": "0e11c2fa26623b3b1580d2b04a9cebb1ed13e04c18929fc1ac8c11ae62b87db5",
"alias": "TESTASSET",
"vm_version": 1,
"issue_program": "20e9108d3ca8049800727f6a3505b3a2710dc579405dde03c250f16d9a7e1e6e78160014c5a5b563c4623018557fb299259542b8739f6bc20163201e074b22ed7ae8470c7ba5d8a7bc95e83431a753a17465e8673af68a82500c22741a547a6413000000007b7b51547ac1631a000000547a547aae7cac00c0",
"raw_definition_byte": "7b0a202022646563696d616c73223a20382c0a2020226465736372697074696f6e223a207b7d2c0a2020226e616d65223a2022544553544153534554222c0a20202273796d626f6c223a2022544553544153534554220a7d",
"definition": {
"decimals": 8,
"description": {},
"name": "TESTASSET",
"symbol": "TESTASSET"
},
"limit_height": 0
},
{
"type": "asset",
"xpubs": [
"25bd0d1cefc98661c51dcd0174105775bc1357a76393cf4f85c14c69716e26c02c98550eb9ea10b851e34de6b2814a447b077b57e3ee56fc6d8a29715788e9c7"
],
"quorum": 1,
"key_index": 1,
"derive_rule": 0,
"id": "4de79606de7845a979ebff195ced79a33eca25af55cf7ab06981d33fda7f2f99",
"alias": "GOLD",
"vm_version": 1,
"issue_program": "ae20993984e9b86cea381424a3a1213fcd72cbeb3cddc8f34536ee979a27fe867c7d5151ad",
"raw_definition_byte": "7b7d",
"definition": {},
"limit_height": 0
},
]
}
Update asset alias by assetID.
-
String
- id, id of asset. -
String
- alias, new alias of asset.
-
String
- status, status information
update asset alias.
// Request
curl -X POST update-asset-alias -d '{"id":"0e11c2fa26623b3b1580d2b04a9cebb1ed13e04c18929fc1ac8c11ae62b87db5", "alias":"testassets"}'
// Result
{
"status": "success"
}
Returns the list of all available account balances.
Optional:
-
String
- account_id, account id. -
String
- account_alias, name of account.
-
String
- status, status information -
Array of Object
, balances owned by the account.-
Object
:-
String
- account_id, account id. -
String
- account_alias, name of account. -
String
- asset_id, asset id. -
String
- asset_alias, name of asset. -
Integer
- amount, specified asset balance of account. -
Object
- definition, description of asset.
-
-
list all the available account balances.
// Request
curl -X POST list-balances -d {}
// Result
{
"status": "success",
"data": [
{
"account_id": "65a47ef1-40f3-40a2-82d6-6c40e3e84e6c",
"account_alias": "test",
"asset_alias": "BTM",
"asset_id": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"amount": 499000000,
"asset_definition": {
"decimals": 8,
"description": "Bytom Official Issue",
"name": "BTM",
"symbol": "BTM"
}
}
]
}
list available account balances by the given account_id:
// Request
curl -X POST list-balances -d {"account_id":"65a47ef1-40f3-40a2-82d6-6c40e3e84e6c"}
// Result
{
"status": "success",
"data": [
{
"account_id": "65a47ef1-40f3-40a2-82d6-6c40e3e84e6c",
"account_alias": "test",
"asset_alias": "BTM",
"asset_id": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"amount": 499000000,
"asset_definition": {
"decimals": 8,
"description": "Bytom Official Issue",
"name": "BTM",
"symbol": "BTM"
}
}
]
}
Returns the sub list of all available unspent outputs for all accounts in your wallet.
Object
:
optional:
-
String
- id, id of unspent output. -
Boolean
- unconfirmed, is include unconfirmed utxo -
Boolean
- smart_contract, is contract utxo -
Integer
- from, the start position of first utxo -
Integer
- count, the number of returned -
String
- account_id, account id. -
String
- account_alias, name of account.
-
Array of Object
, unspent output array.-
Object
:-
String
- account_id, account id. -
String
- account_alias, name of account. -
String
- asset_id, asset id. -
String
- asset_alias, name of asset. -
Integer
- amount, specified asset balance of account. -
String
- address, address of account. -
Boolean
- change, whether the account address is change. -
String
- id, unspent output id. -
String
- program, program of account. -
String
- control_program_index, index of program. -
String
- source_id, source unspent output id. -
String
- source_pos, position of source unspent output id in block. -
String
- valid_height, valid height.
-
-
list all the available unspent outputs:
// Request
curl -X POST list-unspent-outputs -d {}
// Result
{
"status": "success",
"data": [
{
account_alias": "test",
"id": "ebf16bba6f4745f655d86d3bc2c5de79ae26845429b7a2ab425fcc609c8adc5e",
"asset_id": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"asset_alias": "BTM",
"amount": 100000000,
"account_id": "6b8bd994-960d-4658-897c-4f5fed4c7f5b",
"address": "bn1quzkzd38wyraftws4sku8g98f9hdm62e46v9enr",
"control_program_index": 1,
"program": "0014e0ac26c4ee20fa95ba1585b87414e92ddbbd2b35",
"source_id": "bd2bce3858decfc86f282267ec4bb8da40cdd9dbda8b98a67576702afb49fdd6",
"source_pos": 1,
"valid_height": 30011,
"change": false,
"derive_rule": 0
}
]
}
list the unspent output matching the given id:
// Request
curl -X POST list-unspent-outputs -d '{"id": "8e84b6a3047e00a4c740d2741ad4cdbfa2aa74da774c3271f6f14376f0afa34c"}'
// Result
{
"status": "success",
"data": [
{
"account_alias": "test",
"id": "8e84b6a3047e00a4c740d2741ad4cdbfa2aa74da774c3271f6f14376f0afa34c",
"asset_id": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"asset_alias": "BTM",
"amount": 499000000,
"account_id": "65a47ef1-40f3-40a2-82d6-6c40e3e84e6c",
"address": "bn1quzkzd38wyraftws4sku8g98f9hdm62e46v9enr",
"control_program_index": 1,
"program": "001433cc42c8598e5b0bdf42a20c338c7a95aa535f79",
"source_id": "d4d47100a40069edb2541a820de335bc22093008d5ffb6b823ad11ebc6b42865",
"source_pos": 0,
"valid_height": 0,
"change": false,
"derive_rule": 0
}
]
}
Backup wallet to image file, it contain accounts image, assets image and keys image.
none
Object
:
-
Object
- account_image, account image. -
Object
- asset_image, asset image. -
Object
- key_images, key image.
// Request
curl -X backup-wallet -d {}
// Result
{
"status": "success",
"data": {
"account_image": {
"slices": [
{
"account": {
"type": "account",
"xpubs": [
"cc5ef9e9bb71968bbfa94536874570bd765ba08f5492882c794c8f73f8af7791cfd6d2945ea18a3177dbdd82460763cf2958128e4531c440238ee1e065d219a6"
],
"quorum": 1,
"key_index": 1,
"derive_rule": 1,
"id": "2e91a178-9447-4984-b80b-d4f4b8360ae0",
"alias": "alice"
},
"contract_index": 0
},
{
"account": {
"type": "account",
"xpubs": [
"25bd0d1cefc98661c51dcd0174105775bc1357a76393cf4f85c14c69716e26c02c98550eb9ea10b851e34de6b2814a447b077b57e3ee56fc6d8a29715788e9c7"
],
"quorum": 1,
"key_index": 1,
"derive_rule": 1,
"id": "6b8bd994-960d-4658-897c-4f5fed4c7f5b",
"alias": "test"
},
"contract_index": 0
}
]
},
"asset_image": {
"assets": [
{
"id": "0e11c2fa26623b3b1580d2b04a9cebb1ed13e04c18929fc1ac8c11ae62b87db5",
"alias": "TESTASSETS",
"vm_version": 1,
"issue_program": "20e9108d3ca8049800727f6a3505b3a2710dc579405dde03c250f16d9a7e1e6e78160014c5a5b563c4623018557fb299259542b8739f6bc20163201e074b22ed7ae8470c7ba5d8a7bc95e83431a753a17465e8673af68a82500c22741a547a6413000000007b7b51547ac1631a000000547a547aae7cac00c0",
"raw_definition_byte": "7b0a202022646563696d616c73223a20382c0a2020226465736372697074696f6e223a207b7d2c0a2020226e616d65223a2022544553544153534554222c0a20202273796d626f6c223a2022544553544153534554220a7d",
"definition": {
"decimals": 8,
"description": {},
"name": "TESTASSET",
"symbol": "TESTASSET"
}
},
{
"type": "asset",
"xpubs": [
"25bd0d1cefc98661c51dcd0174105775bc1357a76393cf4f85c14c69716e26c02c98550eb9ea10b851e34de6b2814a447b077b57e3ee56fc6d8a29715788e9c7"
],
"quorum": 1,
"key_index": 1,
"derive_rule": 0,
"id": "4de79606de7845a979ebff195ced79a33eca25af55cf7ab06981d33fda7f2f99",
"alias": "GOLD",
"vm_version": 1,
"issue_program": "ae20993984e9b86cea381424a3a1213fcd72cbeb3cddc8f34536ee979a27fe867c7d5151ad",
"raw_definition_byte": "7b7d",
"definition": null
},
{
"type": "asset",
"xpubs": [
"25bd0d1cefc98661c51dcd0174105775bc1357a76393cf4f85c14c69716e26c02c98550eb9ea10b851e34de6b2814a447b077b57e3ee56fc6d8a29715788e9c7"
],
"quorum": 1,
"key_index": 2,
"derive_rule": 0,
"id": "9de35c8265397db20cd7002e5dd458f9f6366b82256724f1147f522e2cba40b1",
"alias": "SILVE",
"vm_version": 1,
"issue_program": "ae20a4873501792ce6f44d27e5a0efa11db98e13e95b320e5b40a5b15cde1343ac3d5151ad",
"raw_definition_byte": "7b7d",
"definition": null
}
]
},
"key_images": {
"xkeys": [
{
"crypto": {
"cipher": "aes-128-ctr",
"ciphertext": "ebbd1b1f7f597ef6267ca315fbff0f85be8fead6d798c459711e30f169d8db4e2705eac6f6f9e4e162a5e08f9d5e2080024f7db1a35fb95c5dee9a73e5bcba19",
"cipherparams": {
"iv": "7080b540bb0d64f5b9add924397ff876"
},
"kdf": "scrypt",
"kdfparams": {
"dklen": 32,
"n": 4096,
"p": 6,
"r": 8,
"salt": "c7f29540fe29646c9783d3242dd33c5077cc17e1853b0ef9831580b9e351f50f"
},
"mac": "79cfcc3891062eba9f7ed8fb97763f6cec5204b353a4ebb760b3185d3f19b32a"
},
"id": "5a68ae8c-3d6b-4be4-bbca-f7e3209b56f4",
"type": "bytom_kd",
"version": 1,
"alias": "test",
"xpub": "25bd0d1cefc98661c51dcd0174105775bc1357a76393cf4f85c14c69716e26c02c98550eb9ea10b851e34de6b2814a447b077b57e3ee56fc6d8a29715788e9c7"
},
{
"crypto": {
"cipher": "aes-128-ctr",
"ciphertext": "2e5c165a871b3842c7b8eb3c4a3c2051a4e4b10efe5f07406fe3a1b9f1272358ac500b32522c63554433dd34f85393cd36049e7d7d2af4f33f0fcf9ba5515dba",
"cipherparams": {
"iv": "9c52fc9b535478c8104350590a66d8ec"
},
"kdf": "scrypt",
"kdfparams": {
"dklen": 32,
"n": 4096,
"p": 6,
"r": 8,
"salt": "23d59b94fe5af02195afe5b8d8edff79320fb5b8ac6c0cadaae336e786dbf19e"
},
"mac": "59247979d257d0b83dc5e0ff99b624fccb47037bb75e004c6ae1aad0a0fbc248"
},
"id": "f42e72ff-5d5d-4b17-81e2-d407b507393e",
"type": "bytom_kd",
"version": 1,
"alias": "alice",
"xpub": "cc5ef9e9bb71968bbfa94536874570bd765ba08f5492882c794c8f73f8af7791cfd6d2945ea18a3177dbdd82460763cf2958128e4531c440238ee1e065d219a6"
},
{
"crypto": {
"cipher": "aes-128-ctr",
"ciphertext": "31f841b5b71348d110ceaa744b6d34b04001e8d855572278fc89fbdc0c848924e84fd28000936317604520153c42d92eed7c207bb294c76f3d5bd1c92e3cd04e",
"cipherparams": {
"iv": "5136cc06d7ab727e8b3dc292f2c3388d"
},
"kdf": "scrypt",
"kdfparams": {
"dklen": 32,
"n": 4096,
"p": 6,
"r": 8,
"salt": "5e6a3d82d673174a6bd4fc04ceec1a129e882158cf4937051a3793b24c9a44d0"
},
"mac": "a145a90b6778dac4c1433420c96eb498d2ba24fb7916d4b31199be789f257238"
},
"id": "de1353ee-9c5f-4bcd-9023-f08805bd8c2c",
"type": "bytom_kd",
"version": 1,
"alias": "alice2",
"xpub": "adb65c15d6d4309417295b912590481b11aa5f9046f8ad79419b5dbc02a397fa47d2bcbd3cd9d8c48ab92c2bb8651d61aed98395bd39fc2dc811ae279dd1e462"
}
]
}
}
}
Restore wallet by image file.
-
Object
- account_image, account image. -
Object
- asset_image, asset image. -
Object
- key_images, key image.
-
String
- status, status information
// Request
curl -X POST restore-wallet -d '{"account_image":{"slices":[{"account":{"type":"account","xpubs":["395d6e0ac25978c3f52f9c7bdfdf75ce6af02639fd7875b4b1f40778ab1120c6dcf461b7ab6fd310983afb54a9a0fb3e09b6ec0d4364c4808c94383d50fb0681"],"quorum":1,"key_index":1,"ID":"0CQTA3EOG0A02","Alias":"def"},"contract_index":2}]},"asset_image":{"assets":[]},"key_images":{"xkeys":[{"crypto":{"cipher":"aes-128-ctr","ciphertext":"bf44766fec149478af9500e25ce0a6bc50bb2fa04e40465781da6ff64e9b3a4c9af3d214cd92c5a41d8498db5f4376526740f960ff429b16e52876aec6860e1d","cipherparams":{"iv":"1b0fc61ae4dacb15f0f77d2b4ba67635"},"kdf":"scrypt","kdfparams":{"dklen":32,"n":4096,"p":6,"r":8,"salt":"e133b1e7caae771ff1ab34b14824d6e27ef399f2b7ded4ad3500f080ede4a1dd"},"mac":"bc6bf411fb63e61a17bc15b94f29cf0d5a0f084c328955da1f7e2b26757cfc23"},"id":"1f40be59-7400-4fdc-b46b-15009f65363a","type":"bytom_kd","version":1,"alias":"default","xpub":"c4ec9bfd5df19d175e17ff7fed89193c37a4a64e1c0928387da01387ca76c3bfd99390e3373ec4d438522cc2d4644214cd2ec3b00965f7a1fa3546809583191c"},{"crypto":{"cipher":"aes-128-ctr","ciphertext":"f0887c8603cbbafc0a66d5b45f71488e089708c7dea4342625a67858a49d6d08c79cd3f1800627e3c8b4668e8df34fcf0be9df5d9d4503acff05373976c312a9","cipherparams":{"iv":"c111b46f9104f49f2c40aedb827e53b5"},"kdf":"scrypt","kdfparams":{"dklen":32,"n":4096,"p":6,"r":8,"salt":"d9ef588b258b111dea1d99a4e4c5a4f968ab69072176bb95b111922e3bbea9e6"},"mac":"336f5fee643776e139f05ebe5e4f209d992ff97e16b906105fadac9e86133554"},"id":"611d407c-9e97-4297-a02a-13cd68e47983","type":"bytom_kd","version":1,"alias":"def","xpub":"395d6e0ac25978c3f52f9c7bdfdf75ce6af02639fd7875b4b1f40778ab1120c6dcf461b7ab6fd310983afb54a9a0fb3e09b6ec0d4364c4808c94383d50fb0681"}]}}'
// Result
{
"status": "success"
}
Trigger to rescan block information into related wallet.
none
-
String
- status,status information
// Request
curl -X POST rescan-wallet -d '{}'
// Result
{
"status": "success"
}
Recovery wallet and accounts from root XPubs. All accounts and balances of bip44 multi-account hierarchy for deterministic wallets can be restored via root xpubs.
-
Object
- xpubs, root XPubs.
-
String
- status,status information
// Request
curl -X POST recovery-wallet -d '{ "xpubs":["c536a2c11fafd8278e02e9393dcbf5aa420eb51a1761a7e5da7f2b9b37969b52a8f8e2b692e7dcaf79dfa0d1e28c63eb9fda42942f20feaa8a71b383d9a4668c"]}'
// Result
{
"status": "success"
}
Return the information of wallet.
none
-
String
- status, status information -
Object
- data-
Integer
- best_block_height, current block height. -
Integer
- wallet_height, current block height for wallet.
-
// Request
curl -X POST wallet-info -d '{}'
// Result
{
"status": "success",
"data": {
"best_block_height": 25861,
"wallet_height": 25861
}
}
Sign a message with the key password(decode encrypted private key) of an address.
Object
:
-
String
- address, address for account. -
String
- message, message for signature by address xpub. must be hex format -
String
- password, password of account.
-
String
- status, status information -
Object
- data-
String
- derived_xpub, derived xpub. -
String
- signature, signature of message.
-
// Request
curl -X POST sign-message -d '{"address":"bn1quzkzd38wyraftws4sku8g98f9hdm62e46v9enr", "message":"6d657373616765", "password":"123456"}'
// Result
{
"status": "success",
"data": {
"signature": "0fb3f4b25536172cd332db53dba97e318393924d6f892ecc3d2624494ea754375541bfd9f74a3fdc5eb60c49087596e8814b0c738eecd25f13e9a7ee74577b09",
"derived_xpub": "e231f38c7652312e2e68b1c30eb08bff5e957995e11c5f27126a5411fd5e4df9c71145e483c1ee3f04b6d5f7746a0693be6a6d148359f40a2d5f111344727946"
}
}
Decode program.
Object
:
-
String
- program, program for account.
-
String
- status, status information -
Object
- data-
String
- instructions, instructions and data for program.
-
// Request
curl -X POST decode-program -d '{"program":"0014a86c83ee12e6d790fb388345cc2e2b87056a0773"}'
// Result
{
"status": "success",
"data": {
"instructions": "DUP \nHASH160 \nDATA_20 a86c83ee12e6d790fb388345cc2e2b87056a0773\nEQUALVERIFY \nTXSIGHASH \nSWAP \nCHECKSIG \n"
}
}
Query the account related transaction by transaction ID.
Object
:
-
String
- tx_id, transaction id, hash of transaction.
-
String
- status, status information -
Object
- data-
String
- tx_id, transaction id, hash of the transaction. -
Integer
- block_time, the unix timestamp for when the block was generation -
String
- block_hash, hash of the block where this transaction was in. -
Integer
- block_height, block height where this transaction was in. -
Integer
- block_index, position of the transaction in the block. -
Integer
- block_transactions_count, transactions count where this transaction was in the block. -
Integer
- size, size of transaction. -
Array of Object
- inputs, object of inputs for the transaction.-
String
- type, the type of input action, available option include: 'spend', 'issue', 'coinbase','veto' . -
String
- asset_id, asset id. -
String
- asset_alias, name of asset. -
Object
- asset_definition, definition of asset(json object). -
Integer
- amount, amount of asset. -
Object
- issuance_program, issuance program, it only exist when type is 'issue'. -
Object
- control_program, control program of account, it only exist when type is 'spend'. -
String
- address, address of account, it only exist when type is 'spend'. -
String
- spent_output_id, the front of outputID to be spent in this input, it only exist when type is 'spend'. -
String
- account_id, account id. -
String
- account_alias, name of account. -
Object
- arbitrary, arbitrary infomation can be set by miner, it only exist when type is 'coinbase'. -
String
- input_id, hash of input action. -
Array of String
- witness_arguments, witness arguments. -
String
- sign_data, signature for input -
String
- vote, vote node public key, it only exist when type is 'veto'.
-
-
Array of Object
- outputs, object of outputs for the transaction.-
String
- type, the type of output action, available option include: 'retire', 'control', 'vote'. -
String
- id, outputid related to utxo. -
Integer
- position, position of outputs. -
String
- asset_id, asset id. -
String
- asset_alias, name of asset. -
Object
- asset_definition, definition of asset(json object). -
Integer
- amount, amount of asset. -
String
- account_id, account id. -
String
- account_alias, name of account. -
Object
- control_program, control program of account. -
String
- address, address of account. -
String
- vote, vote node public key, it only exist when type is 'vote'.
-
-
// Request
curl -X POST get-transaction -d '{"tx_id": "078fe319cbe814fb605282838b558e246cbf867bf05bf7989f9b7ba4a7daecf0"}'
// Result
{
"status": "success",
"data": {
"tx_id": "078fe319cbe814fb605282838b558e246cbf867bf05bf7989f9b7ba4a7daecf0",
"block_time": 1629105846000,
"block_hash": "5daae833709b863a8def0a4e922304af17753198410cf39655bfe6398ff0810a",
"block_height": 1747,
"block_index": 1,
"block_transactions_count": 2,
"inputs": [
{
"type": "spend",
"asset_id": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"asset_alias": "BTM",
"asset_definition": {
"decimals": 8,
"description": "Bytom Official Issue",
"name": "BTM",
"symbol": "BTM"
},
"amount": 1000000000,
"control_program": "001433cc42c8598e5b0bdf42a20c338c7a95aa535f79",
"address": "tn1qx0xy9jze3edshh6z5gxr8rr6jk49xhmeuuchal",
"spent_output_id": "56451d67f771fa084bb86e3e3fb88f0e6b62325803bdb1fccec86660b4bf8475",
"account_id": "65a47ef1-40f3-40a2-82d6-6c40e3e84e6c",
"account_alias": "test",
"input_id": "596918424c57d2300848953ce0f9ad519175c7ac1a992ff089ab5df816543135",
"witness_arguments": [
"ecf88286bb8b79f333dd9e165c87e440b51c9ed615b0a6572ca84a8030b066ebe84194dc1f178068686f23dd0426aeabbff002253d7143783478f1caa032ff04",
"e14d663c7f02be9cbdaf2f2dc8263aa00c177239866f1be8eb30e041b5a50a99"
],
"sign_data": "89d8cf2ff12662ed8d6f05e0e241b3cead7fc904755e8f22d956589eb75a78f9"
}
],
"outputs": [
{
"type": "control",
"id": "8e84b6a3047e00a4c740d2741ad4cdbfa2aa74da774c3271f6f14376f0afa34c",
"position": 0,
"asset_id": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"asset_alias": "BTM",
"asset_definition": {
"decimals": 8,
"description": "Bytom Official Issue",
"name": "BTM",
"symbol": "BTM"
},
"amount": 499000000,
"account_id": "65a47ef1-40f3-40a2-82d6-6c40e3e84e6c",
"account_alias": "test",
"control_program": "001433cc42c8598e5b0bdf42a20c338c7a95aa535f79",
"address": "tn1qx0xy9jze3edshh6z5gxr8rr6jk49xhmeuuchal"
},
{
"type": "control",
"id": "9e40082f650362ea6e99e578f7cfc460b1c7bbeb2bf126e40a3307812705efb7",
"position": 1,
"asset_id": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"asset_alias": "BTM",
"asset_definition": {
"decimals": 8,
"description": "Bytom Official Issue",
"name": "BTM",
"symbol": "BTM"
},
"amount": 500000000,
"control_program": "0014667d5837fa1d0495d124bca737da7b5b00a17b73",
"address": "tn1qve74sdl6r5zft5fyhjnn0knmtvq2z7mnpkcck7"
}
],
"size": 336
}
}
Returns the sub list of all the account related transactions.
Object
:
optional:
-
String
- id, transaction id, hash of transaction. -
String
- account_id, id of account. -
Boolean
- detail , flag of detail transactions, default false (only return transaction summary) -
Boolean
- unconfirmed, flag of unconfirmed transactions(query result include all confirmed and unconfirmed transactions), default false. -
Integer
- from, the start position of first transaction -
Integer
- count, the number of returned
-
String
- status, status information -
Array of Object
- data, transaction array.-
Object
:(summary transaction)-
String
- tx_id, transaction id, hash of the transaction. -
Integer
- block_time, the unix timestamp for when the requst was responsed. -
Array of Object
- inputs, object of summary inputs for the transaction.-
String
- type, the type of input action, available option include: 'spend', 'issue', 'coinbase', 'veto'. -
String
- asset_id, asset id. -
String
- asset_alias, name of asset. -
Integer
- amount, amount of asset. -
Object
- arbitrary, arbitrary infomation can be set by miner, it only exist when type is 'coinbase'.
-
-
Array of Object
- outputs, object of summary outputs for the transaction.-
String
- type, the type of output action, available option include: 'retire', 'control', 'vote'. -
String
- asset_id, asset id. -
String
- asset_alias, name of asset. -
Integer
- amount, amount of asset.
-
-
-
-
Array of Object
- data, transaction array.-
String
- tx_id, transaction id, hash of the transaction. -
Integer
- block_time, the unix timestamp for when the block was generation -
String
- block_hash, hash of the block where this transaction was in. -
Integer
- block_height, block height where this transaction was in. -
Integer
- block_index, position of the transaction in the block. -
Integer
- block_transactions_count, transactions count where this transaction was in the block. -
Integer
- size, size of transaction. -
Array of Object
- inputs, object of inputs for the transaction.-
String
- type, the type of input action, available option include: 'spend', 'issue', 'coinbase','veto' . -
String
- asset_id, asset id. -
String
- asset_alias, name of asset. -
Object
- asset_definition, definition of asset(json object). -
Integer
- amount, amount of asset. -
Object
- issuance_program, issuance program, it only exist when type is 'issue'. -
Object
- control_program, control program of account, it only exist when type is 'spend'. -
String
- address, address of account, it only exist when type is 'spend'. -
String
- spent_output_id, the front of outputID to be spent in this input, it only exist when type is 'spend'. -
String
- account_id, account id. -
String
- account_alias, name of account. -
Object
- arbitrary, arbitrary infomation can be set by miner, it only exist when type is 'coinbase'. -
String
- input_id, hash of input action. -
Array of String
- witness_arguments, witness arguments. -
String
- sign_data, signature for input -
String
- vote, vote node public key, it only exist when type is 'veto'.
-
-
Array of Object
- outputs, object of outputs for the transaction.-
String
- type, the type of output action, available option include: 'retire', 'control', 'vote'. -
String
- id, outputid related to utxo. -
Integer
- position, position of outputs. -
String
- asset_id, asset id. -
String
- asset_alias, name of asset. -
Object
- asset_definition, definition of asset(json object). -
Integer
- amount, amount of asset. -
String
- account_id, account id. -
String
- account_alias, name of account. -
Object
- control_program, control program of account. -
String
- address, address of account. -
String
- vote, vote node public key, it only exist when type is 'vote'.
-
-
list all the available transactions:
// Request
curl -X POST list-transactions -d {}
// Result
{
"tx_id": "dcaf26fd91c8f6ac6fa542ecbf024f0419788c89006c60d6f441f13c6a96673b",
"block_time": 1629442644000,
"inputs": [
{
"type": "spend",
"asset_id": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"asset_alias": "BTM",
"amount": 223096731217
}
],
"outputs": [
{
"type": "control",
"asset_id": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"asset_alias": "BTM",
"amount": 500000000,
"account_id": "6b8bd994-960d-4658-897c-4f5fed4c7f5b",
"account_alias": "test"
},
{
"type": "control",
"asset_id": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"asset_alias": "BTM",
"amount": 222596282217
}
]
}
list the transaction matching the given tx_id with detail:
// Request
curl -X POST list-transactions -d '{"id": "dcaf26fd91c8f6ac6fa542ecbf024f0419788c89006c60d6f441f13c6a96673b","detail": true}'
// Result
{
"status": "success",
"data": [
{
"tx_id": "dcaf26fd91c8f6ac6fa542ecbf024f0419788c89006c60d6f441f13c6a96673b",
"block_time": 1629442644000,
"block_hash": "9947f53d10c635f08f2906756cb173777a92b4ca4316812eaa6eebfdf9882156",
"block_height": 812,
"block_index": 1,
"block_transactions_count": 2,
"inputs": [
{
"type": "spend",
"asset_id": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"asset_alias": "BTM",
"asset_definition": {
"decimals": 8,
"description": "Bytom Official Issue",
"name": "BTM",
"symbol": "BTM"
},
"amount": 223096731217,
"control_program": "0014c28fede9076c2bbc719c7fce59ef1a10baadcb5d",
"address": "bn1qc287m6g8ds4mcuvu0l89nmc6zza2mj6atwflw5",
"spent_output_id": "9df43c51ce03c8e80b0702810b128909d5d24e83b4340e798bb5d3881d4cdfc7",
"input_id": "cb3d07210d68f95d3fd669e4bcf9fe4214e1e0f579efa3371bf856521814be79",
"witness_arguments": [
"5b278f01c5cb2670d8f754f96f12471d036acce26aaf312b1a2b8c7b2afa33ae5934f91fa96d1e9a2c02ccbaa2b305d5bd90f93c608391f0f0e94e64324e8c09",
"79efe42f0dbc49b84acf91b8c33f16c94a9a8a75fd3ffdbc7553766f00f275e1"
],
"sign_data": "435328252f3c2dce3d2bf1de372a085aa5a55368166641a89a03b01a48bad381"
}
],
"outputs": [
{
"type": "control",
"id": "be087ac077ddeeb32a00946d39beff0e35a1be3711d4da4574d4dd3d5979d861",
"position": 0,
"asset_id": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"asset_alias": "BTM",
"asset_definition": {
"decimals": 8,
"description": "Bytom Official Issue",
"name": "BTM",
"symbol": "BTM"
},
"amount": 500000000,
"account_id": "6b8bd994-960d-4658-897c-4f5fed4c7f5b",
"account_alias": "test",
"control_program": "0014e0ac26c4ee20fa95ba1585b87414e92ddbbd2b35",
"address": "bn1quzkzd38wyraftws4sku8g98f9hdm62e46v9enr"
},
{
"type": "control",
"id": "79ab17691fb9a0e0a61f3defa1977801d4e4cd278614ab2b9f841340eb24f5fb",
"position": 1,
"asset_id": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"asset_alias": "BTM",
"asset_definition": {
"decimals": 8,
"description": "Bytom Official Issue",
"name": "BTM",
"symbol": "BTM"
},
"amount": 222596282217,
"control_program": "0014c28fede9076c2bbc719c7fce59ef1a10baadcb5d",
"address": "bn1qc287m6g8ds4mcuvu0l89nmc6zza2mj6atwflw5"
}
],
"size": 340
}
]
}
Build transaction.
Object
:
-
String
- base_transaction, base data for the transaction, default is null. -
Integer
- ttl, integer of the time to live in milliseconds, it means utxo will be reserved(locked) for builded transaction in this time range, if the transaction will not to be submitted into block, it will be auto unlocked for build transaction again after this ttl time. it will be set to 5 minutes(300 seconds) defaultly when ttl is 0. -
Integer
- time_range, the block height at which this transaction will be allowed to be included in a block. If the block height of the main chain exceeds this value, the transaction will expire and no longer be valid. -
Arrary of Object
- actions:-
Object
:-
String
- account_id | account_alias, (type is spend_account) alias or ID of account. -
String
- asset_id | asset_alias, alias or ID of asset. -
Integer
- amount, the specified asset of the amount sent with this transaction. -
String
- type, type of transaction, valid types: 'spend_account', 'issue', 'spend_account_unspent_output', 'control_address', 'control_program', 'retire'. -
String
- address, (type is control_address) address of receiver, the style of address is P2PKH or P2SH. -
String
- control_program, (type is control_program) control program of receiver. -
String
- use_unconfirmed, (type is spend_account and spend_account_unspent_output) flag of use unconfirmed UTXO, default is false. -
String
- arbitrary, (type is retire) arbitrary additional data by hexadecimal. -
Arrary of Object
- arguments, (type is issue and spend_account_unspent_output) arguments of contract, null when it's not contract.-
String
- type, type of argument, valid types: 'raw_tx_signature', 'data'. -
Object
- raw_data, json object of argument content.-
String
- xpub, (type is raw_tx_signature) root xpub. -
String
- derivation_path, (type is raw_tx_signature) derived path. -
String
- value, (type is data) string of binary value.
-
-
-
-
-
String
- status, status information -
Object
-data-
Object
- raw_transaction, builded transactions. -
Object
- signing_instructions,Information used to sign a transactions.
-
-
spend
- transaction type is spend
// Request
curl -X POST build-transaction -d '{"base_transaction":null,"actions":[{"account_id":"6b8bd994-960d-4658-897c-4f5fed4c7f5b","amount":1000000,"asset_id":"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","type":"spend_account"},{"account_id":"6b8bd994-960d-4658-897c-4f5fed4c7f5b","amount":99,"asset_id":"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","type":"spend_account"},{"amount":99,"asset_id":"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","address":"bn1quzkzd38wyraftws4sku8g98f9hdm62e46v9enr","type":"control_address"}],"ttl":0,"time_range": 43432}'
-
issue
- transaction type is issue
// Request
curl -X POST build-transaction -d '{"base_transaction":null,"actions":[{"account_id":"6b8bd994-960d-4658-897c-4f5fed4c7f5b","amount":1000000,"asset_id":"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","type":"spend_account"},{"amount":10000,"asset_id":"0e11c2fa26623b3b1580d2b04a9cebb1ed13e04c18929fc1ac8c11ae62b87db5","type":"issue"},{"amount":10000,"asset_id":"0e11c2fa26623b3b1580d2b04a9cebb1ed13e04c18929fc1ac8c11ae62b87db5","address":"bn1quzkzd38wyraftws4sku8g98f9hdm62e46v9enr","type":"control_address"}],"ttl":0,"time_range": 43432}'
-
address
- transaction type is address
// Request
curl -X POST build-transaction -d '{"base_transaction":null,"actions":[{"account_id":"6b8bd994-960d-4658-897c-4f5fed4c7f5b","amount":1000000,"asset_id":"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","type":"spend_account"},{"account_id":"6b8bd994-960d-4658-897c-4f5fed4c7f5b","amount":99,"asset_id":"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","type":"spend_account"},{"amount":99,"asset_id":"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","address":"bn1quzkzd38wyraftws4sku8g98f9hdm62e46v9enr","type":"control_address"}],"ttl":0,"time_range": 43432}'
-
retire
- transaction type is retire
// Request
curl -X POST build-transaction -d '{"base_transaction":null,"actions":[{"account_id":"6b8bd994-960d-4658-897c-4f5fed4c7f5b","amount":1000000,"asset_id":"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","type":"spend_account"},{"account_id":"6b8bd994-960d-4658-897c-4f5fed4c7f5b","amount":99,"asset_id":"0e11c2fa26623b3b1580d2b04a9cebb1ed13e04c18929fc1ac8c11ae62b87db5","type":"spend_account"},{"amount":99,"asset_id":"0e11c2fa26623b3b1580d2b04a9cebb1ed13e04c18929fc1ac8c11ae62b87db5","arbitrary":"77656c636f6d65efbc8ce6aca2e8bf8ee69da5e588b0e58e9fe5ad90e4b896e7958c","type":"retire"}],"ttl":0,"time_range":43432}'
-
spend_account_unspent_output
- transaction type is spend_account_unspent_output(user can get UTXO information by calllist-unspent-outputs
API)attention:
- action field
output_id
correspond to UTXO resultid
field - UTXO asset and amount will be spent in this transaction
- transaction fee is (utxo asset_amount - output asset_amount)
- action field
// Request
curl -X POST build-transaction -d '{"base_transaction":null,"actions":[{"type":"spend_account_unspent_output","output_id":"ebf16bba6f4745f655d86d3bc2c5de79ae26845429b7a2ab425fcc609c8adc5e"},{"amount":1000000,"asset_id":"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","address":"bn1quzkzd38wyraftws4sku8g98f9hdm62e46v9enr","type":"control_address"}],"ttl":0,"time_range":0}}'
{
"status": "success",
"data": {
"raw_transaction": "0701000101a101035ebd2bce3858decfc86f282267ec4bb8da40cdd9dbda8b98a67576702afb49fdd6ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80c2d72f0101160014e0ac26c4ee20fa95ba1585b87414e92ddbbd2b350040c8a73062a39dccc889dd8a4eaec5aecc352b7fc584469a768d9afe8368f1cfb45d7e50607f374f817638532ff3af854c3c030329ac3e8b242a5876cfe407262b01000101003cffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc0843d01160014e0ac26c4ee20fa95ba1585b87414e92ddbbd2b350000",
"signing_instructions": [
{
"position": 0,
"witness_components": [
{
"type": "raw_tx_signature",
"quorum": 1,
"keys": [
{
"xpub": "25bd0d1cefc98661c51dcd0174105775bc1357a76393cf4f85c14c69716e26c02c98550eb9ea10b851e34de6b2814a447b077b57e3ee56fc6d8a29715788e9c7",
"derivation_path": [
"2c000000",
"99000000",
"01000000",
"00000000",
"01000000"
]
}
],
"signatures": null
},
{
"type": "data",
"value": "e231f38c7652312e2e68b1c30eb08bff5e957995e11c5f27126a5411fd5e4df9"
}
]
}
],
"fee": 99000000,
"allow_additional_actions": false
}
}
Build chain transactions. To solve the problem of excessive utxo causing the transaction to fail, the utxo merge will be performed automatically. Currently, only btm transactions are supported.Warning, this feature requires the mine pool bytomd software to be higher than v1.0.6.
Object
:
-
String
- base_transaction, base data for the transaction, default is null. -
Integer
- ttl, integer of the time to live in milliseconds, it means utxo will be reserved(locked) for builded transaction in this time range, if the transaction will not to be submitted into block, it will be auto unlocked for build transaction again after this ttl time. it will be set to 5 minutes(300 seconds) defaultly when ttl is 0. -
Integer
- time_range, time stamp(block height)is maximum survival time for the transaction, the transaction will be not submit into block after this time stamp. -
Arrary of Object
- actions:-
Object
:-
String
- account_id | account_alias, (type is spend_account) alias or ID of account. -
String
- asset_id | asset_alias, (type is spend_account, issue, retire, control_program and control_address) alias or ID of asset. -
Integer
- amount, (type is spend_account, issue, retire, control_program and control_address) the specified asset of the amount sent with this transaction. -
String
- type, type of transaction, valid types: 'spend_account', 'issue', 'spend_account_unspent_output', 'control_address', 'control_program', 'retire'. -
String
- address, (type is control_address) address of receiver, the style of address is P2PKH or P2SH. -
String
- control_program, (type is control_program) control program of receiver. -
String
- use_unconfirmed, (type is spend_account and spend_account_unspent_output) flag of use unconfirmed UTXO, default is false. -
Arrary of Object
- arguments, (type is issue and spend_account_unspent_output) arguments of contract, null when it's not contract.-
String
- type, type of argument, valid types: 'raw_tx_signature', 'data'. -
Object
- raw_data, json object of argument content.-
String
- xpub, (type is raw_tx_signature) root xpub. -
String
- derivation_path, (type is raw_tx_signature) derived path. -
String
- value, (type is data) string of binary value.
-
-
-
-
-
String
- status, status information -
Object
-data-
Object
- raw_transaction, builded transactions. -
Object
- signing_instructions,Information used to sign a transactions.
-
-
spend
- transaction type is spend
// Request
curl -X POST localhost:9888/build-chain-transactions -d '{"base_transaction":null,"actions":[{"account_id":"6b8bd994-960d-4658-897c-4f5fed4c7f5b","amount":1000000,"asset_id":"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","type":"spend_account"},{"account_id":"6b8bd994-960d-4658-897c-4f5fed4c7f5b","amount":99,"asset_id":"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","type":"spend_account"},{"amount":99,"asset_id":"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","address":"bn1quzkzd38wyraftws4sku8g98f9hdm62e46v9enr","type":"control_address"}],"ttl":0,"time_range": 43432}'
// Result
{
"status": "success",
"data": [
{
"raw_transaction": "070100010160015e1d677df0a501a4f235d3a6170c296698bcfe16e32b3a1989414006a86fda6854ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8092f4010001160014e0ac26c4ee20fa95ba1585b87414e92ddbbd2b350001000201003dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffdd8cb70101160014e0ac26c4ee20fa95ba1585b87414e92ddbbd2b35000001003affffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6301160014e0ac26c4ee20fa95ba1585b87414e92ddbbd2b350000",
"signing_instructions": [
{
"position": 0,
"witness_components": [
{
"type": "raw_tx_signature",
"quorum": 1,
"keys": [
{
"xpub": "25bd0d1cefc98661c51dcd0174105775bc1357a76393cf4f85c14c69716e26c02c98550eb9ea10b851e34de6b2814a447b077b57e3ee56fc6d8a29715788e9c7",
"derivation_path": [
"2c000000",
"99000000",
"01000000",
"00000000",
"01000000"
]
}
],
"signatures": null
},
{
"type": "data",
"value": "e231f38c7652312e2e68b1c30eb08bff5e957995e11c5f27126a5411fd5e4df9"
}
]
}
],
"fee": 1000000,
"allow_additional_actions": false
}
]
}
Sign transaction.
Object
:
-
String
- password, signature of the password. -
Object
- transaction, builded transaction.
-
String
- status, status information -
Object
- data-
Boolean
- sign_complete, returns true if sign succesfully and false otherwise. -
Object
- transaction, signed transaction.
-
// Request
curl -X POST sign-transaction -d '{"password":"123456","transaction":{"allow_additional_actions":false,"local":true,"raw_transaction":"07010000020161015fb6a63a3361170afca03c9d5ce1f09fe510187d69545e09f95548b939cd7fffa3ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80fc93afdf01000116001426bd1b851cf6eb8a701c20c184352ad8720eeee90100015d015bb6a63a3361170afca03c9d5ce1f09fe510187d69545e09f95548b939cd7fffa33152a15da72be51b330e1c0f8e1c0db669269809da4f16443ff266e07cc43680c03e0101160014489a678741ccc844f9e5c502f7fac0a665bedb25010003013effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80a2cfa5df0101160014948fb4f500e66d20fbacb903fe108ee81f9b6d9500013a3152a15da72be51b330e1c0f8e1c0db669269809da4f16443ff266e07cc43680dd3d01160014cd5a822b34e3084413506076040d508bb12232c70001393152a15da72be51b330e1c0f8e1c0db669269809da4f16443ff266e07cc436806301160014a3f9111f3b0ee96cbd119a3ea5c60058f506fb1900","signing_instructions":[{"position":0,"witness_components":[{"keys":[{"derivation_path":["010100000000000000","0500000000000000"],"xpub":"ee9dd8affdef7e0cacd0fbbf310217c7f588156c28e414db74c27afaedd8f876cf54547a672b431ff06ee8a146207df9595638a041b55ada1a764a8b5b30bda0"}],"quorum":1,"signatures":null,"type":"raw_tx_signature"},{"type":"data","value":"62a73b6b7ffe52b6ad782b0e0efdc8309bf2f057d88f9a17d125e41bb11dbb88"}]},{"position":1,"witness_components":[{"keys":[{"derivation_path":["010100000000000000","0600000000000000"],"xpub":"ee9dd8affdef7e0cacd0fbbf310217c7f588156c28e414db74c27afaedd8f876cf54547a672b431ff06ee8a146207df9595638a041b55ada1a764a8b5b30bda0"}],"quorum":1,"signatures":null,"type":"raw_tx_signature"},{"type":"data","value":"ba5a63e7416caeb945eefc2ce874f40bc4aaf6005a1fc792557e41046f7e502f"}]}]}}'
// Result
{
"status": "success",
"data": {
"transaction": {
"raw_transaction": "070100010161015fd4d47100a40069edb2541a820de335bc22093008d5ffb6b823ad11ebc6b42865ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc0c5f8ed01000116001433cc42c8598e5b0bdf42a20c338c7a95aa535f7900630240c9e576b25d57bf84fddb52edd62e72011f4dee3ac278f081cce299d93edaca39898e4d870e91f69f5953939a3e58b51272fc6f5a683a499752baa203f16e650920e14d663c7f02be9cbdaf2f2dc8263aa00c177239866f1be8eb30e041b5a50a990101003dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc0c5ef7301160014d950f1bc4a88692e20fed82f50fa123c164ea8780000",
"signing_instructions": [
{
"position": 0,
"witness_components": [
{
"type": "raw_tx_signature",
"quorum": 1,
"keys": [
{
"xpub": "bec1040aa05d7da3c1fc7deeedaecf74e548d84588804f2bddf8d6cce0367d95bb0c180bb62449eb0e580499ee9955244b606a17664f46be6d23f3a65fe304e6",
"derivation_path": [
"2c000000",
"99000000",
"01000000",
"00000000",
"01000000"
]
}
],
"signatures": [
"c9e576b25d57bf84fddb52edd62e72011f4dee3ac278f081cce299d93edaca39898e4d870e91f69f5953939a3e58b51272fc6f5a683a499752baa203f16e6509"
]
},
{
"type": "data",
"value": "e14d663c7f02be9cbdaf2f2dc8263aa00c177239866f1be8eb30e041b5a50a99"
}
]
}
],
"fee": 256000000,
"allow_additional_actions": false
},
"sign_complete": true
}
}
Sign transactions used for batch signing transactions.
-
String
- password, signature of the password. -
Object
- transaction, builded transaction.
-
String
- status, status information -
Object
- data-
Boolean
- sign_complete, returns true if sign succesfully and false otherwise. -
Object
- transaction, signed transaction.
-
// Request
curl -X POST localhost:9888/sign-transactions -d '{"password":"123456","transactions":[{"raw_transaction":"0701000201620160a0d36052ca3d1335120ae48e1ffb2fb6b25588628eff90fa88bef3117dfb4301ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80ddb2c490e906010116001431630464f2b2058fe3c1fe5bee00742eaf2da8d901000161015f72de2064ab999acf22c05b5cf9c7d53164f80038b46b1ce426708514a30a3485ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80d4f4f69901000116001431630464f2b2058fe3c1fe5bee00742eaf2da8d9010001013fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8084c5b6aaea060116001431630464f2b2058fe3c1fe5bee00742eaf2da8d900","signing_instructions":[{"position":0,"witness_components":[{"type":"raw_tx_signature","quorum":1,"keys":[{"xpub":"b4d084e77bcda7fd8a37e31135200b2a6af98d19018674125dc6290dd14176f92523f229d9f1f3514b461f6931ac2073f586a35cd628c90270063725e6e1e983","derivation_path":["010100000000000000","0100000000000000"]}],"signatures":null},{"type":"data","value":"a86ab33efa9d71994270898ad99f198d60889ef617d5eaf25e776929a8973919"}]},{"position":1,"witness_components":[{"type":"raw_tx_signature","quorum":1,"keys":[{"xpub":"b4d084e77bcda7fd8a37e31135200b2a6af98d19018674125dc6290dd14176f92523f229d9f1f3514b461f6931ac2073f586a35cd628c90270063725e6e1e983","derivation_path":["010100000000000000","0100000000000000"]}],"signatures":null},{"type":"data","value":"a86ab33efa9d71994270898ad99f198d60889ef617d5eaf25e776929a8973919"}]}],"allow_additional_actions":false},{"raw_transaction":"0701000101620160571cc5d99a2994ff6b192bc9387838a3651245cb66dad4a6bc5f660310cebfa9ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8084c5b6aaea06000116001431630464f2b2058fe3c1fe5bee00742eaf2da8d9010002013effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80faafed99010116001431630464f2b2058fe3c1fe5bee00742eaf2da8d900013fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80ddb2c490e9060116001431630464f2b2058fe3c1fe5bee00742eaf2da8d900","signing_instructions":[{"position":0,"witness_components":[{"type":"raw_tx_signature","quorum":1,"keys":[{"xpub":"b4d084e77bcda7fd8a37e31135200b2a6af98d19018674125dc6290dd14176f92523f229d9f1f3514b461f6931ac2073f586a35cd628c90270063725e6e1e983","derivation_path":["010100000000000000","0100000000000000"]}],"signatures":null},{"type":"data","value":"a86ab33efa9d71994270898ad99f198d60889ef617d5eaf25e776929a8973919"}]}],"allow_additional_actions":false}]}'
// Result
{
"status": "success",
"data": {
"transaction": [{
"raw_transaction": "0701000201620160a0d36052ca3d1335120ae48e1ffb2fb6b25588628eff90fa88bef3117dfb4301ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80ddb2c490e906010116001431630464f2b2058fe3c1fe5bee00742eaf2da8d9630240acb57bc06f7e5de99ef3e630ce34fc74c33d4694301202968092ca50ae7842e3331bfeb0cf7b65f383e27670c4d58aeeeb0b77e5355957ca729298d2b4e2470c20a86ab33efa9d71994270898ad99f198d60889ef617d5eaf25e776929a89739190161015f72de2064ab999acf22c05b5cf9c7d53164f80038b46b1ce426708514a30a3485ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80d4f4f69901000116001431630464f2b2058fe3c1fe5bee00742eaf2da8d96302404298424e89e5528f1d0cdd9028489b9d9e3f031ec34a74440cacc7900dc1eac9359c408a4342fc6cef935d2978919df8b23f3912ac4419800d375fac06ddb50620a86ab33efa9d71994270898ad99f198d60889ef617d5eaf25e776929a897391901013fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8084c5b6aaea060116001431630464f2b2058fe3c1fe5bee00742eaf2da8d900",
"signing_instructions": [{
"position": 0,
"witness_components": [{
"type": "raw_tx_signature",
"quorum": 1,
"keys": [{
"xpub": "b4d084e77bcda7fd8a37e31135200b2a6af98d19018674125dc6290dd14176f92523f229d9f1f3514b461f6931ac2073f586a35cd628c90270063725e6e1e983",
"derivation_path": [
"010100000000000000",
"0100000000000000"
]
}],
"signatures": [
"acb57bc06f7e5de99ef3e630ce34fc74c33d4694301202968092ca50ae7842e3331bfeb0cf7b65f383e27670c4d58aeeeb0b77e5355957ca729298d2b4e2470c"
]
},
{
"type": "data",
"value": "a86ab33efa9d71994270898ad99f198d60889ef617d5eaf25e776929a8973919"
}
]
},
{
"position": 1,
"witness_components": [{
"type": "raw_tx_signature",
"quorum": 1,
"keys": [{
"xpub": "b4d084e77bcda7fd8a37e31135200b2a6af98d19018674125dc6290dd14176f92523f229d9f1f3514b461f6931ac2073f586a35cd628c90270063725e6e1e983",
"derivation_path": [
"010100000000000000",
"0100000000000000"
]
}],
"signatures": [
"4298424e89e5528f1d0cdd9028489b9d9e3f031ec34a74440cacc7900dc1eac9359c408a4342fc6cef935d2978919df8b23f3912ac4419800d375fac06ddb506"
]
},
{
"type": "data",
"value": "a86ab33efa9d71994270898ad99f198d60889ef617d5eaf25e776929a8973919"
}
]
}
],
"allow_additional_actions": false
},
{
"raw_transaction": "0701000101620160571cc5d99a2994ff6b192bc9387838a3651245cb66dad4a6bc5f660310cebfa9ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8084c5b6aaea06000116001431630464f2b2058fe3c1fe5bee00742eaf2da8d96302408c742d77eba6c56a8db8c114e60be6c6263df6120aefd7538376129d04ec71b78b718c2085bba85254b44bf4600ba31d4c5a7869d0be0c46d88bd5eb27490e0820a86ab33efa9d71994270898ad99f198d60889ef617d5eaf25e776929a897391902013effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80faafed99010116001431630464f2b2058fe3c1fe5bee00742eaf2da8d900013fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80ddb2c490e9060116001431630464f2b2058fe3c1fe5bee00742eaf2da8d900",
"signing_instructions": [{
"position": 0,
"witness_components": [{
"type": "raw_tx_signature",
"quorum": 1,
"keys": [{
"xpub": "b4d084e77bcda7fd8a37e31135200b2a6af98d19018674125dc6290dd14176f92523f229d9f1f3514b461f6931ac2073f586a35cd628c90270063725e6e1e983",
"derivation_path": [
"010100000000000000",
"0100000000000000"
]
}],
"signatures": [
"8c742d77eba6c56a8db8c114e60be6c6263df6120aefd7538376129d04ec71b78b718c2085bba85254b44bf4600ba31d4c5a7869d0be0c46d88bd5eb27490e08"
]
},
{
"type": "data",
"value": "a86ab33efa9d71994270898ad99f198d60889ef617d5eaf25e776929a8973919"
}
]
}],
"allow_additional_actions": false
}
],
"sign_complete": true
}
}
Returns the list of account votes.
optional:
-
String
- account_alias, alias of account. -
String
- account_id, id of account.
-
String
- status, status information -
Object
- data-
String
- account_id, id of account. -
String
-account_alias, alias of account. -
Integer
- total_vote_number, account total vote number. -
Array of Object
- vote_details, vote array:-
String
-vote pubkey of vote node. -
Integer
- vote_number vote number.
-
-
// Request
curl -X POST list-account-votes -d '{"account_alias": "alice", "account_id": "e894d0ac-7933-49de-b0f0-0f568d652988"}'
// Result
{
"status": "success",
"data": [
{
"account_id": "e894d0ac-7933-49de-b0f0-0f568d652988",
"account_alias": "alice",
"total_vote_number": 20000000000,
"vote_details": [
{
"vote": "2e171e9aed46633f3560cf4d207c4edb92e5ad6b6f63daee44aa0ed4c58f76fd4d0081f225d2b119ac398749dbc7aa113603bc7710693c54852d33b6b082daab",
"vote_number": 10000000000
},
{
"vote": "896285b552bfe0647c0effaee41e5ce98a77981396455259792300cfbc0988bfb1a723488cedf0e73c3220e273fb6843abfbee025d7401b67bf81641b208dfc1",
"vote_number": 10000000000
}
]
}
]
}
Submit transaction.
Object
:
-
Object
- raw_transaction, raw_transaction of signed transaction.
-
String
- status, status information -
Object
- data-
String
- tx_id, transaction id, hash of transaction.
-
// Request
curl -X POST submit-transaction -d '{"raw_transaction":"070100010161015fd4d47100a40069edb2541a820de335bc22093008d5ffb6b823ad11ebc6b42865ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc0c5f8ed01000116001433cc42c8598e5b0bdf42a20c338c7a95aa535f7900630240c9e576b25d57bf84fddb52edd62e72011f4dee3ac278f081cce299d93edaca39898e4d870e91f69f5953939a3e58b51272fc6f5a683a499752baa203f16e650920e14d663c7f02be9cbdaf2f2dc8263aa00c177239866f1be8eb30e041b5a50a990101003dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc0c5ef7301160014d950f1bc4a88692e20fed82f50fa123c164ea8780000"}'
// Result
{
"status": "success",
"data": {
"tx_id": "85eed0e39d8bd533748541d91b9ab1cb7be0fa2528f7a8e52e0b3ac8732ea660"
}
}
Submit transactions used for batch submit transactions.
Object
:
-
Object
- raw_transactions, raw_transactions of signed transactions.
-
String
- status, status information -
Object
- data-
String
- tx_id, transaction id, hash of transaction.
-
// Request
curl -X POST localhost:9888/submit-transactions -d '{"raw_transactions":["0701000201620160a0d36052ca3d1335120ae48e1ffb2fb6b25588628eff90fa88bef3117dfb4301ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80ddb2c490e906010116001431630464f2b2058fe3c1fe5bee00742eaf2da8d9630240acb57bc06f7e5de99ef3e630ce34fc74c33d4694301202968092ca50ae7842e3331bfeb0cf7b65f383e27670c4d58aeeeb0b77e5355957ca729298d2b4e2470c20a86ab33efa9d71994270898ad99f198d60889ef617d5eaf25e776929a89739190161015f72de2064ab999acf22c05b5cf9c7d53164f80038b46b1ce426708514a30a3485ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80d4f4f69901000116001431630464f2b2058fe3c1fe5bee00742eaf2da8d96302404298424e89e5528f1d0cdd9028489b9d9e3f031ec34a74440cacc7900dc1eac9359c408a4342fc6cef935d2978919df8b23f3912ac4419800d375fac06ddb50620a86ab33efa9d71994270898ad99f198d60889ef617d5eaf25e776929a897391901013fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8084c5b6aaea060116001431630464f2b2058fe3c1fe5bee00742eaf2da8d900","0701000101620160571cc5d99a2994ff6b192bc9387838a3651245cb66dad4a6bc5f660310cebfa9ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8084c5b6aaea06000116001431630464f2b2058fe3c1fe5bee00742eaf2da8d96302408c742d77eba6c56a8db8c114e60be6c6263df6120aefd7538376129d04ec71b78b718c2085bba85254b44bf4600ba31d4c5a7869d0be0c46d88bd5eb27490e0820a86ab33efa9d71994270898ad99f198d60889ef617d5eaf25e776929a897391902013effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80faafed99010116001431630464f2b2058fe3c1fe5bee00742eaf2da8d900013fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80ddb2c490e9060116001431630464f2b2058fe3c1fe5bee00742eaf2da8d900"]}'
// Result
{
"status": "success",
"data": {
"tx_id": ["8524bf38701c17c57e2ad7368c0d6c815eb30e92713ff5dd86c1a931cddf2e95", "a0bbfb75c9a00bb2d4801aa95ed0479993a67acfd1cec5b77a8ff86966f52dac"]
}
}
Estimate consumed neu(1BTM = 10^8NEU) for the transaction.
Object
:
-
Object
- transaction_template, builded transaction response.
-
String
- status, status information -
Object
-data-
Integer
- total_neu, total consumed neu(1BTM = 10^8NEU) for execute transaction, total_neu is rounded up storage_neu + vm_neu. -
Integer
- storage_neu, consumed neu for storage transaction . -
Integer
- vm_neu, consumed neu for execute VM.
-
// Request
curl -X POST estimate-transaction-gas -d '{"transaction_template":{"allow_additional_actions":false,"raw_transaction":"070100010161015ffe8a1209937a6a8b22e8c01f056fd5f1730734ba8964d6b79de4a639032cecddffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8099c4d59901000116001485eb6eee8023332da85df60157dc9b16cc553fb2010002013dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80afa08b4f011600142b4fd033bc76b4ddf5cb00f625362c4bc7b10efa00013dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8090dfc04a011600146eea1ce6cfa5b718ae8094376be9bc1a87c9c82700","signing_instructions":[{"position":0,"witness_components":[{"keys":[{"derivation_path":["010100000000000000","0100000000000000"],"xpub":"cb4e5932d808ee060df9552963d87f60edac42360b11d4ad89558ef2acea4d4aaf4818f2ebf5a599382b8dfce0a0c798c7e44ec2667b3a1d34c61ba57609de55"}],"quorum":1,"signatures":null,"type":"raw_tx_signature"},{"type":"data","value":"1c9b5c1db7f4afe31fd1b7e0495a8bb042a271d8d7924d4fc1ff7cf1bff15813"}]}]}}'
// Result
{
"status": "success",
"data": {
"storage_neu": 3840000,
"total_neu": 5259000,
"vm_neu": 1419000
}
}
Create access token, it provides basic access authentication for HTTP protocol, returns token contain username and password, they are separated by a colon.
Object
:
-
String
- id, token ID.
optional:
-
String
- type, type of token.
-
String
- status, status information -
Object
- data-
String
- token, access token, authentication username and password are separated by a colon. -
String
- id, token ID. -
String
- type, type of token. -
Object
- created_at, time to create token.
-
create access token.
// Request
curl -X POST create-access-token -d '{"id":"token1"}'
// Result
{
"status": "success",
"data": {
"id": "token1",
"token": "token1:e155ef989f80ab1c228362316a26ccd5ed0fa26d0ff431007acf39361853c912",
"created_at": "2021-08-18T15:07:36.6947417+08:00"
}
}
Returns the list of all available access tokens.
none
-
String
- status, status information -
Array of Object
, access token array.-
Object
:-
String
- token, access token. -
String
- id, token ID. -
String
- type, type of token. -
Object
- created_at, time to create token.
-
-
list all the available access tokens.
// Request
curl -X POST list-access-tokens -d {}
// Result
{
"status": "success",
"data": [
{
"id": "token1",
"token": "token1:e155ef989f80ab1c228362316a26ccd5ed0fa26d0ff431007acf39361853c912",
"created_at": "2021-08-18T15:07:36.6947417+08:00"
}
]
}
Delete existed access token.
Object
:
-
String
- id, token ID.
-
String
- status,status information
delete access token.
// Request
curl -X POST delete-access-token -d '{"id": "token1"}'
// Result
{
"status": "success"
}
Check access token is valid.
Object
:
-
String
- id, token ID. -
String
- secret, secret of token, the second part of the colon division for token.
-
String
- status,status information
check whether the access token is vaild or not.
// Request
curl -X POST check-access-token -d '{"id": "token1", "secret": "1fee70f537128a201338bd5f25a3adbf33dad02eae4f4c9ac43f336a069df8f3"}'
// Result
{
"status": "success"
}
Query mempool transaction by transaction ID.
Object
:
-
String
- tx_id, transaction id, hash of transaction.
-
String
-status,status information -
Object
-data-
String
- id, transaction id, hash of the transaction. -
Integer
- version, version of transaction. -
Integer
- size, size of transaction. -
Integer
- time_range, the time range of transaction. -
String
- mux_id, the previous transaction mux id(wallet enable can be acquired, this place is empty). -
Array of Object
- inputs, object of inputs for the transaction(input struct please refer to get-transaction API description). -
Array of Object
- outputs, object of outputs for the transaction(output struct please refer to get-transaction API description).
-
// Request
curl -X POST get-unconfirmed-transaction -d '{"tx_id": "382090f24fbfc2f737fa7372b9d161a43f00d1c597a7130a56589d1f469d04b5"}'
// Result
{
"id": "382090f24fbfc2f737fa7372b9d161a43f00d1c597a7130a56589d1f469d04b5",
"inputs": [
{
"address": "bn1qckpcdgjnunkpnavaep2yumka5r9dq4d7vnsx2j",
"amount": 41250000000,
"asset_definition": {},
"asset_id": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"control_program": "001400f7e1f338378834161b5bb73da251e6d0566396",
"input_id": "a0c2fa0719bfe1446681537dcf1f8d0f03add093e29d12481eb807e07778d7b3",
"spent_output_id": "161b44e547a6cc68d732eb64fa38031da98211a99319e088cfe632223f9ac6d8",
"type": "spend",
"witness_arguments": [
"cf0e1b217ab92ade8e81fab10f9f307bb5cc1ad947b5629e3f7a760aba722f5044f2ab59ec92fa4264ff5811de4361abb6eabd7e75ffd28a813a98ceff434c01",
"6890a19b21c326059eef211cd8414282a79d3b9203f2592064221fd360e778a7"
]
}
],
"mux_id": "842cd07eed050b547377b5b123f14a5ec0d76933d564f030cf4d5d5c15769645",
"outputs": [
{
"address": "bn1qckpcdgjnunkpnavaep2yumka5r9dq4d7vnsx2j",
"amount": 21230000000,
"asset_definition": {},
"asset_id": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"control_program": "0014cdccda61b3c8716bd258f29089c5f7eb1be3fe08",
"id": "a8f21ad24689c290634db85278f56d152efe6fe08bc194e5dee5127ed6d3ebee",
"position": 0,
"type": "control"
},
{
"address": "bn1qckpcdgjnunkpnavaep2yumka5r9dq4d7vnsx2j",
"amount": 20000000000,
"asset_definition": {},
"asset_id": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"control_program": "001456f2543b189ee39b8663c0ca546272f45f282849",
"id": "78219e422ea3257aeb32f6d952b5ce5560dab1d6440c9f3aebcdaad2a852d2a8",
"position": 1,
"type": "control"
}
],
"size": 664,
"time_range": 0,
"version": 1
}
Returns the total number of mempool transactions and the list of transaction IDs.
none
-
String
-status,status information -
Object
-data-
Integer
- total, total amount of transactions. -
Array of Object
- tx_ids, list of transaction id.
-
// Request
curl -X POST list-unconfirmed-transactions -d {}
// Result
{
"status": "success",
"data": {
"total": 1,
"tx_ids": [
"a8b6ba0e97956d97f18cb44c6b2a8351ba3ad6acf06e7264a239af8a81700175"
]
}
}
Decode a serialized transaction hex string into a JSON object describing the transaction.
Object
:
-
String
- raw_transaction, hexstring of raw transaction.
-
String
-status,status information -
Object
-data-
String
- tx_id, transaction ID. -
Integer
- version, version of transaction. -
String
- size, size of transaction. -
String
- time_range, time range of transaction. -
String
- fee, fee for sending transaction. -
Array of Object
- inputs, object of inputs for the transaction(input struct please refer to get-transction API description). -
Array of Object
- outputs, object of outputs for the transaction (output struct please refer to get-transaction API description).
-
// Request
curl -X POST decode-raw-transaction -d '{"raw_transaction": "070100010161015fd4d47100a40069edb2541a820de335bc22093008d5ffb6b823ad11ebc6b42865ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc0c5f8ed01000116001433cc42c8598e5b0bdf42a20c338c7a95aa535f790001000101003dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc0c5ef7301160014d950f1bc4a88692e20fed82f50fa123c164ea8780000"}'
// Result
{
"status": "success",
"data": {
"tx_id": "85eed0e39d8bd533748541d91b9ab1cb7be0fa2528f7a8e52e0b3ac8732ea660",
"version": 1,
"size": 171,
"time_range": 0,
"inputs": [
{
"type": "spend",
"asset_id": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"asset_definition": {},
"amount": 499000000,
"control_program": "001433cc42c8598e5b0bdf42a20c338c7a95aa535f79",
"address": "bn1qx0xy9jze3edshh6z5gxr8rr6jk49xhmec2enaw",
"spent_output_id": "8e84b6a3047e00a4c740d2741ad4cdbfa2aa74da774c3271f6f14376f0afa34c",
"input_id": "3a82a64533706d2a1fa1297fe651efcc3a2e9ba6818b3c69247542812a50fbfb",
"witness_arguments": null,
"sign_data": "d7aa7dcbb6373c2e0f1e617cc894418dc41ada4c97a7159e4a5030a2a3307f0a"
}
],
"outputs": [
{
"type": "control",
"id": "9077316730920c285def920534722e59fe0953c9e013394663780dfe7c9d714c",
"position": 0,
"asset_id": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"asset_definition": {},
"amount": 243000000,
"control_program": "0014d950f1bc4a88692e20fed82f50fa123c164ea878",
"address": "bn1qm9g0r0z23p5jug87mqh4p7sj8stya2rc48w7s7"
}
],
"fee": 256000000
}
}
Returns the current block height for blockchain.
none
-
String
-status,status information -
Object
-data-
Integer
- block_count, recent block height of the blockchain.
-
// Request
curl -X POST get-block-count
// Result
{
"status": "success",
"data": {
"block_count": 23959
}
}
Returns the current block hash for blockchain.
none
-
String
-status,status information -
Object
-data-
String
- block_hash, recent block hash of the blockchain.
-
// Request
curl -X POST get-block-hash
// Result
{
"status": "success",
"data": {
"block_hash": "7bc31831bfc148db98684f6939c7756d9fa7b20c91efa1b6868953f4963f655e"
}
}
Returns the detail block by block height or block hash.
Object
: block_height | block_hash
optional:
-
String
- block_hash, hash of block. -
Integer
- block_height, height of block.
Object
:
-
String
- hash, hash of block. -
Integer
- size, size of block. -
Integer
- version, version of block. -
Integer
- height, height of block. -
String
- * validator*,block producer xpub hash -
String
- previous_block_hash, previous block hash. -
Integer
- timestamp, timestamp of block. -
String
- transaction_merkle_root, merkle root of transaction. -
Array of Object
- transactions, transaction object:-
String
- id, transaction id, hash of the transaction. -
Integer
- version, version of transaction. -
Integer
- size, size of transaction. -
Integer
- time_range, the unix timestamp for when the requst was responsed. -
String
- mux_id, the previous transaction mux id(source id of utxo). -
Array of Object
- inputs, object of inputs for the transaction.-
String
- type, the type of input action, available option include: 'spend', 'issue', 'coinbase'.'veto' -
String
- asset_id, asset id. -
Object
- asset_definition, definition of asset(json object). -
Integer
- amount, amount of asset. -
Object
- issuance_program, issuance program, it only exist when type is 'issue'. -
Object
- control_program, control program of account, it only exist when type is 'spend'. -
String
- address, address of account, it only exist when type is 'spend'. -
String
- spent_output_id, the front of outputID to be spent in this input, it only exist when type is 'spend'. -
Object
- arbitrary, arbitrary infomation can be set by miner, it only exist when type is 'coinbase'. -
String
- input_id, hash of input action. -
Array of String
- witness_arguments, witness arguments. -
String
- sign_data,signature for input -
String
- vote,vote node public key, it only exist when type is 'veto'.
-
-
Array of Object
- outputs, object of outputs for the transaction.-
String
- type, the type of output action, available option include: 'retire', 'control','vote'. -
String
- id, outputid related to utxo. -
Integer
- position, position of outputs. -
String
- asset_id, asset id. -
Object
- asset_definition, definition of asset(json object). -
Integer
- amount, amount of asset. -
Object
- control_program, control program of account. -
String
- address, address of account. -
String
- vote,vote node public key, it only exist when type is 'vote'.
-
-
get specified block information by block_hash or block_height, if both exists, the block result is querying by hash.
// Request
curl -X POST get-block -d '{"block_height": 43, "block_hash": "886a8e85b275e7d65b569ba510875c0e63dece1a94569914d7624c0dac8002f9"}'
// Result
{
"status": "success",
"data": {
"hash": "ccd5664ebc5583f4ec3ac7170b8d674cc937122f6ff2b6edd30f48f119a1c57e",
"size": 1718,
"version": 1,
"height": 0,
"validator": "",
"previous_block_hash": "0000000000000000000000000000000000000000000000000000000000000000",
"timestamp": 1528945000000,
"transaction_merkle_root": "1cc3b6d2326c79cb9ef3aada362262f205bf1d25048b0da5fe66bcc7bcc3ae20",
"transactions": [
{
"id": "c85cc9206593e91b8055372af375bfc103f4e687c5effe6f9bcb58b388ef6cb5",
"version": 1,
"size": 153,
"time_range": 0,
"inputs": [
{
"type": "coinbase",
"asset_id": "0000000000000000000000000000000000000000000000000000000000000000",
"asset_definition": {},
"amount": 0,
"arbitrary": "496e666f726d6174696f6e20697320706f7765722e202d2d204a616e2f31312f323031332e20436f6d707574696e6720697320706f7765722e202d2d204170722f32342f323031382e",
"input_id": "953b17a15c82cc524e0e25230736a512809dc1a5fe6c0b29747fa2de2e2d64b4",
"witness_arguments": null,
"sign_data": "0000000000000000000000000000000000000000000000000000000000000000"
}
],
"outputs": [
{
"type": "control",
"id": "f298f2615177930ed102a90222a28e7655209e54ac0bb06821250a685b364657",
"position": 0,
"asset_id": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"asset_definition": {},
"amount": 169073559178579697,
"control_program": "00148dea804c8f5a27518be2696e43dca0352b9a93cc",
"address": "tn1q3h4gqny0tgn4rzlzd9hy8h9qx54e4y7vlfdu47"
}
],
"mux_id": "76398f6c0096af2a8fca51ccbc6cff5ad50115950f041d292babfb9f77a9765e"
},
{
"id": "d4c208871e8dc2ea2111d2990e0c238569284bab6a54c5fead619ec94a3726c2",
"version": 1,
"size": 627,
"time_range": 0,
"inputs": [
{
"type": "issue",
"asset_id": "a0a71c215764e342d10d003be6369baf4145d9c7977f7b8f6bf446e628d8b8b8",
"asset_definition": {
"decimals": 8,
"description": {},
"name": "MAG",
"quorum": 2,
"reissue": "true",
"symbol": "MAG"
},
"amount": 100000000000000,
"issuance_program": "ae20d66ab117eca2bba6aefed569e52d6bf68a7a4ad7d775cbc01f7b2cfcd798f7b22031ab3c2147c330c5e360b4e585047d1dea5f529476ad5aff475ecdd55541923120851b4a24975df6dbeb4f8e5348542764f85bed67b763875325aa5e45116751b35253ad",
"input_id": "61a45c4cef84b2fc486ead3abfda36c1e83526c6e7c3e601534164610c5bcb00",
"witness_arguments": null,
"sign_data": "c944490bdd4b23762e602af64d198a83608a0057789a27dca476a1bfe64d8395"
},
{
"type": "issue",
"asset_id": "47fcd4d7c22d1d38931a6cd7767156babbd5f05bbbb3f7d3900635b56eb1b67e",
"asset_definition": {
"decimals": 8,
"description": {},
"name": "SUP",
"quorum": 1,
"reissue": "false",
"symbol": "SUP"
},
"amount": 9866701291045,
"issuance_program": "0354df07cda069ae203c939b7ba615a49adf57b5b4c9c37e80666436970f8507d56a272539cabcb9e15151ad",
"input_id": "2b53fd0c76b5ce94ef269d3b5fcbb47283ffa8adcad6d4381e0145c9831c1713",
"witness_arguments": null,
"sign_data": "3ce7b9dc79ba37d318d668270a85fce4d877662d99bec25905bbf16a2740fb90"
}
],
"outputs": [
{
"type": "control",
"id": "1da9cefc18c43ed93599ddb2aca9e7ec8423de960526c2592bad840d2c02e0d7",
"position": 0,
"asset_id": "a0a71c215764e342d10d003be6369baf4145d9c7977f7b8f6bf446e628d8b8b8",
"asset_definition": {},
"amount": 100000000000000,
"control_program": "00148dea804c8f5a27518be2696e43dca0352b9a93cc",
"address": "tn1q3h4gqny0tgn4rzlzd9hy8h9qx54e4y7vlfdu47"
},
{
"type": "control",
"id": "4e0432297c20cf9c623b61ff0e3f9aa25604e058b49968ff3c0d631f6d7c4abe",
"position": 1,
"asset_id": "47fcd4d7c22d1d38931a6cd7767156babbd5f05bbbb3f7d3900635b56eb1b67e",
"asset_definition": {},
"amount": 9866701291045,
"control_program": "00148dea804c8f5a27518be2696e43dca0352b9a93cc",
"address": "tn1q3h4gqny0tgn4rzlzd9hy8h9qx54e4y7vlfdu47"
}
],
"mux_id": "52270d00adf94950b9cdb5bb3471e49254b3445f911564594401d96f7fcb8615"
}
]
}
}
Returns the detail block header by block height or block hash.
optional:
-
String
- block_hash, hash of block. -
Integer
- block_height, height of block.
-
String
-status,status information -
Object
-data-
Object
- block_header, header of block.
-
// Request
curl -X POST get-block-header -d '{"block_height": 43, "block_hash": "886a8e85b275e7d65b569ba510875c0e63dece1a94569914d7624c0dac8002f9"}'
// Result
{
"status": "success",
"data": {
"block_header": "01012bb02f815ad8538d0fab91c822c4125aa10d2679eaf59cb806c8dad95b093be0e9b0ca9fedb42f20567572e2dbce3d88ee9fbd7dc76f40dbbde0164c05f060464f5b7f66347e283341400f022d806c1eb8e44ccf6d25e1b9e50adf4b2daf76e14c166b979c25117a0c0ee4ed1fd6690ba9ea230314c0338c3a6b1696c9eedff0aedcfac11e0644c8df0c0100"
}
}
Returns the information of current network
none
-
String
-status,status information -
Object
- data-
Boolean
- listening, whether the node is listening. -
Boolean
- syncing, whether the node is syncing. -
Boolean
- mining, whether the node is mining. -
String
- node_xpub, node pubkey. -
Integer
- peer_count, current count of connected peers. -
Integer
- highest_height, current highest block of the connected peers. -
String
- network_id, network id. -
Object
- version_info, bytomd version information:-
String
- version, current version of the runningbytomd
. -
uint16
- update, whether there exists an update.- 0: no update;
- 1: small update;
- 2: significant update.
-
String
- new_version, the newest version ofbytomd
if there is one.
-
-
// Request
curl -X POST net-info
// Result
{
"status": "success",
"data": {
"listening": true,
"syncing": false,
"mining": false,
"node_xpub": "52db4dddde5d943e8815eb7874f98722e5696198c03c20a569ecff47c84e082103e609b7833b56f8e1fa38c1c91a82a7377758f5d8bf6e4c5fbaafc7ab289695",
"peer_count": 0,
"highest_height": 98613,
"network_id": "mainnet",
"version_info": {
"version": "2.0.2+3f76ecfb",
"update": 0,
"new_version": "2.0.2+3f76ecfb"
}
}
}
Returns the mining status.
none
Object
:
-
Boolean
- is_mining, whether the node is mining.
// Request
curl -X POST is-mining
// Result
{
"status": "success",
"data": {
"is_mining": false
}
}
Start up node mining.
Object
:
-
Boolean
- is_mining, whether the node is mining.
-
String
-status,status information -
String
- data,error data, return null if succeed
// Request
curl -X POST set-mining -d '{"is_mining": true}'
// Result
{
"status": "success",
"data": ""
}
Quary gas rate.
none
-
String
-status,status information -
Object
- data-
Integer
- gas_rate, gas rate.
-
// Request
curl -X POST gas-rate -d '{}'
// Result
{
"status": "success",
"data": {
"gas_rate": 200
}
}
Verify a signed message with derived pubkey of the address.
Object
:
-
String
- address, address for account. -
String
- derived_xpub, derived xpub. -
String
- message, message for signature by derived_xpub. -
String
- signature, signature for message.
Object
:
-
Boolean
- result, verify result.
// Request
curl -X POST verify-message -d '{"address":"bn1quzkzd38wyraftws4sku8g98f9hdm62e46v9enr", "derived_xpub":"6ff8c3d1321ce39a3c3550f57ba70b67dcbcef821e9b85f6150edb7f2f3f91009e67f3075e6e76ed5f657ee4b1a5f4749b7a8c74c8e7e6a1b0e5918ebd5df4d0", "message":"this is a test message", "signature":"74da3d6572233736e3a439166719244dab57dd0047f8751b1efa2da26eeab251d915c1211dcad77e8b013267b86d96e91ae67ff0be520ef4ec326e911410b609"}'
// Result
{
"result": true
}
Returns the list of connected peers.
none
-
String
- status, status information -
Array of Object
, connected peers.-
Object
:-
String
- peer_id, peer id. -
String
- remote_addr, the address(IP and port) of connected peer. -
Integer
- height, the current height of connected peer. -
String
- ping, the delay time of connected peer. -
String
- duration, the connected time. -
Integer
- total_sent, total data sent in byte. -
Integer
- total_received, total data received in byte. -
Integer
- average_sent_rate, average data sent rate in byte. -
Integer
- average_received_rate, average data received rate in byte. -
Integer
- current_sent_rate, current data sent rate in byte. -
Integer
- current_received_rate, current data received rate in byte.
-
-
// Request
curl -X POST list-peers -d '{}'
// Result
{
"status": "success",
"data": [
{
"peer_id": "88c0fda80b0415caa665f52f78b1864d97afbd8228ef108ae9afbb9ea63ebfc6",
"moniker": "anonymous",
"remote_addr": "139.196.235.27:46656",
"height": 27315,
"ping": "12.22s",
"duration": "2h51m56.2s",
"total_sent": 413033,
"total_received": 840480,
"average_sent_rate": 40,
"average_received_rate": 81,
"current_sent_rate": 29,
"current_received_rate": 123
}
]
}
Disconnect to specified peer.
Object
:
-
String
- peer_id, peer id.
-
String
- status, status information
// Request
curl -X POST disconnect-peer -d '{"peer_id":"29661E8BB9A8149F01C6594E49EA80C6B18BF247946A7E2E01D8235BBBFC3594"}'
// Result
{
"status": "success"
}
Connect to specified peer.
Object
:
-
String
- ip, peer IP address. -
Integer
- port, peer port.
-
String
- status, status information -
Object
- data-
String
- peer_id, peer id. -
String
- remote_addr, the address(IP and port) of connected peer. -
Integer
- height, the current height of connected peer. -
Integer
- delay, the delay time of connected peer.
-
// Request
curl -X POST connect-peer -d '{"ip":"139.198.177.164", "port":46657}'
// Result
{
"status": "success"
"data": {
"peer_id": "29661E8BB9A8149F01C6594E49EA80C6B18BF247946A7E2E01D8235BBBFC3594",
"remote_addr": "139.198.177.164:46657",
"height": 65941,
"delay": 0
}
}
Returns vote result at specific block height.
optional:
-
String
- block_hash, hash of block. -
Integer
- block_height, height of block.
-
String
- status, status information -
Array of Object
, vote array-
String
- vote pubkey of vote node. -
Integer
- vote_number vote number.
-
// Request
curl -X POST get-vote-result -d '{"block_height": 100000}'
// Result
{
"status": "success",
"data": [
{
"vote": "aa5cb0d5d193a141ce66dd3448e8d74d73bed1131ea05b130c14c95ad04b0295f2d4d3f421ae10a2517f7431e0eca119fea509e0650bd20b4a64b856b5473f35",
"vote_number": 10000000000
},
{
"vote": "98e6ab8c654bb31e0c432a2c9ff13a6e3419dcb8a1df94f2839f41d79e94b6ca7a68f60b793d947195f761187b37275fbeb345041d5ea3039c5d328b63e3d489",
"vote_number": 10000000000
},
{
"vote": "896285b552bfe0647c0effaee41e5ce98a77981396455259792300cfbc0988bfb1a723488cedf0e73c3220e273fb6843abfbee025d7401b67bf81641b208dfc1",
"vote_number": 10000000000
}
]
}
Create a contract that the user wants to register on bytom to follow the bcrp protocol.
Object
:
-
String
- alias, alias of contract. -
String
- contract, contract content.
-
String
- status, status information -
Object
- data-
String
- id, contract hash. -
String
- alias, contract alias. -
String
- contract, contract content. -
String
- call_program, contract calling program. -
String
- register_program, contract registration program.
-
// Request
curl -X POST create-contract -d '{"alias": "swap","contract": "20e9108d3ca8049800727f6a3505b3a2710dc579405dde03c250f16d9a7e1e6e787403ae7cac00c0"}'
// Result
{
"status": "success",
"data": {
"id": "4e4f02d43bf50171f7f25d046b7f016002da410fc00d2e8902e7b170c98cf946",
"alias": "swap",
"contract": "20e9108d3ca8049800727f6a3505b3a2710dc579405dde03c250f16d9a7e1e6e787403ae7cac00c0",
"call_program": "0462637270204e4f02d43bf50171f7f25d046b7f016002da410fc00d2e8902e7b170c98cf946",
"register_program": "6a046263727001012820e9108d3ca8049800727f6a3505b3a2710dc579405dde03c250f16d9a7e1e6e787403ae7cac00c0"
}
}
Update alias for the existed contract.
Object
:
-
String
- id, contract hash. -
String
- alias, new contract alias.
-
String
- status, status information
// Request
curl -X POST update-contract-alias -d '{"id": "4e4f02d43bf50171f7f25d046b7f016002da410fc00d2e8902e7b170c98cf946","alias":"lock"}'
// Result
{
"status": "success"
}
Query the contract content by id.
Object
:
-
String
- id, contract hash.
-
String
- status, status information -
Object
- data-
String
- id, contract hash. -
String
- alias, contract alias. -
String
- contract, contract content. -
String
- call_program, contract calling program. -
String
- register_program, contract registration program.
-
// Request
curl -X POST get-contract -d '{"id": "4e4f02d43bf50171f7f25d046b7f016002da410fc00d2e8902e7b170c98cf946"}'
// Result
{
"status": "success",
"data": {
"id": "4e4f02d43bf50171f7f25d046b7f016002da410fc00d2e8902e7b170c98cf946",
"alias": "lock",
"contract": "20e9108d3ca8049800727f6a3505b3a2710dc579405dde03c250f16d9a7e1e6e787403ae7cac00c0",
"call_program": "0462637270204e4f02d43bf50171f7f25d046b7f016002da410fc00d2e8902e7b170c98cf946",
"register_program": "6a046263727001012820e9108d3ca8049800727f6a3505b3a2710dc579405dde03c250f16d9a7e1e6e787403ae7cac00c0"
}
}
Returns the list of all available contracts.
none
-
String
- status, status information -
Array of Object
-data, all available contracts.- `Object:
-
String
- id, contract hash. -
String
- alias, contract alias. -
String
- contract, contract content. -
String
- call_program, contract calling program. -
String
- register_program, contract registration program.
-
- `Object:
// Request
curl -X POST get-contract -d '{}'
// Result
{
"status": "success",
"data": [
{
"id": "4e4f02d43bf50171f7f25d046b7f016002da410fc00d2e8902e7b170c98cf946",
"alias": "lock",
"contract": "20e9108d3ca8049800727f6a3505b3a2710dc579405dde03c250f16d9a7e1e6e787403ae7cac00c0",
"call_program": "0462637270204e4f02d43bf50171f7f25d046b7f016002da410fc00d2e8902e7b170c98cf946",
"register_program": "6a046263727001012820e9108d3ca8049800727f6a3505b3a2710dc579405dde03c250f16d9a7e1e6e787403ae7cac00c0"
}
]
}
Returns the chain status of current network node.
none
-
String
- status, status information -
Object
-data-
Integer
- current_height, current block height of blockchain. -
String
- current_hash, current block hash of blockchain. -
Integer
- finalized_height, finalized block height of blockchain. -
String
- finalized_hash, finalized block hash of blockchain. -
Integer
- justified_height, justified block height of blockchain. -
String
- justified_hash, justified block hash of blockchain.
-
// Request
curl -X POST chain-status
// Result
{
"status":"success",
"data":{
"current_height":146906,
"current_hash":"3a7eaa77045a2aa3fb810a215f3049e84b5033dda78f0865298ed68b05258b9c",
"finalized_height":146800,
"finalized_hash":"e7d8b6b56b6aed64f37d9efd7ce8bb733ebbba22b7d7cca103136ae7def41cae",
"justified_height":146900,
"justified_hash":"b2c3439c61c83c7b50d9aee2d2197d6601734dcd4e11a228e33ff8f14c90df2f"
}
}
by bytom
Coming soon