Skip to content
This repository was archived by the owner on Mar 21, 2024. It is now read-only.

API Reference

oysheng edited this page Mar 20, 2018 · 176 revisions

API Endpoint

Default JSON-RPC endpoints:

Client URL
Go http://localhost:9888

A complete request example via curl:

Go

// curl -X POST url/method -d data
curl -X POST http://localhost:9888/create-key -d '{"alias": "alice", "password": "123456"}'

API methods


get-block-count

Parameters

none

Returns

Object:

  • Integer - block_count, block height of the blockchain.
Example
// Request
curl -X POST get-block-count

// Result
{
    "block_count": 519
}

create-key

Parameters

Object:

  • String - alias, name of the key.
  • String - password, password of the key.
Returns

Object:

  • String - alias, name of the key.
  • String - xpub, pubkey of the key.
Example
// Request
curl -X POST create-key -d '{"alias": "alice", "password": "123"}'

// Result
{
  "alias": "alice",
  "xpub": "a7dae957c2d35b42efe7e6871cf5a75ebd2a0d0e51caffe767db42d3e6d69dbe211d1ca492ecf05908fe6fa625ad61b3253375ea744c9442dd5551613ba50aea"
}

list-keys

Parameters

none

Returns

ARRAY of Object - keys owned by the client.

Example
// Request
curl -X POST list-keys

// Result
[
  {
    "alias": "alice",
    "xpub": "a7dae957c2d35b42efe7e6871cf5a75ebd2a0d0e51caffe767db42d3e6d69dbe211d1ca492ecf05908fe6fa625ad61b3253375ea744c9442dd5551613ba50aea"
  },
  {
    "alias": "bob",
    "xpub": "d30a810e88532f73816b7b5007d413cbd21e526ae9159023e5262511893adc1526b8eacd691b27c080201d7d79336a4f3d2cb4c167d997821cad445765916254"
  }
]

delete-key

Parameters

Object:

  • String - xpub, pubkey of the key.
  • String - password, password of the key.
Returns

none if the key is deleted successfully.

Example
// Request
curl -X POST delete-key -d '{"xpub": "a7dae957c2d35b42efe7e6871cf5a75ebd2a0d0e51caffe767db42d3e6d69dbe211d1ca492ecf05908fe6fa625ad61b3253375ea744c9442dd5551613ba50aea", "password": "123"}'

// Result

export-private-key

Parameters

Object:

  • String - xpub, pubkey of the key.
  • String - password, password of the key.
Returns

Object:

  • String - private_key, private key.
Example
// Request
curl -X POST export-private-key -d '{"xpub":"02581f1a2099e1696c498901c0049a22cc3e7f85db71c4ebb78f238d3ef8b323d2fd5c33b6f634aacdd25eb5e09c0c803077c521ef0524e4cc64d1a4420c8bc6", "password":"123"}'

// Result
{
  "private_key": "2AxwqaoXGbFZ2Vqc3Pjc5zZabxBXutvn89c7TFEtpWtTU5hfbmpg9MSzhMTsQwD5Ark61s3vszKfzcZwJ6r52cVcTxUuT"
}

import-private-key

Parameters

Object:

  • String - alias, name of the key.
  • String - private_key, private key.
  • Integer - index, number of account address to be created.
  • String - password, password of the key.
  • String - account_alias, name of account.
Returns

Object:

  • String - alias, name of the key.
  • String - xpub, pubkey of the key.
Example
// Request
curl -X POST import-private-key -d '{"alias":"alice", "private_key":"2AxwqaoXGbFZ2Vqc3Pjc5zZabxBXutvn89c7TFEtpWtTU5hfbmpg9MSzhMTsQwD5Ark61s3vszKfzcZwJ6r52cVcTxUuT", "index":1, "password":"123", "account_alias":"alice"}'

// Result
{
  "alias": "alice",
  "xpub": "02581f1a2099e1696c498901c0049a22cc3e7f85db71c4ebb78f238d3ef8b323d2fd5c33b6f634aacdd25eb5e09c0c803077c521ef0524e4cc64d1a4420c8bc6"
}

create-account

Parameters

Object:

  • Array of String - root_xpubs, pubkey array.
  • String - alias, name of the account.
  • Integer - quorum, the default value is 1, threshold of keys that must sign a transaction to spend asset units controlled by the account.

Optional:

  • Object - tags, account tags.
  • String - access_token, if optional when creating account locally. However, if you want to create account remotely, it's indispensable.
Returns

Object:

  • String - id, account id.
  • String - alias, name of account.
  • Array of Object - xpubs, pubkey array.
  • Integer - quorom, threshold of keys that must sign a transaction to spend asset units controlled by the account.
  • Object - tags, account tags.
  • String - key_index, index of account.
Example
// Request
curl -X POST create-account -d '{"root_xpubs":["2d6c07cb1ff7800b0793e300cd62b6ec5c0943d308799427615be451ef09c0304bee5dd492c6b13aaa854d303dc4f1dcb229f9578786e19c52d860803efa3b9a"],"quorum":1,"alias":"alice"}'

// Result
{
  "alias": "alice",
  "id": "08FO663C00A02",
  "key_index": 1,
  "quorum": 1,
  "tags": null,
  "xpubs": [
    "02581f1a2099e1696c498901c0049a22cc3e7f85db71c4ebb78f238d3ef8b323d2fd5c33b6f634aacdd25eb5e09c0c803077c521ef0524e4cc64d1a4420c8bc6"
  ]
}

list-accounts

Parameters

optional:

  • String - id, account id.
Returns

Array of Object, account array.

Example

list all the available accounts:

// Request
curl -X POST list-accounts -d {}

// Result
[
  {
    "alias": "alice",
    "id": "086KQD75G0A02",
    "key_index": 1,
    "quorum": 1,
    "tags": null,
    "xpubs": [
      "180aab8bf247932a7cf68da5cc9a873266279155097612f1e5fdda4add88d5e91e2e7ce5b736f3ac933824cdee9effcf1531b90dfcb388e5cc306d14e9a2c85e"
    ]
  },
  {
    "alias": "bob",
    "id": "086KQO67G0A04",
    "key_index": 2,
    "quorum": 1,
    "tags": null,
    "xpubs": [
      "180aab8bf247932a7cf68da5cc9a873266279155097612f1e5fdda4add88d5e91e2e7ce5b736f3ac933824cdee9effcf1531b90dfcb388e5cc306d14e9a2c85e"
    ]
  }
]

list the account matching the given id:

// Request
curl -X POST list-accounts -d '{"id": "086KQD75G0A02"}'

// Result
{
  "alias": "alice",
  "id": "086KQD75G0A02",
  "key_index": 1,
  "quorum": 1,
  "tags": null,
  "xpubs": [
    "180aab8bf247932a7cf68da5cc9a873266279155097612f1e5fdda4add88d5e91e2e7ce5b736f3ac933824cdee9effcf1531b90dfcb388e5cc306d14e9a2c85e"
  ]
}

list-addresses

Parameters

optional:

none

Returns

Array of Object.

Example

list all the list-addresses:

// Request
curl -X POST list-addresses -d {}

// Result
[
  {
    "account_id": "086KQD75G0A02",
    "address": "bm1qcn9lf7nxhswratvmg6d78nq7r7yupm36qgsv55"
  },
  {
    "account_id": "086KQD75G0A04",
    "address": "bm1qfkf3tyc95m0axv2mfnjsnu7l0h5tyfnpgpud4lsz5m0xkqmhgy9sd4x24h"
  }
]

update-account-tags

Parameters

Object:

  • String - account_info, alias or ID of account.
  • Object - tags.
Returns

none if the update-account-tags action is successful.

Example
// Request
curl -X POST update-account-tags -d '{"account_info":"bob", "tags":{"xlc":"test2"}}'

// Result

create-account-receiver

Parameters

Object:

  • String - account_id | account_alias
Returns

Object:

  • String - address.
  • String - control_program.
Example

//Request

curl -X POST create-account-receiver -d '{"account_id":"0BDQARM800A04", "account_alias": "bob"}'

// Result

{
    "address": "bm1q5u8u4eldhjf3lvnkmyl78jj8a75neuryzlknk0",
    "control_program": "0014a70fcae7edbc931fb276d93fe3ca47efa93cf064"
}

create-access-token

Parameters
  • String - id, token ID.

optional:

  • String - created_at.
Returns

Object:

  • String - accessToken.
Example
// Request
curl -X POST create-access-token -d '{"id":"token1"}'

// Result
{
  "accessToken": "token1:1fee70f537128a201338bd5f25a3adbf33dad02eae4f4c9ac43f336a069df8f3"
}

create-asset

Parameters

Object:

  • Array of String - root_xpubs, pubkey array.
  • String - alias, name of the account.
  • Integer - quorum, the default value is 1, 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.
Returns

Object:

  • String - id, account id.
  • String - alias.
  • String - issue_program.
  • Array of Object - keys.
  • String - definition.
  • Integer - quorom.
  • Object - tags.
Example
// 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": {

  }
}
}

update-asset-tags

Parameters

Object:

  • String - asset_info, alias or ID of asset.
  • Object - tags
Returns
Example
// Request
curl -X POST update-asset-tags -d '{"asset_info":"gold", "tags":{"xlc":"test2"}}'

// Result

issue
  1. build-transaction with -t issue.
  2. 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_account or control_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 of issue type 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"
}
spend

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_account or control_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 of spend type of build-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"
}
address

// 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"
}

list-balances

Parameters
Returns

Array of Object

Example
// 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"
    }
]

build-transaction

Parameters
  • String - base_transaction, base data for the transaction.
  • Integer - ttl, integer of the time to live in seconds.
  • 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: 'issue', 'spend', 'address'.
      • String - address, (type is address) address of receiver.
      • String - receiver, (type is spend) program of receiver.
Returns
  • Object of build-transaction - transaction, builded transaction.
Example
  • 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","expires_at":"2017-12-28T12:52:06.78309768+08:00"},"type":"control_receiver"}],"ttl":0}'
  • 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}'
  • 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}'
// 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"
        }
      ]
    }
  ]
}

sign-transaction

Parameters
  • String - password, signature of the password.
  • Object - transaction, builded transaction.
Returns
  • Boolean - sign_complete, returns true if sign succesfully and false otherwise.
  • Object of sign-transaction - transaction, signed transaction.
Example
// 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"
          }
        ]
      }
    ]
  }
}

submit-transaction

Parameters
  • Object - transaction, signed transaction.
Returns
  • String - tx_id, transaction id, hash of transaction.
Example
// Request
curl -X POST submit-transaction -d '{"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"}]}]}}'

// Result
{
  "tx_id": "2c0624a7d251c29d4d1ad14297c69919214e78d995affd57e73fbf84ece316cb"
}

get-transaction

Parameters

Object:

  • String - tx_id, transaction id, hash of transaction.
Returns

Object:

  • Integer - block_height, block height where this transaction was in.
  • String - block_hash, hash of the block where this transaction was in.
  • String - block_transactions_count, transaction count where this transaction was in the block.
  • String - tx_id, transaction id, hash of the transaction.
  • Integer - block_index, position of the transaction in the block.
  • Boolean - status_fail, whether the state of the request has failed.
  • String - block_time, the unix timestamp for when the requst was responsed.
  • Array of Object - inputs, object of inputs for the transaction.
  • Array of Object - outputs, object of outputs for the transaction.
Example
// Request
curl -X POST get-transaction -d {"tx_id":"277aa67c2f9b1d340c0be53e81952706a444e12011a670181bc5fa0e7672a49e"}

// Result
{
  "block_height": 30,
  "block_hash": "0693cb1408d38e2df5a5e1302a51218a7f58b790367f610b028b7a0a931909f3",
  "tx_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"
    }
  ],
  "block_index": 1,
  "status_fail": false,
  "block_time": 1516788453
}

list-transactions

Parameters

optional:

  • String - id, id of transaction.
  • Bool - detail , flag of required transactions data ,default false (only return transaction summary)
Returns

Array of Object

Example

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": {}
                }
            ]
        }
    ]
}

list-unspent-outputs

Parameters

optional:

  • String - id, id of output.
Returns
  • Array of Object
Example

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
  }
]

list-assets

Parameters

optional:

  • String - id, id of asset.
Returns
  • Object of Object
Example

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": {

    }
  }
]

get-block

Parameters

block_height | block_hash

optional:

  • String - block_hash, hash of block.
  • int - block_height, height of block.
Example

get-block:

// Request
curl -X POST get-block -d {"block_height": 43, "block_hash": "886a8e85b275e7d65b569ba510875c0e63dece1a94569914d7624c0dac8002f9"}

// Result
{  
  "status":"success",
  "data":{  
    "hash":"0047d8d9c13be3f26d505a557ba47b38ef4c964401e6d70f09f0509cad8d2218",
    "size":1354,
    "version":1,
    "height":49,
    "previous_block_hash":"fd4d9ab04364414b4c7229f414322dd27b6f35fb124349770e76e5574b4edae2",
    "timestamp":1521530725,
    "nonce":0,
    "bits":2305843009222082559,
    "difficulty":"57896037716911750921221705069588091649609539881711309849342236841432341020672",
    "transaction_merkle_root":"00247d504d7dcd51644169b8cec906ebda4c80d0e14f7a314e76ea049855d0b5",
    "transaction_status_hash":"53c0ab896cb7a3778cc1d35a271264d991792b7c44f5c334116bb0786dbc5635",
    "transactions":[  
      {  
        "id":"30b94951c1916f68a8bcdcd82100e215bcdfa4997e11fcb1f850eec199001cba",
        "version":1,
        "size":561,
        "time_range":0,
        "inputs":[  
          {  
            "type":"coinbase",
            "asset_id":"0000000000000000000000000000000000000000000000000000000000000000",
            "asset_definition":"7b7d",
            "amount":0,
            "arbitrary":"31"
          }
        ],
        "outputs":[  
          {  
            "type":"control",
            "id":"4ee9e53fd973ed9f75d9cd30c499bf8404d6ee45e043a674bc0ba0f449708be3",
            "position":0,
            "asset_id":"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
            "asset_definition":"7b7d",
            "amount":625000000000,
            "control_program":"001481da2ddb774dfc805d6c06eeaec66fa2cbb1e61e"
          }
        ],
        "status_fail":false
      },
      {  
        "id":"b7413317e60a04a81d5e91d6710ee4db787c85b8089d947b8853c0cae3985abf",
        "version":1,
        "size":484,
        "time_range":0,
        "inputs":[  
          {  
            "type":"issue",
            "asset_id":"fd18326738c3b521ed41800f5fbc45ac5659f3656348e0435cccea09e7dfd80d",
            "asset_definition":"7b7d",
            "amount":100,
            "issuance_program":"ae20b43301138ab44f6fc524a9f941ddbab89010cdf9d9b305d5072e0b99239b322d5151ad"
          },
          {  
            "type":"spend",
            "asset_id":"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
            "asset_definition":"7b7d",
            "amount":624000000000,
            "spent_output_id":"02cd0ccfcb805dd6276b66ea1dfa730c6e455002c92983aa11569a5857b5331d"
          }
        ],
        "outputs":[  
          {  
            "type":"control",
            "id":"31e5b071bcb95c08d2487b8c556dded1c1ddbd2d715ea368565c6557cd5b1ff1",
            "position":0,
            "asset_id":"fd18326738c3b521ed41800f5fbc45ac5659f3656348e0435cccea09e7dfd80d",
            "asset_definition":"7b7d",
            "amount":100,
            "control_program":"0014dcecda53e4fa5702981d18c99e85f064ea7e57bc"
          },
          {  
            "type":"control",
            "id":"a7869293d75c7eee43c35c33ed40afec39beece09c4405d3de1a68048f91c0e2",
            "position":1,
            "asset_id":"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
            "asset_definition":"7b7d",
            "amount":623000000000,
            "control_program":"001406c37e3e37cee3fd3f0b2b18596d691eb1290199"
          }
        ],
        "status_fail":false
      }
    ]
  }
}

get-work

Parameters
  • null
Returns
  • WorkResp
type WorkResp struct {
    Header legacy.BlockHeader
}
Example
// Request
curl -X POST get-work -d '{}'
{"Header":"01017d167546e5da2b7d121d404b2f4654510b7c24df2ee34006bbbb6b9e3f9fffbdac0000000000000000000000000000000000000000000000000000000000000000d2b5cbd30540887743ecac37228e1bc112e72c62b571a9167c13b3f2e20e089dd3daca7f20be000000000000000000000000000000000000000000000000000000000000000002010000ffffff838080808020"}

submit-work

Parameters
  • header - legacy.BlockHeader
Returns
  • null
legacy.BlockHeader
// 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
}

validate-address

Parameters
  • address - string
Example

list all the list-addresses:

// Request
curl -X POST validate-address -d {"address": "bm1qcn9lf7nxhswratvmg6d78nq7r7yupm36qgsv55"}

// Result
{
   "vaild": true,
   "is_local": true,
}

home

Installation Instructions

Development-Environment

Build-Node

Usage

Create-Account-and-Wallet

Node-CLI-Guide

Node-GUI-Guide

Smart contract

Coming soon

API

API-Reference

Explorer

Explorer-API

Clone this wiki locally