Bitcoin Stack Trade is a query and reply website for Bitcoin crypto-currency fanatics. It solely takes a minute to enroll.
Anyone can ask a query
Anyone can reply
One of the best solutions are voted up and rise to the highest
Requested
Seen
9k occasions
I may be over considering this, however I am attempting to determine one of the simplest ways to construct an unspent output pool. Ought to I simply naively parse each block? Each enter will get faraway from the hash set, and each output will get added again in? Appears terribly inefficient. The factor is it does not appear to be there’s anyway to precisely construct this utxo pool with out traversing the block chain no less than as soon as and developing it. Is there a nicely outlined short-cut I ought to concentrate on? Pointers welcome.
I suppose I can iterate by the on-disk blocks first, after which replace as blocks are available.
5
There’s already a pool with the knowledge that you’re prepared to construct: the UTXO set
. You’ll be able to entry it by querying the LevelDB situated in .bitcoin/chainstate
of a full node.
Nonetheless, there is no such thing as a simple method of doing so through the use of RPC instructions, you must extract the knowledge by your self.
I can present a method to take action should you wanted, and an intensive rationalization of what are you going to seek out in every entry of the LevelDB.
4
You’ll be able to instantly get UTXO set from bitcoind utilizing listunspent
RPC name.
1
There isn’t any easy method to get what you need besides that method you attempt to describe.
RPC didn’t assist any command of what you need.
When you want UTXOs, you could disassemble each *.dat
binary file in sequence from the primary and hold every output for checking on spending in future.
2
I’ve already constructed the utxo set parser however I have to know when the leveldb data is up to date. I want one thing like cursor that may let me bear in mind if something has modified on the community.
1