Bulk Withdrawal ERC20 Tokens - MPC

Send multiple ERC20 token transfers in a single transaction using an MPC wallet. See the Guide.

  1. Build a bulk withdrawal transaction by providing multiple recipients in your transaction request, each specifying the recipient address, amount, and token name. For MPC wallets, use sendMany with type: 'transfer' and include feeOptions for gas configuration. The SDK consolidates the recipients array into a single transaction that interacts with the batcher contract.

    All transfers in a batch must use the same token type. Maximum batch size varies by network (typically around 100 recipients per transaction).

    Prerequisites: Complete Get Started, Create Wallets, Deposit Assets, and Enable Bulk Withdrawals of ERC20 Tokens. You must have sufficient balance of the native coin to cover gas fees.

    API Reference

  2. Sign and send the transaction using the MPC signing flow. Pass either your unencrypted prv key or your walletPassphrase with the encryptedPrv in the keychain. BitGo Express handles the signature-share exchange with BitGo and broadcasts the transaction to the blockchain.

    For more details on the full MPC signing flow, see Withdraw from Wallet - Self-Custody MPC (Manual).

    API Reference

// 1. Build a Bulk Withdrawal Transaction
// Use the JavaScript SDK for this step (see JavaScript tab)
// 2. Sign and Send Transaction
export BITGO_EXPRESS_HOST="<YOUR_LOCAL_HOST>"
export COIN="<ASSET_ID>"
export WALLET_ID="<YOUR_WALLET_ID>"
export ACCESS_TOKEN="<YOUR_ACCESS_TOKEN>"
export TX_REQUEST_ID="<TX_REQUEST_ID>"

curl -X POST \
  http://$BITGO_EXPRESS_HOST/api/v2/$COIN/wallet/$WALLET_ID/signtxtss \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -d '{
    "txRequestId": "'"$TX_REQUEST_ID"'",
    "prv": "string, # Either pass just your `prv` or pass your `walletPassphrase`, `keychain`, and `encryptedPrv`
    "walletPassphrase": "string",
    "keychain": {
      "encryptedPrv": "string"
    }
  }'
Response
// 2. Sign and Send Transaction Response
{
  "transfer": {
    "coin": "opeth:usdc",
    "id": "63727a81cdbc820007b27caa7b76016d",
    "wallet": "63726fde0a3c94000758f2790536041d",
    "txid": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
    "height": 0,
    "date": "2023-11-14T17:27:29.128Z",
    "type": "send",
    "value": "-600000000",
    "valueString": "-600000000",
    "baseValueString": "-600000000",
    "baseValueWithoutFeesString": "-600000000",
    "feeString": "0",
    "payGoFee": 0,
    "payGoFeeString": "0",
    "state": "signed",
    "instant": false
  },
  "txid": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
  "status": "signed"
}