Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var MySkyTarget = build.Select(build.Var{ Dev: [proofHashSize]byte{0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, Testing: [proofHashSize]byte{0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, Standard: [proofHashSize]byte{0, 0, 2, 85, 134, 217, 6, 168, 28, 68, 106, 164, 207, 53, 55, 178, 24, 81, 162, 117, 144, 30, 90, 200, 147, 120, 124, 181, 32, 216, 184, 223}, }).([proofHashSize]byte)
MySkyTarget is the target a proof needs to meet to be considered valid. The Standard target was chosen empirically by running the algorithm on a i9 until the time it takes to solve the pow averaged out around 60s.
Functions ¶
This section is empty.
Types ¶
type BlockPoW ¶
type BlockPoW struct { Version mySkyProofVersion `json:"version"` Nonce mySkyProofNonce `json:"nonce"` MySkyID mySkyID `json:"myskyid"` Signature hexBytes `json:"signature"` }
BlockPoW describes a proof used to verify some time has passed since creating a MySkyID. The fields use custom types which implement the json.Marshaler and json.Unmarshaler interfaces. That way it can be read from an http request's body.
Example proof:
{ "version": "MySkyID-PoW-v1", "nonce": 578437695752307201, "myskyid": "c95988a42db14ab3f8742980becfa2018132116d64b085004273de888ea6e44b", "signature": "cf45f2cf6ce78ae90fdd56e0b3845b977f2926107d5afb366f11e4882955f0f4d5065c7536fb1932fc00c7111c3dfd1a786d06e50b91fe828f05d0587ade990f" }
func (*BlockPoW) ProofBytes ¶
ProofBytes returns a byte presentation of the MySkyProof which can be hashed to compare to a target and hashed+signed for a signature.
func (*BlockPoW) SignMessage ¶
SignMessage returns the message to hash and sign for the pow.