- Alice opens 4M channel to Bob.
- Bob selects a random password
P
and calculates ripemd160 hash of itH(P)
. - Bob locks 2M sats to the output with the script:
OP_SIZE 32 OP_EQUAL
OP_IF
OP_HASH160 <H(P)> OP_EQUALVERIFY
<Alice pubkey>
OP_ELSE
OP_DROP
<cltv timeout> OP_CHECKLOCKTIMEVERIFY OP_DROP
<Bob pubkey>
OP_ENDIF
OP_CHECKSIG
Proposed cltv timeout is 2000 blocks.
- Bobs generates invoice for 2M sats with preimage
P
and hashH(P)
. - Alice pays the invoice and gets
P
from the proof of payment of HTLC. - Alice spends locked onchain funds.