hydra

Withdraw funds from an open head back to L1. (admin access required)

Changed on

Incremental decommit out of an already-Open head, without closing it. Withdraws the local participant's in-head funds to their own L1 address. A decommit removes every output of its transaction from the head, so an exact lovelace amount is first split off inside the head — free, and about a second — while omitting it withdraws whole UTxOs. One whole UTxO is held back as collateral so the wallet can still spend escrows inside the head — the smallest it holds worth at least 5 ADA, so the amount withheld is often more than that; drain takes it too, for winding a head down. Returns as soon as the request is accepted: the head must then sign a snapshot removing the funds before its node posts the L1 payout.

post/hydra/head/withdraw

Request

  • Base URL: ./../api/v1/ (relative, and the document was published on a file host, not at the API’s origin)
  • URL: ./../api/v1/hydra/head/withdraw
  • Auth: API key in header token

Request body

headIdstring required

The Hydra head to withdraw from

lovelacestring

Exact lovelace to withdraw. Omit to withdraw every eligible in-head UTxO whole. An exact amount is split off inside the head first, which costs nothing and takes about a second.

assetUnitstring

Withdraw a native asset instead of ADA: policy id and asset name concatenated. Exactly the amount asked for is split off inside the head first, the same as an ADA withdrawal, so the rest stays where it is.

assetAmountstring

How much of assetUnit to withdraw, in that asset's own smallest unit.

drainboolean

Also withdraw the UTxO held back as collateral. Without collateral this wallet can no longer spend escrows inside the head, so this is for winding a head down.

Example request

{
  "headId": "cuid_v2_auto_generated",
  "lovelace": "10000000",
  "drain": false
}

Response

Withdrawal accepted

status'success' required

Example response

{
  "status": "success",
  "data": {
    "headId": "cuid_v2_auto_generated",
    "accepted": true
  }
}

Changes