## Psudo Code

In case this approach seems complicated, note that the basic code for adding this algorighm to any relay would be nothing more complex than this:

```

const bucket = getBucket(event.hash)

if (bucket == targetBucket) {

results.push(event);

}

else {

merkleStr[bucket] += "-"+event.hash;

}

then...

merkleHashes: string[] = merkleStr.map(v => sha256(v));

```

The above is a very simplified way of generating the Merkel (hash of hashes), but there are other ways like using a "Digest" and adding each event.hash to the digest for a given bucket and then finalizing the digest at the end.

Reply to this note

Please Login to reply.

Discussion

No replies yet.