Is there any way to implement HTLC manually for locking funds in the channels in lightning network and releasing the funds after the time lock expired.
Asked
Active
Viewed 216 times
1 Answers
0
It is probably better to ask that question on https://bitcoin.stackexchange.com however if you look at the lightning network specification (aka BOLT) at BOLT 03 transactions you will for example find this script for a commitment transaction
# To remote node with revocation key
OP_DUP OP_HASH160 <RIPEMD160(SHA256(revocationpubkey))> OP_EQUAL
OP_IF
OP_CHECKSIG
OP_ELSE
<remote_htlcpubkey> OP_SWAP OP_SIZE 32 OP_EQUAL
OP_NOTIF
# To local node via HTLC-timeout transaction (timelocked).
OP_DROP 2 OP_SWAP <local_htlcpubkey> 2 OP_CHECKMULTISIG
OP_ELSE
# To remote node with preimage.
OP_HASH160 <RIPEMD160(payment_hash)> OP_EQUALVERIFY
OP_CHECKSIG
OP_ENDIF
OP_ENDIF
Also note that there is a standalone BIP 199 which is still a draft but specifies how to work with htlcs.

Rene Pickhardt
- 692
- 5
- 17
-
Any idea on how to use these scripts? – prajna May 31 '19 at 11:03
-
Yeah you put them in a Bitcoin transaction where they are executed when the blocks are validated. – Rene Pickhardt May 31 '19 at 17:12