github.com/dawnbass68/maddcash@v0.0.0-20201001105353-c91c12cb36e5/docs/api.md (about)

     1  # Blockbook API
     2  
     3  **Blockbook** provides REST, websocket and socket.io API to the indexed blockchain.
     4  
     5  There are two versions of provided API.
     6  
     7  ## Legacy API V1
     8  
     9  The legacy API is a compatible subset of API provided by **Bitcore Insight**. It supports only Bitcoin-type coins. The details of the REST/socket.io requests can be found in the Insight's documentation.
    10  
    11  ### REST API
    12  ```
    13  GET /api/v1/block-index/<block height>
    14  GET /api/v1/tx/<txid>
    15  GET /api/v1/address/<address>
    16  GET /api/v1/utxo/<address>
    17  GET /api/v1/block/<block height | block hash>
    18  GET /api/v1/estimatefee/<number of blocks>
    19  GET /api/v1/sendtx/<hex tx data>
    20  POST /api/v1/sendtx (hex tx data in request body)  
    21  ```
    22  
    23  ### Socket.io API
    24  Socket.io interface is provided at `/socket.io/`. The interface also can be explored using Blockbook Socket.io Test Page found at `/test-socketio.html`.
    25  
    26  The legacy API is provided as is and will not be further developed.
    27  
    28  The legacy API is currently (Blockbook v0.3.1) also accessible without the */v1/* prefix, however in the future versions the version less access will be removed.
    29  
    30  ## API V2
    31  
    32  API V2 is the current version of API. It can be used with all coin types that Blockbook supports. API V2 can be accessed using REST and websocket interface.
    33  
    34  Common principles used in API V2:
    35  
    36  - all amounts are transferred as strings, in the lowest denomination (satoshis, wei, ...), without decimal point
    37  - empty fields are omitted. Empty field is a string of value *null* or *""*, a number of value *0*, an object of value *null* or an array without elements. The reason for this is that the interface serves many different coins which use only subset of the fields. Sometimes this principle can lead to slightly confusing results, for example when transaction version is 0, the field *version* is omitted.
    38  
    39  
    40  ### REST API
    41  
    42  The following methods are supported:
    43  
    44  - [Status](#status)
    45  - [Get block hash](#get-block-hash)
    46  - [Get transaction](#get-transaction)
    47  - [Get transaction specific](#get-transaction-specific)
    48  - [Get address](#get-address)
    49  - [Get xpub](#get-xpub)
    50  - [Get utxo](#get-utxo)
    51  - [Get block](#get-block)
    52  - [Send transaction](#send-transaction)
    53  - [Tickers list](#tickers-list)
    54  - [Tickers](#tickers)
    55  - [Balance history](#balance-history)
    56  
    57  #### Status page
    58  Status page returns current status of Blockbook and connected backend.
    59  ```
    60  GET /api
    61  ```
    62  
    63  Response:
    64  
    65  ```javascript
    66  {
    67    "blockbook": {
    68      "coin": "Bitcoin",
    69      "host": "blockbook",
    70      "version": "0.3.1",
    71      "gitCommit": "3d9ad91",
    72      "buildTime": "2019-05-17T14:34:00+00:00",
    73      "syncMode": true,
    74      "initialSync": false,
    75      "inSync": true,
    76      "bestHeight": 577261,
    77      "lastBlockTime": "2019-05-22T18:03:33.547762973+02:00",
    78      "inSyncMempool": true,
    79      "lastMempoolTime": "2019-05-22T18:10:10.27929383+02:00",
    80      "mempoolSize": 17348,
    81      "decimals": 8,
    82      "dbSize": 191887866502,
    83      "about": "Blockbook - blockchain indexer for Trezor wallet https://trezor.io/. Do not use for any other purpose."
    84    },
    85    "backend": {
    86      "chain": "main",
    87      "blocks": 577261,
    88      "headers": 577261,
    89      "bestBlockHash": "0000000000000000000ca8c902aa58b3118a7f35d093e25a07f17bcacd91cabf",
    90      "difficulty": "6704632680587.417",
    91      "sizeOnDisk": 250504188580,
    92      "version": "180000",
    93      "subversion": "/Satoshi:0.18.0/",
    94      "protocolVersion": "70015",
    95      "timeOffset": 0,
    96      "warnings": ""
    97    }
    98  }
    99  ```
   100  
   101  #### Get block hash
   102  ```
   103  GET /api/v2/block-index/<block height>
   104  ```
   105  
   106  Response:
   107  
   108  ```javascript
   109  {
   110    "blockHash": "ed8f3af8c10ca70a136901c6dd3adf037f0aea8a93fbe9e80939214034300f1e"
   111  }
   112  ```
   113  
   114  _Note: Blockbook always follows the main chain of the backend it is attached to. See notes on **Get Block** below_ 
   115  
   116  #### Get transaction
   117  Get transaction returns "normalized" data about transaction, which has the same general structure for all supported coins. It does not return coin specific fields (for example information about Zcash shielded addresses).
   118  ```
   119  GET /api/v2/tx/<txid>
   120  ```
   121  
   122  Response for Bitcoin-type coins:
   123  
   124  ```javascript
   125  {
   126    "txid": "9e2bc8fbd40af17a6564831f84aef0cab2046d4bad19e91c09d21bff2c851851",
   127    "version": 1,
   128    "vin": [
   129      {
   130        "txid": "f124e6999bf67e710b9e8a8ac4dbb08a64aa9c264120cf98793455e36a531615",
   131        "vout": 2,
   132        "sequence": 4294967295,
   133        "n": 0,
   134        "addresses": [
   135          "DDhUv8JZGmSxKYV95NLnbRTUKni9cDZD3S"
   136        ],
   137        "isAddress": true,
   138        "value": "55795108999999",
   139        "hex": "473...2c7ec77bb982"
   140      }
   141    ],
   142    "vout": [
   143      {
   144        "value": "55585679000000",
   145        "n": 0,
   146        "hex": "76a914feaca9d9fa7120c7c587c00c639bb18d40faadd388ac",
   147        "addresses": [
   148          "DUMh1rPrXTrCN2Z9EHsLPg7b78rACHB2h7"
   149        ],
   150        "isAddress": true
   151      },
   152      {
   153        "value": "209329999999",
   154        "n": 1,
   155        "hex": "76a914ea8984be785868391d92f49c14933f47c152ea0a88ac",
   156        "addresses": [
   157          "DSXDQ6rnwLX47WFRnemctoXPHA9pLMxqXn"
   158        ],
   159        "isAddress": true
   160      }
   161    ],
   162    "blockHash": "78d1f3de899a10dd2e580704226ebf9508e95e1706f177fc9c31c47f245d2502",
   163    "blockHeight": 2647927,
   164    "confirmations": 1,
   165    "blockTime": 1553088212,
   166    "value": "55795008999999",
   167    "valueIn": "55795108999999",
   168    "fees": "100000000",
   169    "hex": "0100000...0011000"
   170  }
   171  ```
   172  
   173  Response for Ethereum-type coins. There is always only one *vin*, only one *vout*, possibly an array of *tokenTransfers* and *ethereumSpecific* part. Missing is *hex* field:
   174  
   175  ```javascript
   176  {
   177    "txid": "0xb78a36a4a0e7d708d595c3b193cace8f5b420e72e1f595a5387d87de509f0806",
   178    "vin": [
   179      {
   180        "n": 0,
   181        "addresses": [
   182          "0x9c2e011c0ce0d75c2b62b9c5a0ba0a7456593803"
   183        ],
   184        "isAddress": true
   185      }
   186    ],
   187    "vout": [
   188      {
   189        "value": "0",
   190        "n": 0,
   191        "addresses": [
   192          "0xc32ae45504ee9482db99cfa21066a59e877bc0e6"
   193        ],
   194        "isAddress": true
   195      }
   196    ],
   197    "blockHash": "0x39df7fb0893200e1e78c04f98691637a89b64e7a3edd96c16f2537e2fd56c414",
   198    "blockHeight": 5241585,
   199    "confirmations": 3,
   200    "blockTime": 1553088337,
   201    "value": "0",
   202    "fees": "402501000000000",
   203    "tokenTransfers": [
   204      {
   205        "type": "ERC20",
   206        "from": "0x9c2e011c0ce0d75c2b62b9c5a0ba0a7456593803",
   207        "to": "0x583cbbb8a8443b38abcc0c956bece47340ea1367",
   208        "token": "0xc32ae45504ee9482db99cfa21066a59e877bc0e6",
   209        "name": "Tangany Test Token",
   210        "symbol": "TATETO",
   211        "decimals": 18,
   212        "value": "133800000"
   213      }
   214    ],
   215    "ethereumSpecific": {
   216      "status": 1,
   217      "nonce": 2830,
   218      "gasLimit": 36591,
   219      "gasUsed": 36591,
   220      "gasPrice": "11000000000"
   221    }
   222  }
   223  ```
   224  
   225  A note about the `blockTime` field:
   226  - for already mined transaction (`confirmations > 0`), the field `blockTime` contains time of the block
   227  - for transactions in mempool (`confirmations == 0`), the field contains time when the running instance of Blockbook was first time notified about the transaction. This time may be different in different instances of Blockbook.
   228  
   229  #### Get transaction specific
   230  
   231  Returns transaction data in the exact format as returned by backend, including all coin specific fields:
   232  
   233  ```
   234  GET /api/v2/tx-specific/<txid>
   235  ```
   236  
   237  Example response:
   238  
   239  ```javascript
   240  {
   241    "hex": "040000808...8e6e73cb009",
   242    "txid": "7a0a0ff6f67bac2a856c7296382b69151949878de6fb0d01a8efa197182b2913",
   243    "overwintered": true,
   244    "version": 4,
   245    "versiongroupid": "892f2085",
   246    "locktime": 0,
   247    "expiryheight": 495680,
   248    "vin": [],
   249    "vout": [],
   250    "vjoinsplit": [],
   251    "valueBalance": 0,
   252    "vShieldedSpend": [
   253      {
   254        "cv": "50258bfa65caa9f42f4448b9194840c7da73afc8159faf7358140bfd0f237962",
   255        "anchor": "6beb3b64ecb30033a9032e1a65a68899917625d1fdd2540e70f19f3078f5dd9b",
   256        "nullifier": "08e5717f6606af7c2b01206ff833eaa6383bb49c7451534b2e16d588956fd10a",
   257        "rk": "36841a9be87a7022445b77f433cdd0355bbed498656ab399aede1e5285e9e4a2",
   258        "proof": "aecf824dbae8eea863ec6...73878c37391f01df520aa",
   259        "spendAuthSig": "65b9477cb1ec5da...1178fe402e5702c646945197108339609"
   260      },
   261      {
   262        "cv": "a5aab3721e33d6d6360eabd21cbd07524495f202149abdc3eb30f245d503678c",
   263        "anchor": "6beb3b64ecb30033a9032e1a65a68899917625d1fdd2540e70f19f3078f5dd9b",
   264        "nullifier": "60e790d6d0e12e777fb2b18bc97cf42a92b1e47460e1bd0b0ffd294c23232cc9",
   265        "rk": "2d741695e76351597712b4a04d2a4e108a116f376283d2d104219b86e2930117",
   266        "proof": "a0c2a6fdcbba966b9894...3a9c3118b76c8e2352d524cbb44c02decaeda7",
   267        "spendAuthSig": "feea902e01eac9ebd...b43b4af6b607ce5b0b38f708"
   268      }
   269    ],
   270    "vShieldedOutput": [
   271      {
   272        "cv": "23db384cde862f20238a1004e57ba18f114acabc7fd2ac029757f82af5bd4cab",
   273        "cmu": "3ff5a5ff521fabefb5287fef4feb2642d69ead5fe18e6ac717cfd76a8d4088bc",
   274        "ephemeralKey": "057ff6e059967784fa6ac34ad9ecfd9c0c0aba743b7cd444a65ecc32192d5870",
   275        "encCiphertext": "a533d3b99b...a0204",
   276        "outCiphertext": "4baabc15199504b1...c1ad6a",
   277        "proof": "aa1fb2706cba5...1ec7e81f5deea90d4f57713f3b4fc8d636908235fa378ebf1"
   278      }
   279    ],
   280    "bindingSig": "bc018af8808387...5130bb382ad8e6e73cb009",
   281    "blockhash": "0000000001c4aa394e796dd1b82e358f114535204f6f5b6cf4ad58dc439c47af",
   282    "confirmations": 5222,
   283    "time": 1552301566,
   284    "blocktime": 1552301566
   285  }
   286  ```
   287  
   288  #### Get address
   289  
   290  Returns balances and transactions of an address. The returned transactions are sorted by block height, newest blocks first.
   291  
   292  ```
   293  GET /api/v2/address/<address>[?page=<page>&pageSize=<size>&from=<block height>&to=<block height>&details=<basic|tokens|tokenBalances|txids|txs>]
   294  ```
   295  
   296  The optional query parameters:
   297  - *page*: specifies page of returned transactions, starting from 1. If out of range, Blockbook returns the closest possible page.
   298  - *pageSize*: number of transactions returned by call (default and maximum 1000)
   299  - *from*, *to*: filter of the returned transactions *from* block height *to* block height (default no filter)
   300  - *details*: specifies level of details returned by request (default *txids*)
   301      - *basic*: return only address balances, without any transactions
   302      - *tokens*: *basic* + tokens belonging to the address (applicable only to some coins)
   303      - *tokenBalances*: *basic* + tokens with balances + belonging to the address (applicable only to some coins)
   304      - *txids*: *tokenBalances* + list of txids, subject to  *from*, *to* filter and paging
   305      - *txs*:  *tokenBalances* + list of transaction with details, subject to  *from*, *to* filter and paging
   306  
   307  Response:
   308  
   309  ```javascript
   310  {
   311    "page": 1,
   312    "totalPages": 1,
   313    "itemsOnPage": 1000,
   314    "address": "D5Z7XrtJNg7hAtznSDMXvfiFmMYphwuWz7",
   315    "balance": "2432468097999991",
   316    "totalReceived": "3992283916999979",
   317    "totalSent": "1559815818999988",
   318    "unconfirmedBalance": "0",
   319    "unconfirmedTxs": 0,
   320    "txs": 3,
   321    "txids": [
   322      "461dd46d5d6f56d765f82e60e6bf0727a3a1d1cb8c4144373d805b152a21d308",
   323      "bdb5b47603c5d174eae3384c368068c8e9d2183b398ed0e31d125defa4447a10",
   324      "5c1d2686d70d82bd8e84b5d3dc4bd0e8485e28cdc865336db6a5e40b2098277d"
   325    ]
   326  }
   327  ```
   328  
   329  #### Get xpub
   330  
   331  Returns balances and transactions of an xpub, applicable only for Bitcoin-type coins. 
   332  
   333  Blockbook supports BIP44, BIP49 and BIP84 derivation schemes. It expects xpub at level 3 derivation path, i.e. *m/purpose'/coin_type'/account'/*. Blockbook completes the *change/address_index* part of the path when deriving addresses. 
   334  
   335  The BIP version is determined by the prefix of the xpub. The prefixes for each coin are defined by fields `xpub_magic`, `xpub_magic_segwit_p2sh`, `xpub_magic_segwit_native` in the [trezor-common](https://github.com/trezor/trezor-common/tree/master/defs/bitcoin) library. If the prefix is not recognized, Blockbook defaults to BIP44 derivation scheme.
   336  
   337  The returned transactions are sorted by block height, newest blocks first.
   338  
   339  ```
   340  GET /api/v2/xpub/<xpub>[?page=<page>&pageSize=<size>&from=<block height>&to=<block height>&details=<basic|tokens|tokenBalances|txids|txs>&tokens=<nonzero|used|derived>]
   341  ```
   342  
   343  The optional query parameters:
   344  - *page*: specifies page of returned transactions, starting from 1. If out of range, Blockbook returns the closest possible page.
   345  - *pageSize*: number of transactions returned by call (default and maximum 1000)
   346  - *from*, *to*: filter of the returned transactions *from* block height *to* block height (default no filter)
   347  - *details*: specifies level of details returned by request (default *txids*)
   348      - *basic*: return only xpub balances, without any derived addresses and transactions
   349      - *tokens*: *basic* + tokens (addresses) derived from the xpub, subject to *tokens* parameter
   350      - *tokenBalances*: *basic* + tokens (addresses) derived from the xpub with balances, subject to *tokens* parameter
   351      - *txids*: *tokenBalances* + list of txids, subject to  *from*, *to* filter and paging
   352      - *txs*:  *tokenBalances* + list of transaction with details, subject to  *from*, *to* filter and paging
   353  - *tokens*: specifies what tokens (xpub addresses) are returned by the request (default *nonzero*)
   354      - *nonzero*: return only addresses with nonzero balance
   355      - *used*: return addresses with at least one transaction
   356      - *derived*: return all derived addresses
   357  
   358  Response:
   359  
   360  ```javascript
   361  {
   362    "page": 1,
   363    "totalPages": 1,
   364    "itemsOnPage": 1000,
   365    "address": "dgub8sbe5Mi8LA4dXB9zPfLZW8arm...9Vjp2HHx91xdDEmWYpmD49fpoUYF",
   366    "balance": "0",
   367    "totalReceived": "3083381250",
   368    "totalSent": "3083381250",
   369    "unconfirmedBalance": "0",
   370    "unconfirmedTxs": 0,
   371    "txs": 5,
   372    "txids": [
   373      "383ccb5da16fccad294e24a2ef77bdee5810573bb1b252d8b2af4f0ac8c4e04c",
   374      "75fb93d47969ac92112628e39148ad22323e96f0004c18f8c75938cffb6c1798",
   375      "e8cd84f204b4a42b98e535e72f461dd9832aa081458720b0a38db5856a884876",
   376      "57833d50969208091bd6c950599a1b5cf9d66d992ae8a8d3560fb943b98ebb23",
   377      "9cfd6295f20e74ddca6dd816c8eb71a91e4da70fe396aca6f8ce09dc2947839f",
   378    ],
   379    "usedTokens": 2,
   380    "tokens": [
   381      {
   382        "type": "XPUBAddress",
   383        "name": "DUCd1B3YBiXL5By15yXgSLZtEkvwsgEdqS",
   384        "path": "m/44'/3'/0'/0/0",
   385        "transfers": 3,
   386        "decimals": 8,
   387        "balance": "0",
   388        "totalReceived": "2803986975",
   389        "totalSent": "2803986975"
   390      },
   391      {
   392        "type": "XPUBAddress",
   393        "name": "DKu2a8Wo6zC2dmBBYXwUG3fxWDHbKnNiPj",
   394        "path": "m/44'/3'/0'/1/0",
   395        "transfers": 2,
   396        "decimals": 8,
   397        "balance": "0",
   398        "totalReceived": "279394275",
   399        "totalSent": "279394275"
   400      }
   401    ]
   402  }
   403  ```
   404  
   405  Note: *usedTokens* always returns total number of **used** addresses of xpub.
   406  
   407  #### Get utxo
   408  
   409  Returns array of unspent transaction outputs of address or xpub, applicable only for Bitcoin-type coins. By default, the list contains both confirmed and unconfirmed transactions. The query parameter *confirmed=true* disables return of unconfirmed transactions. The returned utxos are sorted by block height, newest blocks first. For xpubs the response also contains address and derivation path of the utxo.
   410  
   411  Unconfirmed utxos do not have field *height*, the field *confirmations* has value *0* and may contain field *lockTime*, if not zero.
   412  
   413  Coinbase utxos do have field *coinbase* set to true, however due to performance reasons only up to minimum coinbase confirmations limit (100). After this limit, utxos are not detected as coinbase.
   414  
   415  ```
   416  GET /api/v2/utxo/<address|xpub>[?confirmed=true]
   417  ```
   418  
   419  Response:
   420  
   421  ```javascript
   422  [
   423    {
   424      "txid": "13d26cd939bf5d155b1c60054e02d9c9b832a85e6ec4f2411be44b6b5a2842e9",
   425      "vout": 0,
   426      "value": "1422303206539",
   427      "confirmations": 0,
   428      "lockTime": 2648100
   429    },
   430    {
   431      "txid": "a79e396a32e10856c97b95f43da7e9d2b9a11d446f7638dbd75e5e7603128cac",
   432      "vout": 1,
   433      "value": "39748685",
   434      "height": 2648043,
   435      "confirmations": 47,
   436      "coinbase": true
   437    },
   438    {
   439      "txid": "de4f379fdc3ea9be063e60340461a014f372a018d70c3db35701654e7066b3ef",
   440      "vout": 0,
   441      "value": "122492339065",
   442      "height": 2646043,
   443      "confirmations": 2047
   444    },
   445    {
   446      "txid": "9e8eb9b3d2e8e4b5d6af4c43a9196dfc55a05945c8675904d8c61f404ea7b1e9",
   447      "vout": 0,
   448      "value": "142771322208",
   449      "height": 2644885,
   450      "confirmations": 3205
   451    }
   452  ]
   453  ```
   454  
   455  #### Get block
   456  
   457  Returns information about block with transactions, subject to paging.
   458  
   459  ```
   460  GET /api/v2/block/<block height|block hash>
   461  ```
   462  
   463  Response:
   464  
   465  ```javascript
   466  {
   467    "page": 1,
   468    "totalPages": 1,
   469    "itemsOnPage": 1000,
   470    "hash": "760f8ed32894ccce9c1ea11c8a019cadaa82bcb434b25c30102dd7e43f326217",
   471    "previousBlockHash": "786a1f9f38493d32fd9f9c104d748490a070bc74a83809103bcadd93ae98288f",
   472    "nextBlockHash": "151615691b209de41dda4798a07e62db8429488554077552ccb1c4f8c7e9f57a",
   473    "height": 2648059,
   474    "confirmations": 47,
   475    "size": 951,
   476    "time": 1553096617,
   477    "version": 6422787,
   478    "merkleRoot": "6783f6083788c4f69b8af23bd2e4a194cf36ac34d590dfd97e510fe7aebc72c8",
   479    "nonce": "0",
   480    "bits": "1a063f3b",
   481    "difficulty": "2685605.260733312",
   482    "txCount": 2,
   483    "txs": [
   484      {
   485        "txid": "2b9fc57aaa8d01975631a703b0fc3f11d70671953fc769533b8078a04d029bf9",
   486        "vin": [
   487          {
   488            "n": 0,
   489            "value": "0"
   490          }
   491        ],
   492        "vout": [
   493          {
   494            "value": "1000100000000",
   495            "n": 0,
   496            "addresses": [
   497              "D6ravJL6Fgxtgp8k2XZZt1QfUmwwGuLwQJ"
   498            ],
   499            "isAddress": true
   500          }
   501        ],
   502        "blockHash": "760f8ed32894ccce9c1ea11c8a019cadaa82bcb434b25c30102dd7e43f326217",
   503        "blockHeight": 2648059,
   504        "confirmations": 47,
   505        "blockTime": 1553096617,
   506        "value": "1000100000000",
   507        "valueIn": "0",
   508        "fees": "0"
   509      },
   510      {
   511        "txid": "d7ce10ecf9819801ecd6ee045cbb33436eef36a7db138206494bacedfd2832cf",
   512        "vin": [
   513          {
   514            "n": 0,
   515            "addresses": [
   516              "9sLa1AKzjWuNTe1CkLh5GDYyRP9enb1Spp"
   517            ],
   518            "isAddress": true,
   519            "value": "1277595845202"
   520          }
   521        ],
   522        "vout": [
   523          {
   524            "value": "9900000000",
   525            "n": 0,
   526            "addresses": [
   527              "DMnjrbcCEoeyvr7GEn8DS4ZXQjwq7E2zQU"
   528            ],
   529            "isAddress": true
   530          },
   531          {
   532            "value": "1267595845202",
   533            "n": 1,
   534            "spent": true,
   535            "addresses": [
   536              "9sLa1AKzjWuNTe1CkLh5GDYyRP9enb1Spp"
   537            ],
   538            "isAddress": true
   539          }
   540        ],
   541        "blockHash": "760f8ed32894ccce9c1ea11c8a019cadaa82bcb434b25c30102dd7e43f326217",
   542        "blockHeight": 2648059,
   543        "confirmations": 47,
   544        "blockTime": 1553096617,
   545        "value": "1277495845202",
   546        "valueIn": "1277595845202",
   547        "fees": "100000000"
   548      }
   549    ]
   550  }
   551  ```
   552  _Note: Blockbook always follows the main chain of the backend it is attached to. If there is a rollback-reorg in the backend, Blockbook will also do rollback. When you ask for block by height, you will always get the main chain block. If you ask for block by hash, you may get the block from another fork but it is not guaranteed (backend may not keep it)_
   553  
   554  #### Send transaction
   555  
   556  Sends new transaction to backend.
   557  
   558  ```
   559  GET /api/v2/sendtx/<hex tx data>
   560  POST /api/v2/sendtx (hex tx data in request body)  
   561  ```
   562  
   563  Response:
   564  
   565  ```javascript
   566  {
   567    "result": "7c3be24063f268aaa1ed81b64776798f56088757641a34fb156c4f51ed2e9d25"
   568  }
   569  ```
   570  
   571  or in case of error
   572  
   573  ```javascript
   574  {
   575    "error": {
   576      "message": "error message"
   577    }
   578  }
   579  ```
   580  
   581  #### Tickers list
   582  
   583  Returns a list of available currency rate tickers for the specified date, along with an actual data timestamp.
   584  
   585  ```
   586  GET /api/v2/tickers-list/?timestamp=<timestamp>
   587  ```
   588  
   589  The query parameters:
   590  - *timestamp*: specifies a Unix timestamp to return available tickers for.
   591  
   592  Example response:
   593  
   594  ```javascript
   595  {
   596    "ts":1574346615,
   597    "available_currencies": [
   598      "eur",
   599      "usd"
   600    ]
   601  }
   602  ```
   603  
   604  #### Tickers
   605  
   606  Returns currency rate for the specified currency and date. If the currency is not available for that specific timestamp, the next closest rate will be returned.
   607  All responses contain an actual rate timestamp.
   608  
   609  ```
   610  GET /api/v2/tickers/[?currency=<currency>&timestamp=<timestamp>]
   611  ```
   612  
   613  The optional query parameters:
   614  - *currency*: specifies a currency of returned rate ("usd", "eur", "eth"...). If not specified, all available currencies will be returned.
   615  - *timestamp*: a Unix timestamp that specifies a date to return currency rates for. If not specified, the last available rate will be returned.
   616  
   617  Example response (no parameters):
   618  
   619  ```javascript
   620  {
   621    "ts": 1574346615,
   622    "rates": {
   623      "eur": 7134.1,
   624      "usd": 7914.5
   625      }
   626  }
   627  ```
   628  
   629  Example response (currency=usd):
   630  
   631  ```javascript
   632  {
   633    "ts": 1574346615,
   634    "rates": {
   635      "usd": 7914.5
   636    }
   637  }
   638  ```
   639  
   640  Example error response (e.g. rate unavailable, incorrect currency...):
   641  ```javascript
   642  {
   643    "ts":7980386400,
   644    "rates": {
   645      "usd": -1
   646    }
   647  }
   648  ```
   649  
   650  #### Balance history
   651  
   652  Returns a balance history for the specified XPUB or address.
   653  
   654  ```
   655  GET /api/v2/balancehistory/<XPUB | address>?from=<dateFrom>&to=<dateTo>[&fiatcurrency=<currency>&groupBy=<groupBySeconds>]
   656  ```
   657  
   658  Query parameters:
   659  - *from*: specifies a start date as a Unix timestamp
   660  - *to*: specifies an end date as a Unix timestamp
   661  
   662  The optional query parameters:
   663  - *fiatcurrency*: if specified, the response will contain fiat rate at the time of transaction. If not, all available currencies will be returned.
   664  - *groupBy*: an interval in seconds, to group results by. Default is 3600 seconds.
   665  
   666  Example response (fiatcurrency not specified):
   667  ```javascript
   668  [
   669    {
   670      "time": 1578391200,
   671      "txs": 5,
   672      "received": "5000000",
   673      "sent": "0",
   674      "rates": {
   675        "usd": 7855.9,
   676        "eur": 6838.13,
   677        ...
   678      }
   679    },
   680    {
   681      "time": 1578488400,
   682      "txs": 1,
   683      "received": "0",
   684      "sent": "5000000",
   685      "rates": {
   686        "usd": 8283.11,
   687        "eur": 7464.45,
   688        ...
   689      }
   690    }
   691  ]
   692  ```
   693  
   694  Example response (fiatcurrency=usd):
   695  
   696  ```javascript
   697  [
   698    {
   699      "time": 1578391200,
   700      "txs": 5,
   701      "received": "5000000",
   702      "sent": "0",
   703      "rates": {
   704        "usd": 7855.9
   705      }
   706    },
   707    {
   708      "time": 1578488400,
   709      "txs": 1,
   710      "received": "0",
   711      "sent": "5000000",
   712      "rates": {
   713        "usd": 8283.11
   714      }
   715    }
   716  ]
   717  ```
   718  
   719  Example response (fiatcurrency=usd&groupBy=172800):
   720  
   721  ```javascript
   722  [
   723    {
   724      "time": 1578355200,
   725      "txs": 6,
   726      "received": "5000000",
   727      "sent": "5000000",
   728      "rates": {
   729        "usd": 7734.45
   730      }
   731    }
   732  ]
   733  ```
   734  
   735  ### Websocket API
   736  
   737  Websocket interface is provided at `/websocket/`. The interface can be explored using Blockbook Websocket Test Page found at `/test-websocket.html`.
   738  
   739  The websocket interface provides the following requests:
   740  
   741  - getInfo
   742  - getBlockHash
   743  - getAccountInfo
   744  - getAccountUtxo
   745  - getTransaction
   746  - getTransactionSpecific
   747  - getBalanceHistory
   748  - getCurrentFiatRates
   749  - getFiatRatesTickersList
   750  - getFiatRatesForTimestamps
   751  - estimateFee
   752  - sendTransaction
   753  - ping
   754  
   755  The client can subscribe to the following events:
   756  
   757  - new block added to blockchain
   758  - new transaction for given address (list of addresses)
   759  - new currency rate ticker
   760  
   761  There can be always only one subscription of given event per connection, i.e. new list of addresses replaces previous list of addresses.
   762  
   763  _Note: If there is reorg on the backend (blockchain), you will get a new block hash with the same or even smaller height if the reorg is deeper_
   764