Skip to content

Latest commit

 

History

History
854 lines (693 loc) · 17.8 KB

api-documentation.md

File metadata and controls

854 lines (693 loc) · 17.8 KB

API Documentation for BTX

Transactions

Get Transactions by blockHeight

GET /api/BTX/mainnet/tx?blockHeight=12

Response
Use Curl command in terminal to get a response
curl https://api.bitcore.cc/api/BTX/mainnet/tx?blockHeight=12
[
   {
      "blockHash" : "14ef67800d6f37104b93c08dbb724fc8e74ebb0985d7e03e724a72a09cde7b2e",
      "blockHeight" : 12,
      "outputCount" : 2,
      "txid" : "47d32c2a2868f71a3897b48c57e367f530904b75a65badd8d77a95c1ad7ff096",
      "locktime" : -1,
      "coinbase" : true,
      "network" : "mainnet",
      "blockTime" : "2017-04-24T04:09:31.000Z",
      "chain" : "BTX",
      "confirmations" : 575847,
      "inputCount" : 1,
      "fee" : -1,
      "blockTimeNormalized" : "2017-04-24T04:09:31.000Z",
      "_id" : "5e8606816061cb14b33fc628",
      "value" : 1250000000,
      "size" : 145
   }
]

Get Transactions by blockHash

GET /api/BTX/mainnet/tx?blockHash=000000006a625f06636b8bb6ac7b960a8d03705d1ace08b1a19da3fdcc99ddbd

Response

Use Curl command in terminal to get a response

curl https://api.bitcore.cc/api/BTX/mainnet/tx?blockHash=e12a0c31e904f7747fb0f66042ffa418ddda737ff95833ea89092a58d52866e4
[
   {
      "value" : 312500000,
      "coinbase" : true,
      "size" : 115,
      "blockHeight" : 580395,
      "confirmations" : -4536,
      "chain" : "BTX",
      "fee" : -1,
      "blockHash" : "e12a0c31e904f7747fb0f66042ffa418ddda737ff95833ea89092a58d52866e4",
      "_id" : "5e9595ca5005e30c78f76378",
      "inputCount" : 1,
      "locktime" : -1,
      "blockTime" : "2020-04-14T11:04:01.000Z",
      "network" : "mainnet",
      "txid" : "172eaed7602a511a9d36a5173d4b17675ff92cd50a2c3c6ce5ae4bd92e08cf12",
      "blockTimeNormalized" : "2020-04-14T11:04:01.000Z",
      "outputCount" : 1
   }
]

Get Transaction by txid

GET /api/BTX/mainnet/tx/:txid

Response

Use Curl command in terminal to get a response

curl https://api.bitcore.cc/api/BTX/mainnet/tx/172eaed7602a511a9d36a5173d4b17675ff92cd50a2c3c6ce5ae4bd92e08cf12
{
   "fee" : -1,
   "blockTimeNormalized" : "2020-04-14T11:04:01.000Z",
   "txid" : "172eaed7602a511a9d36a5173d4b17675ff92cd50a2c3c6ce5ae4bd92e08cf12",
   "locktime" : -1,
   "network" : "mainnet",
   "size" : 115,
   "chain" : "BTX",
   "confirmations" : -4536,
   "value" : 312500000,
   "outputCount" : 1,
   "blockHash" : "e12a0c31e904f7747fb0f66042ffa418ddda737ff95833ea89092a58d52866e4",
   "blockHeight" : 580395,
   "coinbase" : true,
   "inputCount" : 1,
   "_id" : "5e9595ca5005e30c78f76378",
   "blockTime" : "2020-04-14T11:04:01.000Z"
}

Get Authhead

GET /BTX/mainnet/tx/:txid/authhead

Response
Use Curl command in terminal to get a response
curl https://api.bitcore.cc/api/BTX/mainnet/tx/172eaed7602a511a9d36a5173d4b17675ff92cd50a2c3c6ce5ae4bd92e08cf12/authhead
{
   "identityOutputs" : [],
   "network" : "mainnet",
   "chain" : "BTX",
   "authbase" : "172eaed7602a511a9d36a5173d4b17675ff92cd50a2c3c6ce5ae4bd92e08cf12"
}

Get Coins

GET /BTX/mainnet/tx/:txid/coins

Response
Use Curl command in terminal to get a response
curl https://api.bitcore.cc/api/BTX/mainnet/tx/172eaed7602a511a9d36a5173d4b17675ff92cd50a2c3c6ce5ae4bd92e08cf12/coins
{
   "outputs" : [
      {
         "mintHeight" : 580395,
         "spentHeight" : -2,
         "value" : 312500000,
         "coinbase" : true,
         "address" : "2EuXKCjoXzCTb6aUvAArkodfrPrp2iZ4AD",
         "_id" : "5e9595ca5005e30c78f76375",
         "spentTxid" : "",
         "script" : "76a91414bfdd8941fe95b3d033ad669b9968d731478f8488ac",
         "confirmations" : -1,
         "mintTxid" : "172eaed7602a511a9d36a5173d4b17675ff92cd50a2c3c6ce5ae4bd92e08cf12",
         "mintIndex" : 0,
         "network" : "mainnet",
         "chain" : "BTX"
      }
   ],
   "inputs" : []
}

Address

Get Address Transactions

GET /api/BTX/mainnet/address/:address/txs

Response

Use Curl command in terminal to get a response

curl https://api.bitcore.cc/api/BTX/mainnet/address/2RfbGtSeULJez9UjGsJcWPsfyHTUZiTnPg/txs
[
   {
      "network" : "mainnet",
      "chain" : "BTX",
      "mintIndex" : 0,
      "mintHeight" : 580319,
      "_id" : "5e95682c5005e30c78dc566f",
      "confirmations" : -1,
      "value" : 1000000,
      "coinbase" : false,
      "address" : "2RfbGtSeULJez9UjGsJcWPsfyHTUZiTnPg",
      "script" : "76a9148ac6bb327e87568f16d75a041a4f7926393667ae88ac",
      "mintTxid" : "fca422115dfc5693059ec8be06bd0db55ddafee549e68cae6db4f2fb6a1c2dd8",
      "spentHeight" : -2,
      "spentTxid" : ""
   }
]

Get Transaction Outputs by Address

GET /api/BTX/mainnet/address/:address/?unspent=true

Response

Use Curl command in terminal to get a response

curl https://api.bitcore.cc/api/BTX/mainnet/address/2RfbGtSeULJez9UjGsJcWPsfyHTUZiTnPg/?unspent=true
[
   {
      "mintHeight" : 580319,
      "coinbase" : false,
      "mintIndex" : 0,
      "value" : 1000000,
      "spentTxid" : "",
      "mintTxid" : "fca422115dfc5693059ec8be06bd0db55ddafee549e68cae6db4f2fb6a1c2dd8",
      "chain" : "BTX",
      "script" : "76a9148ac6bb327e87568f16d75a041a4f7926393667ae88ac",
      "address" : "2RfbGtSeULJez9UjGsJcWPsfyHTUZiTnPg",
      "_id" : "5e95682c5005e30c78dc566f",
      "confirmations" : -1,
      "spentHeight" : -2,
      "network" : "mainnet"
   }
]

Get Balance for an Address

GET /api/BTX/mainnet/address/:address/balance

Response

Use Curl command in terminal to get a response

curl https://api.bitcore.cc/api/BTX/mainnet/address/2RfbGtSeULJez9UjGsJcWPsfyHTUZiTnPg/balance
{
   "balance" : 1000000,
   "unconfirmed" : 0,
   "confirmed" : 1000000
}

Block

Get Block

GET /api/BTX/mainnet/block/:blockId

Response

Use Curl command in terminal to get a response

curl https://api.bitcore.cc/api/BTX/mainnet/block/d95660b39e3bca7aa5159f32d484629b649796ec9ab882cc91f853a8fb238c55
{
   "network" : "mainnet",
   "version" : 536870912,
   "reward" : 312582721,
   "time" : "2020-04-14T08:35:06.000Z",
   "height" : 580331,
   "timeNormalized" : "2020-04-14T08:35:06.000Z",
   "hash" : "d95660b39e3bca7aa5159f32d484629b649796ec9ab882cc91f853a8fb238c55",
   "confirmations" : -4472,
   "transactionCount" : 3,
   "nonce" : 661668582,
   "size" : 562,
   "chain" : "BTX",
   "merkleRoot" : "003f848c56d74a1268a20d09b5af47d04d6395491993d854d4ea243ae3b608ce",
   "bits" : 453814285,
   "_id" : "5e9572b95005e30c78e29972",
   "nextBlockHash" : "4fdefca9a3ac5202b3d1484aba2f45ad6ce9e62d47d0332b70ad3d41122300eb",
   "previousBlockHash" : "ecdf13b89ac5df31706b8645fe3d72dd6a000df99ed3e67c02cda1a4e8aff922"
}

Get Current Height

GET /api/BTX/mainnet/block/tip

Response

Use Curl command in terminal to get a response

curl https://api.bitcore.cc/api/BTX/mainnet/block/tip
{
   "time" : "2020-04-06T12:39:24.000Z",
   "nonce" : 605478260,
   "transactionCount" : 1,
   "chain" : "BTX",
   "previousBlockHash" : "ecaeed84256e48f07bc87e152312e1724f282bd97179664495bfa622f2e1e6ec",
   "nextBlockHash" : "",
   "size" : 196,
   "version" : 536870912,
   "network" : "mainnet",
   "merkleRoot" : "1b77bfbbbcae34c62c7c0cf49cffbe84c1fa0529f174640b7071bbbf616cf71c",
   "timeNormalized" : "2020-04-06T12:39:24.000Z",
   "reward" : 312500000,
   "_id" : "5e8b202c5005e30c78afb658",
   "bits" : 453970766,
   "processed" : true,
   "hash" : "d188dafee200131230ab2e49f3c5f17f3af3c7b4516dee8992efee9ec6d2394a",
   "height" : 575858
}

Authenticated Methods

Wallet

To test wallet api routes change allowUnauthenticatedCalls: true inside bitcore.config.json

"bitcoreNode": {
    "services": {
        "api": {
            "wallets": {
                "allowCreationBeforeCompleteSync": true
            }
        }
    },
    ...
}

Create 5 Sample Wallets with transactions, addresses, and UTXOS

Inside the project root directory /bitcore/ run:

node packages/bitcore-node/build/test/benchmark/wallet-benchmark.js

Add Wallet TODO : Update for BTX needed

POST /api/BTX/mainnet/wallet

BODY:

{
    "name": "WalletName2",
    "chain": "BTX",
    "network": "mainnet",
    "pubKey": "03bdb94afdc7e5c4811bf9b160ac475b82156ea42c8659c8358b68c828df9a1c3d",
    "path": "m/44'/160'/0'"
}
Response

Use Curl command in terminal to get a response

curl -v POST -H "Content-Type: application/json" -d '{
  "name": "WalletName2",
  "chain": "BTX",
  "network": "mainnet",
  "pubKey": "03bdb94afdc7e5c4811bf9b160ac475b82156ea42c8659c8358b68c828df9a1c3d",
  "path": "m/44'/160'/0'"
}' "https://api.bitcore.cc/api/BTX/mainnet/wallet/"
{
    "chain": "BTC",
    "network": "mainnet",
    "name": "WalletName2",
    "pubKey": "03bdb94afdc7e5c4811bf9b160ac475b82156ea42c8659c8358b68c828df9a1c3d",
    "path": "m/44'/160'/0'",
    "_id": "5c3631e538704e27c6f146c3"
}

Get Wallet TODO : Update for BTX needed

GET /api/BTX/mainnet/wallet/:pubKey

Response

Use Curl command in terminal to get a response

curl https://api.bitcore.cc/api/BTX/mainnet/wallet/03bdb94afdc7e5c4811bf9b160ac475b82156ea42c8659c8358b68c828df9a1c3d
{
    "_id": "5c3639d1e60f7b2e174afc65",
    "chain": "BTC",
    "network": "mainnet",
    "name": "WalletName",
    "pubKey": "03bdb94afdc7e5c4811bf9b160ac475b82156ea42c8659c8358b68c828df9a1c3d",
    "path": "m/44'/0'/0'",
    "singleAddress": null
}

Import Addresses TODO : Update for BTX needed

POST /api/BTX/mainnet/wallet/:pubKey

BODY: raw jsonl wallet file of the form

{
    "address": "mmEsgUprBEQkGDKowPQSLEYDbMtGRKxaF4"
}
Response

Use Curl command in terminal to get a response

curl https://api.bitcore.cc/api/BTX/mainnet/wallet/03bdb94afdc7e5c4811bf9b160ac475b82156ea42c8659c8358b68c828df9a1c3d
{
    "_id": "5c3639d1e60f7b2e174afc65",
    "chain": "BTC",
    "network": "mainnet",
    "name": "WalletName",
    "pubKey": "03bdb94afdc7e5c4811bf9b160ac475b82156ea42c8659c8358b68c828df9a1c3d",
    "path": "m/44'/0'/0'",
    "singleAddress": null
}

Get Wallet Addresses TODO : Update for BTX needed

GET /api/BTX/mainnet/wallet/:pubKey/addresses

Response

Use Curl command in terminal to get a response

curl https://api.bitcore.cc/api/BTX/mainnet/wallet/03bdb94afdc7e5c4811bf9b160ac475b82156ea42c8659c8358b68c828df9a1c3d/addresses
[
    {
        "address": "12c6DSiU4Rq3P4ZxziKxzrL5LmMBrzjrJX"
    },
    {
        "address": "1HLoD9E4SDFFPDiYfNYnkBLQ85Y51J3Zb1"
    },
    {
        "address": "1FvzCLoTPGANNjWoUo6jUGuAG3wg1w4YjR"
    }
]

Get Wallet Transactions TODO : Update for BTX needed

GET /api/BTX/mainnet/wallet/:pubKey/transactions

Response

Use Curl command in terminal to get a response

curl https://api.bitcore.cc/api/BTX/mainnet/wallet/02870d8366cf8e50f383e38e5fafc01d956b67f25fbf5c1dd4e3766cf85acbc400/transactions
[
    {
        "id":"5c34b35d69d5562c2fc43e8c",
        "txid":"0e3e2357e806b6cdb1f70b54c3a3a17b6714ee1f0e68bebb44a74b1efd512098",
        "fee":0,"size":134,
        "category":"receive",
        "satoshis":5000000000,
        "height":1,
        "address":"12c6DSiU4Rq3P4ZxziKxzrL5LmMBrzjrJX",
        "outputIndex":0,
        "blockTime":"2009-01-09T02:54:25.000Z"
    }
]

Get Balance TODO : Update for BTX needed

GET /api/BTX/mainnet/wallet/:pubKey/balance

Response

Use Curl command in terminal to get a response

curl https://api.bitcore.cc/api/BTX/mainnet/wallet/02870d8366cf8e50f383e38e5fafc01d956b67f25fbf5c1dd4e3766cf85acbc400/balance
{
    "confirmed": 46800000000,
    "unconfirmed": 0,
    "balance": 46800000000
}

Get Wallet UTXOS TODO : Update for BTX needed

GET /api/BTX/mainnet/wallet/:pubKey/utxos

Response

Use Curl command in terminal to get a response

curl https://api.bitcore.cc/api/BTX/mainnet/wallet/02870d8366cf8e50f383e38e5fafc01d956b67f25fbf5c1dd4e3766cf85acbc400/utxos
[
    {
        "_id": "5c34b36069d5562c2fc45b09",
        "chain": "BTC",
        "network": "mainnet",
        "coinbase": false,
        "mintIndex": 1,
        "spentTxid": "",
        "mintTxid": "828ef3b079f9c23829c56fe86e85b4a69d9e06e5b54ea597eef5fb3ffef509fe",
        "mintHeight": 248,
        "spentHeight": -2,
        "address": "12cbQLTFMXRnSzktFkuoG3eHoMeFtpTu3S",
        "script": "410411db93e1dcdb8a016b49840f8c53bc1eb68a382e97b1482ecad7b148a6909a5cb2e0eaddfb84ccf9744464f82e160bfa9b8b64f9d4c03f999b8643f656b412a3ac",
        "value": 1800000000,
        "confirmations": 103006
    }
]

Get Wallet UTXOS TODO : Update for BTX needed

GET /api/BTX/mainnet/wallet/:pubKey/utxos

Response

Use Curl command in terminal to get a response

curl https://api.bitcore.cc/api/BTX/mainnet/wallet/02870d8366cf8e50f383e38e5fafc01d956b67f25fbf5c1dd4e3766cf85acbc400/addresses/missing
[
    {
        "_id": "5c34b36069d5562c2fc45b09",
        "chain": "BTC",
        "network": "mainnet",
        "coinbase": false,
        "mintIndex": 1,
        "spentTxid": "",
        "mintTxid": "828ef3b079f9c23829c56fe86e85b4a69d9e06e5b54ea597eef5fb3ffef509fe",
        "mintHeight": 248,
        "spentHeight": -2,
        "address": "12cbQLTFMXRnSzktFkuoG3eHoMeFtpTu3S",
        "script": "410411db93e1dcdb8a016b49840f8c53bc1eb68a382e97b1482ecad7b148a6909a5cb2e0eaddfb84ccf9744464f82e160bfa9b8b64f9d4c03f999b8643f656b412a3ac",
        "value": 1800000000,
        "confirmations": 103006
    }
]

Fee TODO : RPC Error

Get Fee estimate for within N blocks

GET /api/BTX/mainnet/fee/:target

Response

Use Curl command in terminal to get a response

curl https://api.bitcore.cc/api/BTX/mainnet/fee/22
{
    "blocks": "22",
    "feerate": "0.00002003"
}

Stats

Get Daily Transactions

GET /api/BTX/mainnet/stats/daily-transactions

Response

Use Curl command in terminal to get a response

curl https://api.bitcore.cc/api/BTX/mainnet/stats/daily-transactions
{
   "results" : [
      {
         "transactionCount" : 648,
         "date" : "2020-03-15"
      },
      {
         "transactionCount" : 627,
         "date" : "2020-03-16"
      },
      {
         "transactionCount" : 608,
         "date" : "2020-03-17"
      },
      {
         "transactionCount" : 641,
         "date" : "2020-03-18"
      },
      {
         "date" : "2020-03-19",
         "transactionCount" : 677
      },
      {
         "transactionCount" : 620,
         "date" : "2020-03-20"
      },
      {
         "transactionCount" : 625,
         "date" : "2020-03-21"
      },
      {
         "date" : "2020-03-22",
         "transactionCount" : 655
      },
      {
         "transactionCount" : 613,
         "date" : "2020-03-23"
      },
      {
         "date" : "2020-03-24",
         "transactionCount" : 665
      },
      {
         "date" : "2020-03-25",
         "transactionCount" : 663
      },
      {
         "date" : "2020-03-26",
         "transactionCount" : 591
      },
      {
         "transactionCount" : 665,
         "date" : "2020-03-27"
      },
      {
         "date" : "2020-03-28",
         "transactionCount" : 641
      },
      {
         "transactionCount" : 635,
         "date" : "2020-03-29"
      },
      {
         "transactionCount" : 635,
         "date" : "2020-03-30"
      },
      {
         "transactionCount" : 588,
         "date" : "2020-03-31"
      },
      {
         "transactionCount" : 644,
         "date" : "2020-04-01"
      },
      {
         "date" : "2020-04-02",
         "transactionCount" : 646
      },
      {
         "date" : "2020-04-03",
         "transactionCount" : 655
      },
      {
         "date" : "2020-04-04",
         "transactionCount" : 580
      },
      {
         "transactionCount" : 721,
         "date" : "2020-04-05"
      },
      {
         "transactionCount" : 720,
         "date" : "2020-04-06"
      },
      {
         "transactionCount" : 730,
         "date" : "2020-04-07"
      },
      {
         "transactionCount" : 676,
         "date" : "2020-04-08"
      },
      {
         "transactionCount" : 654,
         "date" : "2020-04-09"
      },
      {
         "date" : "2020-04-10",
         "transactionCount" : 737
      },
      {
         "transactionCount" : 594,
         "date" : "2020-04-11"
      },
      {
         "transactionCount" : 689,
         "date" : "2020-04-12"
      },
      {
         "date" : "2020-04-13",
         "transactionCount" : 662
      }
   ],
   "network" : "mainnet",
   "chain" : "BTX"
}

Status

Get Enabled Chains

GET /api/status/enabled-chains

Response

Use Curl command in terminal to get a response

curl https://api.bitcore.cc/api/status/enabled-chains
[
   {
      "network" : "mainnet",
      "chain" : "BTX"
   }
]