# Connect BTC / BCH HTTP REST API

The following examples are using BTC mainnet. Please see the supported chains and networks.

# GET /addr/{addr}

This resource fetches the properties of an address by address

Parameters

Name In Type Required Description
addr path string true The address to be fetched

Responses

Status Meaning Description Schema
200 OK Successful operation Address

# Example responses

200 Response

{
  "addrStr": "string",
  "balance": 0,
  "balanceSat": 0,
  "totalReceived": 0,
  "totalReceivedSat": 0,
  "totalSent": 0,
  "totalSentSat": 0,
  "unconfirmedBalance": 0,
  "unconfirmedBalanceSat": 0,
  "unconfirmedTxApperances": 0,
  "txApperances": 0,
  "transactions": [
    "string"
  ]
}

# Code sample

curl -X GET https://btc.connect.bloq.cloud/api/v1/addr/{addr} \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer xxxxxx.xxxxxxxxxx.xxxxxx'

# GET /addr/{addr}/balance

This resource fetches an address balance in satoshis

Parameters

Name In Type Required Description
addr path string true The address of the balance to be fetched

Responses

Status Meaning Description Schema
200 OK Successful operation number

# Example responses

200 Response

100000

# Code sample

curl -X GET https://btc.connect.bloq.cloud/api/v1/addr/{addr}/balance \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer xxxxxx.xxxxxxxxxx.xxxxxx'

# GET /addr/{addr}/totalReceived

This resource fetches an address total received in satoshis

Parameters

Name In Type Required Description
addr path string true The address of the total received balance to be fetched

Responses

Status Meaning Description Schema
200 OK Successful operation number

# Example responses

200 Response

100000

# Code sample

curl -X GET https://btc.connect.bloq.cloud/api/v1/addr/{addr}/totalReceived \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer xxxxxx.xxxxxxxxxx.xxxxxx'

# GET /addr/{addr}/totalSent

This resource fetches an address total sent in satoshis

Parameters

Name In Type Required Description
addr path string true The address of the total sent balance to be fetched

Responses

Status Meaning Description Schema
200 OK Successful operation number

# Example responses

200 Response

100000

# Code sample

curl -X GET https://btc.connect.bloq.cloud/api/v1/addr/{addr}/totalSent \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer xxxxxx.xxxxxxxxxx.xxxxxx'

# GET /addr/{addr}/unconfirmedBalance

This resource fetches an address unconfirmed balance in satoshis

Parameters

Name In Type Required Description
addr path string true The address of the unconfirmed balance to be fetched

Responses

Status Meaning Description Schema
200 OK Successful operation number

# Example responses

200 Response

100000

# Code sample

curl -X GET https://btc.connect.bloq.cloud/api/v1/addr/{addr}/unconfirmedBalance \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer xxxxxx.xxxxxxxxxx.xxxxxx'

# POST /addrs/txs

This resource fetches transactions for multiple addresses

Body parameter

{
  "addrs": "1CK6KHY6MHgYvmRQ4PAafKYDrg1ejbH1cE,1AJbBmAXSQ23WiAiynScedqCu4mQ3ENPox",
  "from": 2,
  "to": 6
}

Parameters

Name In Type Required Description
body body object true none
» addrs body string false none
» from body number false none
» to body number false none

Responses

Status Meaning Description Schema
200 OK Successful operation Inline

Response Schema

Status Code 200

Name Type Required Restrictions Description
anonymous [Transaction] false none none
» txid string false none none
» version number false none none
» locktime number false none none
» blockhash string false none none
» blockheight number false none none
» confirmations number false none none
» time number false none none
» blocktime number false none none
» isCoinBase boolean false none none
» valueOut number false none none
» size number false none none

# Example responses

200 Response

[
  {
    "txid": "string",
    "version": 0,
    "locktime": 0,
    "blockhash": "string",
    "blockheight": 0,
    "confirmations": 0,
    "time": 0,
    "blocktime": 0,
    "isCoinBase": true,
    "valueOut": 0,
    "size": 0
  }
]

# Code sample

curl -X POST https://btc.connect.bloq.cloud/api/v1/addrs/txs \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer xxxxxx.xxxxxxxxxx.xxxxxx'

# POST /addrs/utxo

This resource fetches unspent outputs from multiple addresses

Body parameter

{
  "addrs": "1CK6KHY6MHgYvmRQ4PAafKYDrg1ejbH1cE,1AJbBmAXSQ23WiAiynScedqCu4mQ3ENPox"
}

Parameters

Name In Type Required Description
body body object true none
» addrs body string false none

Responses

Status Meaning Description Schema
200 OK Successful operation Inline

Response Schema

Status Code 200

Name Type Required Restrictions Description
anonymous [UnspentTransactionOutput] false none none
» address string false none none
» txid string false none none
» vout number false none none
» scriptPubKey string false none none
» amount number false none none
» satoshis number false none none
» confirmations number false none none
» height number false none none
» ts number false none none

# Example responses

200 Response

[
  {
    "address": "string",
    "txid": "string",
    "vout": 0,
    "scriptPubKey": "string",
    "amount": 0,
    "satoshis": 0,
    "confirmations": 0,
    "height": 0,
    "ts": 0
  }
]

# Code sample

curl -X POST https://btc.connect.bloq.cloud/api/v1/addrs/utxo \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer xxxxxx.xxxxxxxxxx.xxxxxx'

# GET /block-index/{height}

This resource fetches a block by block height

Parameters

Name In Type Required Description
height path number true The height of the block hash to be fetched. A height of 0 is the genesis block.

Responses

Status Meaning Description Schema
200 OK Successful operation Inline

Response Schema

Status Code 200

Name Type Required Restrictions Description
» blockHash string false none none

# Example responses

200 Response

{
  "blockHash": "000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f"
}

# Code sample

curl -X GET https://btc.connect.bloq.cloud/api/v1/block-index/{height} \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer xxxxxx.xxxxxxxxxx.xxxxxx'

# GET /blocks

This resource fetches block summaries by date

Parameters

Name In Type Required Description
limit query integer false The number of blocks to display
date query string(date) false The date of the blocks to display

Responses

Status Meaning Description Schema
200 OK Successful operation Inline

Response Schema

Status Code 200

Name Type Required Restrictions Description
anonymous [Blocks] false none none
» blocks [object] false none none
»» height integer false none none
»» size integer false none none
»» hash string false none none
»» time integer false none none
»» txlength integer false none none
»» poolInfo object false none none
»»» poolName string false none none
»»» url string false none none
»» length integer false none none
»» pagination object false none none
»»» next string(date) false none none
»»» prev string(date) false none none
»»» currentTs integer false none none
»»» current string(date) false none none
»»» isToday boolean false none none
»»» more boolean false none none
»»» moreTs integer false none none

# Example responses

200 Response

{
  "blocks": [ 
    {
      "hash": "00000000000000000010ba064273b5bb547c70b9bf6e0a028c1804fc2ff14dc6",
      "height": 627505,
      "poolInfo": {},
      "size": 894969,
      "time": 1587774209,
      "txlength": 2072
    },
    {
      "hash": "0000000000000000000aafb108afbd795ff6afcb69dae8be4ad3ea5a027cab5e",
      "height": 627504,
      "poolInfo": {
        "poolName": "AntMiner",
        "url": "https://bitmaintech.com/"
      },
      "size": 827981,
      "time": 1587773779,
      "txlength": 2047
    }
  ],
  "length": 11,
  "pagination": {
    "next": "2020-04-26",
    "prev": "2020-04-24",
    "current": "2020-04-25",
    "isToday": true,
    "currentTs": 1587859199,
    "more": false
  }
}

# Code sample

curl -X GET https://btc.connect.bloq.cloud/api/v1/blocks?limit=0&date=2019-03-12 \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer xxxxxx.xxxxxxxxxx.xxxxxx'

# GET /block/{hash}

This resource fetches a block by block hash

Parameters

Name In Type Required Description
hash path string true The hash of the block to be fetched

Responses

Status Meaning Description Schema
200 OK Successful operation Block

# Example responses

200 Response

{
  "hash":"000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f",
  "confirmations": 627513,
  "size": 285,
  "height": 0,
  "version": 1,
  "merkleroot": "4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b",
  "time": 1231006505,
  "nonce": 2083236893,
  "bits": "1d00ffff",
  "difficulty": 1,
  "chainwork": "0000000000000000000000000000000000000000000000000000000100010001",
  "nextblockhash": "00000000839a8e6886ab5951d76f411475428afc90947ee320161bbf18eb6048",
  "poolInfo": {},
  "reward": 50,
  "isMainChain": true,
  "tx": [
    "4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b"
  ]
}

# Code sample

curl -X GET https://btc.connect.bloq.cloud/api/v1/block/{hash} \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer xxxxxx.xxxxxxxxxx.xxxxxx'

# GET /utils/estimatefee

This resource retrieves fee estimates

Parameters

Name In Type Required Description
nbBlocks query string false The number of blocks to confirm a transaction

Responses

Status Meaning Description Schema
200 OK Successful operation Inline

Response Schema

Status Code 200

Name Type Required Restrictions Description
» number number false none none

# Example responses

200 Response

{
  "3":0.00022135
}

# Code sample

curl -X GET https://btc.connect.bloq.cloud/api/v1/utils/estimatefee?nbBlocks=3 \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer xxxxxx.xxxxxxxxxx.xxxxxx'

# GET /peer

This resource fetches live network P2P data sync status

Responses

Status Meaning Description Schema
200 OK Successful operation Inline

Response Schema

Status Code 200

Name Type Required Restrictions Description
» connected boolean false none none
» host string false none none
» port number false none none

# Example responses

200 Response

{
  "connected": true,
  "host": "127.0.0.1",
  "port": null
}

# Code sample

curl -X GET https://btc.connect.bloq.cloud/api/v1/peer \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer xxxxxx.xxxxxxxxxx.xxxxxx'

# GET /rawblock/{hash}

This resource fetches a raw block by block hash

Parameters

Name In Type Required Description
hash path string true The hash of the block to be fetched

Responses

Status Meaning Description Schema
200 OK Successful operation Inline

Response Schema

Status Code 200

Name Type Required Restrictions Description
» rawblock string false none none

# Example responses

200 Response

{
  "rawblock": "0000002073e9dbbae8a489082ecf50faa7673883af75a52016..."
}

# Code sample

curl -X GET https://btc.connect.bloq.cloud/api/v1/rawblock/{hash} \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer xxxxxx.xxxxxxxxxx.xxxxxx'

# GET /rawtx/{hash}

This resource fetches a raw transaction by transaction hash

Parameters

Name In Type Required Description
hash path string true The hash of the transaction to be fetched

Responses

Status Meaning Description Schema
200 OK Successful operation Inline

Response Schema

Status Code 200

Name Type Required Restrictions Description
» rawtx string false none none

# Example responses

200 Response

{
  "rawtx": "10000000137902a2007efd3962b919cde8527e97f206a20761063..."
}

# Code sample

curl -X GET https://btc.connect.bloq.cloud/api/v1/rawtx/{hash} \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer xxxxxx.xxxxxxxxxx.xxxxxx'

# GET /status

This resource fetches the status of the bitcoin network

Parameters

Name In Type Required Description
q query string false A specific attribute from the status code. Possible values are: getInfo, getDifficulty, getBestBlockHash and getLastBlockHash

Responses

Status Meaning Description Schema
200 OK Successful operation Inline

Response Schema

Status Code 200

Name Type Required Restrictions Description
» info object false none none
»» version number false none none
»» protocolversion number false none none
»» blocks number false none none
»» timeoffset number false none none
»» connections number false none none
»» proxy string false none none
»» difficulty number false none none
»» testnet boolean false none none
»» relayfee number false none none
»» errors string false none none
»» network string false none none

# Example responses

200 Response

{
  "info": {
    "version": 160300,
    "protocolversion": 70015,
    "timeoffset": 0,
    "connections": 8,
    "testnet": false,
    "network": "livenet","
    errors": "",
    "proxy": "",
    "relayfee": 0.00001,
    "difficulty": 15958652328578.42,
    "blocks": 627512
  }
}

# Code sample

curl -X GET https://btc.connect.bloq.cloud/api/v1/status \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer xxxxxx.xxxxxxxxxx.xxxxxx'

# GET /sync

This resource fetches the historic blockchain data sync status

Responses

Status Meaning Description Schema
200 OK Successful operation Inline

Response Schema

Status Code 200

Name Type Required Restrictions Description
» status string false none none
» blockChainHeight number false none none
» syncPercentage number false none none
» height number false none none
» error string false none none
» type string false none none

# Example responses

200 Response

{
  "status": "finished",
  "height": 546143,
  "blockChainHeight": 546143,
  "syncPercentage": 100,
  "error": null,
  "type": "bitcore node"
}

# Code sample

curl -X GET https://btc.connect.bloq.cloud/api/v1/sync \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer xxxxxx.xxxxxxxxxx.xxxxxx'

# GET /tx/{hash}

This resource fetches a transaction by transaction hash

Parameters

Name In Type Required Description
hash path string true The hash of the transaction to be fetched

Responses

Status Meaning Description Schema
200 OK Successful operation Transaction

# Example responses

200 Response

{
  "txid": "4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b",
  "isCoinBase": true,
  "locktime": 0,
  "size": 204,
  "time": 1231006505,
  "valueOut": 50,
  "version": 1,
  "vin": [
    {
      "coinbase": "04ffff001d0104455468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b73",
      "sequence": 4294967295,
      "n": 0
    }
  ],
  "vout": [
    {
      "value": "50.00000000",
      "n": 0,
      "scriptPubKey": {
        "asm": "04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f OP_CHECKSIG",
        "hex": "4104678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5fac",
        "type": "pubkeyhash",
        "addresses": [
          "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa"
        ]
      },
      "spentHeight": null,
      "spentTxId": null,
      "spentIndex": null
    }
  ],
  "blocktime": 1231006505,
  "blockhash": "000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f",
  "blockheight": 0,
  "confirmations": 627513
}

# Code sample

curl -X GET https://btc.connect.bloq.cloud/api/v1/tx/{hash} \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer xxxxxx.xxxxxxxxxx.xxxxxx'

# GET /txs

This resource fetches transactions by block hash or address

Parameters

Name In Type Required Description
block query string false The block hash associated to the transactions to be fetched
address query string false The address associated to the transactions to be fetched
pageNum query string false The page number

Responses

Status Meaning Description Schema
200 OK Successful operation Inline

Response Schema

Status Code 200

Name Type Required Restrictions Description
anonymous [Transaction] false none none
» txid string false none none
» version number false none none
» locktime number false none none
» blockhash string false none none
» blockheight number false none none
» confirmations number false none none
» time number false none none
» blocktime number false none none
» isCoinBase boolean false none none
» valueOut number false none none
» size number false none none

# Example responses

200 Response

{
  "pagesTotal": 1,
  "txs": [
    {
      "txid": "4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b",
      "isCoinBase": true,
      "locktime": 0,
      "size": 204,
      "time": 1231006505,
      "valueOut": 50,
      "version":1, "vin": [
        {
          "coinbase": "04ffff001d0104455468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b73",
          "sequence": 4294967295,
          "n": 0
        }
      ],
      "vout": [
        {
          "value": "50.00000000",
          "n": 0,
          "scriptPubKey": {
            "asm": "04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f OP_CHECKSIG",
            "hex": "4104678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5fac",
            "type": "pubkeyhash",
            "addresses": [
              "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa"
            ]
          }, 
          "spentHeight": null,
          "spentTxId": null,
          "spentIndex": null
        }
      ],
      "blocktime": 1231006505,
      "blockhash": "000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f",
      "blockheight": 0,
      "confirmations": 627952
    }
  ]
}

# Code sample

curl -X GET https://btc.connect.bloq.cloud/api/v1/txs?block=000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer xxxxxx.xxxxxxxxxx.xxxxxx'

curl -X GET https://btc.connect.bloq.cloud/api/v1/txs?address=1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer xxxxxx.xxxxxxxxxx.xxxxxx'

# POST /tx/send

This resource broadcasts a signed transaction

Body parameter

{
  "rawtx": "01000000017b1eabe0209b1fe794124575ef807057c77ada2138ae4fa8d6c4de0398a14f3f00000000494830450221008949f0cb400094ad2b5eb399d59d01c14d73d8fe6e96df1a7150deb388ab8935022079656090d7f6bac4c9a94e0aad311a4268e082a725f8aeae0573fb12ff866a5f01ffffffff01f0ca052a010000001976a914cbc20a7664f2f69e5355aa427045bc15e7c6c77288ac00000000"
}

Parameters

Name In Type Required Description
body body object true none
» rawtx body string false Signed transaction as hex string

Responses

Status Meaning Description Schema
200 OK Successful operation Inline

Response Schema

Status Code 200

Name Type Required Restrictions Description
» txid string false none none

# Example responses

200 Response

{
  "txid": "c7736a0a0046d5a8cc61c8c3c2821d4d7517f5de2bc66a966011aaa79965ffba"
}

# Code sample

curl -X POST https://btc.connect.bloq.cloud/api/v1/tx/send \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer xxxxxx.xxxxxxxxxx.xxxxxx'

Last updated: 5/18/2020, 9:49:19 PM