I am engaged on a “mild consumer” for ION (Identification Overlay Community), and I would prefer to see if there’s a higher technique to seize the OP_RETURN information that it wants to be able to construct state.

At present I’m iterating by means of each block beginning at a selected peak after which iterating by means of every transaction and every transaction output to be able to discover the OP_RETURN signature that I’m in search of.

Is there a greater strategy 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 would 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 have a look at BIP-37 I think this form of factor may be doable utilizing bloom filters.

Filter matching algorithm
The filter may be examined towards arbitrary items of information, to see if that information was inserted by the consumer. Due to this fact the query arises of what items of information ought to 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.

  1. Take a look at the hash of the transaction itself.
  2. 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. Essential: 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.
  3. For every enter, take a look at the serialized COutPoint construction.
  4. For every enter, take a look at every information component of the enter script (observe: enter scripts solely ever comprise information components).
  5. In any other case there is no such thing as a match.

On this manner addresses, keys and script hashes (for P2SH outputs) can all be added to the filter. It’s also possible to match towards lessons of transactions which might be marked with well-known information components in both inputs or outputs, for instance, to implement varied types of Good property.

(my emphasis)

See additionally https://en.bitcoin.it/wiki/Protocol_documentation#filterload.2C_filteradd.2C_filterclear.2C_merkleblock