Create Addresses
Overview
To enhance your privacy, you can create a new receive address for every transaction. There's no limit to the number of addresses you can create, but there may be asset-specific differences. For more details, see Blockchain References.
If you have multiple receive addresses for a wallet, consider the following:
- Account-based assets can send funds only from the root address of a wallet. If you have multiple receive addresses, you must periodically consolidate the balances to the root address to get the maximum spendable amount. To learn more, see Consolidate Account Balance.
- UTXO-based assets can send funds from any address of a wallet, and therefore don't require periodic consolidation to access the maximum spendable balance.
Prerequisites
Steps
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
const { BitGo } = require('bitgo'); // Fill in with actual access token const accessToken = '<your_actual_access_token>'; // Initialize the SDK const bitgo = new BitGo({ accessToken: accessToken, env: 'custom', customRootURI: 'https://app.bitgo.com', }); // Create the wallet const { wallet } = await bitgo.coin('tbtc4').wallets().generateWallet({ label: 'my hot Wallet', passphrase: 'VerySecurePassword1234', enterprise: '5612c2beeecf83610b621b90964448cd' }); // Or Alternatively you can get an existing wallet const walletId = '63bc8506e014900008265c65363245f4' const existingWallet = await bitgo.coin('tbtc4').wallets().get({ id: walletId }); // use the appropriate wallet instance to create new address const address = await wallet.createAddress( walletVersion: 3, // Required for ECDSA assets, such as ETH and MATIC ); console.log(JSON.stringify(address, undefined, 2));
Note: Some networks, such as Ethereum, don't immediately return a new multisignature address, since creating a new address requires a blockchain transaction. The blockchain must confirm this transaction before you can use the address. The parameter
pendingChainInitialization
identifies if an address is awaiting confirmation.You can save the wallet ID in the response, then wait for the blockchain to confirm the address before using it.
Step Result
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
{ "id": "631283e10e052800066295e210da142a", "address": "2N9wCEV3KGEFsyo9xoUGjVYaSVwjSueutjz", "chain": 10, "index": 2, "coin": "tbtc4", "wallet": "6312824bf3281c0006fedaad1d667e67", "coinSpecific": { "redeemScript": "00200fdaf19ad268ab964d2e3fd352b69365d29d7a61cca4224eb5ef2b05fdcab106", "witnessScript": "522103938ad2f9cb72f6d2001927afaa1f0fc66ed377ac0d19712565447d4c6b17c1db2102ccbaceae6b7bc2d34eec97787f8159dd2152a62103470f87c6736b0650b60aff2102c5b2bc81c2678d225f1defbe0e7acb48aca06fe15ea8beb107e4b729d788cf3e53ae" }, "addressType": "p2shP2wsh", "keychains": [ { "id": "6312824b86f4aa0007dd283d1253ac33", "pub": "xpub661MyMwAqRbcEeuE59B7icbdeDQYFbCTxLRCjSkVYZmgKUZzwjwdXW1V8X33gRmR3LjQsFK9EbzgZ9NezZW2Wj55mScfPHwPitaGdiKJAe8", "ethAddress": "0x94bbb7c3582ae9fbb829daa9fd81e112184df260", "source": "user", "type": "independent", "encryptedPrv": "{\"iv\":\"T+GU0GhX4XHRRg2ohnzp1w==\",\"v\":1,\"iter\":10000,\"ks\":256,\"ts\":64,\"mode\":\"ccm\",\"adata\":\"\",\"cipher\":\"aes\",\"salt\":\"Yn45uWDyOuM=\",\"ct\":\"dbc8wRJU0art3tW6R/wCs2X3F8Fx4cS+sYw1/rPewTqgwuBoUUn+TO2otaxiWaw1lRKjF3mP+2IHTUif6W2n9ByCiva+xWO8l45nxWMG8RHABA5h0mmNZCZzNAD+0Eyd7MuU/9u0tqI81HBJcppgGu0FegdXbKc=\"}" }, { "id": "6312824bb6b93a00078c5624bc86a9b6", "pub": "xpub661MyMwAqRbcFbRoBvNZ7hmNLD1E67drVGYjVQGBPBeZFRowbPnDNPdKK9c7oq19ekqrAQrJJjPVzepH1dDCJWdLu6Vjgt6BWuToUnkfxDw", "ethAddress": "0xbecce05e0b880092bd0d2c85b368ec563751b266", "source": "backup", "type": "independent" }, { "id": "6312824b86f4aa0007dd284157374ba2", "pub": "xpub661MyMwAqRbcGcpsPgX4ZuS4PP7FHW7JzuDLeydN3iF66vka87L6SNaLMc3k4EUUnbFHswyEBX6SXsoQVH6MUvNjFAGGKB5xekSAe2yP5ne", "ethAddress": "0xc3a3c72b10d5b448533ff18b3254ca6bbf0d1ba3", "source": "bitgo", "type": "independent", "isBitGo": true } ] }