Skip to content

Commit f15d644

Browse files
committed
Upload BlockChain.Transactions
1 parent 072c6a2 commit f15d644

File tree

168 files changed

+8014
-66
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

168 files changed

+8014
-66
lines changed

.idea/.idea.BlockChain/.idea/contentModel.xml

+30-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/.idea.BlockChain/.idea/workspace.xml

+80-52
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

BlockChain.Cli/BlockChain.Cli.csproj

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
<ItemGroup>
99
<ProjectReference Include="..\BlockChain.Core\BlockChain.Core.csproj" />
10+
<ProjectReference Include="..\BlockChain.Transactions\BlockChain.Transactions.csproj" />
1011
</ItemGroup>
1112

1213
</Project>

BlockChain.Cli/Program.cs

+16-1
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,28 @@
33
using System.Diagnostics;
44
using System.IO;
55
using System.Linq;
6+
using BlockChain.Transactions.Scripting;
7+
using BlockChain.Transactions.Scripting.Enums;
8+
using BlockChain.Transactions.Scripting.Scripts;
69

710
namespace BlockChain.Cli
811
{
912
class Program
1013
{
1114
static void Main(string[] args)
1215
{
16+
var script = new Script();
17+
script.Push(OPCODE.OP_1);
18+
script.Push(OPCODE.OP_2);
19+
script.Push(OPCODE.OP_3);
20+
script.Push(OPCODE.OP_4);
21+
script.Push(OPCODE.OP_5);
22+
Interpreter.Initialize();
23+
24+
var sw = Stopwatch.StartNew();
25+
for (int i = 0; i < 1000000; i++) script.Run();
26+
Console.WriteLine(sw.ElapsedMilliseconds);
27+
/*
1328
var blockChain = new BlockChain<ExampleBlockData>("blockchain.db");
1429
//for(int i = 0;i<5000000;i++)
1530
// blockChain.Add(new Block<ExampleBlockData>(Convert.FromBase64String("AQAAAAmKCD7tIp5wWCHSYMEE9XHhXHA4AQsH0gMQiiqQkIjwHuOynzH++oBbPhLPtQl1PNwX9KnuriDiafYwR6WMlRz5B3jtcrfXCB4AAP/yBwEAMTIzNDY1NDIzNTE0M2UAAAA=")));
@@ -23,7 +38,7 @@ static void Main(string[] args)
2338
//Console.WriteLine(y.Count);
2439
byte[] file = File.ReadAllBytes("blockchain.db");
2540
26-
Console.WriteLine($"Read {x} blocks in {sw.ElapsedMilliseconds} milliseconds");
41+
Console.WriteLine($"Read {x} blocks in {sw.ElapsedMilliseconds} milliseconds");*/
2742
}
2843
}
2944
}
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
{
2+
"runtimeTarget": {
3+
"name": ".NETCoreApp,Version=v3.1",
4+
"signature": ""
5+
},
6+
"compilationOptions": {},
7+
"targets": {
8+
".NETCoreApp,Version=v3.1": {
9+
"BlockChain.Cli/1.0.0": {
10+
"dependencies": {
11+
"BlockChain.Core": "1.0.0",
12+
"BlockChain.Transactions": "1.0.0"
13+
},
14+
"runtime": {
15+
"BlockChain.Cli.dll": {}
16+
}
17+
},
18+
"BlockChain.Core/1.0.0": {
19+
"runtime": {
20+
"BlockChain.Core.dll": {}
21+
}
22+
},
23+
"BlockChain.Transactions/1.0.0": {
24+
"dependencies": {
25+
"BlockChain.Core": "1.0.0"
26+
},
27+
"runtime": {
28+
"BlockChain.Transactions.dll": {}
29+
}
30+
}
31+
}
32+
},
33+
"libraries": {
34+
"BlockChain.Cli/1.0.0": {
35+
"type": "project",
36+
"serviceable": false,
37+
"sha512": ""
38+
},
39+
"BlockChain.Core/1.0.0": {
40+
"type": "project",
41+
"serviceable": false,
42+
"sha512": ""
43+
},
44+
"BlockChain.Transactions/1.0.0": {
45+
"type": "project",
46+
"serviceable": false,
47+
"sha512": ""
48+
}
49+
}
50+
}
Binary file not shown.
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"runtimeOptions": {
3+
"additionalProbingPaths": [
4+
"/home/job/.dotnet/store/|arch|/|tfm|",
5+
"/home/job/.nuget/packages"
6+
]
7+
}
8+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"runtimeOptions": {
3+
"tfm": "netcoreapp3.1",
4+
"framework": {
5+
"name": "Microsoft.NETCore.App",
6+
"version": "3.1.0"
7+
}
8+
}
9+
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"version": 1,
3-
"dgSpecHash": "M4e7R7yMwgCisJ7UxwhDx3E2ZQVcUpJnuLJicmeGFB6gvkjuaoX8ea0yO8aBG6OFXI9qowwuTbISrkWotoReKA==",
3+
"dgSpecHash": "BPyVTENEF6e5HCDHRoEM7iDw5AnGgQMOsOu07Og3sEDbMIu7etogvnzXen8VdzUHgQjMMbg0nSG4NZIuMQ5gIg==",
44
"success": true
55
}

BlockChain.Cli/obj/BlockChain.Cli.csproj.nuget.dgspec.json

+57
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@
2727
"projectReferences": {
2828
"/home/job/Documents/Projects/BlockChain/BlockChain.Core/BlockChain.Core.csproj": {
2929
"projectPath": "/home/job/Documents/Projects/BlockChain/BlockChain.Core/BlockChain.Core.csproj"
30+
},
31+
"/home/job/Documents/Projects/BlockChain/BlockChain.Transactions/BlockChain.Transactions.csproj": {
32+
"projectPath": "/home/job/Documents/Projects/BlockChain/BlockChain.Transactions/BlockChain.Transactions.csproj"
3033
}
3134
}
3235
}
@@ -113,6 +116,60 @@
113116
"runtimeIdentifierGraphPath": "/usr/share/dotnet/sdk/3.1.100/RuntimeIdentifierGraph.json"
114117
}
115118
}
119+
},
120+
"/home/job/Documents/Projects/BlockChain/BlockChain.Transactions/BlockChain.Transactions.csproj": {
121+
"version": "1.0.0",
122+
"restore": {
123+
"projectUniqueName": "/home/job/Documents/Projects/BlockChain/BlockChain.Transactions/BlockChain.Transactions.csproj",
124+
"projectName": "BlockChain.Transactions",
125+
"projectPath": "/home/job/Documents/Projects/BlockChain/BlockChain.Transactions/BlockChain.Transactions.csproj",
126+
"packagesPath": "/home/job/.nuget/packages/",
127+
"outputPath": "/home/job/Documents/Projects/BlockChain/BlockChain.Transactions/obj/",
128+
"projectStyle": "PackageReference",
129+
"configFilePaths": [
130+
"/home/job/.config/NuGet/NuGet.Config"
131+
],
132+
"originalTargetFrameworks": [
133+
"netcoreapp3.1"
134+
],
135+
"sources": {
136+
"https://api.nuget.org/v3/index.json": {}
137+
},
138+
"frameworks": {
139+
"netcoreapp3.1": {
140+
"projectReferences": {
141+
"/home/job/Documents/Projects/BlockChain/BlockChain.Core/BlockChain.Core.csproj": {
142+
"projectPath": "/home/job/Documents/Projects/BlockChain/BlockChain.Core/BlockChain.Core.csproj"
143+
}
144+
}
145+
}
146+
},
147+
"warningProperties": {
148+
"warnAsError": [
149+
"NU1605"
150+
]
151+
}
152+
},
153+
"frameworks": {
154+
"netcoreapp3.1": {
155+
"imports": [
156+
"net461",
157+
"net462",
158+
"net47",
159+
"net471",
160+
"net472",
161+
"net48"
162+
],
163+
"assetTargetFallback": true,
164+
"warn": true,
165+
"frameworkReferences": {
166+
"Microsoft.NETCore.App": {
167+
"privateAssets": "all"
168+
}
169+
},
170+
"runtimeIdentifierGraphPath": "/usr/share/dotnet/sdk/3.1.100/RuntimeIdentifierGraph.json"
171+
}
172+
}
116173
}
117174
}
118175
}
Binary file not shown.

BlockChain.Cli/obj/Debug/netcoreapp3.1/BlockChain.Cli.csproj.CopyComplete

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/home/job/Documents/Projects/BlockChain/BlockChain.Cli/bin/Debug/netcoreapp3.1/BlockChain.Cli
2+
/home/job/Documents/Projects/BlockChain/BlockChain.Cli/bin/Debug/netcoreapp3.1/BlockChain.Cli.deps.json
3+
/home/job/Documents/Projects/BlockChain/BlockChain.Cli/bin/Debug/netcoreapp3.1/BlockChain.Cli.runtimeconfig.json
4+
/home/job/Documents/Projects/BlockChain/BlockChain.Cli/bin/Debug/netcoreapp3.1/BlockChain.Cli.runtimeconfig.dev.json
5+
/home/job/Documents/Projects/BlockChain/BlockChain.Cli/bin/Debug/netcoreapp3.1/BlockChain.Cli.dll
6+
/home/job/Documents/Projects/BlockChain/BlockChain.Cli/bin/Debug/netcoreapp3.1/BlockChain.Cli.pdb
7+
/home/job/Documents/Projects/BlockChain/BlockChain.Cli/bin/Debug/netcoreapp3.1/BlockChain.Core.dll
8+
/home/job/Documents/Projects/BlockChain/BlockChain.Cli/bin/Debug/netcoreapp3.1/BlockChain.Transactions.dll
9+
/home/job/Documents/Projects/BlockChain/BlockChain.Cli/bin/Debug/netcoreapp3.1/BlockChain.Core.pdb
10+
/home/job/Documents/Projects/BlockChain/BlockChain.Cli/bin/Debug/netcoreapp3.1/BlockChain.Transactions.pdb
11+
/home/job/Documents/Projects/BlockChain/BlockChain.Cli/obj/Debug/netcoreapp3.1/BlockChain.Cli.csprojAssemblyReference.cache
12+
/home/job/Documents/Projects/BlockChain/BlockChain.Cli/obj/Debug/netcoreapp3.1/BlockChain.Cli.AssemblyInfoInputs.cache
13+
/home/job/Documents/Projects/BlockChain/BlockChain.Cli/obj/Debug/netcoreapp3.1/BlockChain.Cli.AssemblyInfo.cs
14+
/home/job/Documents/Projects/BlockChain/BlockChain.Cli/obj/Debug/netcoreapp3.1/BlockChain.Cli.csproj.CopyComplete
15+
/home/job/Documents/Projects/BlockChain/BlockChain.Cli/obj/Debug/netcoreapp3.1/BlockChain.Cli.dll
16+
/home/job/Documents/Projects/BlockChain/BlockChain.Cli/obj/Debug/netcoreapp3.1/BlockChain.Cli.pdb
Binary file not shown.
Binary file not shown.

BlockChain.Cli/obj/project.assets.json

+23-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,19 @@
1111
"runtime": {
1212
"bin/placeholder/BlockChain.Core.dll": {}
1313
}
14+
},
15+
"BlockChain.Transactions/1.0.0": {
16+
"type": "project",
17+
"framework": ".NETCoreApp,Version=v3.1",
18+
"dependencies": {
19+
"BlockChain.Core": "1.0.0"
20+
},
21+
"compile": {
22+
"bin/placeholder/BlockChain.Transactions.dll": {}
23+
},
24+
"runtime": {
25+
"bin/placeholder/BlockChain.Transactions.dll": {}
26+
}
1427
}
1528
}
1629
},
@@ -19,11 +32,17 @@
1932
"type": "project",
2033
"path": "../BlockChain.Core/BlockChain.Core.csproj",
2134
"msbuildProject": "../BlockChain.Core/BlockChain.Core.csproj"
35+
},
36+
"BlockChain.Transactions/1.0.0": {
37+
"type": "project",
38+
"path": "../BlockChain.Transactions/BlockChain.Transactions.csproj",
39+
"msbuildProject": "../BlockChain.Transactions/BlockChain.Transactions.csproj"
2240
}
2341
},
2442
"projectFileDependencyGroups": {
2543
".NETCoreApp,Version=v3.1": [
26-
"BlockChain.Core >= 1.0.0"
44+
"BlockChain.Core >= 1.0.0",
45+
"BlockChain.Transactions >= 1.0.0"
2746
]
2847
},
2948
"packageFolders": {
@@ -52,6 +71,9 @@
5271
"projectReferences": {
5372
"/home/job/Documents/Projects/BlockChain/BlockChain.Core/BlockChain.Core.csproj": {
5473
"projectPath": "/home/job/Documents/Projects/BlockChain/BlockChain.Core/BlockChain.Core.csproj"
74+
},
75+
"/home/job/Documents/Projects/BlockChain/BlockChain.Transactions/BlockChain.Transactions.csproj": {
76+
"projectPath": "/home/job/Documents/Projects/BlockChain/BlockChain.Transactions/BlockChain.Transactions.csproj"
5577
}
5678
}
5779
}

BlockChain.Cli/obj/project.packagespec.json

+3
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
"projectReferences": {
1818
"/home/job/Documents/Projects/BlockChain/BlockChain.Core/BlockChain.Core.csproj": {
1919
"projectPath": "/home/job/Documents/Projects/BlockChain/BlockChain.Core/BlockChain.Core.csproj"
20+
},
21+
"/home/job/Documents/Projects/BlockChain/BlockChain.Transactions/BlockChain.Transactions.csproj": {
22+
"projectPath": "/home/job/Documents/Projects/BlockChain/BlockChain.Transactions/BlockChain.Transactions.csproj"
2023
}
2124
}
2225
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1898664784
1+
1533226103
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>netcoreapp3.1</TargetFramework>
5+
6+
<IsPackable>false</IsPackable>
7+
</PropertyGroup>
8+
9+
<ItemGroup>
10+
<PackageReference Include="nunit" Version="3.12.0" />
11+
<PackageReference Include="NUnit3TestAdapter" Version="3.15.1" />
12+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
13+
</ItemGroup>
14+
15+
<ItemGroup>
16+
<ProjectReference Include="..\BlockChain.Core\BlockChain.Core.csproj" />
17+
<ProjectReference Include="..\BlockChain.Transactions\BlockChain.Transactions.csproj" />
18+
</ItemGroup>
19+
20+
</Project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
using System;
2+
using System.Diagnostics;
3+
using BlockChain.Transactions.Scripting;
4+
using BlockChain.Transactions.Scripting.Enums;
5+
using BlockChain.Transactions.Scripting.Scripts;
6+
using NUnit.Framework;
7+
8+
namespace BlockChain.Transactions.Test.Scripting
9+
{
10+
public class BasicScriptingTest
11+
{
12+
[Test]
13+
public void ScriptingTest1()
14+
{
15+
var script = new Script();
16+
script.Push(OPCODE.OP_1);
17+
script.Push(OPCODE.OP_2);
18+
script.Push(OPCODE.OP_3);
19+
script.Push(OPCODE.OP_4);
20+
script.Push(OPCODE.OP_5);
21+
Interpreter.Initialize();
22+
23+
var sw = Stopwatch.StartNew();
24+
for (int i = 0; i < 1000000; i++) script.Run();
25+
Console.WriteLine(sw.ElapsedMilliseconds);
26+
}
27+
}
28+
}
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)