Bitcoin full node and query server

Apr 20, 2021

View in context in the libbitcoin Slack #general mirror.

P
Phil18:07
Thank you very much for explaining these details about how the blockchain is stored and is queryable I perfectly understand that: 1 - Any block that is having the most known total work of any block given an amount of time, will hit persistence and do a reorg and then will remain queryable through the interface permanently, that is retrievable by hash using getBlock(); 2 - Any transaction that was confirmed, as in if it was a member of such a block at any point in time also remains in persistence permanently and queryable, that is retrievable using getTransaction(); 3 - You can look up transactions that are members of a block by their block object and index; 4 - You can also traverse any strong and weak chain by simply walking the parents of a block up to the Genesis block; So now I’m not clear and please explain to me the following: With respect to UTXO’s, UTXO’s is defined by the transaction hash and the index within that transaction of the output. I was trying to figure out what do you mean by payment index specifically. Then what I want to know within a particular chain GENESIS...HEAD is a particular UTXO is spent or not. And thinking about this problem, this requires a function where within the chain you can look up the membership of a tx id within the chain. And second, you need to have a tracking function whereby you track if another transaction within the same GENESIS...HEAD chain has spent that output. So is this information, whether there is an input that is spent or output, is that what you mean by payment index? Is there any trace of information within LB for a weak chain about whether at a particular block hash, a particular UTXO, which exists within that chain, was spent within that chain at that block hash? Is there any way that I can pull this out of LB? If I want to make a query relative to the strong chain of when the UTXO was spent, is there information about at what block height that a particular UTXO was spent, if it was, when I query on the strong chain