Generating a Deposit Address: Introduction
How to Generate Deposit Addresses in a Virtual Account
Once an End User Virtual Account is created, it is not yet synchronized with the blockchain. There is no blockchain address connected to it acting as a Deposit Address, but just the XPUB from your Master Exchange Wallet.
Steps
Step_1: Generate a Wallet
- This step should have been done while Setting up your Exchange or Application.
- Example: BTC - v3 REST API endpoint
- Retrieve the XPUB and store the Mnemonic.
Example request:
curl --location --request GET 'https://api.tatum.io/v3/bitcoin/wallet' \
--header 'x-api-key: {YOUR_API_KEY}'
//Response
{
"mnemonic": "method main swing charge hero theory eyebrow myself movie series silent camp proof tortoise electric rabbit good clip process always expect chase adult fee",
"xpub": "tpubDFRtR6DexBRjtJAfGYMaLnNWRwz7h5pNXu8rX4wcYuH6xeXncMcTqPnUVqk8d86DmUHJeWJBxhK6vhFHMQr4eZhHkQvKxXYtgYKPPMjKwer"
}
Step_2: Create a Virtual Account (XPUB-based)
Step_3: Generate a deposit address for a Virtual Account (XPUB-based)
Example request:
- The XPUB will be taken from the Virtual_Account_ID.
- The Deposit Address will be generated by adding +1 to the "index", as seen in the response as "
derivationKey
"
//POST: https://api.tatum.io/v3/offchain/account/{id}/address
curl --location --request POST 'https://api.tatum.io/v3/offchain/account/{Virtual_Account_ID}/address' \
--header 'x-api-key: {testnet_API_KEY}'
// Response
{
"xpub": "tpubDFRtR6DexBRjtJAfGYMaLnNWRwz7h5pNXu8rX4wcYuH6xeXncMcTqPnUVqk8d86DmUHJeWJBxhK6vhFHMQr4eZhHkQvKxXYtgYKPPMjKwer",
"derivationKey": 1, //By default, it starts with index == 1, Index == 0 is reserved to act as a ChangeAddress when transferring out.
"address": "tb1q2m35yvwlvrt4glqmlakepdd2jdanpe6nmc7wek", //This is the address your end user can use to deposit assets from outisde your Exchange or Application
"currency": "BTC"
}
Step_4: The result is a blockchain address that has been connected to the VA
- Any incoming blockchain transaction to this address, which matches with the "
currency
" of the VA will be automatically synchronized to the ledger.
Good to Know
- Be mindful of Tatum Derivation Path.
- Any on-chain assets already present in the blockchain address to bind to the Virtual Account will be ignoredβmore information HERE.
- Deposits are only recognized as long as the "currency" of the VA matches the on-chain asset deposited
Never share your mnemonic(s) and/or private key(s) with anyone. It is your responsibility to keep this information safe.
Disclaimer
Virtual Accounts are designed to hold a limited number of deposit addresses (1-5), similar to standard practices in Exchanges. While adding many deposit addresses may appear functional, this setup often leads to unrecoverable synchronization issues across users over time.
To avoid potential disruptions and ensure consistent performance, we recommend adhering to the intended usage of 1-5 deposit addresses per Virtual Account.
Updated 8 days ago