Created
May 14, 2019 16:00
-
-
Save cyberpirate92/45b914689616e60cab744eb7c3005e43 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void addBlock(Block block) throws NoSuchAlgorithmException { | |
block.previousBlockHash = chain.size() == 0 ? CryptoHelper.sha256("0") : chain.get(chain.size()-1).getHash(); | |
// before adding a block to the blockchain | |
// mine block for the magic nonce value | |
block.mine(difficulty); | |
chain.add(block); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment