Install the SDK
If you haven’t already, install the SDK and set up your environment
| Path | Condition | When to use |
|---|---|---|
| Funding (collaborative) | Alice + Bob + server signatures | Open channel instantly |
| Funding (unilateral) | Alice + Bob signatures (after exit delay) | Fallback if server unresponsive |
| To-local (revocation) | Counterparty revocation signature | Punish old state broadcast |
| To-local (normal) | Self signature (after CSV delay) | Claim own balance |
| To-remote | Counterparty signature | Immediate claim |
Build the Tapscript
Funding output
2-of-2 multisig between Alice and Bob, with Ark timeout path:To-local output (commitment transaction)
Funds belonging to the broadcaster, with revocation for punishment:To-remote output (commitment transaction)
Funds belonging to the counterparty, immediately spendable:The dual-path pattern
Every Lightning script gets two Taproot leaves:Script breakdown
| Opcode | Effect |
|---|---|
CHECKSIG | Verify signature, return result |
CHECKSIGVERIFY | Verify signature, continue if valid |
CHECKSEQUENCEVERIFY | Enforce relative timelock (CSV) |
DROP | Remove top stack element |