How can you listen for a transaction on a specific address? I'm working on building a lightning network watchtower and the first thing I need to do is detect when someone closes a channel.


Lightning implementations already have implemented the functionality to watch the blockchain to see if the funding TX was spend (and the channel closed) Often this is outsourced to the Bitcoin fullnode. I suggest to look at their code base for this functionality and modify the relevant code snippet to include a watchtower solution you want to create.

| improve this answer | |
  • Thanks Rene! It's for a class project. I am a CS student just trying to get started with lightning development. Where would you suggest to start if I want to create an alert when someone closes a channel? – Joel Davidson Apr 11 '19 at 21:50
  • Well if you have a Bitcoin node there should be an event you it can listen to on its api if a new block is found. You can parse the block to see if it contains a transaction that spends the funding transaction of the channel. (may I ask : which class at wich university?) there are libs in almost any programming language which help you to parse the blockdata so that it should be easy to go through then and check for a spend of your funding tx – Rene Pickhardt Apr 12 '19 at 3:27
  • I go to University of Colorado, Boulder. This semester is our university's first crypto class. It didn't really cover lightning network but I am really excited about it and am doing my project on it. Looking forward to your book on lightning. – Joel Davidson Apr 12 '19 at 18:11

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.