-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
22 lines (19 loc) · 725 Bytes
/
Copy pathProgram.cs
File metadata and controls
22 lines (19 loc) · 725 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// See https://aka.ms/new-console-template for more information
//reference block.cs in a using statement
using tBlockChain;
Console.WriteLine("Hello, World!");
var ran = new Random();
IBlock genesis = new Block(new byte[] {0x00,0x00,0x00,0x00,0x00});
byte[] difficulty = new byte[] {0x00,0x00};
BlockChain chain = new BlockChain(difficulty, genesis);
for (int i=0; i<200;i++)
{
var data = Enumerable.Range(0,255).Select(p=>(byte)ran.Next());
chain.Add(new Block(data.ToArray()));
Console.WriteLine(chain.LastOrDefault()?.ToString());
if(chain.IsValid())
Console.WriteLine("BlockChain is valid");
else
Console.WriteLine("Chain is invalid");
}
Console.ReadLine();