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.
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–11Prefer 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.
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.
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–12Show 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