Fiber LogoFiber Docs
Channel lifecycle20 minute tutorial

Close a Fiber Channel and Recover Funds

Restore an existing one-way channel, request a cooperative shutdown, and follow its balance back to the browser funding address.

ShutdownRecoveryOn-chain
1 Restore before creating

Look for an existing channel after refresh

The browser starts with the same persisted identity as the one-way tutorials. It first lists active channels and reuses any compatible opening or ready channel.

lib/channels.ts · lines 1–11
2 Request shutdown

Prefer a cooperative close

shutdownChannel() asks both peers to agree on final balances and publish the closing transaction. This tutorial intentionally leaves force close out of the primary flow.

lib/close.ts · lines 1–6
3 Follow every state

Keep closed channels in the query

Normal active-channel lists eventually drop the channel. Poll with include_closed: true so the UI can show SHUTTING_DOWN → CLOSED and the shutdown transaction hash.

lib/close.ts · lines 8–16
4 Reconcile funds

Observe the on-chain balance before and after

Closing returns the final local allocation to the configured shutdown script, minus on-chain fees. Indexing may lag behind the channel state, so the page continues polling.

lib/recovery.ts · lines 1–12
5 Make completion explicit

Show state, transaction, and recovered balance

The final panel preserves the closed channel record and compares funding-address snapshots instead of making the channel disappear.

app/close/page.tsx · lines 4–20