Custody Starter Architecture: Set Up Deposit/Withdraw Wallet (Multisig)
Create a multisignature deposit/withdraw wallet for daily operations. See the Guide.
-
Generate a self-custody wallet using BitGo Express or the SDK. You configure this wallet without restrictive policies to enable rapid customer transactions. The deposit/withdraw wallet is a self-custody wallet used for day-to-day customer operations. This wallet holds the smallest amount of funds and has no restrictive policies, allowing spenders to freely process customer deposits and withdrawals.
This response contains critical key material. Save the backup keychain in a secure place. Save the wallet ID and backup keychain from the response. You need the wallet ID to configure whitelist policies with the standby wallet.
// 1. Create Deposit/Withdraw Wallet
export BITGO_EXPRESS_HOST="<YOUR_LOCAL_HOST>"
export COIN="<ASSET_ID>"
export ACCESS_TOKEN="<YOUR_ACCESS_TOKEN>"
export ENTERPRISE_ID="<YOUR_ENTERPRISE_ID>"
export WALLET_PASSPHRASE="<YOUR_WALLET_PASSPHRASE>"
export LABEL="<YOUR_DESIRED_WALLET_NAME>"
curl -X POST \
http://$BITGO_EXPRESS_HOST/api/v2/$COIN/wallet/generate \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-d '{
"enterprise": "'"$ENTERPRISE_ID"'",
"passphrase": "'"$WALLET_PASSPHRASE"'",
"label": "'"$LABEL"'",
"multisigType": "onchain",
"type": "hot"
}'
// 1. Create Deposit/Withdraw Wallet
const { BitGo } = require('bitgo');
const accessToken = '<YOUR_ACCESS_TOKEN>';
const bitgo = new BitGo({
accessToken: accessToken,
env: 'prod',
});
async function createDepositWithdrawWallet() {
const newWallet = await bitgo.coin('<ASSET_ID>').wallets().generateWallet({
label: 'Deposit-Withdraw Wallet - Hot',
passphrase: '<YOUR_WALLET_PASSPHRASE>',
enterprise: '<YOUR_ENTERPRISE_ID>',
multisigType: 'onchain',
type: 'hot'
});
console.log('Deposit/Withdraw Wallet Created:');
console.log('Wallet ID:', newWallet.wallet.id());
console.log('Receive Address:', newWallet.wallet.receiveAddress());
// IMPORTANT: Save the backup keychain securely
console.log('Backup Keychain (SAVE SECURELY):', newWallet.backupKeychain);
}
createDepositWithdrawWallet();
// 1. Create Deposit/Withdraw Wallet Response
{
"wallet": {
"id": "7849948ac0623f81f74f63dbd8351d5g",
"users": [
{
"user": "62ab90e06dfda30007974f0a52a12995",
"permissions": ["admin", "spend", "view"]
}
],
"coin": "btc",
"label": "Deposit-Withdraw Wallet - Hot",
"m": 2,
"n": 3,
"keys": [
"78499487e6c77351bd3bbf04281fa8cc",
"78499487cd07fc57de18f6481baa1904",
"7849948902be620840a384c148d19980"
],
"enterprise": "62c5ae8174ac860007aff138a2d74df7",
"approvalsRequired": 1,
"isCold": false,
"type": "hot",
"multisigType": "onchain",
"receiveAddress": {
"address": "bc1p..."
}
},
"userKeychain": {
"id": "78499487e6c77351bd3bbf04281fa8cc",
"pub": "xpub661MyMwAqRbcEst4tb4F36AfvoFtAy7U9viB7zapRqNnXhPknsPwNqhxpD1CqMGSGhq3hDMKQR1Br8gGxYygoR6SGic3XdJoTEzM5v9wyFy",
"source": "user",
"encryptedPrv": "{...}"
},
"backupKeychain": {
"id": "78499487cd07fc57de18f6481baa1904",
"pub": "xpub661MyMwAqRbcEfnfBkVRk9BB1SrYaFR884ndYpmNXnci6U2wrAQCsFiD21c49Aq7EvtK6QFzDzMwmFKVqi1bTL7kmuCEJ78bFn9Rq6NyLDV",
"source": "backup",
"encryptedPrv": "{...}"
},
"bitgoKeychain": {
"id": "7849948902be620840a384c148d19980",
"pub": "xpub661MyMwAqRbcGCXsEAmctkLstGa92f5ugiD3hvCL3Wyt8BqHYGCVsL2x6PgNgJeq8Aabtz92sMzq4Ezac459QkDmxowKqoL35gNJXEJDdeo",
"source": "bitgo",
"isBitGo": true
}
}