static void RunWithTransactionPool() { var txn5 = SetupTransactions(); IKeyStore keyStore = new KeyStore(HashFun.Generate256BitKey()); IMBlock block1 = new MBlock(0, keyStore); IMBlock block2 = new MBlock(1, keyStore); IMBlock block3 = new MBlock(2, keyStore); IMBlock block4 = new MBlock(3, keyStore); AddTransactionsToBlocksAndCalculateHashes(block1, block2, block3, block4); MBlockChain chain = new MBlockChain(); chain.AcceptBlock(block1); chain.AcceptBlock(block2); chain.AcceptBlock(block3); chain.AcceptBlock(block4); chain.VerifyChain(); Console.WriteLine(""); Console.WriteLine(""); txn5.ClaimNumber = "weqwewe"; chain.VerifyChain(); Console.WriteLine(); }
private static void RunMultuipleTransactionsBlockExample() { IMBlock block1 = new MBlock(0); IMBlock block2 = new MBlock(1); IMBlock block3 = new MBlock(2); IMBlock block4 = new MBlock(3); block1.AddTransaction(txn1); block1.AddTransaction(txn2); block1.AddTransaction(txn3); block1.AddTransaction(txn4); block2.AddTransaction(txn5); block2.AddTransaction(txn6); block2.AddTransaction(txn7); block2.AddTransaction(txn8); block3.AddTransaction(txn9); block3.AddTransaction(txn10); block3.AddTransaction(txn11); block3.AddTransaction(txn12); block4.AddTransaction(txn13); block4.AddTransaction(txn14); block4.AddTransaction(txn15); block4.AddTransaction(txn16); block1.SetBlockHash(null); block2.SetBlockHash(block1); block3.SetBlockHash(block2); block4.SetBlockHash(block4); MBlockChain chain = new MBlockChain(); chain.AcceptBlock(block1); chain.AcceptBlock(block2); chain.AcceptBlock(block3); chain.AcceptBlock(block4); chain.VerifyChain(); Console.WriteLine(""); Console.WriteLine(""); txn4.ClaimNumber = "El ciupos"; chain.VerifyChain(); }