-
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"}'get-block-count$create-key$list-keys$delete-key$export-private-key$import-private-key$create-account$update-account-tagscreate-account-receiver$create-account-address$create-access-token$create-asset$update-asset-tags$list-accountslist-addresses-
$build-transaction list-balancesget-transaction$list-transactions$list-unspent-outputs$list-assets$get-work$submit-workvalidate-address
none
// Request
curl -X POST get-block-count
// Result
{
"block_count": 519
}Object:
-
String- alias, name of the key. -
String- password, currently, it is unchangable, the default password is 123456.
Object:
-
String- alias, name of the key. -
String- file, file where the key is stored. -
String- xpub, pubkey of the key.
// Request
curl -X POST create-key -d '{"alias": "alice", "password": "123"}'
// Result
{
"alias": "alice",
"file": "/Users/xlc/go/src/github.com/bytom/cmd/bytomd/.bytomd/keystore/UTC--2018-01-02T02-19-54.738565000Z--082f05df-f4cf-415f-bb5a-71f4dcec5757",
"xpub": "af1ce74d8f2722e3d2ee00045ac60313048a9772bd086c7d8fe73c554e95640f90d4a6893d1ab069044032096d5e1136730286f2c9d76558151d637d0b0cea4c"
}none
ARRAY of Object - keys owned by the client.
// Request
curl -X POST list-keys
// Result
[
{
"alias": "alice",
"xpub": "af1ce74d8f2722e3d2ee00045ac60313048a9772bd086c7d8fe73c554e95640f90d4a6893d1ab069044032096d5e1136730286f2c9d76558151d637d0b0cea4c",
"file": "/Users/xlc/go/src/github.com/bytom/cmd/bytomd/.bytomd/keystore/UTC--2018-01-02T02-19-54.738565000Z--082f05df-f4cf-415f-bb5a-71f4dcec5757"
},
{
"alias": "bob",
"xpub": "ab91693ce4a0096929267ea57fd6f9692687b941f79f46c2fe2d57891c23746df19abad214e2c47398284f4dd540922a45470f30e6492515519582c88e9 00b99",
"file": "/Users/xlc/go/src/github.com/bytom/cmd/bytomd/.bytomd/keystore/UTC--2018-01-02T02-21-15.172985000Z--1eb8a685-03a2-4cfd-a175-975250ca3aee"
}
]Object:
-
String- xpub. -
String- password.
none if the key is deleted successfully.
// Request
curl -X POST delete-key -d '{"xpub": "3a5a6e8af9175f77d5dfc341ec60c0753c06c9112b6c0933b7b6122c1b91682762184a6c38ef8225a984eb0520f5ee24d2e2aa1003eb2f475de9a975d9d3b6cd", "password": "123"}'
// ResultObject:
-
String- xpub. -
String- password.
Object:
-
String- private_key.
// Request
curl -X POST export-private-key -d '{"xpub":"02581f1a2099e1696c498901c0049a22cc3e7f85db71c4ebb78f238d3ef8b323d2fd5c33b6f634aacdd25eb5e09c0c803077c521ef0524e4cc64d1a4420c8bc6", "password":"123"}'
// Result
{
"private_key": "2AxwqaoXGbFZ2Vqc3Pjc5zZabxBXutvn89c7TFEtpWtTU5hfbmpg9MSzhMTsQwD5Ark61s3vszKfzcZwJ6r52cVcTxUuT"
}Object:
-
String- alias. -
String- private_key. -
String- index. -
String- password.
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.
Optional:
-
String- tags. -
String- client_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. -
Array of Object- keys. -
Integer- quorom. -
Object- tags. -
String- client_token.
// Request
curl -X POST create-account -d '{"root_xpubs":["2d6c07cb1ff7800b0793e300cd62b6ec5c0943d308799427615be451ef09c0304bee5dd492c6b13aaa854d303dc4f1dcb229f9578786e19c52d860803efa3b9a"],"Quorum":1,"Alias":"alice"}'
// Result
{
"id": "08FO663C00A02",
"alias": "alice",
"keys": [
{
"root_xpub": "02581f1a2099e1696c498901c0049a22cc3e7f85db71c4ebb78f238d3ef8b323d2fd5c33b6f634aacdd25eb5e09c0c803077c521ef0524e4cc64d1a4420c8bc6",
"account_xpub": "c8e2de53818c96a30e7990fe102c6c088ae798d5a6d4624f85ed9be7b692fd71bdc787c265dd9d89a606513be04dd8323eb35156aee463f42ee22596d1675a8d",
"account_derivation _path": [
"010100000000000000"
]
}
],
"quorum": 1,
"tags": null
}optional:
-
String- id.
Array of Object.
list all the available accounts:
// Request
curl -X POST list-accounts -d {}
// Result
[
{
"alias": "alice",
"id": "086KQD75G0A02",
"quorum": 1,
"key_index": 1,
"xpubs": [
"180aab8bf247932a7cf68da5cc9a873266279155097612f1e5fdda4add88d5e91e2e7ce5b736f3ac933824cdee9effcf1531b90dfcb388e5cc306d14e9a2c85e"
]
},
{
"alias": "bob",
"id": "086KQO67G0A04",
"quorum": 1,
"key_index": 2,
"xpubs": [
"180aab8bf247932a7cf68da5cc9a873266279155097612f1e5fdda4add88d5e91e2e7ce5b736f3ac933824cdee9effcf1531b90dfcb388e5cc306d14e9a2c85e"
]
}
]list the account matching the given id:
// Request
curl -X POST list-accounts -d '{"id": "0892BIVCG0A02"}'
// Result
[
{
"alias": "alice",
"id": "0892BIVCG0A02",
"quorum": 1,
"key_index": 1,
"xpubs": [
"64960a7affe454fac9f4f4640a88817ff0a4dd7dd79fd83f8ad2d70c5eaca57af96cda1f42b628d1bdc914f5d00e28cd21f11df9c5d65c40806e755d3c2ff7d7"
]
}
]optional:
none
Array of Object.
list all the list-addresses:
// Request
curl -X POST list-addresses -d {}
// Result
[
{
"account_id": "086KQD75G0A02",
"address": "bm1qcn9lf7nxhswratvmg6d78nq7r7yupm36qgsv55"
},
{
"account_id": "086KQO67G0A04",
"address": "bm1qfkf3tyc95m0axv2mfnjsnu7l0h5tyfnpgpud4lsz5m0xkqmhgy9sd4x24h"
}
]Object:
-
String- account_info, alias or ID of account. -
Object- tags.
none if the update-account-tags action is successful.
// Request
curl -X POST update-account-tags -d '{"account_info":"bob", "tags":{"xlc":"test2"}}'
// ResultObject:
-
String- account_id | account_alias
Object:
-
String- address. -
String- control_program.
//Request
curl -X POST create-account-receiver -d '{"account_id":"0BDQARM800A04", "account_alias": "bob"}'// Result
{
"address": "bm1q5u8u4eldhjf3lvnkmyl78jj8a75neuryzlknk0",
"control_program": "0014a70fcae7edbc931fb276d93fe3ca47efa93cf064"
}Object:
-
String- account_info, ID or alias of account.
Object:
-
String- control_program. -
String- address. -
String- expires_at.
Request:
curl -X POST create-account-address -d '{"account_info":"bob"}'Result:
{
"control_program":"76ab147552f41b234a311bd219dae9f6e456faace4912088ae7cac",
"address":"bm1qw4f0gxerfgc3h5semt5ldezkl2kwfyfqle79m7",
"expires_at":"2018-02-04T14:23:20.233839+08:00"
}-
String- id, token ID.
optional:
-
String- created_at.
Object:
-
String- accessToken.
// Request
curl -X POST create-access-token -d '{"id":"token1"}'
// Result
{
"accessToken": "token1:1fee70f537128a201338bd5f25a3adbf33dad02eae4f4c9ac43f336a069df8f3"
}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.
Optional:
-
String- tags. -
String- definition. -
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. -
String- issue_program. -
Array of Object- keys. -
String- definition. -
Integer- quorom. -
Object- tags.
// Request
curl -X POST create-asset -d '{"alias": "test-asset1", "root_xpubs": ["f6a16704f745a168642712060e6c5a69866147e21ec2447ae628f87d756bb68cc9b91405ad0a95f004090e864fde472f62ba97053ea109837bc89d63a64040d5"], "quorum":1, "access_token": ""}'
// Result
{
"id": "3c1cf4c9436e3f942cb2f1d70a584f1c61df3697698dacccdc89e46f46a003d0",
"alias": "test-asset1",
"issuance_program": "766baa209683b893483c0a5a317bf9868a8e2a09691f8aa8c1f3e2a7bb62b157e76712e05151ad696c00c0",
"keys": [
{
"root_xpub": "f6a16704f745a168642712060e6c5a69866147e21ec2447ae628f87d756bb68cc9b91405ad0a95f004090e864fde472f62ba97053ea109837bc89d63a64040d5",
"asset_pubkey": "9683b893483c0a5a317bf9868a8e2a09691f8aa8c1f3e2a7bb62b157e76712e012bd443fa7d56a0627df0a29dffcdc52641672a0f5cba54d104ad76ebeb8dfc3",
"asset_derivation_path": [
"000200000000000000"
]
}
],
"quorum": 1,
"definition": {
},
"tags": {
}
}
}Object:
-
String- asset_info, alias or ID of asset. -
Object-tags
// Request
curl -X POST update-asset-tags -d '{"asset_info":"gold", "tags":{"xlc":"test2"}}'
// ResultThere are two kinds of transactions, i.e., issue and spend. Every transaction requires two steps to complete:
-
build-transaction, either issue or spend. -
sign-submit-transaction.
-
build-transactionwith-t issue. sign-submit-transaction
Step 1, build-transaction:
Parameters
Object:
-
String- base_transaction -
Integer- ttl -
Arrary of Object- actions:-
Object:-
String- account_id or account_alias. -
String- asset_id or asset_alias. -
Quantity- amount. -
String- type,issue,spend_accountorcontrol_account.
-
-
Returns
Object
Example
// Request
curl -X POST build-transaction -d '{"base_transaction":null,"actions":[{"account_id":"086VU4KEG0A02","amount":20000000,"asset_id":"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","type":"spend_account"},{"amount":1000,"asset_id":"8688ab76020123d14eb72ab1324e3a8d6a3cf1b431332c3235470dc764c647ab","type":"issue"},{"account_id":"086VU4KEG0A02","amount":1000,"asset_id":"8688ab76020123d14eb72ab1324e3a8d6a3cf1b431332c3235470dc764c647ab","type":"control_account"}],"ttl":0}'
// Result
// The following response will be used in the request of sign-submit-transaction step.
{
"raw_transaction": "07010002019d01019a01fb77ab11fafc5cf0446d552724aed272b71cfc7ac7d032d2b1de8890e482d0beffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80c0b1ca9412000131cd022c07a069766baa202178450f93d1d2b6da69cc601500a6e333b3dd350525780cf7eb4d03980f34bb5151ad696c00c0a7ffc6f8bf1ed76651c14756a061d662f580ff4de43b49fa82d80a4b80f8434a000100012c000870504ebd4df97a988688ab76020123d14eb72ab1324e3a8d6a3cf1b431332c3235470dc764c647abe807004f5745f2f3c6b5cf99e874e9d002c6d62fb8bc717461de1b95b6b6b6941201000000012b766baa20273c3761242d790f334d662eee5dbd3cbded3bd9472fab43fe8ccc8d08e2635a5151ad696c00c000020153ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80e6ecc09412012b766baa20f043e82d4ace89bc78e03a2dc3d01436f26a26c2ddcb3c788579950fd228c5765151ad696c00c00000014f8688ab76020123d14eb72ab1324e3a8d6a3cf1b431332c3235470dc764c647abe807012b766baa208a9e5964c4169e3c1d7f60cf88705d670aee2309c436ff3581d338d09709bc4f5151ad696c00c0000000",
"signing_instructions": [
{
"position": 0,
"witness_components": [
{
"type": "signature",
"quorum": 1,
"keys": [
{
"xpub": "bca618ec76a77a5227c1ef64809622200c210efec89f47ae92e923f57e04e387a1985f008c18055b82bc4c870a3e6a53565a7bae1675b188f9dc5437828f6757",
"derivation_path": [
"010100000000000000",
"c206000000000000"
]
}
],
"signatures": null
}
]
},
{
"position": 1,
"witness_components": [
{
"type": "signature",
"quorum": 1,
"keys": [
{
"xpub": "bca618ec76a77a5227c1ef64809622200c210efec89f47ae92e923f57e04e387a1985f008c18055b82bc4c870a3e6a53565a7bae1675b188f9dc5437828f6757",
"derivation_path": [
"000300000000000000"
]
}
],
"signatures": null
}
]
}
],
"local": true,
"allow_additional_actions": false
}Step 2, sign-submit-transaction:
Parameters
Object:
-
String- auth, password. -
Object, transaction, the result ofissuetype of transaction.
Returns
Object:
-
String- txid.
Example
// Request
curl -X POST sign-submit-transaction -d '{"auth":"123","transaction":{"raw_transaction":"07010002019d01019a01fb77ab11fafc5cf0446d552724aed272b71cfc7ac7d032d2b1de8890e482d0beffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80c0b1ca9412000131cd02bf03a069766baa20cdff1d56e1c170a9f34c00fd9b6009895dbb52ea6169b1515a67847d688e05f25151ad696c00c0a7ffc6f8bf1ed76651c14756a061d662f580ff4de43b49fa82d80a4b80f8434a0001000193010190012a8ae1942de353edac5fb4003a74dc4f64258991815c529ff857711eb49f18ec8688ab76020123d14eb72ab1324e3a8d6a3cf1b431332c3235470dc764c647ab840701012b766baa208dde7aebb886ba2257d7cfdbd9b0b9a94008b2a1f02ee1d8416d2878eaefa7e75151ad696c00c0a7ffc6f8bf1ed76651c14756a061d662f580ff4de43b49fa82d80a4b80f8434a000100030153ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80e6ecc09412012b766baa20f043e82d4ace89bc78e03a2dc3d01436f26a26c2ddcb3c788579950fd228c5765151ad696c00c00000014f8688ab76020123d14eb72ab1324e3a8d6a3cf1b431332c3235470dc764c647aba006012b766baa208a9e5964c4169e3c1d7f60cf88705d670aee2309c436ff3581d338d09709bc4f5151ad696c00c00000014e8688ab76020123d14eb72ab1324e3a8d6a3cf1b431332c3235470dc764c647ab64012b766baa206018541acd41d8a610fed1e18f2b137e2a49562deb0e636888b9a6a56ad8f5a95151ad696c00c0000000","signing_instructions":[{"position":0,"witness_components":[{"type":"signature","quorum":1,"keys":[{"xpub":"bca618ec76a77a5227c1ef64809622200c210efec89f47ae92e923f57e04e387a1985f008c18055b82bc4c870a3e6a53565a7bae1675b188f9dc5437828f6757","derivation_path":["010100000000000000","5303000000000000"]}],"signatures":null}]},{"position":1,"witness_components":[{"type":"signature","quorum":1,"keys":[{"xpub":"bca618ec76a77a5227c1ef64809622200c210efec89f47ae92e923f57e04e387a1985f008c18055b82bc4c870a3e6a53565a7bae1675b188f9dc5437828f6757","derivation_path":["010100000000000000","6303000000000000"]}],"signatures":null}]}],"local":true,"allow_additional_actions":false}}'
// Result
{
"txid": "e1fdacf77b5f2303049719c2bd359791916d640d517cdcc58199aeb292947536"
}Step 1, build-transaction:
Parameters
Object:
-
String- base_transaction -
Integer- ttl -
Arrary of Object- actions:-
Object:-
String- account_id or account_alias. -
String- asset_id or asset_alias. -
Quantity- amount. -
String- type,spend_accountorcontrol_receiver.
-
-
Returns
Object
Example
// Request
curl -X POST build-transaction -d '{"base_transaction":null,"actions":[{"account_id":"086VU4KEG0A02","amount":20000000,"asset_id":"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","type":"spend_account"},{"account_id":"086VU4KEG0A02","amount":50,"asset_id":"8688ab76020123d14eb72ab1324e3a8d6a3cf1b431332c3235470dc764c647ab","type":"spend_account"},{"amount":50,"asset_id":"8688ab76020123d14eb72ab1324e3a8d6a3cf1b431332c3235470dc764c647ab","receiver":{"control_program":"766baa20be6dc3a33c6a8e3dc3a99db53f48e04421b25c8da36eb292414b20c1f3cb21135151ad696c00c0","expires_at":"2017-12-28T12:52:06.78309768+08:00"},"type":"control_receiver"}],"ttl":0}'
// Result
{
"allow_additional_actions": false,
"local": true,
"raw_transaction": "07010002019d01019a01fb77ab11fafc5cf0446d552724aed272b71cfc7ac7d032d2b1de8890e482d0beffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80c0b1ca9412000131cd020206a069766baa208aa4811152a4b863c0a40fb089d7f721df7f2a75d342f47201a4ca8cf2ffbad05151ad696c00c0a7ffc6f8bf1ed76651c14756a061d662f580ff4de43b49fa82d80a4b80f8434a00010001930101900144625fb533bd595be2f38f37e4d5ef0a556673d5250d2eff4cf40b182bc5b52b8688ab76020123d14eb72ab1324e3a8d6a3cf1b431332c3235470dc764c647aba00601012b766baa208a9e5964c4169e3c1d7f60cf88705d670aee2309c436ff3581d338d09709bc4f5151ad696c00c0a7ffc6f8bf1ed76651c14756a061d662f580ff4de43b49fa82d80a4b80f8434a000100030153ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80e6ecc09412012b766baa20b6f6b8bdf38a6228a67bcf8693e5abbef19b81e96e4a400afdd7c49ffe1b20dd5151ad696c00c00000014f8688ab76020123d14eb72ab1324e3a8d6a3cf1b431332c3235470dc764c647abee05012b766baa2060ee455c2f79f67a31116819bdb01582e61dde02ec38f907bf2cb05293ac37e15151ad696c00c00000014e8688ab76020123d14eb72ab1324e3a8d6a3cf1b431332c3235470dc764c647ab32012b766baa20be6dc3a33c6a8e3dc3a99db53f48e04421b25c8da36eb292414b20c1f3cb21135151ad696c00c0000000",
"signing_instructions": [
{
"position": 0,
"witness_components": [
{
"keys": [
{
"derivation_path": [
"010100000000000000",
"9805000000000000"
],
"xpub": "bca618ec76a77a5227c1ef64809622200c210efec89f47ae92e923f57e04e387a1985f008c18055b82bc4c870a3e6a53565a7bae1675b188f9dc5437828f6757"
}
],
"quorum": 1,
"signatures": null,
"type": "signature"
}
]
},
{
"position": 1,
"witness_components": [
{
"keys": [
{
"derivation_path": [
"010100000000000000",
"0300000000000000"
],
"xpub": "bca618ec76a77a5227c1ef64809622200c210efec89f47ae92e923f57e04e387a1985f008c18055b82bc4c870a3e6a53565a7bae1675b188f9dc5437828f6757"
}
],
"quorum": 1,
"signatures": null,
"type": "signature"
}
]
}
]
}Step 2, sign-submit-transaction:
Parameters
Object:
-
String- auth, password. -
Object- transaction, the result ofspendtype ofbuild-transaction.
Returns
Object:
-
String- txid.
Example
// Request
curl -X POST sign-submit-transaction -d '{"auth":"123","transaction":{"raw_transaction":"07010002019d01019a01fb77ab11fafc5cf0446d552724aed272b71cfc7ac7d032d2b1de8890e482d0beffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80c0b1ca9412000131cd020206a069766baa208aa4811152a4b863c0a40fb089d7f721df7f2a75d342f47201a4ca8cf2ffbad05151ad696c00c0a7ffc6f8bf1ed76651c14756a061d662f580ff4de43b49fa82d80a4b80f8434a00010001930101900144625fb533bd595be2f38f37e4d5ef0a556673d5250d2eff4cf40b182bc5b52b8688ab76020123d14eb72ab1324e3a8d6a3cf1b431332c3235470dc764c647aba00601012b766baa208a9e5964c4169e3c1d7f60cf88705d670aee2309c436ff3581d338d09709bc4f5151ad696c00c0a7ffc6f8bf1ed76651c14756a061d662f580ff4de43b49fa82d80a4b80f8434a000100030153ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80e6ecc09412012b766baa20b6f6b8bdf38a6228a67bcf8693e5abbef19b81e96e4a400afdd7c49ffe1b20dd5151ad696c00c00000014f8688ab76020123d14eb72ab1324e3a8d6a3cf1b431332c3235470dc764c647abee05012b766baa2060ee455c2f79f67a31116819bdb01582e61dde02ec38f907bf2cb05293ac37e15151ad696c00c00000014e8688ab76020123d14eb72ab1324e3a8d6a3cf1b431332c3235470dc764c647ab32012b766baa20be6dc3a33c6a8e3dc3a99db53f48e04421b25c8da36eb292414b20c1f3cb21135151ad696c00c0000000","signing_instructions":[{"position":0,"witness_components":[{"type":"signature","quorum":1,"keys":[{"xpub":"bca618ec76a77a5227c1ef64809622200c210efec89f47ae92e923f57e04e387a1985f008c18055b82bc4c870a3e6a53565a7bae1675b188f9dc5437828f6757","derivation_path":["010100000000000000","9805000000000000"]}],"signatures":null}]},{"position":1,"witness_components":[{"type":"signature","quorum":1,"keys":[{"xpub":"bca618ec76a77a5227c1ef64809622200c210efec89f47ae92e923f57e04e387a1985f008c18055b82bc4c870a3e6a53565a7bae1675b188f9dc5437828f6757","derivation_path":["010100000000000000","0300000000000000"]}],"signatures":null}]}],"local":true,"allow_additional_actions":false}}'
// Result
{
"txid": "872d58bfe04d247b126e18b183d9ff39dd6f04785b0f0ea12020b7008754ae79"
}// Request
curl -X POST build-transaction -d '{"base-transaction":null, "actions": [{"type": "spend_account", "asset_id": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", "amount":20000000, "account_alias": "alice"},{"type": "spend_account", "asset_alias": "btm","amount": 100000000, "account_alias": "alice"},{"type": "control_address", "asset_alias": "btm", "amount": 100000000,"address": "bm1q675d8fpkvy0a7fv8h9n48ks0wv0dhazt6fyjf2"}], "ttl":0}'// Result
{"allow_additional_actions":false,"local":true,"raw_transaction":"07010002019c01019901fb77ab11fafc5cf0446d552724aed272b71cfc7ac7d032d2b1de8890e482d0beffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80c0b1ca9412000130cd0134a069766baa20c38d34e6f41b91825cecb906da8bfd127b0b6f1422b50a09352e4fed9bbb5f245151ad696c00c0a7ffc6f8bf1ed76651c14756a061d662f580ff4de43b49fa82d80a4b80f8434a000100019c01019901fb77ab11fafc5cf0446d552724aed272b71cfc7ac7d032d2b1de8890e482d0beffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80c0b1ca9412000130cd0138a069766baa20fa2de6a8d4fa052d3b155b0e8d259a7e0007c6e3e43fc10dcd0cf818c087bfea5151ad696c00c0a7ffc6f8bf1ed76651c14756a061d662f580ff4de43b49fa82d80a4b80f8434a000100030153ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80e6ecc09412012b766baa206e1b58dedd65ba5c36c8e47908157da89b6cb8c9bd349bde6270d20caeeb41ec5151ad696c00c000000153ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80fed99a9412012b766baa20dbbffa54ae138b0d84dff52d8dedeb63332659fa0d8cf855ea455243cafa079c5151ad696c00c000000141ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80c2d72f011b76ab14d7a8d3a436611fdf2587b96753da0f731edbf44b88ae7cac000000","signing_instructions":[{"position":0,"witness_components":[{"keys":[{"derivation_path":["010100000000000000","2d00000000000000"],"xpub":"f6a16704f745a168642712060e6c5a69866147e21ec2447ae628f87d756bb68cc9b91405ad0a95f004090e864fde472f62ba97053ea109837bc89d63a64040d5"}],"quorum":1,"signatures":null,"type":"signature"}]},{"position":1,"witness_components":[{"keys":[{"derivation_path":["010100000000000000","3500000000000000"],"xpub":"f6a16704f745a168642712060e6c5a69866147e21ec2447ae628f87d756bb68cc9b91405ad0a95f004090e864fde472f62ba97053ea109837bc89d63a64040d5"}],"quorum":1,"signatures":null,"type":"signature"}]}]}// Request
curl -X POST sign-submit-transaction -d '{"auth":"123", "transaction":{"raw_transaction":"07010002019c01019901fb77ab11fafc5cf0446d552724aed272b71cfc7ac7d032d2b1de8890e482d0beffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80c0b1ca9412000130cd014fa069766baa20b83ed065bf4618829ea6b3f268f29f403af1a5754ed75d3b6ca52cd6044c15535151ad696c00c0a7ffc6f8bf1ed76651c14756a061d662f580ff4de43b49fa82d80a4b80f8434a000100019c01019901fb77ab11fafc5cf0446d552724aed272b71cfc7ac7d032d2b1de8890e482d0beffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80c0b1ca9412000130cd0113a069766baa206ab5948d4dc6648ba68a2874dbde6f8ab0aeab28822791968fbe01a81606be735151ad696c00c0a7ffc6f8bf1ed76651c14756a061d662f580ff4de43b49fa82d80a4b80f8434a000100030153ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80e6ecc09412012b766baa200655c6187aaf860e202b03f0f33c7df5aba58f7fcd5a21797c0df45e3d8695745151ad696c00c000000153ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80fed99a9412012b766baa20caab01a479b10273a98bd3e16125fa5efe87f7f054e62caa937b480a381c98905151ad696c00c000000141ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80c2d72f011b76ab14d7a8d3a436611fdf2587b96753da0f731edbf44b88ae7cac000000","signing_instructions":[{"position":0,"witness_components":[{"type":"signature","quorum":1,"keys":[{"xpub":"f6a16704f745a168642712060e6c5a69866147e21ec2447ae628f87d756bb68cc9b91405ad0a95f004090e864fde472f62ba97053ea109837bc89d63a64040d5","derivation_path":["010100000000000000","4c00000000000000"]}],"signatures":null}]},{"position":1,"witness_components":[{"type":"signature","quorum":1,"keys":[{"xpub":"f6a16704f745a168642712060e6c5a69866147e21ec2447ae628f87d756bb68cc9b91405ad0a95f004090e864fde472f62ba97053ea109837bc89d63a64040d5","derivation_path":["010100000000000000","0500000000000000"]}],"signatures":null}]}],"local":true,"allow_additional_actions":false}}}'// Result
{
"txid":"e426508d54a773af196f94e861bf0c0bd1580aa987b84e205cf88ebba678c7b9"
}Array of Object
// 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"
}
]Array of Object
// Request
curl -X POST get-transaction -d {"tx_hash":"277aa67c2f9b1d340c0be53e81952706a444e12011a670181bc5fa0e7672a49e"}
// Result
{
"block_height": 30,
"block_id": "0693cb1408d38e2df5a5e1302a51218a7f58b790367f610b028b7a0a931909f3",
"block_transactions_count": 2,
"id": "277aa67c2f9b1d340c0be53e81952706a444e12011a670181bc5fa0e7672a49e",
"inputs": [
{
"account_alias": "default",
"account_id": "0BF1J9LCG0A02",
"amount": 624000000000,
"asset_alias": "btm",
"asset_definition": "7b0a202022646563696d616c73223a20382c0a2020226465736372697074696f6e223a20224279746f6d204f6666696369616c204973737565222c0a2020226e616d65223a202262746d222c0a20202273796d626f6c223a202262746d220a7d",
"asset_id": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"spent_output_id": "2072edd06054d7cd27b2f120d0b1a21d4cc3f8077dc5f495ece0fea833ad09d7",
"type": "spend"
}
],
"outputs": [
{
"account_alias": "default",
"account_id": "0BF1J9LCG0A02",
"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",
"amount": 60000000000,
"asset_alias": "btm",
"asset_definition": "7b0a202022646563696d616c73223a20382c0a2020226465736372697074696f6e223a20224279746f6d204f6666696369616c204973737565222c0a2020226e616d65223a202262746d222c0a20202273796d626f6c223a202262746d220a7d",
"asset_id": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"control_program": "0014bfdaf76c1b853ce435ee7454acfbef873d487523",
"id": "63bcfec365913ef980ab95ad2bef5eba9bd8637723af138a695b5e9a0a5a571e",
"position": 1,
"type": "control"
}
],
"position": 1,
"status_fail": false,
"timestamp": "2018-03-17T06:19:48Z"
}optional:
-
String- id, id of transaction. -
Bool- detail , flag of required transactions data ,default false (only return transaction summary)
Array of Object
list all the available transactions:
// Request
curl -X POST list-transactions -d {}list the transaction matching the given id:
// Request
curl -X POST list-transactions -d '{"id": "31b33cefeac572a2c2a6ae233fc1f1cbb6c5c4ed1cb569909a97286d30824a5a","detail":true}'
// Result
{
"status": "success",
"data": [
{
"id": "31b33cefeac572a2c2a6ae233fc1f1cbb6c5c4ed1cb569909a97286d30824a5a",
"timestamp": "2018-01-22T07:36:46.08Z",
"block_id": "2741033a9e1c00f74b02f6d9b90bd9f8d4a694e787326bbad2a3ca57cd030000",
"block_height": 397,
"position": 0,
"block_transactions_count": 1,
"reference_data": {},
"inputs": [
{
"type": "coinbase",
"asset_id": "0000000000000000000000000000000000000000000000000000000000000000",
"asset_definition": {},
"amount": 0,
"reference_data": {},
"arbitrary": "c68d"
}
],
"outputs": [
{
"type": "control",
"id": "991b5e689cc2ab20945018623fadbd3e6a3979cccc567f4dee76d4317694a960",
"position": 0,
"asset_id": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"asset_alias": "btm",
"asset_definition": {
"decimals": 8,
"description": "Bytom Official Issue",
"name": "btm",
"symbol": "btm"
},
"amount": 624000000000,
"account_id": "095S8HFP00A02",
"account_alias": "alice",
"control_program": "00142936749173328eb71e1b98ac6b4240fbcfd3e056",
"reference_data": {}
}
]
}
]
}optional:
-
String- id, id of output.
Array of Object
list all the available unspent outputs:
// Request
curl -X POST list-unspent-outputs -d {}
// Result
[
{
"alias": "alice",
"output_id": "01c5d6da9136cb88f7d3ca3f258e0efb7dda07774dc728dbf477a14e6de9b7e0",
"asset_id": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"amount": 624000000000,
"account_id": "086KQD75G0A02",
"program_index": 5,
"program": "cd027809a069766baa20ac8a4a9edff6e3bd3efe5ec6408d698b817702983b5554518709cdefe4094aa35151ad696c00c0",
"source_id": "fb77ab11fafc5cf0446d552724aed272b71cfc7ac7d032d2b1de8890e482d0be",
"source_pos": 0,
"ref_data": "a7ffc6f8bf1ed76651c14756a061d662f580ff4de43b49fa82d80a4b80f8434a",
"change": false
}
]list the unspent output matching the output id:
// Request
curl -X POST list-unspent-outputs -d '{"id": "651739b8f94a4cdd45e44b19aa50baf6f8a6f3f3ef5d87a5a2442c9361712e4d"}'
// Result
[
{
"alias": "alice",
"output_id": "651739b8f94a4cdd45e44b19aa50baf6f8a6f3f3ef5d87a5a2442c9361712e4d",
"asset_id": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"amount": 624000000000,
"account_id": "0892BIVCG0A02",
"program_index": 1,
"program": "cd5aa069766baa20b9b465509c2c8032e71873871d50050cc572c79b764f0d62c2b52bb63923ab7c5151ad696c00c0",
"sou rce_id": "fb77ab11fafc5cf0446d552724aed272b71cfc7ac7d032d2b1de8890e482d0be",
"source_pos": 0,
"ref_data": "a7ffc6f8bf1ed76651c14756a061d662f580ff4de43b49fa82d80a4b80f8434a",
"change": false
}
]optional:
-
String- id, id of asset.
Object of Object
list all the available keys:
// Request
curl -X POST list-assets -d {}
// Result
[
{
"id": "675f24dcb4f196a67da889aa376ee84e2d028e7771f861a7486c24c73589b8df",
"alias": "gold",
"vm_version": 1,
"issue_program": "766baa203fd2f566ebfcb9bb329d902f82ef93721acebe3697a7268ab2daf988c60772365151ad696c00c0",
"init_blockhash": "64eaa1cae4cf14f775251c5eb786376d2cf218e488dcea79826b9ce56d0a0000",
"xpubs": [
"87ee62ab20818bfb9fa66e62cfb3d0cc95b17ff92db7fd13f81774be656c1e618a3b66c8f832254f786d65f6ae91df2268b6acae228892cae340174399fa45b8"
],
"quorum": 1,
"key_index": 1,
"definition": {
},
"tags": {
}
}
]list the asset matching the given id:
// Request
curl -X POST list-assets -d '{"id": "675f24dcb4f196a67da889aa376ee84e2d028e7771f861a7486c24c73589b8df"}'
// Result
[
{
"id": "675f24dcb4f196a67da889aa376ee84e2d028e7771f861a7486c24c73589b8df",
"alias": "gold",
"vm_version": 1,
"issue_program": "766baa203fd2f566ebfcb9bb329d902f82ef93721acebe3697a7268ab2daf988c60772365151ad696c00c0",
"init_blockhash": "64eaa1cae4cf14f775251c5eb786376d2cf218e488dcea79826b9ce56d0a0000",
"xpubs": [
"87ee62ab20818bfb9fa66e62cfb3d0cc95b17ff92db7fd13f81774be656c1e618a3b66c8f832254f786d65f6ae91df2268b6acae228892cae340174399fa45b8"
],
"quorum": 1,
"key_index": 1,
"definition": {
},
"tags": {
}
}
]- null
WorkResp
type WorkResp struct {
Header legacy.BlockHeader
}// Request
curl -X POST get-work -d '{}'
{"Header":"01017d167546e5da2b7d121d404b2f4654510b7c24df2ee34006bbbb6b9e3f9fffbdac0000000000000000000000000000000000000000000000000000000000000000d2b5cbd30540887743ecac37228e1bc112e72c62b571a9167c13b3f2e20e089dd3daca7f20be000000000000000000000000000000000000000000000000000000000000000002010000ffffff838080808020"}-
header-legacy.BlockHeader
- null
// BlockHeader describes necessary data of the block.
type BlockHeader struct {
// Version of the block.
Version uint64
// Height of the block in the block chain.
// Initial block has height 1.
Height uint64
// Hash of the previous block in the block chain.
PreviousBlockHash bc.Hash
Seed bc.Hash
// Time of the block in seconds.
Timestamp uint64
TransactionStatus bc.TransactionStatus
BlockCommitment
Nonce uint64
Bits uint64
}-
address-string
list all the list-addresses:
// Request
curl -X POST validate-address -d {"address": "bm1qcn9lf7nxhswratvmg6d78nq7r7yupm36qgsv55"}
// Result
{
"vaild": true,
"is_local": true,
}by bytom
Coming soon