Withdraw On Chain from Lightning Wallet

Move bitcoin from Lightning (L2) to on-chain (L1) and withdraw. See the Guide.

  1. You specify the amount of bitcoin you intend to withdraw on chain by contacting support@bitgo.com. BitGo transfers the bitcoin within your wallet from an L2 address to an L1 address.

  2. You use BitGo Express to build, authenticate, and broadcast an on-chain bitcoin transaction all in one call. If your withdrawal doesn't require approval, BitGo publishes the transaction to the blockchain. If you create policy rules to require approvals, the transaction remains in a pending-approval status until a wallet admin approves it.

    API Reference

  3. If you configure an approval requirement for withdrawals, another admin must approve the transaction. You can't approve your own transactions. Once approved, BitGo submits the transaction to a Lightning Network Daemon (LND) for broadcasting to the Bitcoin blockchain.

    API Reference

// 1. Transfer Bitcoin from L2 to L1
// Contact support@bitgo.com to transfer bitcoin from L2 to L1
// 2. Build, Authenticate, and Send Transaction
export BITGO_EXPRESS_HOST="<YOUR_LOCAL_HOST>"
export COIN="tlnbtc"
export WALLET_ID="<YOUR_WALLET_ID>"
export ACCESS_TOKEN="<YOUR_ACCESS_TOKEN>"
export WALLET_PASSPHRASE="<YOUR_WALLET_PASSPHRASE>"
export DESTINATION_ADDRESS="<DESTINATION_ADDRESS>"
export AMOUNT_SAT="<AMOUNT_IN_SATS>"
export SATSPERVBYTE="<FEE_RATE_IN_SATS_PER_VBYTE>"
export NUM_BLOCKS="<NUMBER_OF_BLOCKS_FOR_CONFIRMATION>"

curl -X POST \
  http://$BITGO_EXPRESS_HOST/api/v2/$COIN/wallet/$WALLET_ID/lightning/withdraw \
  -H 'Content-Type: application/json' \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -d '{
    "passphrase": "'"$WALLET_PASSPHRASE"'",     # Wallet passphrase
    "recipients": [                             # Array of recipients for the withdrawal
      {
        "amount": "'"$AMOUNT_SAT"'",            # Amount to send in satoshis
        "address": "'"$DESTINATION_ADDRESS"'"   # Destination Bitcoin address
      }
    ],
    "satsPerVbyte": "'"$SATSPERVBYTE"'"         # Fee rate in satoshis per virtual byte
    "numBlocks": "'"$NUM_BLOCKS"'"              # Target number of blocks for confirmation, used for fee estimation
    "sequenceId": string,                       # Custom identifier for tracking the payment
    "comment": string                           # Additional note or comment for internal reference
  }'
// 3. (Optional) Approve Transaction
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"'"
  }'
Response
// 2. Build, Authenticate, and Send Transaction Response
{
    "txRequestId": "string",
    "txRequestState": "delivered",
    "withdrawStatus": {
      "status": "delivered",
      "txid": "string",
      "failureReason": "string"
    },
    "transfer": {
      "id": "string",
      "coin": "string",
      "wallet": "string",
      "walletType": "string",
      "enterprise": "string",
      "organization": "string",
      "txid": "string",
      "state": "string",
      "type": "string",
      "value": 0,
      "valueString": "string",
      "coinSpecific": {
        "isOffchain": false,
        "invoice": "string"
      }
    }
}

// 3. (Optional) Approve Transaction Response
{
  "id": "655686880765186f0b3e9e88e1bdd0f4",
  "coin": "tbtc4",
  "wallet": "6553e933288be490293ae748efafeaaf",
  "state": "approved",
  "approvalsRequired": 1
}