Skip to content

Commit 57acad0

Browse files
turcolchecho1989
andauthored
Adding OpenExO Network (EXOS) (#169)
* Adding OpenExo Networks * Added OpenExo.Node * Added OpenExo to Blockcore.Node * Network replaced by Block Height in the dashboard * Password type changed in sending form * Update BIP9 params for CVS * Add OpenExo DNS daemon * Updated launchSettings OpenExo Dns * Updated OpenExo BIP9Deployments file * Added dns service to OpenExo.Dns * Added launchSettings.json to OpenExo.Node * Removed OpenExo dns daemon * Added dns flag validation to OpenExo.Node * Removed OpenExo agent from Blockcore.Node Co-authored-by: checho1989 <cheverdolaga@hotmail.com>
1 parent 1e6013a commit 57acad0

23 files changed

Lines changed: 1244 additions & 5 deletions

src/Blockcore.sln

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,15 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Blockcore.Features.WalletWa
128128
EndProject
129129
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Rutanio", "Rutanio", "{50759380-AF62-11EA-BC6D-7563ABA8C5CA}"
130130
EndProject
131-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Rutanio.Node", "Networks\Rutanio\Rutanio.Node\Rutanio.Node.csproj", "{EECEF785-EC8C-4037-9BF9-1DACABDE0E3D}"
131+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Rutanio.Node", "Networks\Rutanio\Rutanio.Node\Rutanio.Node.csproj", "{EECEF785-EC8C-4037-9BF9-1DACABDE0E3D}"
132132
EndProject
133-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Rutanio", "Networks\Rutanio\Rutanio\Rutanio.csproj", "{271E03B3-5DD6-4A16-A54A-1E72AF9B4902}"
133+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Rutanio", "Networks\Rutanio\Rutanio\Rutanio.csproj", "{271E03B3-5DD6-4A16-A54A-1E72AF9B4902}"
134+
EndProject
135+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenExo", "Networks\OpenExo\OpenExo\OpenExo.csproj", "{4F3C67B3-D96D-46A6-9BBC-19EB0A1A8712}"
136+
EndProject
137+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "OpenExo", "OpenExo", "{4B0889C8-78BE-41C2-BB7B-7E82B3B83753}"
138+
EndProject
139+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenExo.Node", "Networks\OpenExo\OpenExo.Node\OpenExo.Node.csproj", "{AAB36899-879B-4098-9060-E69240AB7150}"
134140
EndProject
135141
Global
136142
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -334,12 +340,19 @@ Global
334340
{271E03B3-5DD6-4A16-A54A-1E72AF9B4902}.Debug|Any CPU.Build.0 = Debug|Any CPU
335341
{271E03B3-5DD6-4A16-A54A-1E72AF9B4902}.Release|Any CPU.ActiveCfg = Release|Any CPU
336342
{271E03B3-5DD6-4A16-A54A-1E72AF9B4902}.Release|Any CPU.Build.0 = Release|Any CPU
343+
{4F3C67B3-D96D-46A6-9BBC-19EB0A1A8712}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
344+
{4F3C67B3-D96D-46A6-9BBC-19EB0A1A8712}.Debug|Any CPU.Build.0 = Debug|Any CPU
345+
{4F3C67B3-D96D-46A6-9BBC-19EB0A1A8712}.Release|Any CPU.ActiveCfg = Release|Any CPU
346+
{4F3C67B3-D96D-46A6-9BBC-19EB0A1A8712}.Release|Any CPU.Build.0 = Release|Any CPU
347+
{AAB36899-879B-4098-9060-E69240AB7150}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
348+
{AAB36899-879B-4098-9060-E69240AB7150}.Debug|Any CPU.Build.0 = Debug|Any CPU
349+
{AAB36899-879B-4098-9060-E69240AB7150}.Release|Any CPU.ActiveCfg = Release|Any CPU
350+
{AAB36899-879B-4098-9060-E69240AB7150}.Release|Any CPU.Build.0 = Release|Any CPU
337351
EndGlobalSection
338352
GlobalSection(SolutionProperties) = preSolution
339353
HideSolutionNode = FALSE
340354
EndGlobalSection
341355
GlobalSection(NestedProjects) = preSolution
342-
{50759380-AF62-11EA-BC6D-7563ABA8C5CA} = {3B56C02B-4468-4268-B797-851562789FCC}
343356
{800A5906-C050-4E75-9D7C-0CB1C404A0F8} = {EAE139C2-B19C-4905-9117-8A4068ABD3D2}
344357
{94FEB14E-D123-486D-A24D-D2BE725D96E3} = {EAE139C2-B19C-4905-9117-8A4068ABD3D2}
345358
{E538B76A-513F-46D5-9F14-E35E79B484CA} = {EAE139C2-B19C-4905-9117-8A4068ABD3D2}
@@ -387,12 +400,16 @@ Global
387400
{36CE71D7-812A-40D7-96B7-8220E8E86643} = {88A9A633-DA22-412B-A04C-2A3405D3E2C8}
388401
{8E17F166-F15A-42F7-9407-06CE2A4AA0AF} = {88A9A633-DA22-412B-A04C-2A3405D3E2C8}
389402
{D0A183FE-C913-4F8F-92EC-BD4502745140} = {8820C3A5-74B4-45AB-B80C-2495DFBA4A2B}
403+
{50759380-AF62-11EA-BC6D-7563ABA8C5CA} = {3B56C02B-4468-4268-B797-851562789FCC}
390404
{B3D4208F-797A-4893-BC33-BAB77508DFEE} = {15D29FFD-6142-4DC5-AFFD-10BA0CA55C45}
391405
{EADB5247-F704-4B87-8B0E-606730B8517A} = {EAE139C2-B19C-4905-9117-8A4068ABD3D2}
392406
{F64554A3-EC9A-4DBF-9AD6-25C78176C74E} = {15D29FFD-6142-4DC5-AFFD-10BA0CA55C45}
393407
{53DA5042-1325-48A0-815A-C586590EC2EB} = {EAE139C2-B19C-4905-9117-8A4068ABD3D2}
394408
{EECEF785-EC8C-4037-9BF9-1DACABDE0E3D} = {50759380-AF62-11EA-BC6D-7563ABA8C5CA}
395409
{271E03B3-5DD6-4A16-A54A-1E72AF9B4902} = {50759380-AF62-11EA-BC6D-7563ABA8C5CA}
410+
{4F3C67B3-D96D-46A6-9BBC-19EB0A1A8712} = {4B0889C8-78BE-41C2-BB7B-7E82B3B83753}
411+
{4B0889C8-78BE-41C2-BB7B-7E82B3B83753} = {3B56C02B-4468-4268-B797-851562789FCC}
412+
{AAB36899-879B-4098-9060-E69240AB7150} = {4B0889C8-78BE-41C2-BB7B-7E82B3B83753}
396413
EndGlobalSection
397414
GlobalSection(ExtensibilityGlobals) = postSolution
398415
SolutionGuid = {6C780ABA-5872-4B83-AD3F-A5BD423AD907}

src/Features/Blockcore.Features.NodeHost/UI/Pages/Index.razor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@
112112
</div>
113113
</div>
114114
</div>
115-
<h6 class="text-muted font-weight-normal">Network Height</h6>
115+
<h6 class="text-muted font-weight-normal">Block Height</h6>
116116
</div>
117117
</div>
118118
</div>

src/Features/Blockcore.Features.Wallet/UI/Pages/WalletSend.razor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@
9090
<div class="form-group row">
9191
<label class="col-sm-2 col-form-label">Password</label>
9292
<div class="col-sm-10">
93-
<input @bind="Password" type="text" class="form-control bg-secondary text-light" placeholder="Please enter your password" />
93+
<input @bind="Password" type="password" class="form-control bg-secondary text-light" placeholder="Please enter your password" />
9494
</div>
9595
</div>
9696
<div class="input-group mb-3">
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<AssemblyName>OpenExo.Node</AssemblyName>
5+
<OutputType>Exe</OutputType>
6+
<Authors>Blockcore</Authors>
7+
</PropertyGroup>
8+
9+
<PropertyGroup>
10+
<LangVersion>latest</LangVersion>
11+
</PropertyGroup>
12+
13+
<ItemGroup>
14+
<ProjectReference Include="..\..\..\External\NBitcoin\NBitcoin.csproj" />
15+
<ProjectReference Include="..\..\..\Features\Blockcore.Features.Dns\Blockcore.Features.Dns.csproj" />
16+
<ProjectReference Include="..\..\..\Features\Blockcore.Features.NodeHost\Blockcore.Features.NodeHost.csproj" />
17+
<ProjectReference Include="..\..\..\Features\Blockcore.Features.BlockStore\Blockcore.Features.BlockStore.csproj" />
18+
<ProjectReference Include="..\..\..\Features\Blockcore.Features.ColdStaking\Blockcore.Features.ColdStaking.csproj" />
19+
<ProjectReference Include="..\..\..\Features\Blockcore.Features.Consensus\Blockcore.Features.Consensus.csproj" />
20+
<ProjectReference Include="..\..\..\Features\Blockcore.Features.Diagnostic\Blockcore.Features.Diagnostic.csproj" />
21+
<ProjectReference Include="..\..\..\Features\Blockcore.Features.MemoryPool\Blockcore.Features.MemoryPool.csproj" />
22+
<ProjectReference Include="..\..\..\Features\Blockcore.Features.Miner\Blockcore.Features.Miner.csproj" />
23+
<ProjectReference Include="..\..\..\Features\Blockcore.Features.RPC\Blockcore.Features.RPC.csproj" />
24+
<ProjectReference Include="..\..\..\Features\Blockcore.Features.Wallet\Blockcore.Features.Wallet.csproj" />
25+
</ItemGroup>
26+
27+
<ItemGroup>
28+
<ProjectReference Include="..\OpenExo\OpenExo.csproj" />
29+
</ItemGroup>
30+
</Project>
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
using System;
2+
using System.Threading.Tasks;
3+
using Blockcore;
4+
using Blockcore.Builder;
5+
using Blockcore.Configuration;
6+
using Blockcore.Features.NodeHost;
7+
using Blockcore.Features.BlockStore;
8+
using Blockcore.Features.ColdStaking;
9+
using Blockcore.Features.Consensus;
10+
using Blockcore.Features.Dns;
11+
using Blockcore.Features.Diagnostic;
12+
using Blockcore.Features.MemoryPool;
13+
using Blockcore.Features.Miner;
14+
using Blockcore.Features.RPC;
15+
using Blockcore.Utilities;
16+
using NBitcoin.Protocol;
17+
18+
namespace OpenExo.Node
19+
{
20+
public class Program
21+
{
22+
public static async Task Main(string[] args)
23+
{
24+
try
25+
{
26+
var nodeSettings = new NodeSettings(networksSelector: Networks.Networks.OpenExo, args: args);
27+
28+
IFullNodeBuilder nodeBuilder = new FullNodeBuilder()
29+
.UseNodeSettings(nodeSettings)
30+
.UseBlockStore()
31+
.UsePosConsensus()
32+
.UseMempool()
33+
.AddPowPosMining()
34+
.UseColdStakingWallet()
35+
.UseDiagnosticFeature()
36+
.UseNodeHost()
37+
.AddRPC();
38+
39+
// Build DNS FullNode if enable
40+
UseDnsFullNode(nodeBuilder, nodeSettings);
41+
42+
IFullNode node = nodeBuilder.Build();
43+
44+
if (node != null)
45+
await node.RunAsync();
46+
}
47+
catch (Exception ex)
48+
{
49+
Console.WriteLine("There was a problem initializing the node. Details: '{0}'", ex);
50+
}
51+
}
52+
53+
static void UseDnsFullNode(IFullNodeBuilder nodeBuilder, NodeSettings nodeSettings)
54+
{
55+
if (nodeSettings.ConfigReader.GetOrDefault("dnsfullnode", false, nodeSettings.Logger))
56+
{
57+
var dnsSettings = new DnsSettings(nodeSettings);
58+
59+
if (string.IsNullOrWhiteSpace(dnsSettings.DnsHostName) || string.IsNullOrWhiteSpace(dnsSettings.DnsNameServer) || string.IsNullOrWhiteSpace(dnsSettings.DnsMailBox))
60+
throw new ConfigurationException("When running as a DNS Seed service, the -dnshostname, -dnsnameserver and -dnsmailbox arguments must be specified on the command line.");
61+
62+
nodeBuilder.UseDns();
63+
}
64+
}
65+
}
66+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"profiles": {
3+
"OpenExo (MAIN)": {
4+
"commandName": "Project"
5+
},
6+
"OpenExo (TEST)": {
7+
"commandName": "Project",
8+
"commandLineArgs": "-testnet"
9+
},
10+
"OpenExo (MAIN/RPC)": {
11+
"commandName": "Project",
12+
"commandLineArgs": "-server -rpcallowip=127.0.0.1 -rpcbind=127.0.0.1 -rpcpassword=rpcpassword -rpcuser=rpcuser"
13+
},
14+
"OpenExo (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+
"OpenExo (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+
"OpenExo (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+
"OpenExo (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+
"OpenExo (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+
"OpenExo (TEST/NO ASSUME VALID)": {
35+
"commandName": "Project",
36+
"commandLineArgs": "-testnet -assumevalid=0 -checkpoints=false"
37+
}
38+
}
39+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
using NBitcoin;
2+
3+
4+
namespace OpenExo.Networks.Consensus
5+
{
6+
/// <inheritdoc />
7+
public class OpenExoPosConsensusOptions : PosConsensusOptions
8+
{
9+
/// <summary>Coinstake minimal confirmations softfork activation height for mainnet.</summary>
10+
public const int OpenExoCoinstakeMinConfirmationActivationHeightMainnet = 500000;
11+
12+
/// <summary>Coinstake minimal confirmations softfork activation height for testnet.</summary>
13+
public const int OpenExoCoinstakeMinConfirmationActivationHeightTestnet = 115000;
14+
15+
public override int GetStakeMinConfirmations(int height, Network network)
16+
{
17+
if (network.Name.ToLowerInvariant().Contains("test"))
18+
{
19+
return height < OpenExoCoinstakeMinConfirmationActivationHeightTestnet ? 10 : 20;
20+
}
21+
22+
// The coinstake confirmation minimum should be 50 until activation at height 500K (~347 days).
23+
return height < OpenExoCoinstakeMinConfirmationActivationHeightMainnet ? 50 : 500;
24+
}
25+
}
26+
}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
using NBitcoin;
2+
3+
namespace OpenExo.Networks.Deployments
4+
{
5+
/// <summary>
6+
/// BIP9 deployments for the Blockcore sample coin network.
7+
/// </summary>
8+
public class OpenExoBIP9Deployments : BIP9DeploymentsArray
9+
{
10+
// The position of each deployment in the deployments array. Note that this is decoupled from the actual position of the flag bit for the deployment in the block version.
11+
public const int TestDummy = 0;
12+
public const int CSV = 1;
13+
public const int Segwit = 2;
14+
public const int ColdStaking = 3;
15+
16+
// The number of deployments.
17+
public const int NumberOfDeployments = 4;
18+
19+
/// <summary>
20+
/// Constructs the BIP9 deployments array.
21+
/// </summary>
22+
public OpenExoBIP9Deployments() : base(NumberOfDeployments)
23+
{
24+
}
25+
26+
/// <summary>
27+
/// Gets the deployment flags to set when the deployment activates.
28+
/// </summary>
29+
/// <param name="deployment">The deployment number.</param>
30+
/// <returns>The deployment flags.</returns>
31+
public override BIP9DeploymentFlags GetFlags(int deployment)
32+
{
33+
var flags = new BIP9DeploymentFlags();
34+
35+
switch (deployment)
36+
{
37+
case ColdStaking:
38+
flags.ScriptFlags |= ScriptVerify.CheckColdStakeVerify;
39+
break;
40+
41+
case CSV:
42+
// Start enforcing BIP68 (sequence locks), BIP112 (CHECKSEQUENCEVERIFY) and BIP113 (Median Time Past) using versionbits logic.
43+
flags.ScriptFlags = ScriptVerify.CheckSequenceVerify;
44+
flags.LockTimeFlags = Transaction.LockTimeFlags.VerifySequence | Transaction.LockTimeFlags.MedianTimePast;
45+
break;
46+
47+
case Segwit:
48+
// Start enforcing WITNESS rules using versionbits logic.
49+
flags.ScriptFlags = ScriptVerify.Witness;
50+
break;
51+
}
52+
53+
return flags;
54+
}
55+
}
56+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
using NBitcoin;
2+
3+
namespace OpenExo.Networks
4+
{
5+
public static class Networks
6+
{
7+
public static NetworksSelector OpenExo
8+
{
9+
get
10+
{
11+
return new NetworksSelector(() => new OpenExoMain(), () => new OpenExoTest(), () => new OpenExoRegTest());
12+
}
13+
}
14+
}
15+
}

0 commit comments

Comments
 (0)