Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Add and Mining Block for
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) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.