Withdraw from Advanced Wallet
Build, sign, and send a withdrawal from an advanced wallet. See the Guide.
-
You build and sign a transaction and send it to BitGo all in one call through the AWM sendMany endpoint. Pass
pubkeyfor multisignature wallets orcommonKeychainfor MPC wallets. If your withdrawal doesn't require approval, BitGo applies the final signature and broadcasts the transaction. If policy rules require approvals, the transaction remains in a pending-approval status. -
If you configure an approval requirement for withdrawals, another admin must approve the transaction. You can't approve your own transactions.
-
You only need this step if your MPC transaction required an approval. Once approved, you sign and send the transaction to BitGo using the
commonKeychainvalue from wallet creation. BitGo then applies the final signature and broadcasts to the blockchain.
// 1. Build, Sign, and Send Transaction
export IP_OR_HOSTNAME="<YOUR_SERVER_IP_OR_HOSTNAME>"
export COIN="<ASSET_ID>"
export WALLET_ID="<YOUR_WALLET_ID>"
export ACCESS_TOKEN="<YOUR_ACCESS_TOKEN>"
export PUBKEY="<USER_PUBLIC_KEY>"
export ADDRESS="<DESTINATION_ADDRESS>"
export AMOUNT="<AMOUNT_IN_BASE_UNITS>"
curl -X POST \
http://$IP_OR_HOSTNAME/api/v1/$COIN/advancedwallet/$WALLET_ID/sendMany \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-d '{
"source": "user",
"pubkey": "'"$PUBKEY"'",
"recipients": [
{
"address": "'"$ADDRESS"'",
"amount": "'"$AMOUNT"'"
}
],
"type": "transfer"
}'
// 2. (Optional) Approve Transaction
export APPROVAL_ID="<APPROVAL_ID>"
export OTP="<YOUR_OTP>"
curl -X PUT \
https://app.bitgo-test.com/api/v2/pendingApprovals/$APPROVAL_ID \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-d '{
"state": "approved",
"otp": "'"$OTP"'"
}'
// 3. (Optional) Sign and Send Transaction
export TX_REQUEST_ID="<TX_REQUEST_ID>"
export COMMON_KEYCHAIN="<YOUR_COMMON_KEYCHAIN>"
curl -X POST \
http://$IP_OR_HOSTNAME/api/v1/$COIN/advancedwallet/$WALLET_ID/txrequest/$TX_REQUEST_ID/signAndSend \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-d '{
"source": "user",
"commonKeychain": "'"$COMMON_KEYCHAIN"'"
// 1. Build, Sign, and Send Transaction
// Use the REST API via cURL for advanced wallet sendMany (see cURL tab)
// 2. (Optional) Approve Transaction
const baseCoin = this.bitgoSDK.coin(initialPendingApproval.coin);
const pendingApproval = await baseCoin.pendingApprovals().get({ id: initialPendingApproval.id });
const result = await pendingApproval.approve(params);
// 3. (Optional) Sign and Send Transaction
// Use the REST API via cURL for advanced wallet signAndSend (see cURL tab)
// 1. Build, Sign, and Send Transaction Response
{
"transfer": {
"id": "6553ee12d5a49ecc9baccdcbe0563448",
"coin": "tbtc4",
"wallet": "6553e933288be490293ae748efafeaaf",
"walletType": "hot",
"txid": "e7648c85edac7f9870e511b4ef95b62b1878556791bd52ac715cb2cd4b466e6f",
"type": "send",
"value": -68581,
"valueString": "-68581",
"baseValue": -10000,
"baseValueString": "-10000",
"feeString": "58581",
"state": "signed"
},
"txid": "e7648c85edac7f9870e511b4ef95b62b1878556791bd52ac715cb2cd4b466e6f",
"status": "signed"
}
// 2. (Optional) Approve Transaction Response
{
"id": "655686880765186f0b3e9e88e1bdd0f4",
"coin": "tbtc4",
"wallet": "6553e933288be490293ae748efafeaaf",
"state": "approved",
"approvalsRequired": 1
}
// 3. (Optional) Sign and Send Transaction Response
{
"txid": "8747673834d6c71560a2816963585718567419020dc58151d2f7e1ed8c57de14",
"status": "signed"
}