diff --git a/.gitignore b/.gitignore
index 10c0290..edd02cf 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,4 @@
/.vs/*
-/BasicBlockChain/bin/*
-/BasicBlockChain/obj/*
+*/bin/*
+*/obj/*
/packages/
diff --git a/BasicBlockChain.Core/BasicBlockChain.Core.csproj b/BasicBlockChain.Core/BasicBlockChain.Core.csproj
new file mode 100644
index 0000000..139fb72
--- /dev/null
+++ b/BasicBlockChain.Core/BasicBlockChain.Core.csproj
@@ -0,0 +1,56 @@
+
+
+
+
+ Debug
+ AnyCPU
+ {919BC116-C8FC-4B65-B742-226B38437C48}
+ Library
+ Properties
+ BasicBlockChain.Core
+ BasicBlockChain.Core
+ v4.8
+ 512
+ true
+
+
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+
+
+
+
+
+
+
+
+ ..\packages\VAR.Json.1.1.1.36534\lib\net461\VAR.Json.dll
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/BasicBlockChain/Block.cs b/BasicBlockChain.Core/Block.cs
similarity index 92%
rename from BasicBlockChain/Block.cs
rename to BasicBlockChain.Core/Block.cs
index 643403f..3ef9b2b 100644
--- a/BasicBlockChain/Block.cs
+++ b/BasicBlockChain.Core/Block.cs
@@ -2,8 +2,9 @@
using System.Collections.Generic;
using System.Security.Cryptography;
using System.Text;
+using VAR.Json;
-namespace BasicBlockChain
+namespace BasicBlockChain.Core
{
public class Block
{
@@ -26,8 +27,7 @@ namespace BasicBlockChain
private string GetData()
{
- VAR.Json.JsonWriter jsonWriter = new VAR.Json.JsonWriter(1);
- return jsonWriter.Write(Transactions);
+ return JsonWriter.WriteObject(Transactions);
}
public string CalculateHash(string data = null, SHA256 sha256 = null)
diff --git a/BasicBlockChain/BlockChain.cs b/BasicBlockChain.Core/BlockChain.cs
similarity index 98%
rename from BasicBlockChain/BlockChain.cs
rename to BasicBlockChain.Core/BlockChain.cs
index 7d3b2c2..e7dee0a 100644
--- a/BasicBlockChain/BlockChain.cs
+++ b/BasicBlockChain.Core/BlockChain.cs
@@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.Linq;
-namespace BasicBlockChain
+namespace BasicBlockChain.Core
{
public class BlockChain
{
diff --git a/BasicBlockChain.Core/Properties/AssemblyInfo.cs b/BasicBlockChain.Core/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..7245c9d
--- /dev/null
+++ b/BasicBlockChain.Core/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("BasicBlockChain.Core")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("BasicBlockChain.Core")]
+[assembly: AssemblyCopyright("Copyright © 2020")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("919bc116-c8fc-4b65-b742-226b38437c48")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/BasicBlockChain/Transaction.cs b/BasicBlockChain.Core/Transaction.cs
similarity index 94%
rename from BasicBlockChain/Transaction.cs
rename to BasicBlockChain.Core/Transaction.cs
index e467d2b..e0f4ef6 100644
--- a/BasicBlockChain/Transaction.cs
+++ b/BasicBlockChain.Core/Transaction.cs
@@ -1,6 +1,6 @@
using System;
-namespace BasicBlockChain
+namespace BasicBlockChain.Core
{
public class Transaction
{
diff --git a/BasicBlockChain.Core/packages.config b/BasicBlockChain.Core/packages.config
new file mode 100644
index 0000000..35bfb31
--- /dev/null
+++ b/BasicBlockChain.Core/packages.config
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/BasicBlockChain.sln b/BasicBlockChain.sln
index 19b8c80..87164b6 100644
--- a/BasicBlockChain.sln
+++ b/BasicBlockChain.sln
@@ -5,6 +5,8 @@ VisualStudioVersion = 16.0.28803.452
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BasicBlockChain", "BasicBlockChain\BasicBlockChain.csproj", "{34581A96-29BE-4AB6-9298-BC1AD3E78369}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BasicBlockChain.Core", "BasicBlockChain.Core\BasicBlockChain.Core.csproj", "{919BC116-C8FC-4B65-B742-226B38437C48}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -15,6 +17,10 @@ Global
{34581A96-29BE-4AB6-9298-BC1AD3E78369}.Debug|Any CPU.Build.0 = Debug|Any CPU
{34581A96-29BE-4AB6-9298-BC1AD3E78369}.Release|Any CPU.ActiveCfg = Release|Any CPU
{34581A96-29BE-4AB6-9298-BC1AD3E78369}.Release|Any CPU.Build.0 = Release|Any CPU
+ {919BC116-C8FC-4B65-B742-226B38437C48}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {919BC116-C8FC-4B65-B742-226B38437C48}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {919BC116-C8FC-4B65-B742-226B38437C48}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {919BC116-C8FC-4B65-B742-226B38437C48}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/BasicBlockChain/BasicBlockChain.csproj b/BasicBlockChain/BasicBlockChain.csproj
index a9a3aab..44a4f11 100644
--- a/BasicBlockChain/BasicBlockChain.csproj
+++ b/BasicBlockChain/BasicBlockChain.csproj
@@ -42,20 +42,22 @@
-
- ..\packages\VAR.Json.1.0.6252.27492\lib\net461\VAR.Json.dll
+
+ ..\packages\VAR.Json.1.1.1.36534\lib\net461\VAR.Json.dll
-
-
-
-
+
+
+ {919bc116-c8fc-4b65-b742-226b38437c48}
+ BasicBlockChain.Core
+
+
\ No newline at end of file
diff --git a/BasicBlockChain/Program.cs b/BasicBlockChain/Program.cs
index 48e2897..299272c 100644
--- a/BasicBlockChain/Program.cs
+++ b/BasicBlockChain/Program.cs
@@ -1,4 +1,6 @@
using System;
+using BasicBlockChain.Core;
+using VAR.Json;
namespace BasicBlockChain
{
@@ -6,20 +8,18 @@ namespace BasicBlockChain
{
private static void Main(string[] args)
{
- VAR.Json.JsonWriter jsonWriter = new VAR.Json.JsonWriter(1);
-
// Example BlockChain with some example data
Console.WriteLine();
Console.WriteLine("#### Mining BlockChain with sample data");
var startTime = DateTime.UtcNow;
- BlockChain nullCoin = new BlockChain(genesisDate: new DateTime(2000, 1, 1), difficulty: 2);
+ BlockChain nullCoin = new BlockChain(genesisDate: new DateTime(2000, 1, 1), difficulty: 3);
nullCoin.AddTransaction(new Transaction("VAR", "NAM", 10_000_000, new DateTime(2000, 1, 2)));
nullCoin.ProcessPendingTransactions(new DateTime(2000, 1, 2), "Kable");
nullCoin.AddTransaction(new Transaction("NAM", "VAR", 5_000_000, new DateTime(2000, 1, 3)));
nullCoin.ProcessPendingTransactions(new DateTime(2000, 1, 3), "Kable");
nullCoin.AddTransaction(new Transaction("NAM", "VAR", 5_000_000, new DateTime(2000, 1, 4)));
nullCoin.ProcessPendingTransactions(new DateTime(2000, 1, 4), "Kable");
- Console.WriteLine(jsonWriter.Write(nullCoin));
+ Console.WriteLine(JsonWriter.WriteObject(nullCoin, indent: true));
var endTime = DateTime.UtcNow;
Console.WriteLine($"Duration: {endTime - startTime}");
@@ -35,7 +35,7 @@ namespace BasicBlockChain
Console.WriteLine();
Console.WriteLine("#### Tampering with the data");
nullCoin.Chain[1].Transactions[0].MicroCoinAmount = 1000_000_000;
- Console.WriteLine(jsonWriter.Write(nullCoin));
+ Console.WriteLine(JsonWriter.WriteObject(nullCoin, indent: true));
// Verify
Console.WriteLine("BlockChain is Valid? {0}", nullCoin.Verify() ? "True" : "False");
diff --git a/BasicBlockChain/packages.config b/BasicBlockChain/packages.config
index ca3a1df..35bfb31 100644
--- a/BasicBlockChain/packages.config
+++ b/BasicBlockChain/packages.config
@@ -1,4 +1,4 @@
-
+
\ No newline at end of file