-
Notifications
You must be signed in to change notification settings - Fork 361
API Reference
Default JSON-RPC endpoints:
| Client | URL |
|---|---|
| Go | http://localhost:9888 |
A complete request example via curl:
// curl -X POST url/method -d data
curl -X POST http://localhost:9888/create-key -d '{"alias": "alice", "password": "123456"}'create-keylist-keysdelete-keyreset-key-passwordcreate-accountlist-accountsdelete-accountcreate-account-receiverlist-addressesvalidate-addresscreate-assetget-assetlist-assetsupdate-asset-aliaslist-balanceslist-unspent-outputsbuild-transactionsign-transactionsubmit-transactionestimate-transaction-gasget-transactionlist-transactionsbackup-walletrestore-walletsign-message
create-access-tokenlist-access-tokensdelete-access-tokencheck-access-tokencreate-transaction-feedget-transaction-feedlist-transaction-feedsdelete-transaction-feedupdate-transaction-feedget-unconfirmed-transactionlist-unconfirmed-transactionsdecode-raw-transactionget-block-countget-block-hashget-blockget-block-headerget-difficultyget-hash-ratenet-infois-miningset-mininggas-rateverify-messageget-worksubmit-work
Object:
-
String- alias, name of the key. -
String- password, password of the key.
Object:
-
String- alias, name of the key. -
String- xpub, pubkey of the key. -
String- file, path to the file of key.
// Request
curl -X POST create-key -d '{"alias": "alice", "password": "123456"}'
// Result
{
"alias": "alice",
"xpub": "a7dae957c2d35b42efe7e6871cf5a75ebd2a0d0e51caffe767db42d3e6d69dbe211d1ca492ecf05908fe6fa625ad61b3253375ea744c9442dd5551613ba50aea",
"file": "/Path/To/Library/Bytom/keystore/UTC--2018-04-22T06-30-27.609315219Z--0e34293c-8856-4f5f-b934-37456a3820fa"
}none
-
Array of Object, keys owned by the client.-
Object:-
String- alias, name of the key. -
String- xpub, pubkey of the key.
-
-
// Request
curl -X POST list-keys
// Result
[
{
"alias": "alice",
"xpub": "a7dae957c2d35b42efe7e6871cf5a75ebd2a0d0e51caffe767db42d3e6d69dbe211d1ca492ecf05908fe6fa625ad61b3253375ea744c9442dd5551613ba50aea",
"file": "/Path/To/Library/Bytom/keystore/UTC--2018-04-21T02-35-15.035935116Z--4f2b8bd7-0576-4b82-8941-6cc6da05efe3"
},
{
"alias": "bob",
"xpub": "d30a810e88532f73816b7b5007d413cbd21e526ae9159023e5262511893adc1526b8eacd691b27c080201d7d79336a4f3d2cb4c167d997821cad445765916254",
"file": "/Path/To/Library/Bytom/keystore/UTC--2018-04-22T06-30-27.609315219Z--0e34293c-8856-4f5f-b934-37456a3820fa"
}
]Object:
-
String- xpub, pubkey of the key. -
String- password, password of the key.
none if the key is deleted successfully.
// Request
curl -X POST delete-key -d '{"xpub": "a7dae957c2d35b42efe7e6871cf5a75ebd2a0d0e51caffe767db42d3e6d69dbe211d1ca492ecf05908fe6fa625ad61b3253375ea744c9442dd5551613ba50aea", "password": "123456"}'
// ResultObject:
-
String- xpub, pubkey of the key. -
String- old_password, old password of the key. -
String- new_password, new password of the key.
none if the key password is reset successfully.
// Request
curl -X POST reset-key-password -d '{"xpub": "a7dae957c2d35b42efe7e6871cf5a75ebd2a0d0e51caffe767db42d3e6d69dbe211d1ca492ecf05908fe6fa625ad61b3253375ea744c9442dd5551613ba50aea", "old_password": "123456", "new_password": "654321"}'
// ResultObject:
-
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.
Optional:
-
String- access_token, if optional when creating account locally. However, if you want to create account remotely, it's indispensable.
Object:
-
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.
// Request
curl -X POST create-account -d '{"root_xpubs":["2d6c07cb1ff7800b0793e300cd62b6ec5c0943d308799427615be451ef09c0304bee5dd492c6b13aaa854d303dc4f1dcb229f9578786e19c52d860803efa3b9a"],"quorum":1,"alias":"alice"}'
// Result
{
"alias": "alice",
"id": "08FO663C00A02",
"key_index": 1,
"quorum": 1,
"xpubs": [
"02581f1a2099e1696c498901c0049a22cc3e7f85db71c4ebb78f238d3ef8b323d2fd5c33b6f634aacdd25eb5e09c0c803077c521ef0524e4cc64d1a4420c8bc6"
]
}none
-
Array of Object, account array.-
Object:-
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.
-
-
list all the available accounts:
// Request
curl -X POST list-accounts -d {}
// Result
[
{
"alias": "alice",
"id": "086KQD75G0A02",
"key_index": 1,
"quorum": 1,
"xpubs": [
"180aab8bf247932a7cf68da5cc9a873266279155097612f1e5fdda4add88d5e91e2e7ce5b736f3ac933824cdee9effcf1531b90dfcb388e5cc306d14e9a2c85e"
]
},
{
"alias": "bob",
"id": "086KQO67G0A04",
"key_index": 2,
"quorum": 1,
"xpubs": [
"180aab8bf247932a7cf68da5cc9a873266279155097612f1e5fdda4add88d5e91e2e7ce5b736f3ac933824cdee9effcf1531b90dfcb388e5cc306d14e9a2c85e"
]
}
]Object:
-
String- account_info, alias or ID of account.
none if the account is deleted successfully.
// Request
curl -X POST delete-account -d '{"account_info": "alice"}'
or
curl -X POST delete-account -d '{"account_info": "08FO663C00A02"}'
// ResultObject: account_alias | account_id
optional:
-
String- account_alias, alias of account. -
String- account_id, id of account.
Object:
-
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": "0BDQARM800A02"}'// Result
{
"address": "bm1q5u8u4eldhjf3lvnkmyl78jj8a75neuryzlknk0",
"control_program": "0014a70fcae7edbc931fb276d93fe3ca47efa93cf064"
}-
String- account_alias, alias of account. -
String- account_id, id of account.
-
Array of Object, account address array.-
Object:-
String- account_alias, alias of account. -
String- account_id, id of account. -
String- address, address of account. -
Boolean- change, whether the account address is change.
-
-
list all the addresses:
// Request
curl -X POST list-addresses -d {}
// Result
[
{
"account_alias": "alice",
"account_id": "086KQD75G0A02",
"address": "bm1qcn9lf7nxhswratvmg6d78nq7r7yupm36qgsv55",
"change": false
},
{
"account_alias": "bob",
"account_id": "086KQD75G0A04",
"address": "bm1qfkf3tyc95m0axv2mfnjsnu7l0h5tyfnpgpud4lsz5m0xkqmhgy9sd4x24h",
"change": false
}
]list all the addresses by account_id or account_alias:
// Request
curl -X POST list-addresses -d '{"account_alias": "alice", "account_id": "086KQD75G0A02"}'
// Result
[
{
"account_alias": "alice",
"account_id": "086KQD75G0A02",
"address": "bm1qcn9lf7nxhswratvmg6d78nq7r7yupm36qgsv55",
"change": false
},
{
"account_alias": "alice",
"account_id": "086KQD75G0A02",
"address": "bm1qew4h5uvt5ssrtg2alms0j77r94c30m78ucrcxy",
"change": false
},
{
"account_alias": "alice",
"account_id": "086KQD75G0A02",
"address": "bm1qgnp4lte7wge0rsekevjlrdh39vkzz0c2alheue",
"change": false
}
]Object:
-
string- address, address of account.
Object:
-
Boolean- vaild, whether the account address is vaild. -
Boolean- is_local, whether the account address is local.
check whether the address is vaild or not.
// Request
curl -X POST validate-address -d {"address": "bm1qcn9lf7nxhswratvmg6d78nq7r7yupm36qgsv55"}
// Result
{
"vaild": true,
"is_local": true,
}Object:
-
Array of String- root_xpubs, pubkey array. -
String- alias, name of the asset. -
Integer- quorum, the default value is1, threshold of keys that must sign a transaction to spend asset units controlled by the account.
Optional:
-
Object- definition, definition of asset. -
String- access_token, if optional when creating asset locally. However, if you want to create asset remotely, it's indispensable.
Object:
-
String- id, asset id. -
String- alias, name of the asset. -
String- issuance_program, control program of the issuance of asset. -
Array of Object- keys, 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.
create asset.
// Request
curl -X POST create-asset -d '{"alias": "GOLD", "root_xpubs": ["f6a16704f745a168642712060e6c5a69866147e21ec2447ae628f87d756bb68cc9b91405ad0a95f004090e864fde472f62ba97053ea109837bc89d63a64040d5"], "quorum":1}'
// Result
{
"id": "3c1cf4c9436e3f942cb2f1d70a584f1c61df3697698dacccdc89e46f46a003d0",
"alias": "GOLD",
"issuance_program": "766baa209683b893483c0a5a317bf9868a8e2a09691f8aa8c1f3e2a7bb62b157e76712e05151ad696c00c0",
"keys": [
{
"root_xpub": "f6a16704f745a168642712060e6c5a69866147e21ec2447ae628f87d756bb68cc9b91405ad0a95f004090e864fde472f62ba97053ea109837bc89d63a64040d5",
"asset_pubkey": "9683b893483c0a5a317bf9868a8e2a09691f8aa8c1f3e2a7bb62b157e76712e012bd443fa7d56a0627df0a29dffcdc52641672a0f5cba54d104ad76ebeb8dfc3",
"asset_derivation_path": [
"000200000000000000"
]
}
],
"quorum": 1,
"definition": {}
}Object:
-
String- id, id of asset.
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. -
String- type, type of asset. -
Integer- vm_version, version of VM. -
String- raw_definition_byte, byte of asset definition. -
Object- definition, description of asset.
get asset by assetID.
// Request
curl -X POST get-asset -d '{"id": "50ec80b6bc48073f6aa8fa045131a71213c33f3681203b15ddc2e4b81f1f4730"}'
// Result
{
"alias": "SILVER",
"definition": null,
"id": "50ec80b6bc48073f6aa8fa045131a71213c33f3681203b15ddc2e4b81f1f4730",
"issue_program": "ae2029cd61d9ef31d40af7541f9a50831d6317fdb0870249d0564fcfa9a8f843589c5151ad",
"key_index": 1,
"quorum": 1,
"raw_definition_byte": "",
"type": "asset",
"vm_version": 1,
"xpubs": [
"34b16ee500615cd325f8b84099f83c1ebecaca67977c5dc9b71ae32ceaf18207f996b0a9725b901d3792689b2babcb60febe3b81a684d9b56b65f67f307d453d"
]
}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. -
String- type, type of asset. -
Integer- vm_version, version of VM. -
String- raw_definition_byte, byte of asset definition. -
Object- definition, description of asset.
-
-
list all the available assets:
// Request
curl -X POST list-assets -d {}
// Result
[
{
"alias": "BTM",
"definition": {
"decimals": 8,
"description": "Bytom Official Issue",
"name": "BTM",
"symbol": "BTM"
},
"id": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"issue_program": "",
"key_index": 0,
"quorum": 0,
"raw_definition_byte": "7b0a202022646563696d616c73223a20382c0a2020226465736372697074696f6e223a20224279746f6d204f6666696369616c204973737565222c0a2020226e616d65223a202262746d222c0a20202273796d626f6c223a202262746d220a7d",
"type": "internal",
"vm_version": 1,
"xpubs": null
},
{
"alias": "SILVER",
"definition": null,
"id": "50ec80b6bc48073f6aa8fa045131a71213c33f3681203b15ddc2e4b81f1f4730",
"issue_program": "ae2029cd61d9ef31d40af7541f9a50831d6317fdb0870249d0564fcfa9a8f843589c5151ad",
"key_index": 1,
"quorum": 1,
"raw_definition_byte": "",
"type": "asset",
"vm_version": 1,
"xpubs": [
"34b16ee500615cd325f8b84099f83c1ebecaca67977c5dc9b71ae32ceaf18207f996b0a9725b901d3792689b2babcb60febe3b81a684d9b56b65f67f307d453d"
]
}
]Object:
-
String- id, id of asset. -
String- alias, new alias of asset.
none if the asset alias is updated success.
update asset alias.
// Request
curl -X POST update-asset-alias -d '{"id":"50ec80b6bc48073f6aa8fa045131a71213c33f3681203b15ddc2e4b81f1f4730", "alias":"GOLD"}'
// Resultnone
-
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.
-
-
list all the available account balances.
// Request
curl -X POST list-balances -d {}
// Result
[
{
"account_alias": "default",
"account_id": "0BDQ9AP100A02",
"amount": 35508000000000,
"asset_alias": "BTM",
"asset_id": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
},
{
"account_alias": "alice",
"account_id": "0BDQARM800A04",
"amount": 60000000000,
"asset_alias": "BTM",
"asset_id": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
}
]Object:
optional:
-
String- id, id of unspent output.
-
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
[
{
"account_alias": "alice",
"account_id": "0BKBR6VR00A06",
"address": "bm1qv3htuvug7qdv46ywcvvzytrwrsyg0swltfa0dm",
"amount": 2000,
"asset_alias": "GOLD",
"asset_id": "1883cce6aab82cf9af8cd085a3115dd4a92cdb8e6a9152acd73d7ae4adb9030a",
"change": false,
"control_program_index": 2,
"id": "58f29f0f85f7bd2a91088bcbe536dee41cd0642dfb1480d3a88589bdbfd642d9",
"program": "0014646ebe3388f01acae88ec318222c6e1c0887c1df",
"source_id": "5988c1630c1f325e69bb92cb4b19af14286aa107311bc64b8f1a54629a33e0f4",
"source_pos": 2,
"valid_height": 0
},
{
"account_alias": "default",
"account_id": "0BKBR2D2G0A02",
"address": "bm1qx7ylnhszg24995d5e0nftu9e87kt9vnxcn633r",
"amount": 624000000000,
"asset_alias": "BTM",
"asset_id": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"change": false,
"control_program_index": 12,
"id": "5af9d3c9b69470983377c1fc0c9125c4ac3bfd32c8d505f2a6042aade8503bc9",
"program": "00143789f9de0242aa52d1b4cbe695f0b93facb2b266",
"source_id": "233d1dd49e591980f98e11f333c6c28a867e78448e272011f045131df5aa260b",
"source_pos": 0,
"valid_height": 12
}
]list the unspent output matching the given id:
// Request
curl -X POST list-unspent-outputs -d '{"id": "58f29f0f85f7bd2a91088bcbe536dee41cd0642dfb1480d3a88589bdbfd642d9"}'
// Result
{
"account_alias": "alice",
"account_id": "0BKBR6VR00A06",
"address": "bm1qv3htuvug7qdv46ywcvvzytrwrsyg0swltfa0dm",
"amount": 2000,
"asset_alias": "GOLD",
"asset_id": "1883cce6aab82cf9af8cd085a3115dd4a92cdb8e6a9152acd73d7ae4adb9030a",
"change": false,
"control_program_index": 2,
"id": "58f29f0f85f7bd2a91088bcbe536dee41cd0642dfb1480d3a88589bdbfd642d9",
"program": "0014646ebe3388f01acae88ec318222c6e1c0887c1df",
"source_id": "5988c1630c1f325e69bb92cb4b19af14286aa107311bc64b8f1a54629a33e0f4",
"source_pos": 2,
"valid_height": 0
}Object:
-
String- base_transaction, base data for the transaction, default is null. -
Integer- ttl, integer of the time to live in seconds, 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 for delayed to wrap this transaction, the transaction will be submit into block after this time stamp. -
Arrary of Object- actions:-
Object:-
String- account_id | account_alias, 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. -
String- control_program, (type is control_program) control program of receiver.
-
-
-
Object of build-transaction- transaction, builded transaction.
-
spend- transaction type is spend
// Request
curl -X POST build-transaction -d '{"base_transaction":null,"actions":[{"account_id":"0BF63M2U00A04","amount":20000000,"asset_id":"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","type":"spend_account"},{"account_id":"0BF63M2U00A04","amount":99,"asset_id":"3152a15da72be51b330e1c0f8e1c0db669269809da4f16443ff266e07cc43680","type":"spend_account"},{"amount":99,"asset_id":"3152a15da72be51b330e1c0f8e1c0db669269809da4f16443ff266e07cc43680","receiver":{"control_program":"0014a3f9111f3b0ee96cbd119a3ea5c60058f506fb19"},"type":"control_receiver"}],"ttl":0,"time_range": 1521625823}'-
issue- transaction type is issue
// Request
curl -X POST build-transaction -d '{"base_transaction":null,"actions":[{"account_id":"0BF63M2U00A04","amount":20000000,"asset_id":"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","type":"spend_account"},{"amount":10000,"asset_id":"3152a15da72be51b330e1c0f8e1c0db669269809da4f16443ff266e07cc43680","type":"issue"},{"account_id":"0BF63M2U00A04","amount":10000,"asset_id":"3152a15da72be51b330e1c0f8e1c0db669269809da4f16443ff266e07cc43680","type":"control_account"}],"ttl":0,"time_range": 1521625823}'-
address- transaction type is address
// Request
curl -X POST build-transaction -d '{"base_transaction":null,"actions":[{"account_id":"0BF63M2U00A04","amount":20000000,"asset_id":"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","type":"spend_account"},{"account_id":"0BF63M2U00A04","amount":99,"asset_id":"3152a15da72be51b330e1c0f8e1c0db669269809da4f16443ff266e07cc43680","type":"spend_account"},{"amount":99,"asset_id":"3152a15da72be51b330e1c0f8e1c0db669269809da4f16443ff266e07cc43680","address":"bm1q50u3z8empm5ke0g3ngl2t3sqtr6sd7cepd3z68","type":"control_address"}],"ttl":0,"time_range": 1521625823}'-
retire- transaction type is retire
// Request
curl -X POST build-transaction -d '{"base_transaction":null,"actions":[{"account_id":"0BF63M2U00A04","amount":20000000,"asset_id":"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","type":"spend_account"},{"account_id":"0BF63M2U00A04","amount":99,"asset_id":"3152a15da72be51b330e1c0f8e1c0db669269809da4f16443ff266e07cc43680","type":"spend_account"},{"account_id":"0BF63M2U00A04","amount":99,"asset_id":"3152a15da72be51b330e1c0f8e1c0db669269809da4f16443ff266e07cc43680","type":"retire"}],"ttl":0,"time_range":1521625823}'// Result(this type is spend, the other types are similar.)
{
"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"
}
]
}
]
}Object:
-
String- password, signature of the password. -
Object- transaction, builded transaction.
Object:
-
Boolean- sign_complete, returns true if sign succesfully and false otherwise. -
Object of sign-transaction- 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
{
"sign_complete": true,
"transaction": {
"allow_additional_actions": false,
"local": true,
"raw_transaction": "07010000020161015fb6a63a3361170afca03c9d5ce1f09fe510187d69545e09f95548b939cd7fffa3ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80fc93afdf01000116001426bd1b851cf6eb8a701c20c184352ad8720eeee96302400d432e6f0e22da3168d76552273e60d23d432d61b4dac53e6769d39a1097f1cd1bd8e54c7d39eda334803e5c904bc2de2f27ff29748166e0334dcfded20e980b2062a73b6b7ffe52b6ad782b0e0efdc8309bf2f057d88f9a17d125e41bb11dbb88015d015bb6a63a3361170afca03c9d5ce1f09fe510187d69545e09f95548b939cd7fffa33152a15da72be51b330e1c0f8e1c0db669269809da4f16443ff266e07cc43680c03e0101160014489a678741ccc844f9e5c502f7fac0a665bedb256302401eadd84ad07c3643f71a35cc5669a2c1def96ae98e790d287217e6a3543fe602dd90afffe853c729bd5237a28f33538df631572847d9870829fb1fd1100ff20820ba5a63e7416caeb945eefc2ce874f40bc4aaf6005a1fc792557e41046f7e502f03013effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80a2cfa5df0101160014948fb4f500e66d20fbacb903fe108ee81f9b6d9500013a3152a15da72be51b330e1c0f8e1c0db669269809da4f16443ff266e07cc43680dd3d01160014cd5a822b34e3084413506076040d508bb12232c70001393152a15da72be51b330e1c0f8e1c0db669269809da4f16443ff266e07cc436806301160014a3f9111f3b0ee96cbd119a3ea5c60058f506fb1900",
"signing_instructions": [
{
"position": 0,
"witness_components": [
{
"keys": [
{
"derivation_path": [
"010100000000000000",
"0500000000000000"
],
"xpub": "ee9dd8affdef7e0cacd0fbbf310217c7f588156c28e414db74c27afaedd8f876cf54547a672b431ff06ee8a146207df9595638a041b55ada1a764a8b5b30bda0"
}
],
"quorum": 1,
"signatures": [
"0d432e6f0e22da3168d76552273e60d23d432d61b4dac53e6769d39a1097f1cd1bd8e54c7d39eda334803e5c904bc2de2f27ff29748166e0334dcfded20e980b"
],
"type": "raw_tx_signature"
},
{
"type": "data",
"value": "62a73b6b7ffe52b6ad782b0e0efdc8309bf2f057d88f9a17d125e41bb11dbb88"
}
]
},
{
"position": 1,
"witness_components": [
{
"keys": [
{
"derivation_path": [
"010100000000000000",
"0600000000000000"
],
"xpub": "ee9dd8affdef7e0cacd0fbbf310217c7f588156c28e414db74c27afaedd8f876cf54547a672b431ff06ee8a146207df9595638a041b55ada1a764a8b5b30bda0"
}
],
"quorum": 1,
"signatures": [
"1eadd84ad07c3643f71a35cc5669a2c1def96ae98e790d287217e6a3543fe602dd90afffe853c729bd5237a28f33538df631572847d9870829fb1fd1100ff208"
],
"type": "raw_tx_signature"
},
{
"type": "data",
"value": "ba5a63e7416caeb945eefc2ce874f40bc4aaf6005a1fc792557e41046f7e502f"
}
]
}
]
}
}Object:
-
Object- raw_transaction, raw_transaction of signed transaction.
Object:
-
String- tx_id, transaction id, hash of transaction.
// Request
curl -X POST submit-transaction -d '{"raw_transaction":"07010000010161015ffe8bdb49bbd08f711a54f0fbed4141b74c276de44c831999aac43bdd56f98309ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80c0b1ca94120001160014d61f9b3354771283461e6cb269bec98e7ee975f6630240403d7b35ec72a80816b21822d645adc98af2c1f07d5b379dda4527d8585ec12ef213ada312e3807ae0ccf7206575f313ffe2b405a286309d3172feabe07e7e0620d013706a314a57e84c2b262c2a291e8e2b063785aea9338476a66d41be4de4f202013effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80bc82eb931201160014bdf260424fd2f322dbec9ce4ddbaed8618d8e959000139ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6301160014a3f9111f3b0ee96cbd119a3ea5c60058f506fb1900"}'
// Result
{
"tx_id": "2c0624a7d251c29d4d1ad14297c69919214e78d995affd57e73fbf84ece316cb"
}Object:
-
Object- transaction_template, builded transaction response.
Object:
-
Integer- total_neu, total consumed neu(1BTM = 10^8NEU) for execute transaction. -
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
{
"storage_neu": 3840000,
"total_neu": 5259000,
"vm_neu": 1419000
}Object:
-
String- tx_id, transaction id, hash of transaction.
Object:
-
String- tx_id, transaction id, hash of the transaction. -
String- block_time, the unix timestamp for when the requst was responsed. -
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. -
String- block_transactions_count, transactions count where this transaction was in the block. -
Boolean- status_fail, whether the state of the transaction request has failed. -
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'. -
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- issuance_program, issuance program, it only exist when type is 'issue'. -
String- 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. -
String- arbitrary, arbitrary infomation can be set by miner, it only exist when type is 'coinbase'.
-
-
Array of Object- outputs, object of outputs for the transaction.-
String- type, the type of output action, available option include: 'retire', 'control'. -
String- id, outputid related to utxo. -
String- 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. -
String- control_program, control program of account. -
String- address, address of account.
-
// Request
curl -X POST get-transaction -d '{"tx_id": "277aa67c2f9b1d340c0be53e81952706a444e12011a670181bc5fa0e7672a49e"}'
// Result
{
"block_hash": "0693cb1408d38e2df5a5e1302a51218a7f58b790367f610b028b7a0a931909f3",
"block_height": 30,
"block_index": 1,
"block_time": 1516788453,
"inputs": [
{
"account_alias": "default",
"account_id": "0BF1J9LCG0A02",
"address": "sm1q26kpwrrevhh2c8xrfy5vnaryu0ugc97csrdy69",
"amount": 624000000000,
"asset_alias": "btm",
"asset_definition": "7b0a202022646563696d616c73223a20382c0a2020226465736372697074696f6e223a20224279746f6d204f6666696369616c204973737565222c0a2020226e616d65223a202262746d222c0a20202273796d626f6c223a202262746d220a7d",
"asset_id": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"spent_output_id": "2072edd06054d7cd27b2f120d0b1a21d4cc3f8077dc5f495ece0fea833ad09d7",
"type": "spend"
}
],
"outputs": [
{
"account_alias": "default",
"account_id": "0BF1J9LCG0A02",
"address": "sm1qasn6ugm578a5dy9tqmrzqr6m376v6akunumy55",
"amount": 563980000000,
"asset_alias": "btm",
"asset_definition": "7b0a202022646563696d616c73223a20382c0a2020226465736372697074696f6e223a20224279746f6d204f6666696369616c204973737565222c0a2020226e616d65223a202262746d222c0a20202273796d626f6c223a202262746d220a7d",
"asset_id": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"control_program": "0014e9d07f9fe967a962596e44ee6504fb08df45c3c4",
"id": "be671f65247dfdc0a71f38e90017eca00759f1b3940905ef4415522f31917911",
"position": 0,
"type": "control"
},
{
"account_alias": "alice",
"account_id": "0BF1JGC9G0A04",
"address": "sm1qq4n8j5ys2awj7hn3c8fq2k3z58l5u7p34chc5n",
"amount": 60000000000,
"asset_alias": "btm",
"asset_definition": "7b0a202022646563696d616c73223a20382c0a2020226465736372697074696f6e223a20224279746f6d204f6666696369616c204973737565222c0a2020226e616d65223a202262746d222c0a20202273796d626f6c223a202262746d220a7d",
"asset_id": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"control_program": "0014bfdaf76c1b853ce435ee7454acfbef873d487523",
"id": "63bcfec365913ef980ab95ad2bef5eba9bd8637723af138a695b5e9a0a5a571e",
"position": 1,
"type": "control"
}
],
"status_fail": false,
"tx_id": "277aa67c2f9b1d340c0be53e81952706a444e12011a670181bc5fa0e7672a49e"
}Object:
optional:
-
String- tx_id, transaction id, hash of transaction. -
String- account_id, id of account. -
Bool- detail , flag of required transactions data ,default false (only return transaction summary)
Array of Object, transaction array.
optional:
-
Object:(summary transaction)-
String- tx_id, transaction id, hash of the transaction. -
String- block_time, the unix timestamp for when the requst was responsed. -
Array of Object- inputs, object of summary inputs for the transaction. -
Array of Object- outputs, object of summary outputs for the transaction.
-
-
Object:(detail transaction)-
String- tx_id, transaction id, hash of the transaction. -
String- block_time, the unix timestamp for when the requst was responsed. -
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. -
String- block_transactions_count, transactions count where this transaction was in the block. -
Boolean- status_fail, whether the state of the transaction request has failed. -
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'. -
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- issuance_program, issuance program, it only exist when type is 'issue'. -
String- 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. -
String- arbitrary, arbitrary infomation can be set by miner, it only exist when type is 'coinbase'.
-
-
Array of Object- outputs, object of outputs for the transaction.-
String- type, the type of output action, available option include: 'retire', 'control'. -
String- id, outputid related to utxo. -
String- 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. -
String- control_program, control program of account. -
String- address, address of account.
-
-
list all the available transactions:
// Request
curl -X POST list-transactions -d {}
// Result
[
{
"block_time": 1521771059,
"inputs": [
{
"arbitrary": "c4a4",
"asset_id": "0000000000000000000000000000000000000000000000000000000000000000",
"type": "coinbase"
}
],
"outputs": [
{
"account_alias": "default",
"account_id": "0BMHBOBVG0A02",
"amount": 624000000000,
"asset_alias": "btm",
"asset_id": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"type": "control"
}
],
"tx_id": "c631a8de401913a512c338bcf4a61cb2de6cede12a7385d9d11637eaa6578f33"
},
{
"block_time": 1521770515,
"inputs": [
{
"account_alias": "default",
"account_id": "0BMHBOBVG0A02",
"amount": 624000000000,
"asset_alias": "btm",
"asset_id": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"type": "spend"
}
],
"outputs": [
{
"account_alias": "default",
"account_id": "0BMHBOBVG0A02",
"amount": 563980000000,
"asset_alias": "btm",
"asset_id": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"type": "control"
},
{
"account_alias": "alice",
"account_id": "0BMHDI1P00A04",
"amount": 60000000000,
"asset_alias": "btm",
"asset_id": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"type": "control"
}
],
"tx_id": "1151ce5c7b32b8755b5e48109ec7ed956fb1783eaea9558bf5a2ad957825e4b7"
}
]list the transaction matching the given tx_id with detail:
// Request
curl -X POST list-transactions -d '{"tx_id": "1151ce5c7b32b8755b5e48109ec7ed956fb1783eaea9558bf5a2ad957825e4b7","detail": true}'
// Result
[
{
"block_hash": "aef9ef8440c22eea79a608b11224015d72f80d117afc94e2c1e243d2a4b4264f",
"block_height": 65,
"block_index": 1,
"block_time": 1521770515,
"block_transactions_count": 2,
"inputs": [
{
"account_alias": "default",
"account_id": "0BMHBOBVG0A02",
"address": "sm1q26kpwrrevhh2c8xrfy5vnaryu0ugc97csrdy69",
"amount": 624000000000,
"asset_alias": "btm",
"asset_definition": "7b0a202022646563696d616c73223a20382c0a2020226465736372697074696f6e223a20224279746f6d204f6666696369616c204973737565222c0a2020226e616d65223a202262746d222c0a20202273796d626f6c223a202262746d220a7d",
"asset_id": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"spent_output_id": "075bb0f790b973f212ce4790df38579d0675011c1cc57f7870b05086a8d9781c",
"type": "spend"
}
],
"outputs": [
{
"account_alias": "default",
"account_id": "0BMHBOBVG0A02",
"address": "sm1qasn6ugm578a5dy9tqmrzqr6m376v6akunumy55",
"amount": 563980000000,
"asset_alias": "btm",
"asset_definition": "7b0a202022646563696d616c73223a20382c0a2020226465736372697074696f6e223a20224279746f6d204f6666696369616c204973737565222c0a2020226e616d65223a202262746d222c0a20202273796d626f6c223a202262746d220a7d",
"asset_id": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"control_program": "0014b1c61390b550b04f7185fff188347fbefae4a6e0",
"id": "9b74c3b319359031bc2a05ea3301390929c9671dee6ecadcf8487bcb3f83effc",
"position": 0,
"type": "control"
},
{
"account_alias": "alice",
"account_id": "0BMHDI1P00A04",
"address": "sm1qq4n8j5ys2awj7hn3c8fq2k3z58l5u7p34chc5n",
"amount": 60000000000,
"asset_alias": "btm",
"asset_definition": "7b0a202022646563696d616c73223a20382c0a2020226465736372697074696f6e223a20224279746f6d204f6666696369616c204973737565222c0a2020226e616d65223a202262746d222c0a20202273796d626f6c223a202262746d220a7d",
"asset_id": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"control_program": "001495f14dd5327a7e0ec09e313d118448076a49d45c",
"id": "b550565e376b0077e992963b78986129d94cc3ffecf12e3008c9ccd0b2c0c47e",
"position": 1,
"type": "control"
}
],
"status_fail": false,
"tx_id": "1151ce5c7b32b8755b5e48109ec7ed956fb1783eaea9558bf5a2ad957825e4b7"
}
]list the transaction matching the given account_id:
// Request
curl -X POST list-transactions -d '{"account_id": "0BMHDI1P00A04"}'
// Result
[
{
"block_time": 1521770566,
"inputs": [
{
"account_alias": "alice",
"account_id": "0BMHDI1P00A04",
"amount": 60000000000,
"asset_alias": "btm",
"asset_id": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"type": "spend"
},
{
"amount": 10000,
"asset_alias": "gold",
"asset_id": "951a9b58ef06e5cc89dec48ea9b3e0b608cd4da06f0e06b7415245d8ba1e393c",
"type": "issue"
}
],
"outputs": [
{
"account_alias": "alice",
"account_id": "0BMHDI1P00A04",
"amount": 59980000000,
"asset_alias": "btm",
"asset_id": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"type": "control"
},
{
"account_alias": "alice",
"account_id": "0BMHDI1P00A04",
"amount": 10000,
"asset_alias": "gold",
"asset_id": "951a9b58ef06e5cc89dec48ea9b3e0b608cd4da06f0e06b7415245d8ba1e393c",
"type": "control"
}
],
"tx_id": "ecfd146da57b0958d4f5495ab748e63616c229bc3cf771ffd9a7cbdcb2129ad1"
}
]none
Object:
-
Object- account_image, account image. -
Object- asset_image, asset image. -
Object- key_images, key image.
// Request
curl -X backup-wallet -d {}
// Result
{
"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"
}
]
}
}Object:
-
Object- account_image, account image. -
Object- asset_image, asset image. -
Object- key_images, key image.
none if restore wallet success.
// 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"}]}}'
// ResultObject:
-
String- address, address for account. -
String- message, message for signature by address xpub. -
String- password, password of account.
Object:
-
String- derived_xpub, derived xpub. -
String- signature, signature of message.
// Request
curl -X POST sign-message -d '{"address":"bm1qx2qgvvjz734ur8x5lpfdtlau74aaa5djs0a5jn", "message":"this is a test message", "password":"123456"}'
// Result
{
"signature": "74da3d6572233736e3a439166719244dab57dd0047f8751b1efa2da26eeab251d915c1211dcad77e8b013267b86d96e91ae67ff0be520ef4ec326e911410b609",
"derived_xpub": "6ff8c3d1321ce39a3c3550f57ba70b67dcbcef821e9b85f6150edb7f2f3f91009e67f3075e6e76ed5f657ee4b1a5f4749b7a8c74c8e7e6a1b0e5918ebd5df4d0"
}Object:
-
String- id, token ID.
optional:
-
String- type, type of token.
Object:
-
String- token, access token. -
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
{
"token": "token1:1fee70f537128a201338bd5f25a3adbf33dad02eae4f4c9ac43f336a069df8f3",
"id": "token1",
"created_at": "2018-03-20T18:56:01.043919771+08:00"
}none
-
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
[
{
"token": "token1:1fee70f537128a201338bd5f25a3adbf33dad02eae4f4c9ac43f336a069df8f3",
"id": "token1",
"created_at": "2018-03-20T18:56:01.043919771+08:00"
},
{
"token": "alice:78598c6d9fb9e3258d01f78005d4e5725ad0d45e20af90a30b577b407d4a2edd",
"id": "alice",
"created_at": "2018-03-20T18:56:01.043919771+08:00"
}
]Object:
-
String- id, token ID.
none if the access token is deleted successfully.
delete access token.
// Request
curl -X POST delete-access-token -d '{"id": "token1"}'
// ResultObject:
-
String- id, token ID. -
String- secret, secret of token, the second part of the colon division for token.
none if the access token is checked valid.
check whether the access token is vaild or not.
// Request
curl -X POST check-access-token -d '{"id": "token1", "secret": "1fee70f537128a201338bd5f25a3adbf33dad02eae4f4c9ac43f336a069df8f3"}'
// ResultObject:
-
String- alias, name of the transaction feed. -
String- filter, filter of the transaction feed.
none if the transaction feed is created success.
// Request
curl -X POST create-transaction-feed -d '{"alias": "test1", "filter": "asset_id='84778a666fe453cf73b2e8c783dbc9e04bc4fd7cbb4f50caeaee99cf9967ebed' AND amount_lower_limit = 50 AND amount_upper_limit = 100"}'
// ResultObject:
-
String- alias, name of the transaction feed.
Object:
-
String- id, id of the transaction feed. -
String- alias, name of the transaction feed. -
String- filter, filter of the transaction feed. -
Object- param, param of the transaction feed.-
String- assetid, asset id. -
Integer- lowerlimit, the lower limit of asset amount. -
Integer- upperlimit, the upper limit of asset amount. -
String- transtype, type of transaction.
-
list the available txfeed by alias:
// Request
curl -X POST get-transaction-feed -d '{"alias": "test1"}'
// Result
{
"alias": "test1",
"filter": "asset_id='84778a666fe453cf73b2e8c783dbc9e04bc4fd7cbb4f50caeaee99cf9967ebed' AND amount_lower_limit = 50 AND amount_upper_limit = 100",
"param": {}
}none
-
Array of Object, the transaction feeds.-
Object:-
String- id, id of the transaction feed. -
String- alias, name of the transaction feed. -
String- filter, filter of the transaction feed. -
Object- param, param of the transaction feed.-
String- assetid, asset id. -
Integer- lowerlimit, the lower limit of asset amount. -
Integer- upperlimit, the upper limit of asset amount. -
String- transtype, type of transaction.
-
-
-
list all the available txfeed:
// Request
curl -X POST list-transaction-feeds -d {}
// Result
[
{
"alias": "test1",
"filter": "asset_id='84778a666fe453cf73b2e8c783dbc9e04bc4fd7cbb4f50caeaee99cf9967ebed' AND amount_lower_limit = 50 AND amount_upper_limit = 100",
"param": {}
},
{
"alias": "test2",
"filter": "asset_id='cee6a588cc3fc280749021ef42d5209952a1e6feceada4e69dd8a424ad22b199' AND amount_lower_limit = 30 AND amount_upper_limit = 100",
"param": {}
}
]Object:
-
String- alias, name of the transaction feed.
none if the transaction feed is deleted success.
// Request
curl -X POST delete-transaction-feed -d '{"alias": "test1"}'
// ResultObject:
-
String- alias, name of the transaction feed. -
String- filter, filter of the transaction feed.
none if the transaction feed is updated success.
deleted when the txfeed exists, and create it with alias and filter:
// Request
curl -X POST update-transaction-feed -d '{"alias": "test1", "filter": "asset_id='84778a666fe453cf73b2e8c783dbc9e04bc4fd7cbb4f50caeaee99cf9967ebed' AND amount_lower_limit = 60 AND amount_upper_limit = 80"}'
// ResultObject:
-
String- tx_id, transaction id, hash of transaction.
Object:
-
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. -
Boolean- status_fail, whether the state of the request has failed. -
Array of Object- inputs, object of inputs for the transaction. -
Array of Object- outputs, object of outputs for the transaction.
// Request
curl -X POST get-unconfirmed-transaction -d '{"tx_id": "382090f24fbfc2f737fa7372b9d161a43f00d1c597a7130a56589d1f469d04b5"}'
// Result
{
"id": "382090f24fbfc2f737fa7372b9d161a43f00d1c597a7130a56589d1f469d04b5",
"inputs": [
{
"address": "bm1qqrm7ruecx7yrg9smtwmnmgj3umg9vcukgy5sdj",
"amount": 41250000000,
"asset_definition": {},
"asset_id": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"control_program": "001400f7e1f338378834161b5bb73da251e6d0566396",
"spent_output_id": "161b44e547a6cc68d732eb64fa38031da98211a99319e088cfe632223f9ac6d8",
"type": "spend"
}
],
"outputs": [
{
"address": "bm1qehxd5cdnepckh5jc72ggn30havd78lsgcqmt7k",
"amount": 21230000000,
"asset_definition": {},
"asset_id": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"control_program": "0014cdccda61b3c8716bd258f29089c5f7eb1be3fe08",
"id": "a8f21ad24689c290634db85278f56d152efe6fe08bc194e5dee5127ed6d3ebee",
"position": 0,
"type": "control"
},
{
"address": "bm1q2me9gwccnm3ehpnrcr99gcnj730js2zfucms3r",
"amount": 20000000000,
"asset_definition": {},
"asset_id": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"control_program": "001456f2543b189ee39b8663c0ca546272f45f282849",
"id": "78219e422ea3257aeb32f6d952b5ce5560dab1d6440c9f3aebcdaad2a852d2a8",
"position": 1,
"type": "control"
}
],
"size": 664,
"status_fail": false,
"time_range": 0,
"version": 1
}none
Object:
-
Integer- total, version of transaction. -
Array of Object- tx_ids, list of transaction id.
// Request
curl -X POST list-unconfirmed-transactions -d {}
// Result
{
"total": 2,
"tx_ids": [
"382090f24fbfc2f737fa7372b9d161a43f00d1c597a7130a56589d1f469d04b5",
"fc2da5dfa094c2170144f149fa07a312983157aec0ec95063a1319eedcb2d23b"
]
}Object:
-
String- raw_transaction, hexstring of raw transaction.
Object:
-
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. -
Array of Object- outputs, object of outputs for the transaction.
// Request
curl -X POST decode-raw-transaction -d '{"raw_transaction": "070100010161015fc8215913a270d3d953ef431626b19a89adf38e2486bb235da732f0afed515299ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8099c4d59901000116001456ac170c7965eeac1cc34928c9f464e3f88c17d8630240b1e99a3590d7db80126b273088937a87ba1e8d2f91021a2fd2c36579f7713926e8c7b46c047a43933b008ff16ecc2eb8ee888b4ca1fe3fdf082824e0b3899b02202fb851c6ed665fcd9ebc259da1461a1e284ac3b27f5e86c84164aa518648222602013effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80bbd0ec980101160014c3d320e1dc4fe787e9f13c1464e3ea5aae96a58f00013cffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8084af5f01160014bb93cdb4eca74b068321eeb84ac5d33686281b6500"}'
// Result
{
"version": 1,
"size": 332,
"time_range": 0,
"fee": 20000000,
"inputs": [
{
"address": "tm1q26kpwrrevhh2c8xrfy5vnaryu0ugc97c4yxp66",
"amount": 41250000000,
"asset_definition": {},
"asset_id": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"control_program": "001456ac170c7965eeac1cc34928c9f464e3f88c17d8",
"spent_output_id": "01bb3309666618a1507cb5be845b17dee5eb8028ee7e71b17d74b4dc97085bc8",
"type": "spend"
}
],
"outputs": [
{
"address": "tm1qc0fjpcwuflnc06038s2xfcl2t2hfdfv06pfd70",
"amount": 41030000000,
"asset_definition": {},
"asset_id": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"control_program": "0014c3d320e1dc4fe787e9f13c1464e3ea5aae96a58f",
"id": "567b34857614d16292220beaca16ce34b939c75023a49cc43fa432fff51ca0dd",
"position": 0,
"type": "control"
},
{
"address": "tm1qhwfumd8v5a9sdqepa6uy43wnx6rzsxm9uhmk4q",
"amount": 200000000,
"asset_definition": {},
"asset_id": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"control_program": "0014bb93cdb4eca74b068321eeb84ac5d33686281b65",
"id": "a8069d412e48c2b2994d2816758078cff46b215421706b4bad41f72a32928d92",
"position": 1,
"type": "control"
}
]
}none
Object:
-
Integer- block_count, recent block height of the blockchain.
// Request
curl -X POST get-block-count
// Result
{
"block_count": 519
}none
Object:
-
String- block_hash, recent block hash of the blockchain.
// Request
curl -X POST get-block-hash
// Result
{
"block_hash": "997bf5cecb4df097991a7a121a7fd3cb5a404fa856e3d6032c791ac07bc7c74c"
}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- previous_block_hash, previous block hash. -
Integer- timestamp, timestamp of block. -
Integer- nonce, nonce value. -
Integer- bits, bits of difficulty. -
String- difficulty, difficulty value(String type). -
String- transaction_merkle_root, merkle root of transaction. -
String- transaction_status_hash, merkle root of transaction status. -
Array of Object- transactions, transaction object:-
String- id, transaction id, hash of the transaction. -
String- version, version of transaction. -
String- size, size of transaction. -
String- time_range, the unix timestamp for when the requst was responsed. -
String- status_fail, whether the state of the request has failed. -
Array of Object- inputs, object of inputs for the transaction.-
String- type, the type of input action, available option include: 'spend', 'issue', 'coinbase'. -
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- issuance_program, issuance program, it only exist when type is 'issue'. -
String- 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. -
String- arbitrary, arbitrary infomation can be set by miner, it only exist when type is 'coinbase'.
-
-
Array of Object- outputs, object of outputs for the transaction.-
String- type, the type of output action, available option include: 'retire', 'control'. -
String- id, outputid related to utxo. -
String- 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. -
String- control_program, control program of account. -
String- address, address of account.
-
-
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
{
"bits": 2305843009222082600,
"difficulty": "57896037716911750921221705069588091649609539881711309849342236841432341020672",
"hash": "886a8e85b275e7d65b569ba510875c0e63dece1a94569914d7624c0dac8002f9",
"height": 43,
"nonce": 3,
"previous_block_hash": "2c72ccbd53b92a4f9423c5b610b4e106bbe8fbf3ecf2e16a1266b17ee323ff9d",
"size": 386,
"timestamp": 1521614189,
"transaction_merkle_root": "77d40262cfeca3a16d4587132974552ef00951e43ce567a26801ebc3dbdb4d96",
"transaction_status_hash": "53c0ab896cb7a3778cc1d35a271264d991792b7c44f5c334116bb0786dbc5635",
"transactions": [
{
"id": "4576b1b1ec251da3263dbdd5486bcbf9a1cd1f712172dbe7a7a5fe46ab194629",
"inputs": [
{
"amount": 0,
"arbitrary": "09",
"asset_definition": "7b7d",
"asset_id": "0000000000000000000000000000000000000000000000000000000000000000",
"type": "coinbase"
}
],
"outputs": [
{
"amount": 624000000000,
"asset_definition": "7b7d",
"asset_id": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"control_program": "0014f3403bcd8b443d03882a280b50f6f98986e1a255",
"id": "da87b40854a9b93be72ecdc24fe7bb03986ea3530e344b0f918f0788c3d83717",
"position": 0,
"type": "control"
}
],
"size": 77,
"status_fail": false,
"time_range": 0,
"version": 1
}
],
"version": 1
}Object: block_height | block_hash
optional:
-
String- block_hash, hash of block. -
Integer- block_height, height of block.
Object:
-
Object- block_header, header of block. -
Integer- reward, reward.
// Request
curl -X POST get-block-header -d '{"block_height": 43, "block_hash": "886a8e85b275e7d65b569ba510875c0e63dece1a94569914d7624c0dac8002f9"}'
// Result
{
"block_header": "01019601e87da37e7d73f31d54304c719c9058ec7bc7de7819deda89a7c8834a99bc05b8fbdbe6d60540eba9e5d5cb79fd87b3c0fad32f6772c1e4483f2a070e093a6176d85226d986a8c9c377e5192668bc0a367e4a4764f11e7c725ecced1d7b6a492974fab1b6d5bc00ad918480808080801e",
"reward": 41250000000
}Object:
optional:
-
String- block_hash, hash of block. -
Integer- block_height, height of block.
Object:
-
Integer- bits, bits of block. -
String- difficulty, difficulty of block. -
String- hash, block hash. -
Integer- height, block height.
Get difficulty for current block or specified block hash / height.
// Request
curl -X POST get-difficulty -d '{"block_height": 506, "block_hash": "d1fce60caea5466eae2b812e4586b55120c52aca27b6c92bd7c51e9cda82dcdf"}'
// Result
{
"bits": 2161727821137910500,
"difficulty": "15154807",
"hash": "d1fce60caea5466eae2b812e4586b55120c52aca27b6c92bd7c51e9cda82dcdf",
"height": 506
}Object:
optional:
-
String- block_hash, hash of block. -
Integer- block_height, height of block.
Object:
-
Integer- hash_rate, difficulty of block. -
String- hash, block hash. -
Integer- height, block height.
Get hash rate for current block or specified block hash / height.
// Request
curl -X POST get-hash-rate -d '{"block_height": 506, "block_hash": "d1fce60caea5466eae2b812e4586b55120c52aca27b6c92bd7c51e9cda82dcdf"}'
// Result
{
"hash": "d1fce60caea5466eae2b812e4586b55120c52aca27b6c92bd7c51e9cda82dcdf",
"hash_rate": 7577403,
"height": 506
}none
Object:
-
Boolean- listening, whether the node is listening. -
Boolean- syncing, whether the node is syncing. -
Boolean- mining, whether the node is mining. -
Integer- peer_count, current count of connected peers. -
Integer- current_block, current block height in the node's blockchain. -
Integer- highest_block, current highest block of the connected peers. -
String- network_id, network id. -
String- version, bytom version.
// Request
curl -X POST net-info
// Result
{
"listening": true,
"syncing": true,
"mining": true,
"peer_count": 0,
"current_block": 627,
"highest_block": 0,
"network_id": "mainnet",
"version": "0.5.0"
}none
Object:
-
Boolean- is_mining, whether the node is mining.
// Request
curl -X POST is-mining
// Result
{
"is_mining": true
}Object:
-
Boolean- is_mining, whether the node is mining.
// Request
curl -X POST set-mining -d '{"is_mining": true}'
// Resultnone
Object:
-
Integer- gas_rate, gas rate.
// Request
curl -X POST gas-rate
// Result
{
"gas_rate": 1000
}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":"bm1qx2qgvvjz734ur8x5lpfdtlau74aaa5djs0a5jn", "derived_xpub":"6ff8c3d1321ce39a3c3550f57ba70b67dcbcef821e9b85f6150edb7f2f3f91009e67f3075e6e76ed5f657ee4b1a5f4749b7a8c74c8e7e6a1b0e5918ebd5df4d0", "message":"this is a test message", "signature":"74da3d6572233736e3a439166719244dab57dd0047f8751b1efa2da26eeab251d915c1211dcad77e8b013267b86d96e91ae67ff0be520ef4ec326e911410b609"}'
// Result
{
"result": true
}none
Object:
-
Object- block_header, raw block header. -
Object- seed, seed.
type GetWorkResp struct {
BlockHeader *types.BlockHeader `json:"block_header"`
Seed *bc.Hash `json:"seed"`
}// Request
curl -X POST get-work -d '{}'
// Result
{
"block_header": "0101870103f2c7495164c8f3af43697e81faa21dcb2d60aa5e10ce4f233491e62420742fbeadfcd50540bef2670a5fade2e58ad4955e2375a04ad1e4cb9c104faddab43f4a79e35be253c9c377e5192668bc0a367e4a4764f11e7c725ecced1d7b6a492974fab1b6d5bc00ffffff838080808020",
"seed": "702bef3f1707577fd0d75b6359a2919fa216487fe306771e27710acbaa9164ce"
}Object:
-
Object- block_header, raw block header.
type SubmitWorkReq struct {
BlockHeader *types.BlockHeader `json:"block_header"`
}true if success
// Request
curl -X POST submit-work -d '{"block_header": "0101870103f2c7495164c8f3af43697e81faa21dcb2d60aa5e10ce4f233491e62420742fbeadfcd50540bef2670a5fade2e58ad4955e2375a04ad1e4cb9c104faddab43f4a79e35be253c9c377e5192668bc0a367e4a4764f11e7c725ecced1d7b6a492974fab1b6d5bc00ffffff838080808020"}'
// Result
true / errorby bytom
Coming soon