Partial indexing on pruned node?

When you run a full node, you can index the data by address or transaction for fast queries. Such indexed nodes are used by applications like wallets, which need to be able to retrieve arbitrary tx data quickly.

Some nodes have indexing built in (BCHD, Bitcoin Verde), while others expect a separate indexer service to run alongside the node (BCHn, Flowee). To my knowledge, all of them expect to index the entire blockchain and do not work at all with pruned nodes.

This is a problem because the indexes consume a lot of risk space, even more than the blockchain itself (~400GB last time I checked and probably more by now). That means the cost of a cloud server that can host the index is a little high.

What I'm wondering is, would it be possible to run a pruned node and maintain only a partial index? For example, just index the data for the current UTXO set and the last N blocks (say 1 week or 1 month of blocks). Then just discard index data for spent transactions further in the past.

This would give you all the data you need for a wallet backend that allows you to view, send and receive your available funds. You just wouldn't be able to retrieve older transaction history for already-spent funds. It would also give you a buffer of N blocks of historic transactions which you could query if you needed to (e.g. to check whether a disputed payment was sent by a customer).

This seems like it would make it much cheaper and more accessible to run a node that can be an application backend, even when blocks get up to 256MB or larger.

My question: is there any technical reason that this cannot be done?

submitted by /u/fatalglory
[link] [comments]

source https://www.reddit.com/r/btc/comments/r8xnhs/partial_indexing_on_pruned_node/

Comments