Skip to content

Commit 68f7b70

Browse files
Added x42 to BlockCore. (#109)
* Added x42 to BlockCore. * Updated Testnet paramaters.
1 parent 94c3da2 commit 68f7b70

19 files changed

Lines changed: 1814 additions & 0 deletions

src/Blockcore.sln

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,12 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "City", "Networks\City\City\
111111
EndProject
112112
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "City.Node", "Networks\City\City.Node\City.Node.csproj", "{363B09A7-BA71-4BC2-ABCA-B47065C374E5}"
113113
EndProject
114+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "x42", "x42", "{88A9A633-DA22-412B-A04C-2A3405D3E2C8}"
115+
EndProject
116+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "x42.Networks", "Networks\x42\x42\x42.Networks.csproj", "{36CE71D7-812A-40D7-96B7-8220E8E86643}"
117+
EndProject
118+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "x42.Node", "Networks\x42\x42.Node\x42.Node.csproj", "{8E17F166-F15A-42F7-9407-06CE2A4AA0AF}"
119+
EndProject
114120
Global
115121
GlobalSection(SolutionConfigurationPlatforms) = preSolution
116122
Debug|Any CPU = Debug|Any CPU
@@ -281,6 +287,14 @@ Global
281287
{363B09A7-BA71-4BC2-ABCA-B47065C374E5}.Debug|Any CPU.Build.0 = Debug|Any CPU
282288
{363B09A7-BA71-4BC2-ABCA-B47065C374E5}.Release|Any CPU.ActiveCfg = Release|Any CPU
283289
{363B09A7-BA71-4BC2-ABCA-B47065C374E5}.Release|Any CPU.Build.0 = Release|Any CPU
290+
{36CE71D7-812A-40D7-96B7-8220E8E86643}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
291+
{36CE71D7-812A-40D7-96B7-8220E8E86643}.Debug|Any CPU.Build.0 = Debug|Any CPU
292+
{36CE71D7-812A-40D7-96B7-8220E8E86643}.Release|Any CPU.ActiveCfg = Release|Any CPU
293+
{36CE71D7-812A-40D7-96B7-8220E8E86643}.Release|Any CPU.Build.0 = Release|Any CPU
294+
{8E17F166-F15A-42F7-9407-06CE2A4AA0AF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
295+
{8E17F166-F15A-42F7-9407-06CE2A4AA0AF}.Debug|Any CPU.Build.0 = Debug|Any CPU
296+
{8E17F166-F15A-42F7-9407-06CE2A4AA0AF}.Release|Any CPU.ActiveCfg = Release|Any CPU
297+
{8E17F166-F15A-42F7-9407-06CE2A4AA0AF}.Release|Any CPU.Build.0 = Release|Any CPU
284298
EndGlobalSection
285299
GlobalSection(SolutionProperties) = preSolution
286300
HideSolutionNode = FALSE
@@ -330,6 +344,9 @@ Global
330344
{3AD23CD3-51A4-4DFE-9501-55963B54519A} = {3B56C02B-4468-4268-B797-851562789FCC}
331345
{C4D5381C-53D0-419A-A32B-70E38C5A42A4} = {3AD23CD3-51A4-4DFE-9501-55963B54519A}
332346
{363B09A7-BA71-4BC2-ABCA-B47065C374E5} = {3AD23CD3-51A4-4DFE-9501-55963B54519A}
347+
{88A9A633-DA22-412B-A04C-2A3405D3E2C8} = {3B56C02B-4468-4268-B797-851562789FCC}
348+
{36CE71D7-812A-40D7-96B7-8220E8E86643} = {88A9A633-DA22-412B-A04C-2A3405D3E2C8}
349+
{8E17F166-F15A-42F7-9407-06CE2A4AA0AF} = {88A9A633-DA22-412B-A04C-2A3405D3E2C8}
333350
EndGlobalSection
334351
GlobalSection(ExtensibilityGlobals) = postSolution
335352
SolutionGuid = {6C780ABA-5872-4B83-AD3F-A5BD423AD907}
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
using System;
2+
using System.Threading.Tasks;
3+
using Blockcore;
4+
using Blockcore.Builder;
5+
using Blockcore.Configuration;
6+
using Blockcore.Features.Api;
7+
using Blockcore.Features.BlockStore;
8+
using Blockcore.Features.ColdStaking;
9+
using Blockcore.Features.Consensus;
10+
using Blockcore.Features.Diagnostic;
11+
using Blockcore.Features.MemoryPool;
12+
using Blockcore.Features.Miner;
13+
using Blockcore.Features.RPC;
14+
using Blockcore.Features.SignalR;
15+
using Blockcore.Features.SignalR.Broadcasters;
16+
using Blockcore.Features.SignalR.Events;
17+
using Blockcore.Utilities;
18+
using NBitcoin;
19+
using NBitcoin.Protocol;
20+
21+
namespace x42.Daemon
22+
{
23+
public class Program
24+
{
25+
public static async Task Main(string[] args)
26+
{
27+
try
28+
{
29+
var nodeSettings = new NodeSettings(networksSelector: Networks.Networks.x42,
30+
protocolVersion: ProtocolVersion.PROVEN_HEADER_VERSION, args: args)
31+
{
32+
MinProtocolVersion = ProtocolVersion.ALT_PROTOCOL_VERSION
33+
};
34+
35+
IFullNodeBuilder nodeBuilder = new FullNodeBuilder()
36+
.UseNodeSettings(nodeSettings)
37+
.UseBlockStore()
38+
.UsePosConsensus()
39+
.UseMempool()
40+
.UseColdStakingWallet()
41+
.AddPowPosMining()
42+
.UseApi()
43+
.AddRPC()
44+
.UseDiagnosticFeature();
45+
46+
if (nodeSettings.EnableSignalR)
47+
{
48+
nodeBuilder.AddSignalR(options =>
49+
{
50+
options.EventsToHandle = new[]
51+
{
52+
(IClientEvent) new BlockConnectedClientEvent(),
53+
new TransactionReceivedClientEvent()
54+
};
55+
56+
options.ClientEventBroadcasters = new[]
57+
{
58+
(Broadcaster: typeof(StakingBroadcaster), ClientEventBroadcasterSettings: new ClientEventBroadcasterSettings { BroadcastFrequencySeconds = 5 }),
59+
(Broadcaster: typeof(WalletInfoBroadcaster), ClientEventBroadcasterSettings: new ClientEventBroadcasterSettings { BroadcastFrequencySeconds = 5 })
60+
};
61+
});
62+
}
63+
64+
IFullNode node = nodeBuilder.Build();
65+
66+
if (node != null)
67+
await node.RunAsync();
68+
}
69+
catch (Exception ex)
70+
{
71+
Console.WriteLine("There was a problem initializing the node. Details: '{0}'", ex);
72+
}
73+
}
74+
}
75+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"profiles": {
3+
"x42 (MAIN)": {
4+
"commandName": "Project"
5+
},
6+
"x42 (TEST)": {
7+
"commandName": "Project",
8+
"commandLineArgs": "-testnet"
9+
},
10+
"x42 (MAIN/RPC)": {
11+
"commandName": "Project",
12+
"commandLineArgs": "-server -rpcallowip=127.0.0.1 -rpcbind=127.0.0.1 -rpcpassword=rpcpassword -rpcuser=rpcuser"
13+
},
14+
"x42 (TEST/RPC)": {
15+
"commandName": "Project",
16+
"commandLineArgs": "-server -rpcallowip=127.0.0.1 -rpcbind=127.0.0.1 -rpcpassword=rpcpassword -rpcuser=rpcuser -testnet"
17+
},
18+
"x42 (MAIN/LOCAL/RPC)": {
19+
"commandName": "Project",
20+
"commandLineArgs": "-server -rpcallowip=127.0.0.1 -rpcbind=127.0.0.1 -rpcpassword=rpcpassword -rpcuser=rpcuser -datadir=nodedata"
21+
},
22+
"x42 (TEST/LOCAL/RPC)": {
23+
"commandName": "Project",
24+
"commandLineArgs": "-server -rpcallowip=127.0.0.1 -rpcbind=127.0.0.1 -rpcpassword=rpcpassword -rpcuser=rpcuser -datadir=nodedata -testnet"
25+
},
26+
"x42 (MAIN/LOCAL/RPC/DEFAULT)": {
27+
"commandName": "Project",
28+
"commandLineArgs": "-server -rpcallowip=127.0.0.1 -rpcbind=127.0.0.1 -rpcpassword=rpcpassword -rpcuser=rpcuser -datadir=nodedata -defaultwalletname=default -defaultwalletpassword=default -unlockdefaultwallet -server"
29+
},
30+
"x42 (TEST/LOCAL/RPC/DEFAULT)": {
31+
"commandName": "Project",
32+
"commandLineArgs": "-server -rpcallowip=127.0.0.1 -rpcbind=127.0.0.1 -rpcpassword=rpcpassword -rpcuser=rpcuser -datadir=nodedata -defaultwalletname=default -defaultwalletpassword=default -unlockdefaultwallet -server -testnet"
33+
},
34+
"x42 (TEST/NO ASSUME VALID)": {
35+
"commandName": "Project",
36+
"commandLineArgs": "-testnet -assumevalid=0 -checkpoints=false"
37+
}
38+
}
39+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>netcoreapp3.1</TargetFramework>
5+
<RuntimeFrameworkVersion>3.1.0</RuntimeFrameworkVersion>
6+
<AssemblyName>x42.Node</AssemblyName>
7+
<OutputType>Exe</OutputType>
8+
<Authors>Blockcore</Authors>
9+
</PropertyGroup>
10+
11+
<PropertyGroup>
12+
<LangVersion>latest</LangVersion>
13+
</PropertyGroup>
14+
15+
<ItemGroup>
16+
<ProjectReference Include="..\..\..\External\NBitcoin\NBitcoin.csproj" />
17+
<ProjectReference Include="..\..\..\Features\Blockcore.Features.Api\Blockcore.Features.Api.csproj" />
18+
<ProjectReference Include="..\..\..\Features\Blockcore.Features.BlockStore\Blockcore.Features.BlockStore.csproj" />
19+
<ProjectReference Include="..\..\..\Features\Blockcore.Features.ColdStaking\Blockcore.Features.ColdStaking.csproj" />
20+
<ProjectReference Include="..\..\..\Features\Blockcore.Features.Consensus\Blockcore.Features.Consensus.csproj" />
21+
<ProjectReference Include="..\..\..\Features\Blockcore.Features.Diagnostic\Blockcore.Features.Diagnostic.csproj" />
22+
<ProjectReference Include="..\..\..\Features\Blockcore.Features.MemoryPool\Blockcore.Features.MemoryPool.csproj" />
23+
<ProjectReference Include="..\..\..\Features\Blockcore.Features.Miner\Blockcore.Features.Miner.csproj" />
24+
<ProjectReference Include="..\..\..\Features\Blockcore.Features.RPC\Blockcore.Features.RPC.csproj" />
25+
<ProjectReference Include="..\..\..\Features\Blockcore.Features.SignalR\Blockcore.Features.SignalR.csproj" />
26+
<ProjectReference Include="..\..\..\Features\Blockcore.Features.Wallet\Blockcore.Features.Wallet.csproj" />
27+
<ProjectReference Include="..\x42\x42.Networks.csproj" />
28+
</ItemGroup>
29+
</Project>

0 commit comments

Comments
 (0)