Releases: thewizardplusplus/go-pow
Releases · thewizardplusplus/go-pow
Release list
v1.0.0
The major version.
Features
- use of patterns:
- implementation based on Domain-Driven Design (DDD) principles;
- usage of the Builder pattern to ensure entity invariants;
- definition of entities with explicitly declared value types for each field;
- definition of challenges with the following fields:
leading zero bit count— the required number of leading zero bits in the resulting hash;target bit index— a bit index used in determining the solution’s difficulty:- it refers to the bit position such that the resulting hash will be less than the number where that bit is set (for example, with a 256-bit hash and a requirement of 6 leading zeros, we would set the 250th bit);
- only one of
leading zero bit countortarget bit indexshould be set explicitly — the other is derived from it;
created at(optional) — the timestamp when the challenge was created;TTL(optional) — the duration after which the challenge expires:created atandTTLmust either be both specified or both omitted;
resource(optional) — the resource associated with the challenge, typically for scoping:- based on the
net/url.URLtype, but any Uniform Resource Identifier (URI) format is allowed;
- based on the
serialized payload— the raw data to be included in the hash:- must be pre-serialized to a string; the library does not handle serialization itself;
hash— the hash function used to verify the solution:- based on the
hash.Hashinterface;
- based on the
hash data layout— the structure of the data used during hashing:- based on the
text/template.Templatetype; - defines which fields of the challenge will be hashed and in what order, giving full control over the hash input structure;
- based on the
- generation of solutions that meet specified challenge criteria:
- starting nonce value:
- it can be zero;
- it can be randomly selected within a given range;
- the generation process can be interrupted via:
- context cancellation;
- an attempt limit;
- starting nonce value:
- validation of solutions against their corresponding challenges;
- sentinel errors provided through a dedicated
errorssubpackage.