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": "n36h3pAH7sC3z8KMB47BjbqvW2aJd2oTi7"
}

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.

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"
}

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
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. It is possible to build a blockchain transaction in 2 ways:

  • fromAddress - assets will be sent from the list of addresses. For each of the addresses, the last 100 transactions will be scanned for any unspent UTXO to be included in the transaction.
  • fromUTXO - assets will be sent from the list of unspent UTXOs. Each of the UTXOs will be included in the transaction.

In bitcoin-like blockchains, a transaction is created from the list of previously unspent UTXOs. Every UTXO contains the amount of funds that can be spent.

When the UTXO is entered into the transaction, the whole amount is included and must be spent. For example, address A receives 2 transactions, T1 with 1 BTC and T2 with 2 BTC. The transaction, which will consume the UTXOs for T1 and T2, will have an available amount to spend of 3 BTC = 1 BTC (T1) + 2 BTC(T2).

There can be multiple recipients of the transactions. In the to section, every recipient address has its own corresponding amount. When the amount of funds that the recipient should receive is lower than the amount of funds from the UTXOs, the difference is used as a transaction fee.

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

Array of addresses and corresponding private keys. Tatum will automatically scan last 100 transactions for each address and will use all of the unspent values. We advise to use this option if you have 1 address per 1 transaction only.

Array
address
required
string [ 30 .. 50 ]

Address to send assets from.

privateKey
required
string [ 52 .. 52 ]

Private key of the address to send assets from. Private key, or signature Id must be present.

required
Array of objects

Array of addresses and values to send bitcoins to. Values must be set in BTC. Difference between from and to is transaction fee.

Array
address
required
string [ 30 .. 60 ]

Destination address.

value
required
number >= 0

Amount to be sent, in BTC.

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",
  • "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, Tatum Middleware 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.

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 arrays

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
}