Package org.drasyl.identity
Class ProofOfWork
- java.lang.Object
-
- org.drasyl.identity.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.
-
-
Constructor Summary
Constructors Constructor Description ProofOfWork(int nonce)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object o)
static ProofOfWork
generateProofOfWork(CompressedPublicKey publicKey, short difficulty)
int
getNonce()
int
hashCode()
void
incNonce()
boolean
isValid(CompressedPublicKey publicKey, short difficulty)
static ProofOfWork
of(int nonce)
static ProofOfWork
of(CompressedPublicKey publicKey, short difficulty)
String
toString()
-
-
-
Method Detail
-
getNonce
public int getNonce()
-
of
public static ProofOfWork of(int nonce)
-
of
public static ProofOfWork of(CompressedPublicKey publicKey, short difficulty)
-
generateProofOfWork
public static ProofOfWork generateProofOfWork(CompressedPublicKey publicKey, short difficulty)
-
isValid
public boolean isValid(CompressedPublicKey publicKey, short difficulty)
-
incNonce
public void incNonce()
-
-