Tatum
Search…
How to send a Bitcoin transaction
To send a Bitcoin transaction, you have two options with Tatum:
    You can enter a list of blockchain addresses from which the assets will be sent.
    You can enter specific Unspent Transaction Outputs (UTXO) which will be used to send the assets.
More about Bitcoin
The Bitcoin blockchain is not account-based but transaction-based. You operate with a list of previously received transactions and the assets within them. This means that you can use multiple transactions in one transaction as a source of your assets, not just one specific address. To find out more about how Bitcoin works, check out this article.
When you enter a list of addresses, all incoming transactions that have not previously been used are used as a source. When you enter a list of UTXOs, only specific unspent transactions that belong to you are used.
Bitcoin transaction inputs
Please be aware that all of the assets that belong to the specific transaction are used as input, not only a fraction of them. To learn more about Bitcoin transactions, check out this article.
Finally, you have to know how much bitcoin you want to send to whom. You need to define a list of recipient addresses with the specific amounts that each address is to receive. The sum of the assets being sent must be bigger than the sum of assets being received. The difference is the transaction fee that must be paid to the network.
Example
You want to use 10 BTC from 2 addresses as input and send it to 3 recipients, each of which will receive 3 BTC. The fee is 10 BTC - 9 BTC = 1 BTC.

Sending a Bitcoin transaction

Enough of the theory. Let's send some bitcoin using this API endpoint.
Request - List of addresses as a source
Request - List of UTXOs as a source
Response
1
curl --location --request POST 'https://api-eu1.tatum.io/v3/bitcoin/transaction' \
2
--header 'x-api-key: YOUR_API_KEY' \
3
--header 'Content-Type: application/json' \
4
--data-raw '{
5
"fromAddress": [
6
{
7
"address": "mgSXLa5sJHvBpYTKZ62aW9z2YWQNTJ59Zm",
8
"privateKey": "cNUHqqs67WVhMZP9hH3i9nLQ1BGEasA87y6N6SQMsfYaBaPi9SEs"
9
}
10
],
11
"to": [
12
{
13
"address": "mgSXLa5sJHvBpYTKZ62aW9z2YWQNTJ59Zm",
14
"value": 0.000006
15
},
16
{
17
"address": "mgSXLa5sJHvBpYTKZ62aW9z2YWQNTJ59Zm",
18
"value": 0.000009
19
}
20
]
21
}'
Copied!
1
curl --location --request POST 'https://api-eu1.tatum.io/v3/bitcoin/transaction' \
2
--header 'x-api-key: YOUR_API_KEY' \
3
--header 'Content-Type: application/json' \
4
--data-raw '{
5
"fromUTXO": [
6
{
7
"txHash": "b2dc763cf75373ad14c984c07846f5425c20ddf34606debb0a148cd770528ef9",
8
"index": 0,
9
"privateKey": "cNUHqqs67WVhMZP9hH3i9nLQ1BGEasA87y6N6SQMsfYaBaPi9SEs"
10
},
11
{
12
"txHash": "b2dc763cf75373ad14c984c07846f5425c20ddf34606debb0a148cd770528ef9",
13
"index": 1,
14
"privateKey": "cNUHqqs67WVhMZP9hH3i9nLQ1BGEasA87y6N6SQMsfYaBaPi9SEs"
15
}
16
],
17
"to": [
18
{
19
"address": "mgSXLa5sJHvBpYTKZ62aW9z2YWQNTJ59Zm",
20
"value": 0.0000006
21
},
22
{
23
"address": "mgSXLa5sJHvBpYTKZ62aW9z2YWQNTJ59Zm",
24
"value": 0.000006
25
}
26
]
27
}'
Copied!
1
{
2
"txId": "962e4ad3781e7036ff3af6d880744fd3f06131c32d1085254da3cfa77b0e933f"
3
}
Copied!
Securely signing transactions
In this guide, we are signing transactions with a private key via API. This is fine for testing and demo purposes, but should not be used for production purposes. Your private keys and mnemonics should never leave your security perimeter. To correctly and securely sign a transaction you can use Tatum JS, the local middleware API, or our complex key management system, Tatum KMS.

Getting transaction details

The result is the transaction ID that can be obtained and checked via the Bitcoin/Get transaction endpoint.
Request
Response
1
curl --location --request GET 'https://api-eu1.tatum.io/v3/bitcoin/transaction/962e4ad3781e7036ff3af6d880744fd3f06131c32d1085254da3cfa77b0e933f' \
2
--header 'x-api-key: YOUR_API_KEY'
Copied!
1
{
2
"txid": "962e4ad3781e7036ff3af6d880744fd3f06131c32d1085254da3cfa77b0e933f",
3
"hash": "962e4ad3781e7036ff3af6d880744fd3f06131c32d1085254da3cfa77b0e933f",
4
"size": 374,
5
"vsize": 374,
6
"version": 2,
7
"locktime": 0,
8
"vin": [
9
{
10
"txid": "b2dc763cf75373ad14c984c07846f5425c20ddf34606debb0a148cd770528ef9",
11
"scriptSig": {
12
"asm": "3045022100e3ae860d446af1199e2799361abf8cc4cae3648a029fed3ad926fb3206ae13770220797889b261ec643c0c1dca38855bd58b6b367a9a98cda43fa220d15a919cc89201 0313f828eb023cde7a5924add3f2bd9c3e228b4e49ec6f550e8e1c5439572c238a",
13
"hex": "483045022100e3ae860d446af1199e2799361abf8cc4cae3648a029fed3ad926fb3206ae13770220797889b261ec643c0c1dca38855bd58b6b367a9a98cda43fa220d15a919cc89201210313f828eb023cde7a5924add3f2bd9c3e228b4e49ec6f550e8e1c5439572c238a"
14
},
15
"sequence": 4294967295,
16
"vout": 0
17
},
18
{
19
"txid": "b2dc763cf75373ad14c984c07846f5425c20ddf34606debb0a148cd770528ef9",
20
"scriptSig": {
21
"asm": "304502210081baa63650e42672c8dde6d5b3b414e037102620b9154168c49abd4a90cc491c02204e5808826457bff853aa68c2f9ddaebf46baa3b77dfaee5c467b66eaa773690e01 0313f828eb023cde7a5924add3f2bd9c3e228b4e49ec6f550e8e1c5439572c238a",
22
"hex": "48304502210081baa63650e42672c8dde6d5b3b414e037102620b9154168c49abd4a90cc491c02204e5808826457bff853aa68c2f9ddaebf46baa3b77dfaee5c467b66eaa773690e01210313f828eb023cde7a5924add3f2bd9c3e228b4e49ec6f550e8e1c5439572c238a"
23
},
24
"sequence": 4294967295,
25
"vout": 1
26
}
27
],
28
"vout": [
29
{
30
"value": 6e-7,
31
"n": 0,
32
"scriptPubKey": {
33
"asm": "OP_DUP OP_HASH160 0a21a1144fd4f6892c111c00141932608d17d3a9 OP_EQUALVERIFY OP_CHECKSIG",
34
"hex": "76a9140a21a1144fd4f6892c111c00141932608d17d3a988ac",
35
"type": "PUBKEYHASH",
36
"reqSigs": 1,
37
"addresses": [
38
"mgSXLa5sJHvBpYTKZ62aW9z2YWQNTJ59Zm"
39
]
40
}
41
},
42
{
43
"value": 0.000006,
44
"n": 1,
45
"scriptPubKey": {
46
"asm": "OP_DUP OP_HASH160 0a21a1144fd4f6892c111c00141932608d17d3a9 OP_EQUALVERIFY OP_CHECKSIG",
47
"hex": "76a9140a21a1144fd4f6892c111c00141932608d17d3a988ac",
48
"type": "PUBKEYHASH",
49
"reqSigs": 1,
50
"addresses": [
51
"mgSXLa5sJHvBpYTKZ62aW9z2YWQNTJ59Zm"
52
]
53
}
54
}
55
],
56
"blockhash": null,
57
"confirmations": 0,
58
"time": 1605903228,
59
"blocktime": 0,
60
"hex": "0200000002f98e5270d78c140abbde0646f3dd205c42f54678c084c914ad7353f73c76dcb2000000006b483045022100e3ae860d446af1199e2799361abf8cc4cae3648a029fed3ad926fb3206ae13770220797889b261ec643c0c1dca38855bd58b6b367a9a98cda43fa220d15a919cc89201210313f828eb023cde7a5924add3f2bd9c3e228b4e49ec6f550e8e1c5439572c238afffffffff98e5270d78c140abbde0646f3dd205c42f54678c084c914ad7353f73c76dcb2010000006b48304502210081baa63650e42672c8dde6d5b3b414e037102620b9154168c49abd4a90cc491c02204e5808826457bff853aa68c2f9ddaebf46baa3b77dfaee5c467b66eaa773690e01210313f828eb023cde7a5924add3f2bd9c3e228b4e49ec6f550e8e1c5439572c238affffffff023c000000000000001976a9140a21a1144fd4f6892c111c00141932608d17d3a988ac58020000000000001976a9140a21a1144fd4f6892c111c00141932608d17d3a988ac00000000"
61
}
Copied!
And that's it. Super easy. Now you know how to create your wallet, receive assets, and send them somewhere else. To find out more about the endpoints you used today, read our API Reference.
Last modified 1mo ago