Creating and managing a Bitcoin wallet using a REST API can seem complex at first, but with the right tools and understanding, it becomes a streamlined process. This guide walks you through the essential steps—generating a wallet, deriving private keys and addresses, checking balances, estimating fees, and broadcasting transactions—using Bitcoin’s Testnet and a secure API framework.
Whether you're a developer integrating blockchain functionality or exploring how Bitcoin transactions work under the hood, this tutorial provides clear, actionable insights. All examples use the Bitcoin Testnet, so no real funds are at risk.
📘 Understanding the Bitcoin Testnet Environment
Before diving into code, it's important to note that all operations in this guide are performed on Bitcoin’s Testnet—a sandbox network for developers to test applications without using real BTC. This allows safe experimentation with wallet creation, fund transfers, and transaction logic.
🔐 Security Note: The system used does not store your mnemonics or private keys. You are fully responsible for securing them. Losing access means losing control of your funds—there is no recovery mechanism.
Step 1: Generate a Bitcoin Wallet (Mnemonic & xPub)
The foundation of any Bitcoin wallet is a mnemonic phrase—a 24-word human-readable seed that generates all future keys and addresses.
Use the following endpoint to create a new wallet:
👉 Learn how to securely generate your first cryptocurrency wallet using API commands.
curl --location 'https://api.tatum.io/v3/bitcoin/wallet' \
--header 'x-api-key: {YOUR_API_KEY}'Sample Response:
{
"mnemonic": "pull leader deputy custom invest hat panel behind reward fancy tribe valley elite wish mistake letter bounce sing anchor electric #### #### #### ####",
"xpub": "tpubDFRDRgtnYJcXdhC4eE1HktF86nLwLodEopxvmAePWyZPXR6zGnu5XtQ2S4TBjHgF6rPnxGdJ8MinjYKAGqoumF4L9TL8wMJJoAGW1XR####"
}- The
mnemonicis your master seed. - The
xpub(extended public key) lets you generate multiple public addresses without exposing private keys.
📌 Best Practice: Store your mnemonic securely—offline storage like hardware wallets or encrypted vaults is recommended.
Step 2: Derive a Private Key from Mnemonic
Once you have a mnemonic, you can derive private keys for specific address indices. Each index corresponds to a unique key pair.
curl --location 'https://api.tatum.io/v3/bitcoin/wallet/priv' \
--header 'Content-Type: application/json' \
--header 'x-api-key: {YOUR_API_KEY}' \
--data '{
"index": 1,
"mnemonic": "pull leader deputy custom invest hat panel behind reward fancy tribe valley elite wish mistake letter bounce sing anchor electric #### #### #### ####"
}'Response:
{
"key": "####"
}This private key controls access to funds at the corresponding address. Never expose it publicly.
Step 3: Generate a Public Bitcoin Address
Using the xpub, generate a public receiving address. For index 1:
curl --location 'https://api.tatum.io/v3/bitcoin/address/tpubDFRDRgtnYJcXdhC4eE1HktF86nLwLodEopxvmAePWyZPXR6zGnu5XtQ2S4TBjHgF6rPnxGdJ8MinjYKAGqoumF4L9TL8wMJJoAGW1XR####/1' \
--header 'x-api-key: {YOUR_API_KEY}'Response:
{
"address": "tb1q7hec37mcmfk6hmqn67echzdf8zwg5n5pqnfzma"
}You can now share this address to receive test BTC.
Step 4: Check Address Balance
To verify incoming funds:
curl --location 'https://api.tatum.io/v3/bitcoin/address/balance/tb1q7hec37mcmfk6hmqn67echzdf8zwg5n5pqnfzma' \
--header 'x-api-key: {YOUR_API_KEY}'Response:
{
"incoming": "0.00828",
"outgoing": "0",
"incomingPending": "0.00008",
"outgoingPending": "0"
}This shows confirmed and pending unspent transaction outputs (UTXOs).
Step 5: Retrieve UTXOs for Transaction Building
Before sending funds, identify available UTXOs:
curl --location 'https://api.tatum.io/v4/data/utxos?chain=bitcoin-testnet&address=tb1q7hec37mcmfk6hmqn67echzdf8zwg5n5pqnfzma&totalValue=0.002' \
--header 'x-api-key: {YOUR_API_KEY}'Returns an array of spendable outputs, including transaction hash, index, and value.
⚠️ For rapid consecutive transactions from the same address, always re-check UTXO status to avoid double-spending attempts.
Step 6: Estimate Transaction Fees
Accurate fee estimation ensures timely confirmation:
curl --location 'https://api.tatum.io/v3/blockchain/estimate' \
--header 'Content-Type: application/json' \
--header 'x-api-key: {YOUR_API_KEY}' \
--data '{
"chain": "BTC",
"type": "TRANSFER",
"fromUTXO": [ ... ],
"to": [
{
"address": "tb1qguyupqrsd36c0fta99rf6prxe2lfr73ahxkvpf",
"value": 0.00042
}
]
}'Response:
{
"slow": "0.00003145",
"medium": "0.00005529",
"fast": "0.00006645"
}Choose based on network congestion. Testnet estimates may be unreliable due to arbitrary fee settings by users.
Step 7: Broadcast a Bitcoin Transaction
Now send funds using the collected data.
Variant 1: Explicit Fee & Change Address
curl --location 'https://api.tatum.io/v3/bitcoin/transaction' \
--header 'Content-Type: application/json' \
--header 'x-api-key: {YOUR_API_KEY}' \
--data '{
"fromUTXO": [
{
"txHash": "...",
"index": 0,
"privateKey": "####"
}
],
"to": [
{
"value": 0.00042,
"address": "tb1qguyupqrsd36c0fta99rf6prxe2lfr73ahxkvpf"
}
],
"fee": "0.0009945",
"changeAddress": "tb1q7hec37mcmfk6hmqn67echzdf8zwg5n5pqnfzma"
}'Returns:
{ "txId": "63b02f60968800202ee211ac14520e51b4b2e25335cf0523fee38beb1b154395" }Variant 2: Multiple Outputs (Including Change)
Specify exact outputs; miner fee is deducted implicitly:
{
"to": [
{ "value": 0.0001, "address": "receiver" },
{ "value": 0.0065, "address": "change" }
]
}👉 Discover how to build and broadcast secure Bitcoin transactions with minimal fees.
Step 8: Verify Transaction Details
After broadcasting, confirm the transaction:
curl --location 'https://api.tatum.io/v3/bitcoin/transaction/63b02f60968800202ee211ac14520e51b4b2e25335cf0523fee38beb1b154395' \
--header 'x-api-key: {YOUR_API_KEY}'Unconfirmed transactions may return errors or lack block information until mined.
🔍 Frequently Asked Questions (FAQ)
Q: Can I recover my funds if I lose my mnemonic?
A: No. Since the service doesn’t store mnemonics or private keys, loss means permanent inaccessibility of funds.
Q: Why are Testnet fee estimates inaccurate?
A: Testnet coins have no value, so users often set arbitrary fees, skewing market data. Always monitor mempool conditions manually.
Q: What is a UTXO?
A: Unspent Transaction Output—the portion of Bitcoin not yet spent from a prior transaction, used as input for new ones.
Q: How do I speed up a stuck transaction?
A: Use Child Pays for Parent (CPFP)—send a high-fee transaction spending the output of the stuck one. RBF is not supported via core API.
Q: Is Replace-By-Fee (RBF) available?
A: No. Transactions broadcasted via this API cannot be replaced.
Q: Why should I care about derivation paths?
A: Using the correct path ensures compatibility with standard wallets (like BIP44). Mismatches lead to inaccessible funds.
Core Keywords
- Bitcoin REST API
- Generate Bitcoin wallet
- Derive private key from mnemonic
- Bitcoin address generation
- Check BTC balance
- UTXO management
- Estimate Bitcoin transaction fee
- Broadcast Bitcoin transaction
By mastering these foundational steps, you gain full programmatic control over Bitcoin operations—ideal for building wallets, exchanges, or blockchain analytics tools. Always test thoroughly on Testnet before moving to production environments.
👉 Start building powerful blockchain applications with reliable API infrastructure today.