Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Add and Mining Block for toutsurlebitcoin.fr
public Block latestBlock() {
return blocks.get(blocks.size() - 1);
}
public Block newBlock(String data) {
Block latestBlock = latestBlock();
return new Block(latestBlock.getIndex() + 1, System.currentTimeMillis(),
latestBlock.getHash(), data);
}
public void addBlock(Block b) {
if (b != null) {
b.mineBlock(difficulty);
blocks.add(b);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment