Second Proposal for Reward Bounties

by Brown, Tuesday, October 27, 2020, 12:58 (404 days ago) @ Brown

Here is ocaml code that could support this proposal:

http://grid01.ciirc.cvut.cz/~chad/candarray.ml

To explain, each bounty is placed on a "term address". A "term address" is determined by 20 bytes. (There are also 2 bits of an address to determine if the address is "p2pkh", "p2sh", "publication" or "term", but we can ignore these 2 bits since we know we are in the space of term addresses.) To be precise the "20 bytes" is a quintuple of int32's.

Each of the 41419 problems corresponds to a unique 20 bytes giving the term address.

In the candarray.ml code there is a big array called "candarray" over (int32 * int32 * int32 * int32 * int32) of length 41419 where the values give the 41419 term addresses. I checked that no entry has a duplicate of the first int32, so I sorted them by this first int32.

There is a function "candp" that takes 20 bytes and returns true if it is one of these 41419 "candidates" and false otherwise. Since the array is sorted on the first int32, a quick binary search can check for membership in the set. This "candp" function can be used to disallow non-coinstake txs that try to spend bounties to the candidates (at least until reward bounties are retired).

It's a rather large data file as code, but on my (fairly old) 32-bit desktop it didn't cause any problems with memory or time.


Complete thread:

 RSS Feed of thread

powered by my little forum