0

Is there any way to implement HTLC manually for locking funds in the channels in lightning network for a period of time (by setting intervals) and releasing the funds after the time lock expired using bitcoin regtest mode?

1

Yes...

... But it is going to be a lot of work.

First you should look at BIP 199 which defines htlc scripts. However that alone will only tell you how to create a htlc output.

But with the transaction itself it is not done. You need to use the right channel state and keys so you could read BOLT 02, 03 and 05 to learn about the peer protocol and messages you need to exchange with your channel partner (for such you will actually also need BOLT 08 and 01 covering setting up a transport session and the message format), the key derivation and the exact onchain specs for htlc output and witeness scripts. You will find all the BOLTs at https://github.com/lightningnetwork/lightning-rfc?files=1

All of this can be done in regtest. If you want to use a regular lightning implementation you can also run them in regtest mode by changing the corresponding entry in the config file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.