-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding Rutanio Network (RUTA) (#161)
* Add access to hashkey to use a dynamic string * Add Rutanio networks * Add Rutanio.Node * Add Rutanio to NetworkSelector node and use a custom agent (Blockcore-Ruta) * Use ContenType as a configuration parameter to allow connections with differents daemons (i.e: ElectrumX) * Add node agent instead of Swagger title * Update favicon to use with Rutanio * Update Rutanio nodeBuilder to use same order then Blockcore.Node * RUTA will fall through last case option (XDS) * Introduce network-specific standard script * Framework props were removed; they are global prop * MaxTxFee added. Use the new rules for coindb * favicon feature was removed (for later release) * BIP9 Deployment on place * API title use now Blockcore + coin ticker * ApiTitle more readable * Indentation line to solve PR conflicts Co-authored-by: checho1989 <cheverdolaga@hotmail.com>
- Loading branch information
1 parent
29194d6
commit 6dac1ff
Showing
30 changed files
with
1,229 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
using System; | ||
using System.Threading.Tasks; | ||
using Blockcore; | ||
using Blockcore.Builder; | ||
using Blockcore.Configuration; | ||
using Blockcore.Features.NodeHost; | ||
using Blockcore.Features.BlockStore; | ||
using Blockcore.Features.ColdStaking; | ||
using Blockcore.Features.Consensus; | ||
using Blockcore.Features.Diagnostic; | ||
using Blockcore.Features.MemoryPool; | ||
using Blockcore.Features.Miner; | ||
using Blockcore.Features.RPC; | ||
using Blockcore.Utilities; | ||
using NBitcoin.Protocol; | ||
|
||
namespace Rutanio.Daemon | ||
{ | ||
public class Program | ||
{ | ||
public static async Task Main(string[] args) | ||
{ | ||
try | ||
{ | ||
var nodeSettings = new NodeSettings(networksSelector: Networks.Networks.Rutanio, args: args, agent: "Blockcore-RUTA"); | ||
|
||
IFullNodeBuilder nodeBuilder = new FullNodeBuilder() | ||
.UseNodeSettings(nodeSettings) | ||
.UseBlockStore() | ||
.UseMempool() | ||
.UseNodeHost() | ||
.AddRPC() | ||
.UseDiagnosticFeature() | ||
.UsePosConsensus() | ||
.AddPowPosMining() | ||
.UseColdStakingWallet(); | ||
|
||
IFullNode node = nodeBuilder.Build(); | ||
|
||
if (node != null) | ||
await node.RunAsync(); | ||
} | ||
catch (Exception ex) | ||
{ | ||
Console.WriteLine("There was a problem initializing the node. Details: '{0}'", ex); | ||
} | ||
} | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
src/Networks/Rutanio/Rutanio.Node/Properties/launchSettings.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
{ | ||
"profiles": { | ||
"Rutanio (MAIN)": { | ||
"commandName": "Project" | ||
}, | ||
"Rutanio (TEST)": { | ||
"commandName": "Project", | ||
"commandLineArgs": "-testnet" | ||
}, | ||
"Rutanio (MAIN/RPC)": { | ||
"commandName": "Project", | ||
"commandLineArgs": "-server -rpcallowip=127.0.0.1 -rpcbind=127.0.0.1 -rpcpassword=rpcpassword -rpcuser=rpcuser" | ||
}, | ||
"Rutanio (TEST/RPC)": { | ||
"commandName": "Project", | ||
"commandLineArgs": "-server -rpcallowip=127.0.0.1 -rpcbind=127.0.0.1 -rpcpassword=rpcpassword -rpcuser=rpcuser -testnet" | ||
}, | ||
"Rutanio (MAIN/LOCAL/RPC)": { | ||
"commandName": "Project", | ||
"commandLineArgs": "-server -rpcallowip=127.0.0.1 -rpcbind=127.0.0.1 -rpcpassword=rpcpassword -rpcuser=rpcuser -datadir=nodedata" | ||
}, | ||
"Rutanio (TEST/LOCAL/RPC)": { | ||
"commandName": "Project", | ||
"commandLineArgs": "-server -rpcallowip=127.0.0.1 -rpcbind=127.0.0.1 -rpcpassword=rpcpassword -rpcuser=rpcuser -datadir=nodedata -testnet" | ||
}, | ||
"Rutanio (MAIN/LOCAL/RPC/DEFAULT)": { | ||
"commandName": "Project", | ||
"commandLineArgs": "-server -rpcallowip=127.0.0.1 -rpcbind=127.0.0.1 -rpcpassword=rpcpassword -rpcuser=rpcuser -datadir=nodedata -defaultwalletname=default -defaultwalletpassword=default -unlockdefaultwallet -server" | ||
}, | ||
"Rutanio (TEST/LOCAL/RPC/DEFAULT)": { | ||
"commandName": "Project", | ||
"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" | ||
}, | ||
"Rutanio (TEST/NO ASSUME VALID)": { | ||
"commandName": "Project", | ||
"commandLineArgs": "-testnet -assumevalid=0 -checkpoints=false" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<AssemblyName>Rutanio.Node</AssemblyName> | ||
<OutputType>Exe</OutputType> | ||
<Authors>Blockcore</Authors> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup> | ||
<LangVersion>latest</LangVersion> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\..\..\External\NBitcoin\NBitcoin.csproj" /> | ||
<ProjectReference Include="..\..\..\Features\Blockcore.Features.NodeHost\Blockcore.Features.NodeHost.csproj" /> | ||
<ProjectReference Include="..\..\..\Features\Blockcore.Features.BlockStore\Blockcore.Features.BlockStore.csproj" /> | ||
<ProjectReference Include="..\..\..\Features\Blockcore.Features.ColdStaking\Blockcore.Features.ColdStaking.csproj" /> | ||
<ProjectReference Include="..\..\..\Features\Blockcore.Features.Consensus\Blockcore.Features.Consensus.csproj" /> | ||
<ProjectReference Include="..\..\..\Features\Blockcore.Features.Diagnostic\Blockcore.Features.Diagnostic.csproj" /> | ||
<ProjectReference Include="..\..\..\Features\Blockcore.Features.MemoryPool\Blockcore.Features.MemoryPool.csproj" /> | ||
<ProjectReference Include="..\..\..\Features\Blockcore.Features.Miner\Blockcore.Features.Miner.csproj" /> | ||
<ProjectReference Include="..\..\..\Features\Blockcore.Features.RPC\Blockcore.Features.RPC.csproj" /> | ||
<ProjectReference Include="..\..\..\Features\Blockcore.Features.Wallet\Blockcore.Features.Wallet.csproj" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\Rutanio\Rutanio.csproj" /> | ||
</ItemGroup> | ||
</Project> |
15 changes: 15 additions & 0 deletions
15
src/Networks/Rutanio/Rutanio/Networks/Consensus/RutanioPosConsensusOptions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using NBitcoin; | ||
|
||
namespace Rutanio.Networks.Consensus | ||
{ | ||
/// <inheritdoc /> | ||
public class RutanioPosConsensusOptions : PosConsensusOptions | ||
{ | ||
/// <inheritdoc /> | ||
public override int GetStakeMinConfirmations(int height, Network network) | ||
{ | ||
// StakeMinConfirmations must equal MaxReorgLength so that nobody can stake in isolation and then force a reorg | ||
return (int)network.Consensus.MaxReorgLength; | ||
} | ||
} | ||
} |
55 changes: 55 additions & 0 deletions
55
src/Networks/Rutanio/Rutanio/Networks/Deployments/RutanioBIP39Deployments.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
using NBitcoin; | ||
namespace Rutanio.Networks.Deployments | ||
{ | ||
/// <summary> | ||
/// BIP9 deployments for the Blockcore sample coin network. | ||
/// </summary> | ||
public class RutanioBIP9Deployments : BIP9DeploymentsArray | ||
{ | ||
// 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. | ||
public const int TestDummy = 0; | ||
public const int CSV = 1; | ||
public const int Segwit = 2; | ||
public const int ColdStaking = 3; | ||
|
||
// The number of deployments. | ||
public const int NumberOfDeployments = 4; | ||
|
||
/// <summary> | ||
/// Constructs the BIP9 deployments array. | ||
/// </summary> | ||
public RutanioBIP9Deployments() : base(NumberOfDeployments) | ||
{ | ||
} | ||
|
||
/// <summary> | ||
/// Gets the deployment flags to set when the deployment activates. | ||
/// </summary> | ||
/// <param name="deployment">The deployment number.</param> | ||
/// <returns>The deployment flags.</returns> | ||
public override BIP9DeploymentFlags GetFlags(int deployment) | ||
{ | ||
var flags = new BIP9DeploymentFlags(); | ||
|
||
switch (deployment) | ||
{ | ||
case ColdStaking: | ||
flags.ScriptFlags |= ScriptVerify.CheckColdStakeVerify; | ||
break; | ||
|
||
case CSV: | ||
// Start enforcing BIP68 (sequence locks), BIP112 (CHECKSEQUENCEVERIFY) and BIP113 (Median Time Past) using versionbits logic. | ||
flags.ScriptFlags = ScriptVerify.CheckSequenceVerify; | ||
flags.LockTimeFlags = Transaction.LockTimeFlags.VerifySequence | Transaction.LockTimeFlags.MedianTimePast; | ||
break; | ||
|
||
case Segwit: | ||
// Start enforcing WITNESS rules using versionbits logic. | ||
flags.ScriptFlags = ScriptVerify.Witness; | ||
break; | ||
} | ||
|
||
return flags; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using NBitcoin; | ||
|
||
namespace Rutanio.Networks | ||
{ | ||
public static class Networks | ||
{ | ||
public static NetworksSelector Rutanio | ||
{ | ||
get | ||
{ | ||
return new NetworksSelector(() => new RutanioMain(), () => new RutanioTest(), () => new RutanioRegTest()); | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.