Withdraw from Wallet - Self-Managed TSS Hot (Simple)
Overview
The simple withdrawal flow for self-managed TSS hot wallets enables you to build, sign, and send transactions, all in 1 call, using the BitGo JavaScript SDK. The simple flow suffices for most use cases. If you require more granular control, see the integration guide for the advanced flow.
The simple flow also supports sending to many recipients in 1 transaction, lowering the aggregate amount of blockchain fees when compared to creating multiple transactions. Sending to many aligns with the simple transaction flow, where in 1 call you build, sign, and send a half-signed transaction to BitGo. BitGo then uses the BitGo key to create a fully signed send-to-many transaction.
Just like with the advanced flow, you can configure wallet policies to require approvals on withdrawals. Once the transaction is half signed and approved, you send it to BitGo for final signing and broadcasting to the blockchain.
Prerequisites
- Get Started
- Create Enterprise Challenge (Required for ECDSA assets)
- Create Wallets
- Create Wallet Whitelists
- Deposit assets into your wallet
1. Build, Sign, and Send Transaction
Build and sign the transaction and send it to BitGo, all in 1 call.
Endpoints:
1 2 3 4 5 6
const buildParams = { recipients: [{ amount: '<your amount>', address: '<your address>' }], walletPassphrase: '<your passphrase>', type: 'transfer', isTss: true }; const walletInstance = await bitgo .coin('hteth') .wallets() .get({ id: walletId }); await walletInstance.sendMany(buildParams);
Step Result
BitGo uses the data you pass to build a half-signed transaction. The transaction remains in a pending-approval status until a wallet admin approves it.
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 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
{ "apiVersion": "full", "txRequestId": "7bf743ce-0f68-4d93-a606-43dc8196f146", "walletId": "643707b0cbd48b0007b90f4ab1bb25a9", "walletType": "hot", "version": 12, "enterpriseId": "636ac41473b8d20007bcda7c2bbb2792", "userId": "5cb525d7e1b1328103076788fd6a07f9", "policiesChecked": true, "date": "2023-04-20T18:20:07.506Z", "intent": { "intentType": "payment", "recipients": [ { "address": { "address": "0x2F527A28e252B933591ed3fAAE5101C1c070Dc7a" }, "amount": { "value": "2000", "symbol": "hteth" } } ], "feeOptions": { "baseFee": "26232273214", "gasUsedRatio": "0.45957376666666666", "safeLowMinerTip": "423", "normalMinerTip": "1352405703", "standardMinerTip": "1555266558", "fastestMinerTip": "1500000000", "ludicrousMinerTip": "83126544502", "maxPriorityFeePerGas": "1555266558", "maxFeePerGas": "54019812986" }, "senderAddressIndex": 0 }, "intents": [ { "intentType": "payment", "recipients": [ { "address": { "address": "0x2F527A28e252B933591ed3fAAE5101C1c070Dc7a" }, "amount": { "value": "2000", "symbol": "hteth" } } ], "feeOptions": { "baseFee": "26232273214", "gasUsedRatio": "0.45957376666666666", "safeLowMinerTip": "423", "normalMinerTip": "1352405703", "standardMinerTip": "1555266558", "fastestMinerTip": "1500000000", "ludicrousMinerTip": "83126544502", "maxPriorityFeePerGas": "1555266558", "maxFeePerGas": "54019812986" }, "senderAddressIndex": 0 } ], "state": "delivered", "latest": true, "transactions": [ { "state": "delivered", "signatureShares": [], "unsignedTx": { "parsedTx": { "spendAmounts": [ { "coinName": "hteth", "amountString": "2000" } ], "outputs": [ { "_id": "64418236150e8b000739cbcf", "address": "0x2f527a28e252b933591ed3faae5101c1c070dc7a", "valueString": "2000" } ], "inputs": [ { "_id": "64418236150e8b000739cbce", "value": 2000, "valueString": "2000", "address": "0x2fd10b0ec55ce0624fe9f3e4a8c3ad426dc08712" } ], "minerFee": "0", "spendAmount": "2000" }, "serializedTxHex": "02ee0503845cb37bfe850c93d4ee7a83016378942f527a28e252b933591ed3faae5101c1c070dc7a8207d080c0808080", "signableHex": "02eb0503845cb37bfe850c93d4ee7a83016378942f527a28e252b933591ed3faae5101c1c070dc7a8207d080c0", "derivationPath": "m/0", "feeInfo": { "fee": "2528666119252000", "feeString": "2528666119252000" } }, "txHash": "0xdea675f5fb159de6ebd5bfd7d867a966507807a9de4b2a760c5eaa432e828928", "updatedDate": "2023-04-20T18:20:07.522Z", "createdDate": "2023-04-20T18:19:33.782Z" } ], "messages": [] }
2. Approve Transaction
Note: You can't approve your own transactions - another admin must approve them.
Endpoint: Update Pending Approval
1 2 3 4 5 6 7 8 9 10 11 12
export APPROVAL_ID="<APPROVAL_ID>" export ACCESS_TOKEN="<YOUR_ACCESS_TOKEN>" 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"'" }'
Step Result
Once approved, BitGo rebuilds the half-signed transaction, applying the most up-to-date fees. BitGo then applies the final signature using the BitGo key and broadcasts the transaction to the blockchain.
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 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
{ "id": "655686880765186f0b3e9e88e1bdd0f4", "coin": "tbtc", "wallet": "6553e933288be490293ae748efafeaaf", "enterprise": "62c5ae8174ac860007aff138a2d74df7", "creator": "62ab90e06dfda30007974f0a52a12995", "createDate": "2023-11-16T21:15:52.703Z", "info": { "type": "transactionRequest", "transactionRequest": { "requestedAmount": "10000", "fee": 45242, "sourceWallet": "6553e933288be490293ae748efafeaaf", "policyUniqueId": "6553e933288be490293ae753", "recipients": [ { "address": "2N3sBpM1RnWRMXnEVoUWnM7xtYzL756JE2Q", "amount": "10000", "_id": "655686880765186f0b3e9e8a" } ], "buildParams": { "recipients": [ { "address": "2N3sBpM1RnWRMXnEVoUWnM7xtYzL756JE2Q", "amount": "10000" } ] }, "coinSpecific": { "tbtc": { "txHex": "01000000000101eac5e7d68acfc2349672fb99094e79c2006e5fd663475c8f1eb6f29095970b740100000000ffffffff02102700000000000017a914747e6b7f5db53794b0fc01d95878e0f9b6db96738746c1020000000000220020efb9deaabeab5d62cecc363f24cd6deafcdd14d93d8734f7f01ed3953e732a640500483045022100cd6c221e4cefbb51aa82087d86e7d089b2473eb21ae809dba89eb9f13c4caf19022000f3b7f1b7fec2dc49cbfce35baa69ca37ab9ee8e51c779cde5b98a653f3e142010000695221029bde55661e4f359cf9ca2d1846c235e752f760ed6d65e2018f821253e78b3c722103f2b4a813ab79e4fb46edf3a6a87fb154a85b45810158e949f41a3fce3c9bf574210399a6d766f6d3a3843f8479446ee766b5745dc15c24d1db5149214d27987bd29453ae00000000" } }, "validTransaction": "01000000000101eac5e7d68acfc2349672fb99094e79c2006e5fd663475c8f1eb6f29095970b740100000000ffffffff02102700000000000017a914747e6b7f5db53794b0fc01d95878e0f9b6db96738746c1020000000000220020efb9deaabeab5d62cecc363f24cd6deafcdd14d93d8734f7f01ed3953e732a640400483045022100cd6c221e4cefbb51aa82087d86e7d089b2473eb21ae809dba89eb9f13c4caf19022000f3b7f1b7fec2dc49cbfce35baa69ca37ab9ee8e51c779cde5b98a653f3e14201473044022002b246c43722fec49858caf6b0605a0d01a6b6c13c964b84bf272604fd3951780220324ee44ba3ce8febb154c317e688a5f6ed410ad8e2bd77c5678bf1f7f3eb45f601695221029bde55661e4f359cf9ca2d1846c235e752f760ed6d65e2018f821253e78b3c722103f2b4a813ab79e4fb46edf3a6a87fb154a85b45810158e949f41a3fce3c9bf574210399a6d766f6d3a3843f8479446ee766b5745dc15c24d1db5149214d27987bd29453ae00000000", "validTransactionHash": "ff40ccd5c8ba75ffdce27d8584b6e8ee625cb3f71f7cbb6d072a445a97c2c8c3" } }, "state": "approved", "scope": "wallet", "userIds": [ "62ab90e06dfda30007974f0a52a12995", "627ff9325a5c1b0007c05a40d15e1522" ], "approvalsRequired": 1, "singleRunResults": [ { "ruleId": "Custodial Enterprise Transaction ID Verification", "triggered": false, "_id": "655686880765186f0b3e9e89" } ], "resolvers": [ { "user": "627ff9325a5c1b0007c05a40d15e1522", "date": "2023-11-16T21:33:24.644Z", "resolutionType": "pending" } ] }
Next
You can view your completed withdrawal in BitGo or on a blockchain explorer.