Package org.drasyl.identity
Class ProofOfWork
java.lang.Object
org.drasyl.identity.ProofOfWork
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 Summary
Modifier and TypeMethodDescriptionboolean
static ProofOfWork
generateProofOfWork
(CompressedPublicKey publicKey, short difficulty) static short
getDifficulty
(ProofOfWork proofOfWork, CompressedPublicKey publicKey) int
getNonce()
int
hashCode()
void
incNonce()
int
intValue()
Returns the value of thisProofOfWork
as anint
.boolean
isValid
(CompressedPublicKey publicKey, short difficulty) static ProofOfWork
of
(int nonce) toString()
-
Method Details
-
hashCode
public int hashCode() -
equals
-
toString
-
getNonce
public int getNonce() -
intValue
public int intValue()Returns the value of thisProofOfWork
as anint
. -
of
-
generateProofOfWork
-
isValid
-
getDifficulty
-
incNonce
public void incNonce()
-