Bitcoin Stack Change 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
The perfect solutions are voted up and rise to the highest
Requested
Seen
120 occasions
I am engaged on a “mild consumer” for ION (Id Overlay Community), and I might wish to see if there’s a higher methodology to seize the OP_RETURN information that it wants with the intention to construct state.
Presently I’m iterating via each block beginning at a selected top after which iterating via every transaction and every transaction output with the intention to discover the OP_RETURN signature that I’m in search of.
Is there a greater method to accomplish this by requesting all OP_RETURN information solely? The bandwidth necessities for downloading all the block information is a bottleneck for what I might love to do, however I do not suppose what I am in search of is feasible with solely the Bitcoin Wire protocol.
I’ve no expertise of this however from a superficial take a look at BIP-37 I believe this type of factor may be doable utilizing bloom filters.
Filter matching algorithm
The filter will be examined in opposition to arbitrary items of information, to see if that information was inserted by the consumer. Subsequently the query arises of what items of information must be inserted/examined.To find out if a transaction matches the filter, the next algorithm is used. As soon as a match is discovered the algorithm aborts.
- Check the hash of the transaction itself.
- For every output, take a look at every information component of the output script. This implies every hash and key within the output script is examined independently. Vital: if an output matches while testing a transaction, the node may have to replace the filter by inserting the serialized COutPoint construction. See beneath for extra particulars.
- For every enter, take a look at the serialized COutPoint construction.
- For every enter, take a look at every information component of the enter script (notice: enter scripts solely ever comprise information parts).
- In any other case there isn’t any match.
On this means addresses, keys and script hashes (for P2SH outputs) can all be added to the filter. You can even match in opposition to courses of transactions which are marked with well-known information parts in both inputs or outputs, for instance, to implement numerous types of Sensible property.
(my emphasis)
See additionally https://en.bitcoin.it/wiki/Protocol_documentation#filterload.2C_filteradd.2C_filterclear.2C_merkleblock
Nah.. simply did it. To hurry issues up you possibly can obtain the tx index, saving an RPC name. That will increase the chain measurement by round 60GB.
Traversing all blocks (round 450K as Op_return was launched in March 2014) goes to take 100 days on a 16GB 4-core with SSD.