Class ProofOfWork

  • public class ProofOfWork
    extends Object
    This class models the proof of work for a given public key. Hence, identity creation becomes an expensive operation and sybil attacks should be made more difficult.
    • Method Detail

      • hashCode

        public int hashCode()
        hashCode in class Object
      • getNonce

        public int getNonce()
      • intValue

        public int intValue()
        Returns the value of this ProofOfWork as an int.
      • isValid

        public boolean isValid​(CompressedPublicKey publicKey,
                               byte difficulty)
        Checks if the current proof of work is valid for given public key and difficulty.
        publicKey - the public key
        difficulty - the difficulty
        if valid true, otherwise false
        IllegalArgumentException - if the difficulty is not in between [0,64]
      • incNonce

        public void incNonce()