Docs / Guides
Withdraw stake safely
Stake leaves only through an unbonding delay, so every receipt you issued can still be claimed. The delay is the largest claim window the service has ever registered plus one hour.
- Call
request_unbond(service_id, amount)fromActiveorSuspended. Ifstake − amount ≥ min_stakethe service stays Active and onlyamountis pending (partial withdrawal). Otherwise the whole stake becomes pending,full_exitis set and the service moves toUnbonding, which stops new offers. - Wait until
unlock_at = now + max_claim_window + 3600. The pending amount remains fully slashable throughout, and a slash reduces it if stake falls below it. - Call
withdraw(service_id). It paysmin(pending, stake); a full exit pays the whole stake and closes the service. Beforeunlock_atit fails withStillLocked.
Bond Registry
request_unbond(service_id, amount) // Active | Suspended; one pending withdrawal at a time (WithdrawalPending otherwise)
cancel_unbond(service_id) // clears the pending amount; Unbonding -> Active (stake >= min) or Suspended
withdraw(service_id) -> amount // after unlock_at; a Pending service withdraws at once (no receipts can exist)Changed your mind? cancel_unbond(service_id) clears the pending amount and returns an Unbonding service to Active, or to Suspended if stake is below the minimum. Terms cannot be updated while a service is Unbonding.
Two side effects to plan for
- Fees are collected whenever stake moves (
deposit,request_unbond,withdraw,slash). A partial withdrawal that leaves exactlymin_stakecan therefore end below it after the fee, which suspends the service. Stake a little above the minimum. - A
Pendingservice (never funded to its minimum) can callwithdrawimmediately: no offer could have existed, so there is nothing to wait for.
Try the numbers in the unbonding and fee calculator.