7

I am running lightning with the LND implementation and a full node. Nevertheless, I heard that it is possible to use Lighting in pruned mode.

How is this possible?

  1. I read in the LND install documentation that you need the -txindex flag:

In order to run lnd with a bitcoind back-end, the bitcoind instance must be configured with --txindex just like btcd above.

  1. In the Wikipage of Bitcoin it says for pruned mode:

This mode is incompatible with -txindex

I also read here and here the same arguments.

Is this outdated or is it not possible to use prune mode in lightning?

3

You are correct in that you cannot run a LND node with a pruned bitcoind server.

Pruning isn't compatible with transaction indexing because the index would point to transactions which have been pruned (no longer in store).

Each lightning node requires transaction indexing, because it will be looking for specific txid's on-chain throughout the lifetime of the payment channel.

Broadcast and confirmation of:

  • Funding transaction
  • Commitment transactions in a unilateral close
  • Closing transaction

The only way to determine whether any of the transactions above have been confirmed, is to query an up-to-date transaction index of the strong chain, which is not possible with a pruned node.

Lightning nodes also subscribe to the ZeroMQ subscription service of the bitcoind node, but this only tells the node about newly broadcast transactions accepted by in the mempool, not whether they have been confirmed yet.

| improve this answer | |
  • I've not tried it, but what happens when I start a lightning node in pruned mode in practice? – dvg Jan 13 '19 at 18:36
  • The lightning node will not be able to query bitcoind for transactions (by txid). – James C. Jan 13 '19 at 19:38
  • When would I get aware of this? – dvg Jan 13 '19 at 19:54
  • I dont know, the lnd node will through an error, I dont know exactly how the error msg will look like. – James C. Jan 13 '19 at 20:13
  • Ok, thx for response! – dvg Jan 13 '19 at 20:41
4

It is possible to run Lightning (both LND and c-lightning) with bitcoind pruned mode.

There are already packages turning the pruned mode on when disk space is limited: Lightning Power Node Launcher (works with LND) and BTCPayServer docker (works with c-lightnig).

There is a lot of conflicting information online, because it became possible only after Bitcoin Core 0.16.0 was released.

Update from the official lnd documentation:

We don't require --txindex when running with bitcoind but activating the txindex will generally make lnd run faster.

NOTE: WE DO NOT FULLY SUPPORT PRUNED OPERATING MODES FOR FULL NODES. It's possible to run a node in a pruned mode and have it serve lnd, however one must take care to ensure that lnd has all blocks on disk since the birth of the wallet, and the age of the earliest channels (which were created around March 2018).

| improve this answer | |
  • I believe your answer is either incorrect or at least misleading. I tried running bitcoind in pruned mode with txindex enabled, but its startup just fails with message "Error: Prune mode is incompatible with -txindex.". On the other hand it is possible running bitcoind with pruned mode and txindex disabled. This will however make lnd fallback to lookup and download the missing tx info from peers by itself. – thegeko Dec 9 '19 at 23:19
  • I read through BIP159, but all it does is signalling, that the node is running in pruned mode hence will provide only latest blocks. It even recommends hiding prune depth by refusing to provide blocks older than 288 blocks from the tip. If the actual bitcoind implementation obeys this recommendation, it would make bitcoind even less usable for tx info lookup after BIP159 implementation. – thegeko Dec 9 '19 at 23:24
  • You are certainly right: BIP159 reference is confusing, I will edit the answer to remove it. – Dmitry Laptev Mar 2 at 22:06

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.