Bitcoin

Bitcoin Blockchain enables access to the most commonly used Bitcoin methods. These methods bring a small level of abstraction and are used for applications that communicate with the blockchain directly. Some of the methods are used alongside Tatum Private Ledger to connect the blockchain and the private ledger, like wallet generation or getting information about transactions.
Tatum supports 2 chains:

  • Mainnet - a regular live chain
  • Testnet3 - a chain used for testing purposes. Coins on the test chain have no value and can be obtained from a faucet, e.g. https://testnet-faucet.mempool.co/

Generate a Bitcoin wallet

1 credit per API call

Tatum supports BIP44 HD wallets. Because they can generate 2^31 addresses from 1 mnemonic phrase, they are very convenient and secure. A mnemonic phrase consists of 24 special words in a defined order and can restore access to all generated addresses and private keys.
Each address is identified by 3 main values:

  • Private Key - your secret value, which should never be revealed
  • Public Key - public address to be published
  • Derivation index - index of generated address

Tatum follows BIP44 specification and generates for Bitcoin wallet with derivation path m'/44'/0'/0'/0. More about BIP44 HD wallets can be found here - https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki. Generate BIP44 compatible Bitcoin wallet.

SecurityX-API-Key
Request
query Parameters
mnemonic
string <= 500 characters

Mnemonic to use for generation of extended public and private keys.

Responses
200

OK

400

Bad Request. Validation failed for the given object in the HTTP Body or Request parameters.

401

Unauthorized. Not valid or inactive subscription key present in the HTTP Header.

403

Forbidden. The request is authenticated, but it is not possible to perform the required operation due to a logical error or invalid permissions.

500

Internal server error. There was an error on the server while processing the request.

get/v3/bitcoin/wallet
Request samples
Response samples
application/json
{
  • "mnemonic": "urge pulp usage sister evidence arrest palm math please chief egg abuse",
  • "xpub": "xpub6EsCk1uU6cJzqvP9CdsTiJwT2rF748YkPnhv5Qo8q44DG7nn2vbyt48YRsNSUYS44jFCW9gwvD9kLQu9AuqXpTpM1c5hgg9PsuBLdeNncid"
}

Generate a Bitcoin address from the wallet's extended public key

1 credit per API call

Generate a Bitcoin address from the extended public key of the wallet. The address is generated for the specific index - each extended public key can generate up to 2^32 addresses with the index starting from 0 up to 2^31 - 1.

SecurityX-API-Key
Request
path Parameters
xpub
required
string

Extended public key of a wallet.

Example: xpub6EsCk1uU6cJzqvP9CdsTiJwT2rF748YkPnhv5Qo8q44DG7nn2vbyt48YRsNSUYS44jFCW9gwvD9kLQu9AuqXpTpM1c5hgg9PsuBLdeNncid
index
required
number >= 0

Derivation index of the desired address to be generated.

Responses
200

OK

400

Bad Request. Validation failed for the given object in the HTTP Body or Request parameters.

401

Unauthorized. Not valid or inactive subscription key present in the HTTP Header.

403

Forbidden. The request is authenticated, but it is not possible to perform the required operation due to a logical error or invalid permissions.

500

Internal server error. There was an error on the server while processing the request.

get/v3/bitcoin/address/{xpub}/{index}
Request samples
Response samples
application/json
{
  • "address": "0xa7673161CbfE0116A4De9E341f8465940c2211d4"
}

Generate the private key for a Bitcoin address

1 credit per API call

Generates a private key for an address from a mnemonic for a given derivation path index. The private key is generated for the specific index - each mnemonic can generate up to 2^32 private keys starting from index 0 until 2^31 - 1.

SecurityX-API-Key
Request
Request Body schema: application/json
index
required
integer <= 2147483647

Derivation index of private key to generate.

mnemonic
required
string [ 1 .. 500 ] characters

Mnemonic to generate private key from.

Responses
200

OK

400

Bad Request. Validation failed for the given object in the HTTP Body or Request parameters.

401

Unauthorized. Not valid or inactive subscription key present in the HTTP Header.

403

Forbidden. The request is authenticated, but it is not possible to perform the required operation due to a logical error or invalid permissions.

500

Internal server error. There was an error on the server while processing the request.

post/v3/bitcoin/wallet/priv
Request samples
application/json
{
  • "index": 0,
  • "mnemonic": "urge pulp usage sister evidence arrest palm math please chief egg abuse"
}
Response samples
application/json
{
  • "key": "cTmS2jBWXgFaXZ2xG9jhn67TiyTshnMp3UedamzEhGm6BZV1vLgQ"
}

Get Bitcoin blockchain information

1 credit per API call

Gets Bitcoin blockchain information. Obtains basic info like the testnet / mainnet version of the chain, the current block number and its hash.

SecurityX-API-Key
Responses
200

OK

401

Unauthorized. Not valid or inactive subscription key present in the HTTP Header.

403

Forbidden. The request is authenticated, but it is not possible to perform the required operation due to a logical error or invalid permissions.

500

Internal server error. There was an error on the server while processing the request.

get/v3/bitcoin/info
Request samples
Response samples
application/json
{
  • "chain": "test",
  • "blocks": 1579820,
  • "headers": 1579820,
  • "bestblockhash": "0000000000000106e4c03ca093ce0cf77e796ddff4f3cadc59ca6b0380e3eed4",
  • "difficulty": 6522714.521250089
}

Get the hash of a Bitcoin block

1 credit per API call

Gets a Bitcoin block hash. Returns the hash of the block to get the block's details.

SecurityX-API-Key
Request
path Parameters
i
required
number

The number of blocks preceding a particular block on a blockchain.

Example: 1580117
Responses
200

OK

400

Bad Request. Validation failed for the given object in the HTTP Body or Request parameters.

401

Unauthorized. Not valid or inactive subscription key present in the HTTP Header.

403

Forbidden. The request is authenticated, but it is not possible to perform the required operation due to a logical error or invalid permissions.

500

Internal server error. There was an error on the server while processing the request.

get/v3/bitcoin/block/hash/{i}
Request samples
Response samples
application/json
{
  • "hash": "0000000053f225e202cf27fe3046e06719efd3b31b5ab75fc5ef7f853c8b246f"
}

Get a Bitcoin block by its hash or height

1 credit per API call

Gets Bitcoin block detail by block hash or height.

SecurityX-API-Key
Request
path Parameters
hash
required
string

Block hash or height.

Example: 00000000ca231a439a5c0a86a5a5dd6dc1918a8e897b96522fa9499288e70183
Responses
200

OK

400

Bad Request. Validation failed for the given object in the HTTP Body or Request parameters.

401

Unauthorized. Not valid or inactive subscription key present in the HTTP Header.

404

Block not found.

500

Internal server error. There was an error on the server while processing the request.

get/v3/bitcoin/block/{hash}
Request samples
Response samples
application/json
{
  • "hash": "00000000ca231a439a5c0a86a5a5dd6dc1918a8e897b96522fa9499288e70183",
  • "height": 15235,
  • "depth": 1567867,
  • "version": 1,
  • "prevBlock": "000000006e79360d7b2519410fe5a73e8e08393fd7166620c73c711e4507d9fd",
  • "merkleRoot": "480c227c5042377dbd54464d33e1f59c19fe02fe76d7f55b6955db438479aece",
  • "time": 1338861927,
  • "bits": 486604799,
  • "nonce": 1193572362,
  • "txs": [
    ]
}

Get the balance of a Bitcoin address

1 credit per API call

Get the balance of a Bitcoin address.

The API returns the balance only if the address has up to 50,000 UTXOs (Unspent Transaction Outputs). For an address with more than 50,000 UTXOs, the API returns an error with the 403 response code.

SecurityX-API-Key
Request
path Parameters
address
required
string

The blockchain address to get the balance for

Example: 2MsM67NLa71fHvTUBqNENW15P68nHB2vVXb
Responses
200

OK

400

Bad Request. Validation failed for the given object in the HTTP Body or Request parameters.

401

Unauthorized. Not valid or inactive subscription key present in the HTTP Header.

403

Forbidden. The request is authenticated, but it is not possible to perform the required operation due to a logical error or invalid permissions.

500

Internal server error. There was an error on the server while processing the request.

get/v3/bitcoin/address/balance/{address}
Request samples
Response samples
application/json
{
  • "incoming": "0.1234",
  • "outgoing": "0.1",
  • "incomingPending": "0.0004",
  • "outgoingPending": "0.05"
}

Get the balance of multiple Bitcoin addresses

50 credits per API call

Get the balance of multiple Bitcoin addresses, up to 30.

The API returns the balance only if the address has up to 50,000 UTXOs (Unspent Transaction Outputs). For an address with more than 50,000 UTXOs, the API returns an error with the 403 response code.

SecurityX-API-Key
Request
query Parameters
addresses
required
string

The blockchain addresses separated by comma to get the balances for

Example: addresses=2MsM67NLa71fHvTUBqNENW15P68nHB2vVXb,2MsM67NLa71fHvTUBqNENW15P68nHB2vVXb
Responses
200

OK

400

Bad Request. Validation failed for the given object in the HTTP Body or Request parameters.

401

Unauthorized. Not valid or inactive subscription key present in the HTTP Header.

403

Forbidden. The request is authenticated, but it is not possible to perform the required operation due to a logical error or invalid permissions.

500

Internal server error. There was an error on the server while processing the request.

get/v3/bitcoin/address/balance/batch
Request samples
Response samples
application/json
[
  • {
    }
]

Get all transactions for a Bitcoin address

1 credit per API call

Get all transactions for a Bitcoin address.

SecurityX-API-Key
Request
path Parameters
address
required
string

Address

Example: 2MsM67NLa71fHvTUBqNENW15P68nHB2vVXb
query Parameters
pageSize
required
number [ 1 .. 50 ]

Max number of items per page is 50.

Example: pageSize=10
offset
number

Offset to obtain the next page of data.

Example: offset=0
txType
string

Type of the transaction to fetch - either incoming, or outgoing. If none is present - all transactions are fetched.

Enum: "incoming" "outgoing"
Example: txType=incoming
Responses
200

OK

400

Bad Request. Validation failed for the given object in the HTTP Body or Request parameters.

401

Unauthorized. Not valid or inactive subscription key present in the HTTP Header.

403

Forbidden. The request is authenticated, but it is not possible to perform the required operation due to a logical error or invalid permissions.

500

Internal server error. There was an error on the server while processing the request.

get/v3/bitcoin/transaction/address/{address}
Request samples
Response samples
application/json
[
  • {
    }
]

Send BTC to Bitcoin addresses

2 credits per API call

Send BTC to blockchain addresses.

Bitcoin transactions are based on UTXOs. "UTXO" stands for "Unspent Transaction Output". A UTXO is the amount of BTC/satoshis that remains at a Bitcoin address after a cryptocurrency transaction involving this address has been performed. The UTXO can then be used as input for a new cryptocurrency transaction. For more information about Bitcoin transactions and UTXO, see the Bitcoin user documentation. To check UTXOs in a transaction, see the API for getting information about a transaction output (UTXO) in a Bitcoin transaction.

You can build a BTC transaction by one of the following methods:

  • Sending BTC from blockchain addresses
    The assets are sent from a list of addresses. For each address, the last 100 transactions are scanned for any UTXO to be included in the transaction. For easier control over the assets to be sent, we recommend that you use this method only if you have one address to send the assets from.
    To use this method, use the BtcTransactionFromAddress or BtcTransactionFromAddressKMS schema of the request body.
  • Sending BTC from UTXOs
    The assets are sent from a list of UTXOs. Each UTXO is included in the transaction. Use this method if you want to manually calculate the amount to send.
    To use this method, use the BtcTransactionFromUTXO or BtcTransactionFromUTXOKMS schema of the request body.

When an UTXO is entered into a transaction, the whole UTXO amount is included and must be spent. For example, address A receives two transactions, T1 with 1 BTC and T2 with 2 BTC. A transaction that consumes the UTXOs from both T1 and T2 will have an available amount of 3 BTC to spend:
1 BTC (from T1) + 2 BTC (from T2) = 3 BTC (to spend in total)

You can send the assets to one or multiple recipients in one transaction. If you send the assets to multiple addresses, each address must have its own amount to receive.

Paying the gas fee and receiving the change
When the amount that the recipients should receive is lower than the amount from the UTXOs, the difference between these two amounts is by default used as the gas fee for the transaction. Because this amount may be considerable and you may not want to spend it all on the gas fee, you can explicitly specify the fee amount and the blockchain address where any extra funds remaining after covering the fee will be sent (the fee and changeAddress parameters in the request body, correspondingly).

Signing a transaction
When sending BTC, you are charged a fee for the transaction, and you must sign the transaction with the private key of the blockchain address from which the fee will be deducted.

Providing the private key in the API is not a secure way of signing transactions, because the private key can be stolen or exposed. Your private keys should never leave your security perimeter. You should use the private keys only for testing a solution you are building on the testnet of a blockchain.

For signing transactions on the mainnet, we strongly recommend that you use the Tatum Key Management System (KMS) and provide the signature ID instead of the private key in the API. Alternatively, you can use the Tatum JavaScript client.

SecurityX-API-Key
Request
Request Body schema: application/json
One of:
required
Array of objects (BtcTransactionFromAddressSource)

The array of blockchain addresses to send the assets from and their private keys. For each address, the last 100 transactions are scanned for any UTXO to be included in the transaction.

Array
address
required
string [ 30 .. 50 ]

The blockchain address to send the assets from

privateKey
required
string [ 52 .. 52 ]

The private key of the address to send the assets from

required
Array of objects (BtcTransactionFromAddressTarget)

The array of blockchain addresses to send the assets to and the amounts that each address should receive (in BTC). The difference between the UTXOs calculated in the fromAddress section and the total amount to receive calculated in the to section will be used as the gas fee. To explicitly specify the fee amount and the blockchain address where any extra funds remaining after covering the fee will be sent, set the fee and changeAddress parameters.

Array
address
required
string [ 30 .. 60 ]

The blockchain address to receive the assets

value
required
number >= 0

The amount to receive (in BTC)

fee
string

The fee to be paid for the transaction (in BTC); if you are using this parameter, you have to also use the changeAddress parameter because these two parameters only work together.

changeAddress
string [ 30 .. 60 ]

The blockchain address to send any extra assets remaning after covering the fee to; if you are using this parameter, you have to also use the fee parameter because these two parameters only work together.

Responses
200

OK

400

Bad Request. Validation failed for the given object in the HTTP Body or Request parameters.

401

Unauthorized. Not valid or inactive subscription key present in the HTTP Header.

403

Forbidden. The request is authenticated, but it is not possible to perform the required operation due to a logical error or invalid permissions.

500

Internal server error. There was an error on the server while processing the request.

post/v3/bitcoin/transaction
Request samples
application/json
{
  • "fromAddress": [
    ],
  • "to": [
    ]
}
Response samples
application/json
{
  • "txId": "c83f8818db43d9ba4accfe454aa44fc33123d47a4f89d47b314d6748eb0e9bc9"
}

Get a Bitcoin transaction by its hash

1 credit per API call

Get Bitcoin Transaction detail by transaction hash.

SecurityX-API-Key
Request
path Parameters
hash
required
string

Transaction hash

Example: 1451692ebbfbea1a2d2ec6fe6782596b6aa2e46c0589d04c406f491b5b46bc6a
Responses
200

OK

400

Bad Request. Validation failed for the given object in the HTTP Body or Request parameters.

401

Unauthorized. Not valid or inactive subscription key present in the HTTP Header.

403

Forbidden. The request is authenticated, but it is not possible to perform the required operation due to a logical error or invalid permissions.

500

Internal server error. There was an error on the server while processing the request.

get/v3/bitcoin/transaction/{hash}
Request samples
Response samples
application/json
{
  • "hash": "4c7846a8ff8415945e96937dea27bdb3144c15d793648d725602784826052586",
  • "hex": "020000000001072840e4f49e088d9ab233f6209aede5d91c44ecb59f490dbf289e7ef5028bc6aa0000000000ffffffffada5ca08d78992fac3bd48e1ac197c2b4bbd98b349d706ba7dd38c7c3dceed940000000000ffffffff0265691f1374c79a164186b6290a6bdf785561dcf5e3c155599dbaa646e2f06e0000000000ffffffff4f0b53ff85e10ff33c3cf95a1b650729c83b75d6b894d8224b40ca00b944a3ff0000000000ffffffff30aa398d22fd3b60534389c926093863d560eaeca4c6f85454b5fa0222f96db30000000000ffffffff9c02daa47a879222fc7e9d3c0ec7158d4853d3cc4a4465001412e5fc0371e7470100000000ffffffff78bdc156966a07d09f9bdb45ccb2e21765657f806b7e2ab7b7bb9dad5d5b5bc30000000000ffffffff010c2845000000000016001490a446c7f165cfd99dd5dd87a6bb83a17fd9e9f1024730440220384fa3d7935db56a637cf6c662dfc6990957e2838afa5db29e7569c996ba24930220567d4ed8ec36a940d871bc26d292656690e55bd10567c823af2c6ffab9a7868f012103ccb40d87b4e847b970a9dd23c3d5078964213cf6a78257796d801316bb7bb60c0247304402206b6db0dd0dd158835618613b952056327113374a8dec6be5f41c41a8ce552fe2022027c356009488123c27c98aa66080f6898484b7c098dc366540be8f6935feeefe012103ccb40d87b4e847b970a9dd23c3d5078964213cf6a78257796d801316bb7bb60c0247304402200baf8a00f9f767cc83c35e3a29a03a4f054c886fc07828481b83ae858eb5853902202f6d82ef65f64ac5db1db947aa03e1ed5f3b19710cf4c3e4448cd5a7f25277df012103ccb40d87b4e847b970a9dd23c3d5078964213cf6a78257796d801316bb7bb60c02483045022100b7d574102ede6a4d556269129592faa8f7ff54ca846c2516804811e06aca380202206a0e519a911e3fe130f1d446f5fd16b951fd25136b2f9b2980dd9eefe4f3a860012103ccb40d87b4e847b970a9dd23c3d5078964213cf6a78257796d801316bb7bb60c02473044022008548dc3eff2713011d3fad3e661918f51cd4a3b688f90326f5febf4dbb34c8f0220245e37520b501a7c429f9428c4892034d398c8198006fedd9fdb45790c8d0d23012103ccb40d87b4e847b970a9dd23c3d5078964213cf6a78257796d801316bb7bb60c02473044022044bd3552b24b49b2c9bc2acee7a8d587407070cb80e7c65cdefff78fe7df0f99022067581ae9d54d2fdedb9bcf69c2281830e165f9df631f6c889f98dfb7c1e4a78a012103ccb40d87b4e847b970a9dd23c3d5078964213cf6a78257796d801316bb7bb60c02483045022100a141642697ba55407e4d6d2b6d3d1b2f93d5126794e77028c00307835a4c71ce02202658200b9d779d0f6f169bdd27dc81cbbb10718e57754349e57e020ea6bf5cfb012103ccb40d87b4e847b970a9dd23c3d5078964213cf6a78257796d801316bb7bb60c00000000",
  • "witnessHash": "4c7846a8ff8415945e96937dea27bdb3144c15d793648d725602784826052586",
  • "fee": 4540,
  • "rate": 20088,
  • "mtime": 1575663337,
  • "blockNumber": 1611609,
  • "block": "00000000000001e13fe1eb3977f3379e3d0f6577fc6e087d27db46597ebddb8b",
  • "time": 1575663091,
  • "index": 1,
  • "version": 2,
  • "inputs": [
    ],
  • "outputs": [
    ],
  • "locktime": 1611608
}

Get information about a transaction output (UTXO) in a Bitcoin transaction

1 credit per API call

Get information about a transaction output in a transaction and check whether this output is a UTXO or has been spent.

"UTXO" stands for "Unspent Transaction Output". A UTXO is the amount of BTC/satoshis that remains at a Bitcoin address after a cryptocurrency transaction involving this address has been performed. The UTXO can then be used as input for a new cryptocurrency transaction. For more information about Bitcoin transactions and UTXO, see the Bitcoin user documentation.

  • If the transaction output is an UTXO, the API returns data about it.
  • If the transaction output has been spent and there is no UTXO to return, the API returns an error with the 404 response code.
SecurityX-API-Key
Request
path Parameters
hash
required
string = 64 characters

The transaction hash

Example: 53faa103e8217e1520f5149a4e8c84aeb58e55bdab11164a95e69a8ca50f8fcc
index
required
number >= 0

The index of the transaction output that you want to check for the UTXO

Example: 0
Responses
200

OK

400

Bad Request. Validation failed for the given object in the HTTP Body or Request parameters.

401

Unauthorized. Not valid or inactive subscription key present in the HTTP Header.

403

Forbidden. The request is authenticated, but it is not possible to perform the required operation due to a logical error or invalid permissions.

500

Internal server error. There was an error on the server while processing the request.

get/v3/bitcoin/utxo/{hash}/{index}
Request samples
Response samples
application/json
{
  • "version": 1,
  • "height": 210000,
  • "value": 30000000,
  • "script": "76a91400ba915c3d18907b79e6cfcd8b9fdf69edc7a7db88ac",
  • "address": "R9M3aUWCcKoiqDPusJvqNkAbjffLgCqYip",
  • "coinbase": false,
  • "hash": "53faa103e8217e1520f5149a4e8c84aeb58e55bdab11164a95e69a8ca50f8fcc",
  • "index": 0
}

Get transactions from the Bitcoin mempool

1 credit per API call

Gets Bitcoin transaction IDs in the mempool.

SecurityX-API-Key
Responses
200

OK

400

Bad Request. Validation failed for the given object in the HTTP Body or Request parameters.

401

Unauthorized. Not valid or inactive subscription key present in the HTTP Header.

403

Forbidden. The request is authenticated, but it is not possible to perform the required operation due to a logical error or invalid permissions.

500

Internal server error. There was an error on the server while processing the request.

get/v3/bitcoin/mempool
Request samples
Response samples
application/json
[
  • "4c7846a8ff8415945e96937dea27bdb3144c15d793648d725602784826052586"
]

Broadcast a signed Bitcoin transaction

2 credits per API call

Broadcasts a signed transaction to the Bitcoin blockchain. This method is used internally from Tatum KMS or Tatum Client Libraries. It is possible to create a custom signing mechanism and only use this method for broadcasting data to the blockchain.

SecurityX-API-Key
Request
Request Body schema: application/json
txData
required
string [ 1 .. 500000 ] characters

Raw signed transaction to be published to network.

signatureId
string <uuid>

ID of prepared payment template to sign. Required only, when broadcasting transaction signed by Tatum KMS.

index
number [ 0 .. 2147483647 ]

(Only if the signature ID is mnemonic-based and you run KMS v6.2 or later) The index of the address to send the assets from that was generated from the mnemonic

Responses
200

OK

400

Bad Request. Validation failed for the given object in the HTTP Body or Request parameters.

401

Unauthorized. Not valid or inactive subscription key present in the HTTP Header.

403

Forbidden. The request is authenticated, but it is not possible to perform the required operation due to a logical error or invalid permissions.

500

Internal server error. There was an error on the server while processing the request.

post/v3/bitcoin/broadcast
Request samples
application/json
{
  • "txData": "62BD544D1B9031EFC330A3E855CC3A0D51CA5131455C1AB3BCAC6D243F65460D"
}
Response samples
application/json
{
  • "txId": "c83f8818db43d9ba4accfe454aa44fc33123d47a4f89d47b314d6748eb0e9bc9"
}

Connect to a Bitcoin node through an RPC driverDeprecated

This endpoint is deprecated. Do not use it.
Instead, use this API.


2 credits per API call

Use this endpoint URL as an http-based JSON RPC driver to connect directly to the node provided by Tatum. To learn more about JSON RPC, visit the Bitcoin developers' guide.

SecurityX-API-Key
Request
Request Body schema: application/json
jsonrpc
string

Version of the JSON RPC.

id
string

ID of the request, could be any arbitrary identifier.

method
string

Method to invoke on the node.

params
Array of objects

Params to the method call, if required.

Responses
200

OK

400

Bad Request. Validation failed for the given object in the HTTP Body or Request parameters.

401

Unauthorized. Not valid or inactive subscription key present in the HTTP Header.

500

Internal server error. There was an error on the server while processing the request.

post/v3/bitcoin/node
Request samples
application/json
{ }
Response samples
application/json
{
  • "jsonrpc": "1.0",
  • "id": "test",
  • "result": 654321
}