-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.cs
27 lines (23 loc) · 825 Bytes
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
using System;
using System.Linq;
namespace SimpleBlockchain
{
class MainClass
{
public static void Main(string[] args)
{
Random rnd = new Random(DateTime.UtcNow.Millisecond);
IBlock genesis = new Block(new byte[] { 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, 2256).Select(p => (byte)rnd.Next());
chain.Add(new Block(data.ToArray()));
Console.WriteLine(chain.LastOrDefault()?.ToString());
Console.WriteLine($"Chain is Valid: {chain.IsValid()}");
}
Console.ReadLine();
}
}
}