Skip to main content

Install the SDK

If you haven’t already, install the SDK and set up your environment
A Spilman Channel allows one party (Alice) to incrementally pay another (Bob) offchain using monotonically increasing state updates.

Build the Tapscript

Collaborative update path (offchain, instant)

Alice and Bob agree on state, server co-signs:

Refund path (after timeout)

Alice can reclaim funds after the absolute timeout if Bob is unresponsive:

Unilateral update path (onchain, timelocked)

Close channel without server after exit delay:

Unilateral refund path (emergency fallback)

Alice can reclaim unilaterally after a longer delay:

Assemble the VtxoScript

Channel state updates

Alice sends incrementally larger amounts to Bob by signing new transactions:
Bob only keeps the latest state. Each new transaction pays Bob more than the previous one, so older states are worthless to him.

Closing the channel

Bob closes by submitting the latest signed state to the server:

Script breakdown

Timelock ordering

The timelocks must be ordered: unilateralUpdateDelay < unilateralRefundDelay This ensures Bob can always close with the latest valid state before Alice’s refund becomes valid.

Next steps

Hashlock contract

Add hash conditions for atomic swaps

Deep dive

Learn about VTXOs and timelocks