Commit 84dfd415 authored by Maxim Bogdanov's avatar Maxim Bogdanov 🙉

Added fuctionality to run node connected to Destream test server.

"-destreamtest",
"-destreamtestserver" argument runs test server node.
parent 6f02b835
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
[Xx]64/
[Xx]86/
[Bb]uild/
bld/
[Bb]in/
[Oo]bj/
# Visual Studio 2015 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUNIT
*.VisualState.xml
TestResult.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# DNX
project.lock.json
artifacts/
*_i.c
*_p.c
*_i.h
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# JustCode is a .NET coding add-in
.JustCode
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
*.ncrunchproject
*.ncrunchsolution
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# TODO: Un-comment the next line if you do not want to checkin
# your web deploy settings because they may include unencrypted
# passwords
#*.pubxml
*.publishproj
# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/packages/*
# except build/, which is used as an MSBuild target.
!**/packages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/packages/repositories.config
# NuGet v3's project.json files produces more ignoreable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Microsoft Azure ApplicationInsights config file
ApplicationInsights.config
# Windows Store app package directory
AppPackages/
BundleArtifacts/
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!*.[Cc]ache/
# Others
ClientBin/
[Ss]tyle[Cc]op.*
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.pfx
*.publishsettings
node_modules/
orleans.codegen.cs
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
# SQL Server files
*.mdf
*.ldf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# LightSwitch generated files
GeneratedArtifacts/
ModelManifest.xml
# Paket dependency manager
.paket/paket.exe
# FAKE - F# Make
.fake/
/Sources/Stratis.Bitcoin.IntegrationTests/TestData
/Sources/Stratis.Bitcoin.IntegrationTests/ValidSomeBlocks
/Sources/Stratis.BitcoinD/Properties/launchSettings.json
/Sources/Stratis.Bitcoin.Tests/TestData/
/Sources/Stratis.Bitcoin.Tests/Stratis.Bitcoin.Tests/TestData
/Sources/Stratis.StratisD/Logs
/Sources/Stratis.BitcoinD/Logs
\ No newline at end of file
...@@ -62,6 +62,9 @@ namespace NBitcoin ...@@ -62,6 +62,9 @@ namespace NBitcoin
public static Network StratisRegTest => Network.GetNetwork("StratisRegTest") ?? InitStratisRegTest(); public static Network StratisRegTest => Network.GetNetwork("StratisRegTest") ?? InitStratisRegTest();
public static Network DestreamTest => Network.GetNetwork("DestreamTest") ?? InitDestreamTest();
public static Network DestreamTestServer => Network.GetNetwork("DestreamTest") ?? InitDestreamTestServerNetwork();
private static Network InitMain() private static Network InitMain()
{ {
Network network = new Network Network network = new Network
...@@ -314,7 +317,7 @@ namespace NBitcoin ...@@ -314,7 +317,7 @@ namespace NBitcoin
var consensus = new Consensus(); var consensus = new Consensus();
consensus.NetworkOptions = new NetworkOptions() { IsProofOfStake = true }; consensus.NetworkOptions = new NetworkOptions() { IsProofOfStake = true };
consensus.GetPoWHash = (n, h) => Crypto.HashX13.Instance.Hash(h.ToBytes(options:n)); consensus.GetPoWHash = (n, h) => Crypto.HashX13.Instance.Hash(h.ToBytes(options: n));
consensus.SubsidyHalvingInterval = 210000; consensus.SubsidyHalvingInterval = 210000;
consensus.MajorityEnforceBlockUpgrade = 750; consensus.MajorityEnforceBlockUpgrade = 750;
...@@ -382,18 +385,18 @@ namespace NBitcoin ...@@ -382,18 +385,18 @@ namespace NBitcoin
new DNSSeedData("seednode4.stratis.cloud", "seednode4.stratis.cloud") new DNSSeedData("seednode4.stratis.cloud", "seednode4.stratis.cloud")
}) })
.SetBase58Bytes(Base58Type.PUBKEY_ADDRESS, new byte[] {(63)}) .SetBase58Bytes(Base58Type.PUBKEY_ADDRESS, new byte[] { (63) })
.SetBase58Bytes(Base58Type.SCRIPT_ADDRESS, new byte[] {(125)}) .SetBase58Bytes(Base58Type.SCRIPT_ADDRESS, new byte[] { (125) })
.SetBase58Bytes(Base58Type.SECRET_KEY, new byte[] {(63 + 128)}) .SetBase58Bytes(Base58Type.SECRET_KEY, new byte[] { (63 + 128) })
.SetBase58Bytes(Base58Type.ENCRYPTED_SECRET_KEY_NO_EC, new byte[] {0x01, 0x42}) .SetBase58Bytes(Base58Type.ENCRYPTED_SECRET_KEY_NO_EC, new byte[] { 0x01, 0x42 })
.SetBase58Bytes(Base58Type.ENCRYPTED_SECRET_KEY_EC, new byte[] {0x01, 0x43}) .SetBase58Bytes(Base58Type.ENCRYPTED_SECRET_KEY_EC, new byte[] { 0x01, 0x43 })
.SetBase58Bytes(Base58Type.EXT_PUBLIC_KEY, new byte[] {(0x04), (0x88), (0xB2), (0x1E)}) .SetBase58Bytes(Base58Type.EXT_PUBLIC_KEY, new byte[] { (0x04), (0x88), (0xB2), (0x1E) })
.SetBase58Bytes(Base58Type.EXT_SECRET_KEY, new byte[] {(0x04), (0x88), (0xAD), (0xE4)}) .SetBase58Bytes(Base58Type.EXT_SECRET_KEY, new byte[] { (0x04), (0x88), (0xAD), (0xE4) })
.SetBase58Bytes(Base58Type.PASSPHRASE_CODE, new byte[] {0x2C, 0xE9, 0xB3, 0xE1, 0xFF, 0x39, 0xE2}) .SetBase58Bytes(Base58Type.PASSPHRASE_CODE, new byte[] { 0x2C, 0xE9, 0xB3, 0xE1, 0xFF, 0x39, 0xE2 })
.SetBase58Bytes(Base58Type.CONFIRMATION_CODE, new byte[] {0x64, 0x3B, 0xF6, 0xA8, 0x9A}) .SetBase58Bytes(Base58Type.CONFIRMATION_CODE, new byte[] { 0x64, 0x3B, 0xF6, 0xA8, 0x9A })
.SetBase58Bytes(Base58Type.STEALTH_ADDRESS, new byte[] {0x2a}) .SetBase58Bytes(Base58Type.STEALTH_ADDRESS, new byte[] { 0x2a })
.SetBase58Bytes(Base58Type.ASSET_ID, new byte[] {23}) .SetBase58Bytes(Base58Type.ASSET_ID, new byte[] { 23 })
.SetBase58Bytes(Base58Type.COLORED_ADDRESS, new byte[] {0x13}) .SetBase58Bytes(Base58Type.COLORED_ADDRESS, new byte[] { 0x13 })
.SetBech32(Bech32Type.WITNESS_PUBKEY_ADDRESS, "bc") .SetBech32(Bech32Type.WITNESS_PUBKEY_ADDRESS, "bc")
.SetBech32(Bech32Type.WITNESS_SCRIPT_ADDRESS, "bc"); .SetBech32(Bech32Type.WITNESS_SCRIPT_ADDRESS, "bc");
...@@ -468,23 +471,99 @@ namespace NBitcoin ...@@ -468,23 +471,99 @@ namespace NBitcoin
.AddDNSSeeds(new[] .AddDNSSeeds(new[]
{ {
new DNSSeedData("testnet1.stratisplatform.com", "testnet1.stratisplatform.com"), new DNSSeedData("peak-srv-12.qb-systems.ru", "peak-srv-12.qb-systems.ru"),
/*new DNSSeedData("testnet1.stratisplatform.com", "testnet1.stratisplatform.com"),
new DNSSeedData("testnet2.stratisplatform.com", "testnet2.stratisplatform.com"), new DNSSeedData("testnet2.stratisplatform.com", "testnet2.stratisplatform.com"),
new DNSSeedData("testnet3.stratisplatform.com", "testnet3.stratisplatform.com"), new DNSSeedData("testnet3.stratisplatform.com", "testnet3.stratisplatform.com"),
new DNSSeedData("testnet4.stratisplatform.com", "testnet4.stratisplatform.com") new DNSSeedData("testnet4.stratisplatform.com", "testnet4.stratisplatform.com")*/
}); });
builder.AddSeeds(new[] builder.AddSeeds(new[]
{ {
new NetworkAddress(IPAddress.Parse("51.140.231.125"), builder.Port), // danger cloud node new NetworkAddress(IPAddress.Parse("95.128.181.196"), builder.Port)//, // danger cloud node
/*new NetworkAddress(IPAddress.Parse("51.140.231.125"), builder.Port)//, // danger cloud node
new NetworkAddress(IPAddress.Parse("13.70.81.5"), 3389), // beard cloud node new NetworkAddress(IPAddress.Parse("13.70.81.5"), 3389), // beard cloud node
new NetworkAddress(IPAddress.Parse("191.235.85.131"), 3389), // fassa cloud node new NetworkAddress(IPAddress.Parse("191.235.85.131"), 3389), // fassa cloud node
new NetworkAddress(IPAddress.Parse("52.232.58.52"), 26178), // neurosploit public node new NetworkAddress(IPAddress.Parse("52.232.58.52"), 26178), // neurosploit public node*/
});
return builder.BuildAndRegister();
}
private static Network InitDestreamTest()
{
var builder = Network.GetDestreamTestNetworkBuilderWithCommonData();
builder.AddDNSSeeds(new[]
{
new DNSSeedData("peak-srv-12.qb-systems.ru", "peak-srv-12.qb-systems.ru")
});
builder.AddSeeds(new[]
{
new NetworkAddress(IPAddress.Parse("95.128.181.196"), builder.Port)
}); });
return builder.BuildAndRegister(); return builder.BuildAndRegister();
} }
private static Network InitDestreamTestServerNetwork()
{
var builder = Network.GetDestreamTestNetworkBuilderWithCommonData();
return builder.BuildAndRegister();
}
private static NetworkBuilder GetDestreamTestNetworkBuilderWithCommonData()
{
Block.BlockSignature = true;
Transaction.TimeStamp = true;
var consensus = Network.StratisMain.Consensus.Clone();
consensus.PowLimit = new Target(uint256.Parse("0000ffff00000000000000000000000000000000000000000000000000000000"));
// The message start string is designed to be unlikely to occur in normal data.
// The characters are rarely used upper ASCII, not valid as UTF-8, and produce
// a large 4-byte int at any alignment.
var messageStart = new byte[4];
messageStart[0] = 0x71;
messageStart[1] = 0x31;
messageStart[2] = 0x21;
messageStart[3] = 0x11;
var magic = BitConverter.ToUInt32(messageStart, 0); //0x5223570;
var genesis = Network.StratisMain.GetGenesis();
genesis.Header.Time = 1493909211;
genesis.Header.Nonce = 2433759;
genesis.Header.Bits = consensus.PowLimit;
consensus.HashGenesisBlock = genesis.GetHash(consensus.NetworkOptions);
Assert(consensus.HashGenesisBlock == uint256.Parse("0x00000e246d7b73b88c9ab55f2e5e94d9e22d471def3df5ea448f5576b1d156b9"));
consensus.DefaultAssumeValid = new uint256("0x12ae16993ce7f0836678f225b2f4b38154fa923bd1888f7490051ddaf4e9b7fa"); // 218810
var builder = new NetworkBuilder()
.SetName("DestreamTest")
.SetRootFolderName(StratisRootFolderName)
.SetDefaultConfigFilename(StratisDefaultConfigFilename)
.SetConsensus(consensus)
.SetMagic(magic)
.SetGenesis(genesis)
.SetPort(26178)
.SetRPCPort(26174)
.SetMaxTimeOffsetSeconds(StratisMaxTimeOffsetSeconds)
.SetMaxTipAge(StratisDefaultMaxTipAgeInSeconds)
.SetTxFees(10000, 60000, 10000)
.SetBase58Bytes(Base58Type.PUBKEY_ADDRESS, new byte[] { (65) })
.SetBase58Bytes(Base58Type.SCRIPT_ADDRESS, new byte[] { (196) })
.SetBase58Bytes(Base58Type.SECRET_KEY, new byte[] { (65 + 128) })
.SetBase58Bytes(Base58Type.ENCRYPTED_SECRET_KEY_NO_EC, new byte[] { 0x01, 0x42 })
.SetBase58Bytes(Base58Type.ENCRYPTED_SECRET_KEY_EC, new byte[] { 0x01, 0x43 })
.SetBase58Bytes(Base58Type.EXT_PUBLIC_KEY, new byte[] { (0x04), (0x88), (0xB2), (0x1E) })
.SetBase58Bytes(Base58Type.EXT_SECRET_KEY, new byte[] { (0x04), (0x88), (0xAD), (0xE4) });
return builder;
}
private static Network InitStratisRegTest() private static Network InitStratisRegTest()
{ {
// TODO: move this to Networks // TODO: move this to Networks
......
...@@ -28,7 +28,21 @@ namespace Stratis.StratisD ...@@ -28,7 +28,21 @@ namespace Stratis.StratisD
{ {
try try
{ {
Network network = args.Contains("-testnet") ? Network.StratisTest : Network.StratisMain; if (args != null) {
foreach (var item in args)
{
Console.WriteLine($"cli argument: {item}");
}
}
Network network = null;
if (args.Contains("-testnet"))
network = Network.StratisTest;
else if (args.Contains("-destreamtest"))
network = Network.DestreamTest;
else if (args.Contains("-destreamtestserver"))
network = Network.DestreamTestServer;
else
network = Network.StratisMain;
NodeSettings nodeSettings = new NodeSettings(network, ProtocolVersion.ALT_PROTOCOL_VERSION, args:args, loadConfiguration:false); NodeSettings nodeSettings = new NodeSettings(network, ProtocolVersion.ALT_PROTOCOL_VERSION, args:args, loadConfiguration:false);
......
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<PublishProtocol>FileSystem</PublishProtocol>
<Configuration>Release</Configuration>
<TargetFramework>netcoreapp2.0</TargetFramework>
<PublishDir>bin\Release\PublishOutput</PublishDir>
</PropertyGroup>
</Project>
\ No newline at end of file
{ {
"profiles": { "profiles": {
"Stratis.StratisD": { "Stratis.StratisD": {
"commandName": "Project" "commandName": "Project",
"commandLineArgs": "-destreamtest"
}, },
"Stratis.StratisD Test": { "Stratis.StratisD Test": {
"commandName": "Project", "commandName": "Project",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment