Tatum
Search…
How to create a blockchain wallet
Generating a Bitcoin wallet in three API calls
Getting started
To use Tatum, you have to sign up for an API key in the Dashboard. This API Key is used in every HTTP request to Tatum as an HTTP header.
Do you know that many developers do not know how to handle private keys securely and store them somewhere in their infrastructure? For 2 million users, they store 2 million private keys. This is a really bad way to do it. Let's look at how to create a wallet, a much more secure and efficient way of handling private keys.
Today, you will be working with Bitcoin to generate a BIP44 compatible wallet. The most important feature of this type of wallet is that you only need to store one secret mnemonic for more than 2 billion private keys and addresses.
BIP 44 is originally a Bitcoin proposal to generate multiple addresses for different blockchains from a single mnemonic seed.

Creating a blockchain wallet

To generate a Bitcoin wallet, you need to call a request to the Bitcoin/walletendpoint. The result contains two fields - a mnemonic and extended public key (xpub).
Request
Response
1
curl --request GET \
2
--url 'https://api-eu1.tatum.io/v3/bitcoin/wallet' \
3
--header 'x-api-key: YOUR_API_KEY'
Copied!
1
{
2
"mnemonic": "zebra parent avocado margin ready heart space orchard police junior travel today bag action rough system novel large rain detail route spare add mail",
3
"xpub": "xpub6FPGLmppWEemTJ56aq6wcSkjeZN4iEw1CBvQzkusgbJpqyoiPPJASLpbduzKrNF54i348moHyoVGkyz1H2TC3iEPLfacjPFEfTENkD6YzzZ"
4
}
Copied!
Working with private keys
In this guide, we are using our API to create blockchain wallets and private keys, which is fine for testing and demo purposes.
However, for production use, your private keys and mnemonics should never leave your security perimeter. To correctly and securely generate wallets and work with private keys, we recommend using Tatum CLI from the command line or our complex key management system, Tatum KMS.

Generating an address from the wallet

A mnemonic is a 24 word-long string that you can understand as a password to our wallet. Every address and the private key can be generated from a mnemonic. It is sensitive information and should not be revealed. Otherwise, you risk losing your funds.
"Xpub" is an abbreviation for "extended public key." You can understand it as a generator of addresses. Only addresses can be generated with an xpub, not private keys.
Every wallet generated from Tatum holds more than 2 billion addresses. To generate a specific address, you can use an endpoint to generate the address - Bitcoin/address, where you enter your xpub and the index of the address you want to generate.
Request
Response
1
curl --request GET \
2
--url https://api-eu1.tatum.io/v3/bitcoin/address/xpub6FPGLmppWEemTJ56aq6wcSkjeZN4iEw1CBvQzkusgbJpqyoiPPJASLpbduzKrNF54i348moHyoVGkyz1H2TC3iEPLfacjPFEfTENkD6YzzZ/1 \
3
--header 'x-api-key: YOUR_API_KEY'
Copied!
1
{
2
"address": "1BZWZ89vWpb8htzpBmPMwcWPxt5f6usdZN"
3
}
Copied!
The result of the API call is the address for index number 1.

Generating a private key from the wallet

To generate a private key, the same mechanism is used. The only difference is that in this case, private keys are not generated from xpubs but from the mnemonic itself. When you execute a Bitcoin/wallet/priv endpoint request with the mnemonic and index entered as the request body, you can see the generated private key for index number 1.
Request
Response
1
curl --request POST \
2
--url https://api-eu1.tatum.io/v3/bitcoin/wallet/priv \
3
--header 'content-type: application/json' \
4
--header 'x-api-key: YOUR_API_KEY' \
5
--data '{"index":1,"mnemonic":"zebra parent avocado margin ready heart space orchard police junior travel today bag action rough system novel large rain detail route spare add mail"}'
Copied!
1
{
2
"key": "L2A9CvxKQ26LudMRN1air5JpRNZU6Wadno1shxkfq3X3kLtTVQ9z"
3
}
Copied!
That was super easy. You made only three calls to Tatum, and you were able to generate a wallet and receive bitcoin at the blockchain addresses. The same principle applies to other blockchains supported by Tatum, such as Ethereum, Litecoin, Bitcoin Cash, and others...
To find out more about the API calls we have just used, visit our API reference.
Last modified 1mo ago