-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.vb
More file actions
29 lines (24 loc) · 971 Bytes
/
Copy pathProgram.vb
File metadata and controls
29 lines (24 loc) · 971 Bytes
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
28
29
Imports System
Imports System.Linq
Imports BlockChain.BlockChain
Module Program
Public Sub Main(args As String())
Dim ran As New Random()
Dim genesis As IBlock = New Block(New Byte() {&H0, &H0, &H0, &H0, &H0})
Dim difficulty As Byte() = New Byte() {&H0, &H0}
Dim chain As New BlockChain.BlockChain(difficulty, genesis)
Console.WriteLine("Hello World!")
For i As Integer = 0 To 199
Dim data = Enumerable.Range(0, 255).Select(Function(p) CByte(ran.Next(0, 255)))
chain.Add(New Block(data.ToArray()))
Console.WriteLine(chain.LastOrDefault()?.ToString())
If chain.IsValid() Then
Console.WriteLine("BlockChain is valid")
Else
Console.WriteLine("Chain is invalid")
End If
Next
Console.WriteLine("Press Enter to exit...")
Console.ReadLine()
End Sub
End Module