-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e7da180
commit 91d802f
Showing
2 changed files
with
37 additions
and
6 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,40 @@ | ||
public class App { | ||
public static void main(String[] args) throws Exception { | ||
System.out.println("Hello, World!"); | ||
public static void main(String[] args) { | ||
|
||
for (Integer i = 0; i < 100; i++) { | ||
System.out.println(SHA256Helper.generateHash(i.toString())); | ||
} | ||
BlockChain blockChain = new BlockChain(); | ||
|
||
Miner miner = new Miner(); | ||
|
||
// Genesis Block | ||
Block block0 = new Block(0, "", Constants.GENESIS_PREV_HASH); | ||
miner.mine(block0, blockChain); | ||
|
||
// First Block | ||
Block block1 = new Block(1, "Transaction1", blockChain.getBlockChain().get(blockChain.getSize() - 1).getHash()); | ||
|
||
miner.mine(block1, blockChain); | ||
|
||
// Second Block | ||
Block block2 = new Block(2, "Transaction2", blockChain.getBlockChain().get(blockChain.getSize() - 1).getHash()); | ||
|
||
miner.mine(block2, blockChain); | ||
|
||
// Third Block | ||
Block block3 = new Block(3, "Transaction3", blockChain.getBlockChain().get(blockChain.getSize() - 1).getHash()); | ||
|
||
miner.mine(block3, blockChain); | ||
|
||
// Fourth Block | ||
Block block4 = new Block(4, "Transaction4", blockChain.getBlockChain().get(blockChain.getSize() - 1).getHash()); | ||
|
||
miner.mine(block4, blockChain); | ||
|
||
// Fifth Block | ||
Block block5 = new Block(5, "Transaction5", blockChain.getBlockChain().get(blockChain.getSize() - 1).getHash()); | ||
|
||
miner.mine(block5, blockChain); | ||
|
||
System.out.println("\n" + "Blockchain: \n" + blockChain); | ||
System.out.println("Miner's reward: " + miner.getReward()); | ||
} | ||
} |
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