Withdraw - Custody MPC
Request withdrawals with BitGo-managed signing. See the Guide.
-
Request the transaction by specifying the transaction details and sending them to BitGo. BitGo uses the data to build an unsigned transaction. The transaction remains in a pending-approval status until a wallet admin approves it.
For custody MPC wallets, you must specify
videoApprovers— the users who will participate in video verification.Note: You can only transact from custody wallets in the production environment. BitGo doesn't sign transactions from custody wallets in testnet.
-
Approve the transaction. Once approved, BitGo rebuilds the unsigned transaction with current fees. After video verification, BitGo operators sign and broadcast the transaction.
// 1. Request Transaction
export WALLET_ID="<WALLET_ID>"
export ACCESS_TOKEN="<YOUR_ACCESS_TOKEN>"
curl -X POST \
https://app.bitgo-test.com/api/v2/wallet/$WALLET_ID/txrequests \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-d '{
"intent": {
"intentType": "payment",
"recipients": [
{
"address": { "address": "<DESTINATION_ADDRESS>" },
"amount": { "value": "100", "symbol": "gteth" }
}
]
},
"videoApprovers": ["<VIDEO_APPROVER_ID_1>", "<VIDEO_APPROVER_ID_2>"],
"apiVersion": "full"
}'
// 2. Approve Transaction
export COIN="<ASSET_ID>"
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"'"
}'
// 1. Request Transaction
let params = {
recipients: [
{
amount: 0.01 * 1e8,
address: '2NFfxvXpAWjKng7enFougtvtxxCJ2hQEMo4',
},
],
};
wallet.prebuildTransaction(params).then(function (transaction) {
console.dir(transaction);
});
// 2. Approve Transaction
const baseCoin = bitgo.coin(initialPendingApproval.coin);
const pendingApproval = await baseCoin.pendingApprovals().get({ id: initialPendingApproval.id });
const result = await pendingApproval.approve(params);
// 1. Request Transaction Response
{
"transfer": {
"id": "6553ee12d5a49ecc9baccdcbe0563448",
"coin": "tbtc4",
"wallet": "6553e933288be490293ae748efafeaaf",
"type": "send",
"state": "signed"
},
"txid": "e7648c85edac7f9870e511b4ef95b62b1878556791bd52ac715cb2cd4b466e6f",
"status": "signed"
}
// 1. Request Transaction Response (pending approval)
{
"error": "triggered all transactions policy",
"pendingApproval": {
"id": "655686880765186f0b3e9e88e1bdd0f4",
"state": "pending",
"approvalsRequired": 1
}
}
// 2. Approve Transaction Response
{
"id": "655686880765186f0b3e9e88e1bdd0f4",
"state": "approved"
}