NAV

Introduction

Welcome to Bitails! A BSV archive, an indexer, and a UTXO manager. Use the APIs, sockets, and other features to build your idea, and do not worry about BSV blockchain getting big. Bitails focuses on providing services to companies and developers that work on BSV. Try out our new features and manage UTXOs, send data to BSV, fetch data from BSV, watch entities, and create your applications faster and with less effort!

Authentication

At the moment, Bitails is free and requires no authentication or API key, feel free to use and share it with others.

Swagger

The Swagger is available for both main net and test net.

Main net - API: https://api.bitails.net/swagger

Test net - API: https://test-api.bitails.net/swagger

Main net - mAPI: https://mapi.bitails.net/swagger

Test net - mAPI: https://test-mapi.bitails.net/swagger

Scripthash

This section covers scripthash API, find the documentation regarding sockets on scripthashes in the 'Socket' section.

Get Unspent of Scripthash


# c79e8d823c1ce9b80c9c340a389409f489989800044466c9d05bfef12c472232  
curl `https://api.bitails.net/scripthash/{scripthash}/unspent`

The above command returns JSON structured like this:

[
  {
    "scripthash": "c79e8d823c1ce9b80c9c340a389409f489989800044466c9d05bfef12c472232",
    "unspent": [
    {
    "txid": "1f13d03c29ae4e0b996fd72636087247fcb9326dcc28b4852b7ffa7e5180f619",
    "vout": 1,
    "satoshis": 3522,
    "time": "1645960789",
    "confirmations": 200,
    }
    ]
  }
] 

This endpoint retrieves unspent outputs(UTXOs) of a scripthash.

HTTP Request

GET https://api.bitails.net/scripthash/{scripthash}/unspent

Parameter Description
scripthash
from
limit

Get Unspent of Multiple Scripthashes


  curl --location --request POST `https://api.bitails.net/scripthash/unspent/multi` \
--header "Content-Type: application/json" \
--data "{\"scripthashes\": [\"213fb7922dc20cae6bd1cbf27f708a15fc089efdac632118fc8fb60ef1899630\", \"bbec6039916d01db85a839e06d84d95415515a7d791393128303707e5dd1c211\", ... ]}"

The above command returns JSON structured like this:

[
  {
    "scripthash": "bbec6039916d01db85a839e06d84d95415515a7d791393128303707e5dd1c211",
    "unspent":
    [
      {
       "txid": "1f13d03c29ae4e0b996fd72636087247fcb9326dcc28b4852b7ffa7e5180f619",
       "vout": 1,
       "satoshis": 3522,
       "time": "1645960789",
       "confirmations": 200,
      }
    ]
  },
  {
    "scripthash": "213fb7922dc20cae6bd1cbf27f708a15fc089efdac632118fc8fb60ef1899630",
    "unspent":
    [
      {
       "txid": "1f13d03c29ae4e0b996fd72636087247fcb9326dcc28b4852b7ffa7e5180f619",
       "vout": 1,
       "satoshis": 3522,
       "time": "1645960789",
       "confirmations": 200,
      }
    ]
  }
] 

This endpoint retrieves unspent outputs(UTXOs) of a scripthash.

HTTP Request

GET https://api.bitails.net/scripthash/unspent/multi

Parameter Description
from
limit

Get Balance of Scripthash


# c79e8d823c1ce9b80c9c340a389409f489989800044466c9d05bfef12c472232  
curl `https://api.bitails.net/scripthash/{scripthash}/balance`

The above command returns JSON structured like this:


{
    "scripthash": "c79e8d823c1ce9b80c9c340a389409f489989800044466c9d05bfef12c472232",
    "confirmed": 36453,
    "unconfirmed": 1000,
    "summary": 37453,
    "count":34,
}

This endpoint retrieves the balance of a scripthash.

HTTP Request

GET https://api.bitails.net/scripthash/{scripthash}/balance

Parameter Description
scripthash

Get History of Scripthash


# c79e8d823c1ce9b80c9c340a389409f489989800044466c9d05bfef12c472232  
curl `https://api.bitails.net/scripthash/{scripthash}/history`

The above command returns JSON structured like this:

[
  {
    "scripthash": "c79e8d823c1ce9b80c9c340a389409f489989800044466c9d05bfef12c472232",
    "histories": [
    {
    "txid": "40ff70b97334699d71a552ab5ea97c996fa8d64a9e0dc0041ec1701b10ed6914",
    "inputSatoshis": 2000,
    "outputSatoshis": 0,
    "time": 1655049588,
    }
  ]
  }
]
  
  
  
  
  
  
  
  

This endpoint retrieves the history of a scripthash. Note that the inputSatoshis and outputSatoshis refer to the role of the scripthash in the transaction. In other words, when the inputSatoshis is a non-zero value, it means the scripthash was seen in the inputs of the transaction(Spent), and when the outputSatoshis is non-zero, it implies that the scripthash was seen in the output of the transaction(Received).

GET https://api.bitails.net/scripthash/{scripthash}/history

HTTP Request

URL Parameters

Parameter Description
scripthash
pgkey
limit Maximum 5000

Scenario Using pgkey

1. The first request has no pgkey - recommended limit=5000

2. The first response includes 5000 history(the set limit) plus one pgkey which acts as a place holder and points to the last served data.

3. in later requests, the pgkey should be sent to the server as well. Each response has a new pgkey which should be used in the next request.

How do we know when we get to the end of the history?

Good question! when you receive a response which has no pgkey anymore, it means you are at the end of the history. It is like you were scrolling a page and now you are at the end.

Get Details of Scripthash


# c79e8d823c1ce9b80c9c340a389409f489989800044466c9d05bfef12c472232  
curl `https://api.bitails.net/scripthash/{scripthash}/details`

The above command returns JSON structured like this:


  {
  "lastSeen":
  {
    "txid": "40ff70b97334699d71a552ab5ea97c996fa8d64a9e0dc0041ec1701b10ed6914",
    "inputSatoshis": 0,
    "outputSatoshis": 12120,
    "time": 1655049588,
    },
    "firstSeen": 
    {
      "txid": "c3d6c4b466bc369561fa854cab42a6acd89aeeb528c5ffbde83e7a380dfc7914",
      "inputSatoshis": 0,
      "outputSatoshis": 12120,
      "time": 1655049588,
    },
      "balance":
      {
    "scripthash": "c79e8d823c1ce9b80c9c340a389409f489989800044466c9d05bfef12c472232",
    "confirmed": 36453,
    "unconfirmed": 1000,
    "summary": 37453,
    "count": 34,
    },
}

This endpoint retrieves the details of a scripthash.

HTTP Request

GET https://api.bitails.net/scripthash/{scripthash}/details

Parameter Description
scripthash

Address

This section covers address API, find the documentation regarding sockets on addresses in the 'Socket' section.

Get Unspent of Address


# 18C5qX7sM98gKtgGqTAXTa53dnbyrSkx6e  
curl `https://api.bitails.net/address/{address}/unspent`

The above command returns JSON structured like this:

[
  {
    "address": "18C5qX7sM98gKtgGqTAXTa53dnbyrSkx6e",
    "scripthash": "c79e8d823c1ce9b80c9c340a389409f489989800044466c9d05bfef12c472232",
    "unspent": [
    {
    "txid": "1f13d03c29ae4e0b996fd72636087247fcb9326dcc28b4852b7ffa7e5180f619",
    "vout": 1,
    "satoshis": 3522,
    "time": 1645960789,
    "confirmations": 200,
    }
    ]
  }

] 

This endpoint retrieves unspent outputs(UTXO) of an address.

HTTP Request

GET https://api.bitails.net/address/{address}/unspent

Parameter Description
address
from
limit

Get Unspent of Multiple Addresses


  curl --location --request POST `https://api.bitails.net/address/unspent/multi` \
--header "Content-Type: application/json" \
--data "{\"addresses\": [\"18C5qX7sM98gKtgGqTAXTa53dnbyrSkx6e\", \"17F5qX7sM88gKtgGqTAXTa53dnbyrSkx6e\", ... ]}"

The above command returns JSON structured like this:


[
  {
    "address": "18C5qX7sM98gKtgGqTAXTa53dnbyrSkx6e",
    "scripthash": "c79e8d823c1ce9b80c9c340a389409f489989800044466c9d05bfef12c472232",
    "unspent": 
    [
      {
        "txid": "1f13d03c29ae4e0b996fd72636087247fcb9326dcc28b4852b7ffa7e5180f619",
        "vout": 1,
        "satoshis": 3522,
        "time": 1645960789,
        "confirmations": 200,
      }
    ]
  },
  {
    "address": "18C5qX7sM98gKtgGqTAXTa53dnbyrSkx6e",
    "scripthash": "c79e8d823c1ce9b80c9c340a389409f489989800044466c9d05bfef12c472232",
    "unspent": 
    [
      {
        "txid": "1f13d03c29ae4e0b996fd72636087247fcb9326dcc28b4852b7ffa7e5180f619",
        "vout": 1,
        "satoshis": 3522,
        "time": 1645960789,
        "confirmations": 200,
      }
    ]
  }
] 

This endpoint retrieves unspent outputs(UTXO) of an address.

HTTP Request

POST https://api.bitails.net/address/unspent/multi

Parameter Description
from
limit

Get Balance of Address


# 18C5qX7sM98gKtgGqTAXTa53dnbyrSkx6e  
curl `https://api.bitails.net/address/{address}/balance`

The above command returns JSON structured like this:


{
    "address": "18C5qX7sM98gKtgGqTAXTa53dnbyrSkx6e",
    "scripthash": "c79e8d823c1ce9b80c9c340a389409f489989800044466c9d05bfef12c472232",
    "confirmed": 36453,
    "unconfirmed": 1000,
    "summary": 37453,
    "count": 34,
}

This endpoint retrieves the balance of an address.

HTTP Request

GET https://api.bitails.net/address/{address}/balance

Parameter Description
address

Get Balance of Multiple Addresses


  curl --location --request POST `https://api.bitails.net/address/balance/multi` \
--header "Content-Type: application/json" \
--data "{\"addresses\": [\"18C5qX7sM98gKtgGqTAXTa53dnbyrSkx6e\", \"17F5qX7sM88gKtgGqTAXTa53dnbyrSkx6e\", ... ]}"

The above command returns JSON structured like this:


{
    "confirmed": 36453,
    "unconfirmed": 1000,
    "summary": 37453,
    "count": 34,
}

This endpoint retrieves the balance of an address.

HTTP Request

POST https://api.bitails.net/address/balance/multi

Parameter Description

Get History of Address


# 18C5qX7sM98gKtgGqTAXTa53dnbyrSkx6e  
curl `https://api.bitails.net/address/{address}/history`

The above command returns JSON structured like this:

[
  {
  "address": "18C5qX7sM98gKtgGqTAXTa53dnbyrSkx6e",
    "scripthash": "c79e8d823c1ce9b80c9c340a389409f489989800044466c9d05bfef12c472232",
    "histories": [
    {
    "txid": "40ff70b97334699d71a552ab5ea97c996fa8d64a9e0dc0041ec1701b10ed6914",
    "inputSatoshis": 0,
    "outputSatoshis": 12120,
    "time": 1655049588,
    }
  ]
  }
] 
  
  
  
  
  

This endpoint retrieves the history of an address. Note that the inputSatoshis and outputSatoshis refer to the role of the address in the transaction. In other words, when the inputSatoshis is a non-zero value, it means the address was seen in the inputs of the transaction(Spent), and when the outputSatoshis is non-zero, it implies that the address was seen in the output of the transaction(Received).

HTTP Request

GET https://api.bitails.net/address/{address}/history

Parameter Description
address
pgkey
limit Maximum 5000

Scenario Using pgkey

1. The first request has no pgkey - recommended limit=5000

2. The first response includes 5000 history(the set limit) plus one pgkey which acts as a place holder and points to the last served data.

3. in later requests, the pgkey should be sent to the server as well. Each response has a new pgkey which should be used in the next request.

How do we know when we get to the end of the history?

Good question! when you receive a response which has no pgkey anymore, it means you are at the end of the history. It is like you were scrolling a page and now you are at the end.

Get History of Multiple Addresses


curl --location --request POST `https://api.bitails.net/address/history/multi` \
--header "Content-Type: application/json" \
--data "{\"addresses\": [\"18C5qX7sM98gKtgGqTAXTa53dnbyrSkx6e\", \"17F5qX7sM88gKtgGqTAXTa53dnbyrSkx6e\", ... ]}"

The above command returns JSON structured like this:


[
  {
  "txid": "40ff70b97334699d71a552ab5ea97c996fa8d64a9e0dc0041ec1701b10ed6914",
  "inputSatoshis": 1123,
  "outputSatoshis": 0,
  "time": 1655049588,
  },
  {
  "txid": "40ff70b97334699d71a552ab5ea97c996fa8d64a9e0dc0041ec1701b10ed6914",
  "inputSatoshis": 3243,
  "outputSatoshis": 0,
  "time": 1655049588,
  }
]
  
  
  
  
  

This endpoint retrieves the history of an address. Note that the inputSatoshis and outputSatoshis refer to the role of the address in the transaction. In other words, when the inputSatoshis is a non-zero value, it means the address was seen in the inputs of the transaction(Spent), and when the outputSatoshis is non-zero, it implies that the address was seen in the output of the transaction(Received).

HTTP Request

POST https://api.bitails.net/address/history/multi

Parameter Description
from
limit

Get Details of Address


# 18C5qX7sM98gKtgGqTAXTa53dnbyrSkx6e  
curl `https://api.bitails.net/address/{address}/details`

The above command returns JSON structured like this:


{
    "lastSeen": 
    {
    "txid": "40ff70b97334699d71a552ab5ea97c996fa8d64a9e0dc0041ec1701b10ed6914",
    "inputSatoshis": 0,
    "outputSatoshis": 12120,
    "time": 1655049588,
    },
    "firstSeen": 
    {
      "txid": "c3d6c4b466bc369561fa854cab42a6acd89aeeb528c5ffbde83e7a380dfc7914",
      "inputSatoshis": 1222,
      "inputSatoshis": 0,
      "time": 1655049588,
    },
      "balance": 
    {
    "address": "18C5qX7sM98gKtgGqTAXTa53dnbyrSkx6e",
    "scripthash": "c79e8d823c1ce9b80c9c340a389409f489989800044466c9d05bfef12c472232",
    "confirmed": 36453,
    "unconfirmed": 1000,
    "summary": 37453,
    "count": 34,
    },
}

This endpoint retrieves the details of an address.

HTTP Request

GET https://api.bitails.net/address/{address}/details

Parameter Description
address

Transaction

The Transaction API is used to retrieve the details of a transaction, find the documentation regarding sockets on transactions in the 'Socket' section.

Get Input of Transaction


# 687a32b54ea9a8f270e648cdd6666185e452e5a9a92cabfc506d1bc1e3ecc5ac  
curl `https://api.bitails.net/tx/{txid}/input/{inputIndex}`

The above command returns JSON structured like this:


{
    "index": 0,
    "source": {
        "txid": "5a63449e5bcbc2e266857c9a2f90ae4cea9907b4dd16793d2db11f9524caaff7",
        "vout": 0,
        "satoshis": 18776,
      },
    "scriptSig": "483045022100cfda7d900ccce55c40089df9474e61177f27ac2f3be74b9e958805fab61c992202206ad20dbfcdb244fa8d49fbbb6fde6d5dbe43cd9f93e8d96b6bea983079f17829412102062d9f5d80fcd868c5db4ace2fb38d907296c0b2a00b603a0ec4237b850a04e7",
    "sequence": 4294967295,
}
 

This endpoint retrieves an input of a transaction.

HTTP Request

GET https://api.bitails.net/tx/{txid}/input/{inputIndex}

Parameter Description
txid
index Input index

Get Inputs of Transaction


# f3f4e891bf22e62530acdedae2ec383cd961b8ca70039c4183c1dee16ef8463b  
curl `https://api.bitails.net/tx/{txid}/inputs/{fromIndex}/{toIndex}`

The above command returns JSON structured like this:


[
{
"index": 0,
"source": {
    "txid": "5a63449e5bcbc2e266857c9a2f90ae4cea9907b4dd16793d2db11f9524caaff7",
    "vout": 0,
    "satoshis": 18776,
  },
"scriptSig": "483045022100cfda7d900ccce55c40089df9474e61177f27ac2f3be74b9e958805fab61c992202206ad20dbfcdb244fa8d49fbbb6fde6d5dbe43cd9f93e8d96b6bea983079f17829412102062d9f5d80fcd868c5db4ace2fb38d907296c0b2a00b603a0ec4237b850a04e7",
"sequence": 4294967295,
},
{
"index": 0,
"source": {
    "txid": "5a63449e5bcbc2e266857c9a2f90ae4cea9907b4dd16793d2db11f9524caaff7",
    "vout": 0,
    "satoshis": 18776,
  },
"scriptSig": "483045022100cfda7d900ccce55c40089df9474e61177f27ac2f3be74b9e958805fab61c992202206ad20dbfcdb244fa8d49fbbb6fde6d5dbe43cd9f93e8d96b6bea983079f17829412102062d9f5d80fcd868c5db4ace2fb38d907296c0b2a00b603a0ec4237b850a04e7",
"sequence": 4294967295,
},
{
"index": 0,
"source": {
    "txid": "5a63449e5bcbc2e266857c9a2f90ae4cea9907b4dd16793d2db11f9524caaff7",
    "vout": 0,
    "satoshis": 18776,
  },
"scriptSig": "483045022100cfda7d900ccce55c40089df9474e61177f27ac2f3be74b9e958805fab61c992202206ad20dbfcdb244fa8d49fbbb6fde6d5dbe43cd9f93e8d96b6bea983079f17829412102062d9f5d80fcd868c5db4ace2fb38d907296c0b2a00b603a0ec4237b850a04e7",
"sequence": 4294967295,
},
]

This endpoint retrieves multiple inputs of a transaction.

HTTP Request

GET https://api.bitails.net/tx/{txid}/inputs/{fromIndex}/{toIndex}

Parameter Description
txid
from Starting index
to Ending index

Get Output of Transaction


# f3f4e891bf22e62530acdedae2ec383cd961b8ca70039c4183c1dee16ef8463b  
curl `https://api.bitails.net/tx/{txid}/output/{outputIndex}`

The above command returns JSON structured like this:


{
    "index": 0,
    "type": "nulldata"
    "reqSigs": -1,
    "scripthash": "cbb5deafd5267b5cc8b09e4396928035121de3135ff053117eceebb882875d82",
    "spent": "false",
    "scriptSize": 938,
    "partialScript": "false",
    "script": "006a2231394878696756345179427633744870515663554551797131707a5a56646f41757403626173106170706c69636174696f6e2f6a736f6e0100306d705f74726164655f76345f3148456d3235445a326276634c7548757132767759546357577638776d5a524569395f3108677a69702c656e634d3103261d4dff43edf620b6f92a35a7a0eeed02f628d0494aa0c7895baf15892a5b1305d702b7726a1e53f9b3820cd03a5b40055b54b0fefbfa2f021637d5f5fea58b345a79b3d58a3c3cc427cf1ba5e3daeb35a6de2c90d1aa95db008845104bdbd8bab185305da20f3ecc7b59a6641a077fa011a1891d5bfabc1bb24943eb4e58038720f9347d8ab16069e94a600e9c0d5adba29b293606cd8849ee9125bf40313a3ca71b3d24a3c873ab1dc4322fcd22c541e8d22987cd5ca4d143f36759c3caff75f7b9e3e2583741f15252265db54a6e1113da9fea1448d1fd37f1e4c9f90cdbd925190a35f9e0df4bd243c0d5de4d8aca62ba60e53a792249f23dcfe4910a54bee9b16bfbfe84c68ad4b9bdb8ba7ee81c9c92ede77b2b11f93d8369b624c1259ec19e300d6b83b85d3baf508bba206fc72f23ce48950ff83cf81e7989ebc07e6d8d86efddb6a9352ad5c64dfa8d444b809e84130f8466b2dfc8f62b61475dfda02ba976f34fdf08e51cf0960b3eb...",
}
 

This endpoint retrieves an output of a transaction.

HTTP Request

GET https://api.bitails.net/tx/{txid}/output/{outputIndex}

Parameter Description
txid
index Output index

Get Outputs of Transaction


# 687a32b54ea9a8f270e648cdd6666185e452e5a9a92cabfc506d1bc1e3ecc5ac  
curl `https://api.bitails.net/tx/{txid}/outputs/{fromIndex}/{toIndex}`

The above command returns JSON structured like this:


[
{
"index": 0,
"type": "nulldata"
"reqSigs": -1,
"scripthash": "cbb5deafd5267b5cc8b09e4396928035121de3135ff053117eceebb882875d82",
"spent": "false",
"scriptSize": 938,
"partialScript": "false",
"script": "006a2231394878696756345179427633744870515663554551797131707a5a56646f41757403626173106170706c69636174696f6e2f6a736f6e0100306d705f74726164655f76345f3148456d3235445a326276634c7548757132767759546357577638776d5a524569395f3108677a69702c656e634d3103261d4dff43edf620b6f92a35a7a0eeed02f628d0494aa0c7895baf15892a5b1305d702b7726a1e53f9b3820cd03a5b40055b54b0fefbfa2f021637d5f5fea58b345a79b3d58a3c3cc427cf1ba5e3daeb35a6de2c90d1aa95db008845104bdbd8bab185305da20f3ecc7b59a6641a077fa011a1891d5bfabc1bb24943eb4e58038720f9347d8ab16069e94a600e9c0d5adba29b293606cd8849ee9125bf40313a3ca71b3d24a3c873ab1dc4322fcd22c541e8d22987cd5ca4d143f36759c3caff75f7b9e3e2583741f15252265db54a6e1113da9fea1448d1fd37f1e4c9f90cdbd925190a35f9e0df4bd243c0d5de4d8aca62ba60e53a792249f23dcfe4910a54bee9b16bfbfe84c68ad4b9bdb8ba7ee81c9c92ede77b2b11f93d8369b624c1259ec19e300d6b83b85d3baf508bba206fc72f23ce48950ff83cf81e7989ebc07e6d8d86efddb6a9352ad5c64dfa8d444b809e84130f8466b2dfc8f62b61475dfda02ba976f34fdf08e51cf0960b3eb...",
},
{
"index": 1,
"type": "pubkeyhash"
"reqSigs": 1,
"satoshis": 800,
"scripthash": "cbb5deafd5267b5cc8b09e4396928035121de3135ff053117eceebb882875d82",
"spent": "false",
"scriptSize": 25,
"partialScript": "false",
"script": "76a914feaf96c5b259c80d36bdd1d6f1d8caa9bb584fe188ac...",
]

This endpoint retrieves multiple outputs of a transaction.

HTTP Request

GET https://api.bitails.net/tx/{txid}/outputs/{fromIndex}/{toIndex}

Parameter Description
txid
from Starting index
to Ending index

Get Transaction By ID


# c32597ddd7d8623d7eb1ddd854ab36541e037dc1f9f0ab7aaf55d3a1e5a17af0  
curl `https://api.bitails.net/tx/{txid}`

The above command returns JSON structured like this:

[
  {
  "txid": "c32597ddd7d8623d7eb1ddd854ab36541e037dc1f9f0ab7aaf55d3a1e5a17af0",
    "blockhash": "00000000000000001055c413778451e93e4ab0b4ee442900470abe777916da35",
    "blockheight": 742364,
    "inblockIndex": 5,
    "confirmations": 1234,
    "time": 1654203396,
    "size": 1128,
    "fee": 645,
    "ops": [0]
    "inputsCount": 2,
    "sumOfInputsSatoshis": 1247,
    "outputsCount": 2,
    "sumOfOutputsSatoshis": 602,
    "locktime": 0,
    "partialInputs": false,
    "inputs": [
        {
        "index": 0,
        "source": {
            "txid": "5a63449e5bcbc2e266857c9a2f90ae4cea9907b4dd16793d2db11f9524caaff7",
            "vout": 0,
            "satoshis": 18776,
          },
        "scriptSig": "483045022100cfda7d900ccce55c40089df9474e61177f27ac2f3be74b9e958805fab61c992202206ad20dbfcdb244fa8d49fbbb6fde6d5dbe43cd9f93e8d96b6bea983079f17829412102062d9f5d80fcd868c5db4ace2fb38d907296c0b2a00b603a0ec4237b850a04e7",
        "sequence": 4294967295,
        },
        {
      "index": 1,
      "source": {
          "txid": "5a63449e5bcbc2e266857c9a2f90ae4cea9907b4dd16793d2db11f9524caaff7",
          "vout": 0,
          "satoshis": 18776,
      },
      "scriptSig": "483045022100cfda7d900ccce55c40089df9474e61177f27ac2f3be74b9e958805fab61c992202206ad20dbfcdb244fa8d49fbbb6fde6d5dbe43cd9f93e8d96b6bea983079f17829412102062d9f5d80fcd868c5db4ace2fb38d907296c0b2a00b603a0ec4237b850a04e7",
      "sequence": 4294967295,
      }
    ],
  "partialOutputs": false,
  "outputs": [
        {
        "index": 0,
        "type": "nulldata"
        "reqSigs": -1,
        "scripthash": "cbb5deafd5267b5cc8b09e4396928035121de3135ff053117eceebb882875d82",
        "spent": "false",
        "scriptSize": 938,
        "partialScript": "false",
        "script": "006a2231394878696756345179427633744870515663554551797131707a5a56646f41757403626173106170706c69636174696f6e2f6a736f6e0100306d705f74726164655f76345f3148456d3235445a326276634c7548757132767759546357577638776d5a524569395f3108677a69702c656e634d3103261d4dff43edf620b6f92a35a7a0eeed02f628d0494aa0c7895baf15892a5b1305d702b7726a1e53f9b3820cd03a5b40055b54b0fefbfa2f021637d5f5fea58b345a79b3d58a3c3cc427cf1ba5e3daeb35a6de2c90d1aa95db008845104bdbd8bab185305da20f3ecc7b59a6641a077fa011a1891d5bfabc1bb24943eb4e58038720f9347d8ab16069e94a600e9c0d5adba29b293606cd8849ee9125bf40313a3ca71b3d24a3c873ab1dc4322fcd22c541e8d22987cd5ca4d143f36759c3caff75f7b9e3e2583741f15252265db54a6e1113da9fea1448d1fd37f1e4c9f90cdbd925190a35f9e0df4bd243c0d5de4d8aca62ba60e53a792249f23dcfe4910a54bee9b16bfbfe84c68ad4b9bdb8ba7ee81c9c92ede77b2b11f93d8369b624c1259ec19e300d6b83b85d3baf508bba206fc72f23ce48950ff83cf81e7989ebc07e6d8d86efddb6a9352ad5c64dfa8d444b809e84130f8466b2dfc8f62b61475dfda02ba976f34fdf08e51cf0960b3eb...",
        },
        {
        "index": 1,
        "type": "pubkeyhash"
        "reqSigs": 1,
        "satoshis": 800,
        "scripthash": "cbb5deafd5267b5cc8b09e4396928035121de3135ff053117eceebb882875d82",
        "spent": "false",
        "scriptSize": 25,
        "partialScript": "false",
        "script": "76a914feaf96c5b259c80d36bdd1d6f1d8caa9bb584fe188ac...",
     }
    ]
  }
] 

This endpoint retrieves the parsed format of transaction.

HTTP Request

GET https://api.bitails.net/tx/{txid}

Parameter Description
txid

Get Merkle Proof


# 13d94f78bcaddcadf0fb7672f788c62cb93d5cdaa73e187d44cee24849d80f89  
curl `https://api.bitails.net/tx/{txid}/proof`

The above command returns JSON structured like this:


{
"blockhash": "00000000000000000085985685d702b6c2911db73800cc5601333e2f60312ba2",
"branches": [
    {
        "pos": "R",
        "hash": "946e8cf5a6d812f2cb666531ba59e80847abd6cdc05d65695a5fc41682d4379c",
        },
        {
        "pos": "L",
        "hash": "966d90b60347991a47feff12dd3533d89b68cda452488e236481da0456a169d6",
        },
        {
        "pos": "L",
        "hash": "ea0b162823c00a628575ab0c4c008837a1d8e6544932be457dff1c5ef8c5a2bc",
        },
        {
        "pos": "R",
        "hash": "831c2840c0882ca369fd18b5187ea55a3108245480c6b25ff6cd15ec0f563990",
    }
  ],
"hash": "13d94f78bcaddcadf0fb7672f788c62cb93d5cdaa73e187d44cee24849d80f89",
"merkleRoot": "10aff887bac4789106e85312b2afdcebd71926c15b0604236af9f2972ab30d8d"
}

This endpoint retrieves the proof of a transaction.

HTTP Request

GET https://api.bitails.net/tx/{txid}/proof

Parameter Description
txid

Get Merkle Proof - TSC Format


# 13d94f78bcaddcadf0fb7672f788c62cb93d5cdaa73e187d44cee24849d80f89  
curl `https://api.bitails.net/tx/{txid}/proof/tsc`

The above command returns JSON structured like this:


{
"index": 6,
"txOrId": "13d94f78bcaddcadf0fb7672f788c62cb93d5cdaa73e187d44cee24849d80f89",
"target": "00000000000000000085985685d702b6c2911db73800cc5601333e2f60312ba2",
"nodes": [
"946e8cf5a6d812f2cb666531ba59e80847abd6cdc05d65695a5fc41682d4379c",
"966d90b60347991a47feff12dd3533d89b68cda452488e236481da0456a169d6",
"ea0b162823c00a628575ab0c4c008837a1d8e6544932be457dff1c5ef8c5a2bc",
"831c2840c0882ca369fd18b5187ea55a3108245480c6b25ff6cd15ec0f563990",
"e9b4210567f28b3b77c4979c4ed8f9e5fd9a123eee01d0dd5f31d9dc6315286e",
"e6c435ede10b252f8ee4f8bdd43ee5c93414d8e02aefbcc3921e33da5c6802d3",
  ]
}

This endpoint retrieves the proof of a transaction.

HTTP Request

GET https://api.bitails.net/tx/{txid}/proof/tsc

Parameter Description
txid

Send Raw Transaction


 
curl --location --request POST `https://api.bitails.net/tx/broadcast` \
--header "Content-Type: application/json" \
--data "{\"raw\": \"hexRawTX...\" }"

The above command returns JSON structured like this:


{
"txid": "946e8cf5a6d812f2cb666531ba59e80847abd6cdc05d65695a5fc41682d4379c",
}

This endpoint broadcasts the raw transaction up to 32MB in hex to the Blockchain.

HTTP Request

POST https://api.bitails.net/tx/broadcast

Request Body

Key Value
raw The raw format of tx in hex

Send Big Raw Transaction


 
request(
  {
    url: 'https://test-api.bitails.net/tx/broadcast/multipart',
    method: 'POST',
    formData: { 
      raw: {
        value: Buffer.from(
          '0100000001944a3a02dd89a9eb0336a137.......',
          'hex'
        ),
        options: {
          filename: 'raw' 
        }
      }
    }
  },
  (err, res, body) => {
    console.log(err, body);
  }
);

The above command returns JSON structured like this:


{
"txid": "946e8cf5a6d812f2cb666531ba59e80847abd6cdc05d65695a5fc41682d4379c",
}

This endpoint is usefull for broadcasting a huge transaction.

HTTP Request

POST https://api.bitails.net/tx/broadcast/multipart

Request Body

Key Value
raw The raw format of tx in hex

Block

All about blocks!

Get Block By Height

  
curl `https://api.bitails.net/block/height/{height}`

The above command returns JSON structured like this:


{
"hash": "000000000000000005e14d3f9fdfb70745308706615cfa9edca4f4558332b201",
  "size": 81577,
  "height": 500000,
  "version": 536870912,
  "merkleroot": "4af279645e1b337e655ae3286fc2ca09f58eb01efa6ab27adedd1e9e6ec19091",
  "transactionCount": 150,
  "time": 1509343584,
  "mediantime": 1509336533,
  "nonce": 3604508752,
  "bits": "1809b91a",
  "chainwork": "0000000000000000000000000000000000000000007ae48aca46e3b449ad9714",
  "previousBlockHash": "0000000000000000043831d6ebb013716f0580287ee5e5687e27d0ed72e6e523",
  "nextBlockHash": "00000000000000000568f0a96bf4348847bc84e455cbfec389f27311037a20f3",
  "countOfTransactionsInputs": 468,
  "sumOfTransactionsInputsSatoshis": 2978761212445,
  "countOfTransactionsOutputs": 273,
  "sumOfTransactionsOutputsSatoshis": 2978758164777,
  "fees": 3047668,
  "averageFee": 20454,
  "feeRate": 37.43879907621247,
  "reward": 1250000000,
  "partialTransactions": true,
  "transactionsDetails": [
      {
          "index": 0,
          "txid": "946e8cf5a6d812f2cb666531ba59e80847abd6cdc05d65695a5fc41682d4379c",
          "countOfInputs": 2,
          "countOfOutputs": 2,
          "size": 350,
      },
      {
          "index": 1,
          "txid": "946e8cf5a6d812f2cb666531ba59e80847abd6cdc05d65695a5fc41682d4379c",
          "countOfInputs": 1,
          "countOfOutputs": 2,
          "size": 224,
      },
      {
          "index": 2,
          "txid": "946e8cf5a6d812f2cb666531ba59e80847abd6cdc05d65695a5fc41682d4379c",
          "countOfInputs": 1,
          "countOfOutputs": 1,
          "size": 173,
      }
    ]
}
 

This endpoint retrieves a block data by height.

HTTP Request

GET https://api.bitails.net/block/height/{height}

Parameter Description
height Block Height

Get Block List

  
curl `https://api.bitails.net/block/list?fromHeight={height}&limit={limit}`

The above command returns JSON structured like this:


[
        {
        "hash": "000000000000000005e14d3f9fdfb70745308706615cfa9edca4f4558332b201",
        "size": 81577,
        "height": "500000",
        "transactionCount": 50,
        "timestamp": 1509343584,
        "countOfTransactionsInputs": 468,
        "sumOfTransactionsInputsSatoshis": 2978761212445,
        "countOfTransactionsOutputs": 273,
        "sumOfTransactionsOutputsSatoshis": "2978758164777",
        "totalFee": 3047668,
        "averageFee": 20454,
        "age": 146464720,
        },
        {
        "hash": "00000000000000000568f0a96bf4348847bc84e455cbfec389f27311037a20f3",
        "size": 81577,
        "height": "500001",
        "transactionCount": 50,
        "timestamp": 1509343584,
        "countOfTransactionsInputs": 468,
        "sumOfTransactionsInputsSatoshis": 2978761212445,
        "countOfTransactionsOutputs": 273,
        "sumOfTransactionsOutputsSatoshis": "2978758164777",
        "totalFee": 3047668,
        "averageFee": 20454,
        "age": 146464720,
        },
        {
        "hash": "00000000000000000797607b2b69d1561027dbaf28545a33d6ec3adb89f8e564",
        "size": 81577,
        "height": "500002",
        "transactionCount": 50,
        "timestamp": 1509343584,
        "countOfTransactionsInputs": 468,
        "sumOfTransactionsInputsSatoshis": 2978761212445,
        "countOfTransactionsOutputs": 273,
        "sumOfTransactionsOutputsSatoshis": "2978758164777",
        "totalFee": 3047668,
        "averageFee": 20454,
        "age": 146464720,
        }
]

This endpoint retrieves a list of blocks with details.

HTTP Request

GET https://api.bitails.net/block/list?fromHeight={height}&limit={limit}

URL Parameters

Parameter Description
fromHeight block height to begin with
limit number of blocks to list

Get Latest Block

  
curl `https://api.bitails.net/block/latest`

The above command returns JSON structured like this:


{
  "hash": "000000000000000005e14d3f9fdfb70745308706615cfa9edca4f4558332b201",
  "size": 81577,
  "height": 500000,
  "version": 536870912,
  "merkleroot": "4af279645e1b337e655ae3286fc2ca09f58eb01efa6ab27adedd1e9e6ec19091",
  "transactionCount": 150,
  "time": 1509343584,
  "mediantime": 1509336533,
  "nonce": 3604508752,
  "bits": "1809b91a",
  "chainwork": "0000000000000000000000000000000000000000007ae48aca46e3b449ad9714",
  "previousBlockHash": "0000000000000000043831d6ebb013716f0580287ee5e5687e27d0ed72e6e523",
  "nextBlockHash": "00000000000000000568f0a96bf4348847bc84e455cbfec389f27311037a20f3",
  "countOfTransactionsInputs": 468,
  "sumOfTransactionsInputsSatoshis": 2978761212445,
  "countOfTransactionsOutputs": 273,
  "sumOfTransactionsOutputsSatoshis": 2978758164777,
  "fees": 3047668,
  "averageFee": 20454,
  "feeRate": 37.43879907621247,
  "reward": 1250000000,
  "partialTransactions": true,
  "transactionsDetails": [
  {
          "index": 0,
          "txid": "946e8cf5a6d812f2cb666531ba59e80847abd6cdc05d65695a5fc41682d4379c",
          "countOfInputs": 2,
          "countOfOutputs": 2,
          "size": 350,
        },
        {
          "index": 1,
          "txid": "946e8cf5a6d812f2cb666531ba59e80847abd6cdc05d65695a5fc41682d4379c",
          "countOfInputs": 1,
          "countOfOutputs": 2,
          "size": 224,
        },
        {
          "index": 2,
          "txid": "946e8cf5a6d812f2cb666531ba59e80847abd6cdc05d65695a5fc41682d4379c",
          "countOfInputs": 1,
          "countOfOutputs": 1,
          "size": 173,
        }
    ]
}
 

This endpoint retrieves the latest block.

HTTP Request

GET https://api.bitails.net/block/latest

Get Block By Hash

  
curl `https://api.bitails.net/block/{blockhash}`

The above command returns JSON structured like this:


{
  "hash": "000000000000000005e14d3f9fdfb70745308706615cfa9edca4f4558332b201",
  "size": 81577,
  "height": 500000,
  "version": 536870912,
  "merkleroot": "4af279645e1b337e655ae3286fc2ca09f58eb01efa6ab27adedd1e9e6ec19091",
  "transactionCount": 150,
  "time": 1509343584,
  "mediantime": 1509336533,
  "nonce": 3604508752,
  "bits": "1809b91a",
  "chainwork": "0000000000000000000000000000000000000000007ae48aca46e3b449ad9714",
  "previousBlockHash": "0000000000000000043831d6ebb013716f0580287ee5e5687e27d0ed72e6e523",
  "nextBlockHash": "00000000000000000568f0a96bf4348847bc84e455cbfec389f27311037a20f3",
  "countOfTransactionsInputs": 468,
  "sumOfTransactionsInputsSatoshis": 2978761212445,
  "countOfTransactionsOutputs": 273,
  "sumOfTransactionsOutputsSatoshis": 2978758164777,
  "fees": 3047668,
  "averageFee": 20454,
  "feeRate": 37.43879907621247,
  "reward": 1250000000,
  "partialTransactions": true,
  "transactionsDetails": [
        {
        "index": 0,
        "txid": "946e8cf5a6d812f2cb666531ba59e80847abd6cdc05d65695a5fc41682d4379c",
        "countOfInputs": 2,
        "countOfOutputs": 2,
        "size": 350,
      },
      {
        "index": 1,
        "txid": "946e8cf5a6d812f2cb666531ba59e80847abd6cdc05d65695a5fc41682d4379c",
        "countOfInputs": 1,
        "countOfOutputs": 2,
        "size": 224,
      },
      {
        "index": 2,
        "txid": "946e8cf5a6d812f2cb666531ba59e80847abd6cdc05d65695a5fc41682d4379c",
        "countOfInputs": 1,
        "countOfOutputs": 1,
        "size": 173,
      }
    ]
}
 

This endpoint retrieves the block data by hash.

HTTP Request

GET https://api.bitails.net/block/{blockhash}

Parameter Description
hash Block Hash

Get Transactions of Block

  
curl `https://api.bitails.net/block/{blockhash}/transactions`

The above command returns JSON structured like this:


 [
        {
        "index": 0,
        "txid": "946e8cf5a6d812f2cb666531ba59e80847abd6cdc05d65695a5fc41682d4379c",
        "countOfInputs": 2,
        "countOfOutputs": 2,
        "size": 350,
        },
        {
        "index": 1,
        "txid": "946e8cf5a6d812f2cb666531ba59e80847abd6cdc05d65695a5fc41682d4379c",
        "countOfInputs": 1,
        "countOfOutputs": 2,
        "size": 224,
        },
        {
        "index": 2,
        "txid": "946e8cf5a6d812f2cb666531ba59e80847abd6cdc05d65695a5fc41682d4379c",
        "countOfInputs": 1,
        "countOfOutputs": 1,
        "size": 173,
        }
    ]
 

This endpoint retrieves the transactions of a block.

HTTP Request

GET https://api.bitails.net/block/{blockhash}/transactions

Parameter Description
hash Block Hash
from Starting i
limit Number of Results

Mempool

Bitails keeps transactions for fourteen days in the Mempool.

Get Mempool Info

  
curl `https://api.bitails.net/mempool`

The above command returns JSON structured like this:


  {
    "transactionsCount": 23764,
    "size": 10998880813,
    "circulatedSatoshis": "2976405264895",
    "age": 1776,
  }
 

This endpoint retrieves the Mempool info.

HTTP Request

GET https://api.bitails.net/mempool

Get Mempool transactions

 
   
curl `https://api.bitails.net/mempool/transactions`

The above command returns JSON structured like this:


[
  {
    "txid": "c09e7ecccc9305377b01c754e008b7bd434b092e0d629a1c836806a30d86338f",
    "countOfInputs": 2,
    "countOfOutputs": "1",
    "ops": [0],
    "size": 403,
    "timestamp": 1658243646,
  },
  {
  "txid": "c09e7ecccc9305377b01c754e008b7bd434b092e0d629a1c836806a30d86338f",
  "countOfInputs": 2,
  "countOfOutputs": "1",
  "ops": [0],
  "size": 403,
  "timestamp": 1658243646,
  },
  {
  "txid": "c09e7ecccc9305377b01c754e008b7bd434b092e0d629a1c836806a30d86338f",
  "countOfInputs": 2,
  "countOfOutputs": "1",
  "ops": [0],
  "size": 403,
  "timestamp": 1658243646,
  },
]
 

This endpoint retrieves the transactions in mempool.

HTTP Request

GET https://api.bitails.net/mempool/transactions

URL Parameters

Parameter Description
from Starting index
limit Number of transactions to retrieve

Network

Retrieve the state of the BSV network in just milliseconds!

Get Network Stats

  
curl `https://api.bitails.net/network/stats`

The above command returns JSON structured like this:


  [
    {
    "daily": "{",
    "transactions": 1858986,
    "tpsAverage": 21.759002588863734,
    "blocks": 140,
    "blockAverageTime": 610,
    "blockAverageSize": 120234565,
    "size": 18810864256,
    },
    {
    "weekly": "{",
    "transactions": 1858986,
    "tpsAverage": 21.759002588863734,
    "blocks": 140,
    "blockAverageTime": 610,
    "blockAverageSize": 120234565,
    "size": 18810864256,
    },
    {
    "monthly": "{",
    "transactions": 1858986,
    "tpsAverage": 21.759002588863734,
    "blocks": 140,
    "blockAverageTime": 610,
    "blockAverageSize": 120234565,
    "size": 18810864256,
    },
    {
    "yearly": "{",
    "transactions": 1858986,
    "tpsAverage": 21.759002588863734,
    "blocks": 140,
    "blockAverageTime": 610,
    "blockAverageSize": 120234565,
    "size": 18810864256,
    },
    {
    "alltime": "{",
    "transactions": 1858986,
    "tpsAverage": 21.759002588863734,
    "blocks": 140,
    "blockAverageTime": 610,
    "blockAverageSize": 120234565,
    "size": 18810864256,
    },
]
 

This endpoint retrieves the network stats.

HTTP Request

GET https://api.bitails.net/network/stats

Get Network Info

  
curl `https://api.bitails.net/network/info`

The above command returns JSON structured like this:


    {
    "blocks": "747778",
    "bestblockhash": "000000000000000009103cdfe9355853a1653148d5be978141d31f7bf2786cee",
    "chainwork": "00000000000000000000000000000000000000000139ace7839b1aef60d83f3c",
    "difficulty": 74430838267.01804,
    "mediantime": 1657539582,
    "blockAverageSize": 120234565,
    "size": 18810864256,
    }

This endpoint retrieves the network info.

HTTP Request

GET https://api.bitails.net/network/info

Download

Download raw transactions or a specific output of a transaction.

Download Transaction


# 40ff70b97334699d71a552ab5ea97c996fa8d64a9e0dc0041ec1701b10ed6914 
curl `https://api.bitails.net/download/tx/{txid}`

The above command returns the transaction output in binary and the following is one example on how to get the data:



  function bufferToHex (buffer) {
    return [...new Uint8Array (buffer)]
    .map (b => b.toString (16).padStart (2, "0"))
    .join ("");
}
axios.get('https://api.bitails.net/download/tx/40ff70b97334699d71a552ab5ea97c996fa8d64a9e0dc0041ec1701b10ed6914',
     {
          responseType: 'arraybuffer',
          headers: {
          'Content-Type': 'application/gzip'
     }
  })
  .then(async response => {
      console.log(bufferToHex(response.data));
  })
  .catch(error => {
      console.log({error});
});








This endpoint retrieves raw transaction data.

HTTP Request

GET https://api.bitails.net/download/tx/{txid}

Parameter Description
txid

Download Transaction Output


# 40ff70b97334699d71a552ab5ea97c996fa8d64a9e0dc0041ec1701b10ed6914 
curl `https://api.bitails.net/download/tx/{txid}/output/{outputIndex}`

The above command returns the transaction output in binary and the following is one example on how to get the data:


function bufferToHex (buffer) {
      return [...new Uint8Array (buffer)]
      .map (b => b.toString (16).padStart (2, "0"))
      .join ("");
}
axios.get('https://api.bitails.net/download/tx/40ff70b97334699d71a552ab5ea97c996fa8d64a9e0dc0041ec1701b10ed6914/output/0',
       {
            responseType: 'arraybuffer',
            headers: {
            'Content-Type': 'application/gzip'
       }
    })
    .then(async response => {
        console.log(bufferToHex(response.data));
    })
    .catch(error => {
        console.log({error});
});










This endpoint retrieves specific transaction output( No need to download extra information).

HTTP Request

GET https://api.bitails.net/download/tx/{txid}/output/{outputIndex}

Parameter Description
txid
output Output index

Search

Search through the BSV database for a specific parameter

Search Blockchain


curl `https://api.bitails.net/search?q={text}`

The above command returns JSON structured like this:


  {
    "ops": {
      "from": "0",
      "limit": "10",
      "total": 1400,
      "remain": 1390,
      "results":[
      {
      "txid": "40ff70b97334699d71a552ab5ea97c996fa8d64a9e0dc0041ec1701b10ed6914",
      "n": 0,
      "time": ,
      "highlight": [
      "Upfile-v1data:text/plain;base64,dGhpcyBpcyBhIHRlc3QgRmlsZQ==Upfile-v1"
      ]
      },
  {
    "ops": {
      "from": "0",
      "limit": "10",
      "total": 1400,
      "remain": 1390,
      "results":[
      {
      "txid": "40ff70b97334699d71a552ab5ea97c996fa8d64a9e0dc0041ec1701b10ed6914",
      "n": 0,
      "time": ,
      "highlight": [
      "Upfile-v1data:text/plain;base64,dGhpcyBpcyBhIHRlc3QgRmlsZQ==Upfile-v1"
      ]
      }
    }

This endpoint retrieves transactions including the search parameter.

HTTP Request

GET https://api.bitails.net/search?q={text}

Parameter Description
type all, ops, tx, block, scripthash, address
from Starting index
limit Ending index

Socket

Fire up a socket and watch the network! A perfect tool for monitoring blockchain in real-time. It can be used for IoT devices, wallets and many other use cases.

Mempool Info


const { io } = require('socket.io-client')
const socket = io('https://api.bitails.net/global')
socket.connect()
socket.on('mempool',info => console.log(info))






Get mempool info in a 5 second interval

Topic

mempool

Watch All Transactions


const { io } = require('socket.io-client')
const socket = io('https://api.bitails.net/global')
socket.connect()
socket.on('tx', (data) => {
console.log(JSON.stringify(data, null, 2));
});






Watch the network for all the transactions(different in output comparing to 'address' and 'scripthash' topics).

Topic

tx

Watch a Transaction


const { io } = require('socket.io-client')
const socket = io('https://api.bitails.net/global')
socket.connect()
socket.on('tx-9e8ea17aa1fd450bf2e0ff41891e05286ba117d08f207f508094a2b1e0e7669d', (data) => {
console.log(JSON.stringify(data, null, 2));
});






Watch the network for a specific transaction.

Topic

tx-{txid}

Lock On all Addresses


const { io } = require('socket.io-client')
const socket = io('https://api.bitails.net/global')
socket.connect()
socket.on('lock-address', (data) => {
console.log(JSON.stringify(data, null, 2));
});





Watch the network for all the addresses(different in output comparing to 'tx' and 'scripthash' topics).

Topic

lock-address

Lock On Address


const { io } = require('socket.io-client')
const socket = io('https://api.bitails.net/global')
socket.connect()
socket.on('lock-address-18C5qX7sM98gKtgGqTAXTa53dnbyrSkx6e', (data) => {
console.log(JSON.stringify(data, null, 2));
});





Watch the network for incoming transactions to a specific address.

Topic

lock-address-{address}

Lock On All Scripthashes


const { io } = require('socket.io-client')
const socket = io('https://api.bitails.net/global')
socket.connect()
socket.on('lock-scripthash', (data) => {
console.log(JSON.stringify(data, null, 2));
});





Watch the network for all the scripthashes(different in output comparing to 'tx' and 'address' topics).

Topic

lock-scripthash

Lock On Scripthash


const { io } = require('socket.io-client')
const socket = io('https://api.bitails.net/global')
socket.connect()
socket.on('lock-scripthash-e4f725c7f7a95838f3fc8c138b7d5ce19dfbb8cd6cb9cb37f590533855dba399', (data) => {
console.log(JSON.stringify(data, null, 2));
});





Watch the network for incoming transactions to a specific scripthash.

Topic

lock-scripthash-{scripthash}

Spent UTXOs on All Addresses


const { io } = require('socket.io-client')
const socket = io('https://api.bitails.net/global')
socket.connect()
socket.on('spent-address', (data) => {
console.log(JSON.stringify(data, null, 2));
});





This endpoint lists all the spent UTXOs of any addresses.

Topic

spent-address

Spent UTXOs on Address


const { io } = require('socket.io-client')
const socket = io('https://api.bitails.net/global')
socket.connect()
socket.on('spent-address-1GhhT4dXpqdtum9pS2Rqzbuyjm5gNDUHEU', (data) => {
console.log(JSON.stringify(data, null, 2));
});





This endpoint lists all the spent UTXOs of an address.

Topic

spent-address-{address}

Spent UTXOs on All scripthashes


const { io } = require('socket.io-client')
const socket = io('https://api.bitails.net/global')
socket.connect()
socket.on('spent-scripthash', (data) => {
console.log(JSON.stringify(data, null, 2));
});





This endpoint lists all the spent UTXOs of any scripthashes.

Topic

spent-scripthash

Spent UTXOs on Scripthash


const { io } = require('socket.io-client')
const socket = io('https://api.bitails.net/global')
socket.connect()
socket.on('spent-scripthash-e4f725c7f7a95838f3fc8c138b7d5ce19dfbb8cd6cb9cb37f590533855dba399', (data) => {
console.log(JSON.stringify(data, null, 2));
});





This endpoint lists all the spent UTXOs of a scripthash.

Topic

spent-scripthash-{scripthash}

Spent or Lock on Owner


const { io } = require('socket.io-client')
const socket = io('https://api.bitails.net/owner',{auth:{key: 'long-key'}});
socket.connect()
socket.on('data', (data) => {
console.log(JSON.stringify(data, null, 2));
});





This endpoint lists all the spent UTXOs of an owner.

Topic

data

Service

A service can be any application or entity. By creating a service, the service owner can add many 'owners' and attach addresses to these owners. With this, the owners can get the unspent, balance, history, and details of the addresses bound to them. We leave it to you to think how many use cases this feature has!

Create Service


var url = 'https://api.bitails.net/service/create';,
var options = {
method: 'POST',
url: url
};
  request(options, function(error, response, body) {
  if (error) {
     console.log(error);
  } else {
      console.log(body);
  }
});

The above command returns JSON structured like this:


{
"serviceId": "214d60f65359345456787654bba17a4c05f5ce639806023357176a51bfd52ad8",
"key": "sXjprmkz4os4JeFKt2IByyqUAbHzk0FYK9Ci+GICelk",
}

This endpoint creates a service.

HTTP Request

POST https://api.bitails.net/service/create

Revoke Service Key


var url = 'https://api.bitails.net/service/revoke';
var options = {
method: 'POST',
                url: url,
                headers: {
                    'key': serviceKey, // The Service Key which will be changed
                }
            };
            request(options, function(error, response, body) {
                if (error) {
                   console.log(error);
                } else {
                    console.log(body);

                }
            });

The above command returns JSON structured like this:


{
"serviceId": "214d60f65359345456787654bba17a4c05f5ce639806023357176a51bfd52ad8",
"key": "sXjprmkz4os4JeFKt2IByyqUAbHzk0FYK9Ci+GICelk",
}

This endpoint revokes a service key.

HTTP Request

POST https://api.bitails.net/service/revoke

Create Owner


var url = 'https://api.bitails.net/service/create/owner';
var options = {
method: 'POST',
                url: url,
                headers: {
                    'key': serviceKey,
                }
            };
            request(options, function(error, response, body) {
                if (error) {
                   console.log(error);
                } else {
                    console.log(body);

                }
            });

The above command returns JSON structured like this:


{
"ownerID": "bde30c4aa622e1731582bba9463bc6f1daa1712f5191c0df3125c06085bde05b",
"key": "sXjprmkz4os4JeFKt2IByyqUAbHzk0FYK9Ci+GICelk",
}

This endpoint creates an owner.

Owners can bind addresses, and fetch all the UTXOs of all the addresses in one request

HTTP Request

POST https://api.bitails.net/service/create/owner

Remove Owner


var url = 'https://api.bitails.net/service/remove/owner';
var theBody = {
  "ownerId": ownerId // the owner ID that is going to be removed from the service 
}
var options = {
method: 'DELETE',
                url: url,
                headers: {
                    'key': serviceKey,
                }
            };
            request(options, function(error, response, body) {
                if (error) {
                   console.log(error);
                } else {
                    console.log(body);

          }
 });

This endpoint removes an owner from a service.

HTTP Request

DELETE https://api.bitails.net/service/remove/owner

Owner

An owner is an entity that is using a service. Let's say a wallet is a service, and the user of that wallet is the owner.

Get Owner Unspent


var url = 'https://api.bitails.net/owner/unspent';
var options = {
    method: 'GET',
                url: url,
                headers: {
                    'key': ownerKey
                }
            };
            request(options, function(error, response, body) {
                if (error) {
                   console.log(error);
                } else {
                    console.log(body);

                }
            });

The above command returns JSON structured like this:


  {
    "ownerId": "a3b100f38f6fb0f5f053b6a36552088cd15c4704f87da8e5e911045386075b47",
    "unspent": [
      {
        "scripthash": "7ca9a89f75d5457dfac435d105dd874f344b7853718c7d4d27fa20ead078b45a",
        "unspent": {
          "txid": "78b26b845325edf76f59fd98e575ecca0cef790b5ce35b6106d90970b2c884f1",
          "vout": "0",
          "satoshis": 1957,
          "time": "1657811336",
          "confirmations": 2187
        }
      },
      {
        "scripthash": "c877d2c901c06c66fb7ac170a66c072d171c59154192729889eb5a59be34f082",
        "unspent": {
          "txid": "0c96f18135f8f61356544e15d7f026ce0ae6409ad0a57063cf84e6d7ff3c4039",
          "vout": "0",
          "satoshis": 1789,
          "time": "1658216042",
          "confirmations": 1510
        }
      }
    ]
  }

This endpoint retrieves owner unspents.

HTTP Request

GET https://api.bitails.net/owner/unspent

Get Owner Balance


var url = 'https://api.bitails.net/owner/balance';
var options = {
    method: 'GET',
    url: url,
    headers: {
        'key': ownerKey
    }
};
request(options, function(error, response, body) {
    if (error) {
       console.log(error);
    } else {
        console.log(body);

    }
}); 

The above command returns JSON structured like this:


{
"ownerId": "214d60f65359345456787654bba17a4c05f5ce639806023357176a51bfd52ad8",
"confirmed": 1957,
"unconfirmed": 1000,
"summary": 2957,
"count": 2,
}

This endpoint retrieves owner balance.

HTTP Request

GET https://api.bitails.net/owner/balance

Get Owner History


var url = 'https://api.bitails.net/owner/history';
var options = {
    method: 'GET',
                url: url,
                headers: {
                    'key': ownerKey
                }
            };
            request(options, function(error, response, body) {
                if (error) {
                   console.log(error);
                } else {
                    console.log(body);

                }
            });

The above command returns JSON structured like this:



  {
    "ownerId": "a3b100f38f6fb0f5f053b6a36552088cd15c4704f87da8e5e911045386075b47",
    "histories": [
      {
        "txid": "0c96f18135f8f61356544e15d7f026ce0ae6409ad0a57063cf84e6d7ff3c4039",
        "inputSatoshis": 0,
        "outputSatoshis": 1789,
        "time": 1658216024,
      },
      {
        "txid": "0c96f18135f8f61356544e15d7f026ce0ae6409ad0a57063cf84e6d7ff3c4039",
        "inputSatoshis": 0,
        "outputSatoshis": 1789,
        "time": 1658216024,
      }
    ]
  }

This endpoint retrieves owner history. Note that the inputSatoshis and outputSatoshis refer to the role of the address in the transaction. In other words, when the inputSatoshis is a non-zero value, it means the address was seen in the inputs of the transaction(Spent), and when the outputSatoshis is non-zero, it implies that the address was seen in the output of the transaction(Received).

HTTP Request

GET https://api.bitails.net/owner/history

Bind Address to Owner


var url = 'https://api.bitails.net/owner/bind';
var theBody = {
  "addressesSigs": [
    {
      "address": theAddr,     // the address to bind to the owner
      "base64Sig": signature, // base64 format of the signature which used the string format of
                              // the address as a message to sign by the private key.
    }
  ]
}
var options = {
method: 'POST',
                url: url,
                headers: {
                    'key': ownerKey, // The Owner Key
                },
                //body in format of json
                body: theBody,
                json: true
            }; 
            request(options, function(error, response, body) {
                if (error) {
                   console.log(error);
                } else {
                    console.log(body);
                }
            });

This endpoint binds address to owner.

HTTP Request

POST https://api.bitails.net/owner/bind

Unbind Address from Owner


var url = 'https://api.bitails.net/owner/unbind';
var theBody = {
  "addresses": [
                  theAddr //the Address to unbind
                ]
              }
var options = {
method: 'POST',
                url: url,
                headers: {
                    'key': ownerKey, // The Owner Key
                },
                //body in format of json
                body: theBody,
                json: true
            };
            request(options, function(error, response, body) {
                if (error) {
                   console.log(error);
                } else {
                    console.log(body);

                }
            });

This endpoint unbinds address from owner.

HTTP Request

POST https://api.bitails.net/owner/unbind

Revoke Owner Key


var url = 'https://api.bitails.net/owner/revoke';
var options = {
method: 'POST',
    url: url,
    headers: {
        'key': ownerKey, // The Owner Key which will be changed
    }
};
if (error) {
request(options, function(error, response, body) {
    if (error) {
       console.log(error);
    } else {
        console.log(body);

    }
});

The above command returns JSON structured like this:


{
"ownerId": "214d60f65359345456787654bba17a4c05f5ce639806023357176a51bfd52ad8",
"key": "7ND41g3DAcfO1VvHzX/INJF1ejQ1hX3LL3iG66coBUQ",
}

This endpoint revokes the owner key.

HTTP Request

POST https://api.bitails.net/owner/revoke

Errors

Err 404

As obvious as it is, As obvious as it is, a 404 error is generated when the page is not found

Err 500

Internal Error - And we are probably checking the system to see what happened!

Err 503

Scheduled Maintenance!

Bitails

Some useful info regarding Bitails.

System Architecture

Bitails claims it is built to scale! A known and mostly undelivered statement in the blockchain space! So, for the sake of transparency, we share our system architecture to give a better sense of what we do under the hood!

Contact Info

The following is the contact information for Bitails:

Donation!

If you like what Bitails is doing, consider donating to our project, it helps us keep providing an A-Level service with even more features.