Beispiel #1
0
        private static Network InitStratisRegTest()
        {
            // TODO: move this to Networks
            var net = Network.GetNetwork("StratisRegTest");

            if (net != null)
            {
                return(net);
            }

            Block.BlockSignature  = true;
            Transaction.TimeStamp = true;

            var consensus = Network.StratisTest.Consensus.Clone();

            consensus.PowLimit = new Target(uint256.Parse("7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"));

            consensus.PowAllowMinDifficultyBlocks = true;
            consensus.PowNoRetargeting            = true;

            var messageStart = new byte[4];

            messageStart[0] = 0xcd;
            messageStart[1] = 0xf2;
            messageStart[2] = 0xc0;
            messageStart[3] = 0xef;
            var magic = BitConverter.ToUInt32(messageStart, 0);

            var genesis = Network.StratisMain.GetGenesis();

            genesis.Header.Time        = 1494909211;
            genesis.Header.Nonce       = 2433759;
            genesis.Header.Bits        = consensus.PowLimit;
            consensus.HashGenesisBlock = genesis.GetHash(consensus.NetworkOptions);

            Assert(consensus.HashGenesisBlock == uint256.Parse("0x93925104d664314f581bc7ecb7b4bad07bcfabd1cfce4256dbd2faddcf53bd1f"));

            consensus.DefaultAssumeValid = null; // turn off assumevalid for regtest.

            var builder = new NetworkBuilder()
                          .SetName("StratisRegTest")
                          .SetRootFolderName(StratisRootFolderName)
                          .SetDefaultConfigFilename(StratisDefaultConfigFilename)
                          .SetConsensus(consensus)
                          .SetMagic(magic)
                          .SetGenesis(genesis)
                          .SetPort(18444)
                          .SetRPCPort(18442)
                          .SetMaxTimeOffsetSeconds(StratisMaxTimeOffsetSeconds)
                          .SetMaxTipAge(StratisDefaultMaxTipAgeInSeconds)
                          .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.BuildAndRegister());
        }
        private static Network InitStratisTest()
        {
            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("StratisTest")
                          .SetRootFolderName(StratisRootFolderName)
                          .SetDefaultConfigFilename(StratisDefaultConfigFilename)
                          .SetConsensus(consensus)
                          .SetMagic(magic)
                          .SetGenesis(genesis)
                          .SetPort(26178)
                          .SetRPCPort(26174)
                          .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) })

                          .AddDNSSeeds(new[]
            {
                new DNSSeedData("testnode1.stratisplatform.com", "testnode1.stratisplatform.com"),
                new DNSSeedData("testnode2.stratis.cloud", "testnode2.stratis.cloud"),
                new DNSSeedData("testnode3.stratisplatform.com", "testnode3.stratisplatform.com")
            });

            builder.AddSeeds(new[] { new NetworkAddress(IPAddress.Parse("51.141.28.47"), builder.Port) });     // the c# testnet node

            return(builder.BuildAndRegister());
        }
Beispiel #3
0
        private static Network InitPurpleRegTest()
        {
            // TODO: move this to Networks
            var net = Network.GetNetwork("PurpleRegTest");

            if (net != null)
            {
                return(net);
            }

            Block.BlockSignature  = true;
            Transaction.TimeStamp = true;

            var consensus = Network.PurpleTest.Consensus.Clone();

            consensus.PowLimit = new Target(uint256.Parse("7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"));

            consensus.PowAllowMinDifficultyBlocks = true;
            consensus.PowNoRetargeting            = true;

            var messageStart = new byte[4];

            messageStart[0] = 0xdd;
            messageStart[1] = 0xd6;
            messageStart[2] = 0xea;
            messageStart[3] = 0xf7;
            var magic = BitConverter.ToUInt32(messageStart, 0);

            var genesis = Network.PurpleMain.GetGenesis();

            genesis.Header.Time  = 1515944354;
            genesis.Header.Nonce = 2;
            genesis.Header.Bits  = consensus.PowLimit;

            consensus.HashGenesisBlock = genesis.GetHash(consensus.NetworkOptions);

            Assert(consensus.HashGenesisBlock == uint256.Parse("0x59b6c7ad17bd6f16cdc68e4e5e41aad885bbc8b973c7d589b5ef726d39d29360"));

            consensus.DefaultAssumeValid = null; // turn off assumevalid for regtest.

            var builder = new NetworkBuilder()
                          .SetName("PurpleRegTest")
                          .SetConsensus(consensus)
                          .SetMagic(magic)
                          .SetGenesis(genesis)
                          .SetPort(18444)
                          .SetRPCPort(18442)
                          .SetBase58Bytes(Base58Type.PUBKEY_ADDRESS, new byte[] { (51) })
                          .SetBase58Bytes(Base58Type.SCRIPT_ADDRESS, new byte[] { (125) })
                          .SetBase58Bytes(Base58Type.SECRET_KEY, new byte[] { (63 + 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.BuildAndRegister());
        }
        private Network CreateSignet()
        {
            NetworkBuilder builder = new NetworkBuilder();

            builder.SetChainName(SignetName);
            builder.SetNetworkSet(this);
            builder.SetConsensus(new Consensus()
            {
                SubsidyHalvingInterval      = 210000,
                MajorityEnforceBlockUpgrade = 750,
                MajorityRejectBlockOutdated = 950,
                MajorityWindow                = 1000,
                BIP34Hash                     = new uint256(),
                PowLimit                      = new Target(new uint256("00000377ae000000000000000000000000000000000000000000000000000000")),
                PowTargetTimespan             = TimeSpan.FromSeconds(14 * 24 * 60 * 60),
                PowTargetSpacing              = TimeSpan.FromSeconds(10 * 60),
                PowAllowMinDifficultyBlocks   = false,
                PowNoRetargeting              = false,
                RuleChangeActivationThreshold = 1916,
                MinerConfirmationWindow       = 2016,
                CoinbaseMaturity              = 100,
                SupportSegwit                 = true,
                SupportTaproot                = true
            })
            .SetBase58Bytes(Base58Type.PUBKEY_ADDRESS, new byte[] { 111 })
            .SetBase58Bytes(Base58Type.SCRIPT_ADDRESS, new byte[] { 196 })
            .SetBase58Bytes(Base58Type.SECRET_KEY, new byte[] { 239 })
            .SetBase58Bytes(Base58Type.EXT_PUBLIC_KEY, new byte[] { 0x04, 0x35, 0x87, 0xCF })
            .SetBase58Bytes(Base58Type.EXT_SECRET_KEY, new byte[] { 0x04, 0x35, 0x83, 0x94 })
            .SetBech32(Bech32Type.WITNESS_PUBKEY_ADDRESS, "tb")
            .SetBech32(Bech32Type.WITNESS_SCRIPT_ADDRESS, "tb")
            .SetBech32(Bech32Type.TAPROOT_ADDRESS, "tb")
            .SetMagic(GetSignetMagic())
            .SetPort(38333)
            .SetRPCPort(38332)
            .SetName("signet")
            .AddAlias("bitcoin-signet")
            .AddAlias("btc-signet")
#if !NOSOCKET
            .AddSeeds(new[]
            {
                "178.128.221.177",
                "2a01:7c8:d005:390::5"
            }.Select(o => new Protocol.NetworkAddress(System.Net.IPAddress.Parse(o))))
#endif
            .SetGenesis("0100000000000000000000000000000000000000000000000000000000000000000000003ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4a008f4d5fae77031e8ad222030101000000010000000000000000000000000000000000000000000000000000000000000000ffffffff4d04ffff001d0104455468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b73ffffffff0100f2052a01000000434104678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5fac00000000");
            var network = builder.BuildAndRegister();
#if !NOFILEIO
            var data = Network.GetDefaultDataFolder("bitcoin");
            if (data != null)
            {
                var signetCookie = Path.Combine(data, "signet", ".cookie");
                RPC.RPCClient.RegisterDefaultCookiePath(network, signetCookie);
            }
#endif
            return(network);
        }
Beispiel #5
0
        private static Network InitStratisTest()
        {
            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 pchMessageStart = new byte[4];

            pchMessageStart[0] = 0x71;
            pchMessageStart[1] = 0x31;
            pchMessageStart[2] = 0x21;
            pchMessageStart[3] = 0x11;
            var magic = BitConverter.ToUInt32(pchMessageStart, 0);             //0x5223570;

            var genesis = Network.StratisMain.GetGenesis().Clone();

            genesis.Header.Time        = 1493909211;
            genesis.Header.Nonce       = 2433759;
            genesis.Header.Bits        = consensus.PowLimit;
            consensus.HashGenesisBlock = genesis.GetHash();

            assert(consensus.HashGenesisBlock == uint256.Parse("0x00000e246d7b73b88c9ab55f2e5e94d9e22d471def3df5ea448f5576b1d156b9"));

            var builder = new NetworkBuilder()
                          .SetName("StratisTest")
                          .SetConsensus(consensus)
                          .SetMagic(magic)
                          .SetGenesis(genesis)
                          .SetPort(26178)
                          .SetRPCPort(26174)
                          .SetTxFees(10000, 40000, 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) })

#if !NOSOCKET
                          .AddDNSSeeds(new[]
            {
                new DNSSeedData("stratisplatform.com", "testnode1.stratisplatform.com"),
            });

            builder.AddSeeds(new[] { new NetworkAddress(IPAddress.Parse("51.141.51.129"), builder._Port) });                     // the c# testnet node
#endif

                          return(builder.BuildAndRegister());
        }
Beispiel #6
0
        private static Network InitPurpleTest()
        {
            Block.BlockSignature  = true;
            Transaction.TimeStamp = true;

            var consensus = Network.PurpleMain.Consensus.Clone();

            consensus.PowLimit           = new Target(uint256.Parse("0000ffff00000000000000000000000000000000000000000000000000000000"));
            consensus.DefaultAssumeValid = new uint256("0x0000f7d14f2c4e337ec16f0a22bc51d605d66bee7d61a7dfbba81255d0980c50");

            // 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] = 0x16;
            messageStart[1] = 0x24;
            messageStart[2] = 0x43;
            messageStart[3] = 0x04;
            var magic = BitConverter.ToUInt32(messageStart, 0); //0x5223570;

            var genesis = Network.PurpleMain.GetGenesis();

            genesis.Header.Time  = 1515944095;
            genesis.Header.Nonce = 42735;
            genesis.Header.Bits  = consensus.PowLimit;

            consensus.HashGenesisBlock = genesis.GetHash(consensus.NetworkOptions);

            Assert(consensus.HashGenesisBlock == uint256.Parse("0x0000f7d14f2c4e337ec16f0a22bc51d605d66bee7d61a7dfbba81255d0980c50"));

            var builder = new NetworkBuilder()
                          .SetName("PurpleTest")
                          .SetConsensus(consensus)
                          .SetMagic(magic)
                          .SetGenesis(genesis)
                          .SetPort(26178)
                          .SetRPCPort(26174)
                          .SetTxFees(10000, 60000, 10000)
                          .SetBase58Bytes(Base58Type.PUBKEY_ADDRESS, new byte[] { (51) })
                          .SetBase58Bytes(Base58Type.SCRIPT_ADDRESS, new byte[] { (125) })
                          .SetBase58Bytes(Base58Type.SECRET_KEY, new byte[] { (63 + 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) });

            //.AddDNSSeeds(new[]
            //{
            //});

            //builder.AddSeeds(new[] { new NetworkAddress(IPAddress.Parse(""), builder.Port) }); // the c# testnet node

            return(builder.BuildAndRegister());
        }
        private static Network InitStratisMain()
        {
            Block.BlockSignature  = true;
            Transaction.TimeStamp = true;

            var consensus = new Consensus();

            consensus.NetworkOptions = new NetworkOptions()
            {
                IsProofOfStake = true
            };
            consensus.GetPoWHash = (n, h) => Crypto.HashX13.Instance.Hash(h.ToBytes(options: n));

            consensus.SubsidyHalvingInterval      = 210000;
            consensus.MajorityEnforceBlockUpgrade = 750;
            consensus.MajorityRejectBlockOutdated = 950;
            consensus.MajorityWindow = 1000;
            consensus.BuriedDeployments[BuriedDeployments.BIP34] = 227931;
            consensus.BuriedDeployments[BuriedDeployments.BIP65] = 388381;
            consensus.BuriedDeployments[BuriedDeployments.BIP66] = 363725;
            consensus.BIP34Hash                     = new uint256("0x000000000000024b89b42a942fe0d9fea3bb44ab7bd1b19115dd6a759c0808b8");
            consensus.PowLimit                      = new Target(new uint256("00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"));
            consensus.PowTargetTimespan             = TimeSpan.FromSeconds(14 * 24 * 60 * 60); // two weeks
            consensus.PowTargetSpacing              = TimeSpan.FromSeconds(10 * 60);
            consensus.PowAllowMinDifficultyBlocks   = false;
            consensus.PowNoRetargeting              = false;
            consensus.RuleChangeActivationThreshold = 1916; // 95% of 2016
            consensus.MinerConfirmationWindow       = 2016; // nPowTargetTimespan / nPowTargetSpacing

            consensus.BIP9Deployments[BIP9Deployments.TestDummy] = new BIP9DeploymentsParameters(28, 1199145601, 1230767999);
            consensus.BIP9Deployments[BIP9Deployments.CSV]       = new BIP9DeploymentsParameters(0, 1462060800, 1493596800);
            consensus.BIP9Deployments[BIP9Deployments.Segwit]    = new BIP9DeploymentsParameters(1, 0, 0);

            consensus.LastPOWBlock = 12500;

            consensus.ProofOfStakeLimit   = new BigInteger(uint256.Parse("00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff").ToBytes(false));
            consensus.ProofOfStakeLimitV2 = new BigInteger(uint256.Parse("000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffff").ToBytes(false));

            consensus.CoinType = 105;

            consensus.DefaultAssumeValid = new uint256("0x5acb513b96dcb727fbe85c7d50a1266e6414cdd4c3ae66d01313c34a81b466a2"); // 602240

            Block genesis = CreateStratisGenesisBlock(1470467000, 1831645, 0x1e0fffff, 1, Money.Zero);

            consensus.HashGenesisBlock = genesis.GetHash(consensus.NetworkOptions);

            // 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] = 0x70;
            messageStart[1] = 0x35;
            messageStart[2] = 0x22;
            messageStart[3] = 0x05;
            var magic = BitConverter.ToUInt32(messageStart, 0); //0x5223570;

            Assert(consensus.HashGenesisBlock == uint256.Parse("0x0000066e91e46e5a264d42c89e1204963b2ee6be230b443e9159020539d972af"));
            Assert(genesis.Header.HashMerkleRoot == uint256.Parse("0x65a26bc20b0351aebf05829daefa8f7db2f800623439f3c114257c91447f1518"));

            var builder = new NetworkBuilder()
                          .SetName("StratisMain")
                          .SetConsensus(consensus)
                          .SetMagic(magic)
                          .SetGenesis(genesis)
                          .SetPort(16178)
                          .SetRPCPort(16174)
                          .SetTxFees(10000, 60000, 10000)

                          .AddDNSSeeds(new[]
            {
                new DNSSeedData("seednode1.stratisplatform.com", "seednode1.stratisplatform.com"),
                new DNSSeedData("seednode2.stratis.cloud", "seednode2.stratis.cloud"),
                new DNSSeedData("seednode3.stratisplatform.com", "seednode3.stratisplatform.com"),
                new DNSSeedData("seednode4.stratis.cloud", "seednode4.stratis.cloud")
            })

                          .SetBase58Bytes(Base58Type.PUBKEY_ADDRESS, new byte[] { (63) })
                          .SetBase58Bytes(Base58Type.SCRIPT_ADDRESS, new byte[] { (125) })
                          .SetBase58Bytes(Base58Type.SECRET_KEY, new byte[] { (63 + 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) })
                          .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.STEALTH_ADDRESS, new byte[] { 0x2a })
                          .SetBase58Bytes(Base58Type.ASSET_ID, new byte[] { 23 })
                          .SetBase58Bytes(Base58Type.COLORED_ADDRESS, new byte[] { 0x13 })
                          .SetBech32(Bech32Type.WITNESS_PUBKEY_ADDRESS, "bc")
                          .SetBech32(Bech32Type.WITNESS_SCRIPT_ADDRESS, "bc");

            var seed       = new[] { "101.200.198.155", "103.24.76.21", "104.172.24.79" };
            var fixedSeeds = new List <NetworkAddress>();
            // Convert the pnSeeds array into usable address objects.
            Random   rand    = new Random();
            TimeSpan oneWeek = TimeSpan.FromDays(7);

            for (int i = 0; i < seed.Length; i++)
            {
                // It'll only connect to one or two seed nodes because once it connects,
                // it'll get a pile of addresses with newer timestamps.
                NetworkAddress addr = new NetworkAddress();
                // Seed nodes are given a random 'last seen time' of between one and two
                // weeks ago.
                addr.Time     = DateTime.UtcNow - (TimeSpan.FromSeconds(rand.NextDouble() * oneWeek.TotalSeconds)) - oneWeek;
                addr.Endpoint = Utils.ParseIpEndpoint(seed[i], builder.Port);
                fixedSeeds.Add(addr);
            }

            builder.AddSeeds(fixedSeeds);
            return(builder.BuildAndRegister());
        }
Beispiel #8
0
        private static Network InitStratisMain()
        {
            Block.BlockSignature  = true;
            Transaction.TimeStamp = true;

            var consensus = new Consensus();

            consensus.SubsidyHalvingInterval      = 210000;
            consensus.MajorityEnforceBlockUpgrade = 750;
            consensus.MajorityRejectBlockOutdated = 950;
            consensus.MajorityWindow = 1000;
            consensus.BuriedDeployments[BuriedDeployments.BIP34] = 227931;
            consensus.BuriedDeployments[BuriedDeployments.BIP65] = 388381;
            consensus.BuriedDeployments[BuriedDeployments.BIP66] = 363725;
            consensus.BIP34Hash                     = new uint256("0x000000000000024b89b42a942fe0d9fea3bb44ab7bd1b19115dd6a759c0808b8");
            consensus.PowLimit                      = new Target(new uint256("000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")); // ODN
            consensus.PowTargetTimespan             = TimeSpan.FromSeconds(14 * 24 * 60 * 60);                                                     // two weeks
            consensus.PowTargetSpacing              = TimeSpan.FromSeconds(10 * 60);
            consensus.PowAllowMinDifficultyBlocks   = false;
            consensus.PowNoRetargeting              = false;
            consensus.RuleChangeActivationThreshold = 1916; // 95% of 2016
            consensus.MinerConfirmationWindow       = 2016; // nPowTargetTimespan / nPowTargetSpacing

            consensus.BIP9Deployments[BIP9Deployments.TestDummy] = new BIP9DeploymentsParameters(28, 1199145601, 1230767999);
            consensus.BIP9Deployments[BIP9Deployments.CSV]       = new BIP9DeploymentsParameters(0, 1462060800, 1493596800);
            consensus.BIP9Deployments[BIP9Deployments.Segwit]    = new BIP9DeploymentsParameters(1, 0, 0);

            consensus.LastPOWBlock = 12500;

            consensus.ProofOfStakeLimit   = new BigInteger(uint256.Parse("00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff").ToBytes(false));
            consensus.ProofOfStakeLimitV2 = new BigInteger(uint256.Parse("000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffff").ToBytes(false));

            consensus.CoinType = 105;

            var genesis = CreateStratisGenesisBlock(1503532800, 36151509, consensus.PowLimit.ToCompact(), 1, Money.Zero);             // ODN

            consensus.HashGenesisBlock = genesis.GetHash();

            var pchMessageStart = new byte[4];             // ODN

            pchMessageStart[0] = 0x4f;
            pchMessageStart[1] = 0x64;
            pchMessageStart[2] = 0x6e;
            pchMessageStart[3] = 0x31;
            var magic = BitConverter.ToUInt32(pchMessageStart, 0);

            assert(consensus.HashGenesisBlock == uint256.Parse("0x0000006dd8a92f58e952fa61c9402b74a381a69d1930fb5cc12c73273fab5f0a"));             // ODN
            assert(genesis.Header.HashMerkleRoot == uint256.Parse("0x062e0ef40ca83213f645710bf497cc68220d42ac2254d31bbc8fb64a4d207209"));          // ODN

            var builder = new NetworkBuilder()
                          .SetName("StratisMain")
                          .SetConsensus(consensus)
                          .SetMagic(magic)
                          .SetGenesis(genesis)
                          .SetPort(56660)       // ODN
                          .SetRPCPort(56661)    // ODN
                          .SetTxFees(10000, 60000, 10000)
#if !NOSOCKET
                          .AddDNSSeeds(new[]
            {
                new DNSSeedData("obsidianblockchain1.westeurope.cloudapp.azure.com", "obsidianblockchain1.westeurope.cloudapp.azure.com"),
                new DNSSeedData("obsidianblockchain2.westeurope.cloudapp.azure.com", "obsidianblockchain2.westeurope.cloudapp.azure.com"),
                new DNSSeedData("obsidianseednode1.westeurope.cloudapp.azure.com", "obsidianseednode1.westeurope.cloudapp.azure.com")
            })
#endif

                                                                                            //vAlertPubKey = Encoders.Hex.DecodeData("0486bce1bac0d543f104cbff2bd23680056a3b9ea05e1137d2ff90eeb5e08472eb500322593a2cb06fbf8297d7beb6cd30cb90f98153b5b7cce1493749e41e0284");

                          .SetBase58Bytes(Base58Type.PUBKEY_ADDRESS, new byte[] { (75) })   // ODN
                          .SetBase58Bytes(Base58Type.SCRIPT_ADDRESS, new byte[] { (125) })
                          .SetBase58Bytes(Base58Type.SECRET_KEY, new byte[] { (75 + 128) }) // ODN
                          .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), (0xC2), (0x1E) })       // ODN
                          .SetBase58Bytes(Base58Type.EXT_SECRET_KEY, new byte[] { (0x04), (0x88), (0xB2), (0xDD) })       // ODN
                          .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.STEALTH_ADDRESS, new byte[] { 0x2a })
                          .SetBase58Bytes(Base58Type.ASSET_ID, new byte[] { 23 })
                          .SetBase58Bytes(Base58Type.COLORED_ADDRESS, new byte[] { 0x13 })
                          .SetBech32(Bech32Type.WITNESS_PUBKEY_ADDRESS, "bc")
                          .SetBech32(Bech32Type.WITNESS_SCRIPT_ADDRESS, "bc");

#if !NOSOCKET
            var seed        = new[] { "138.68.191.239", "104.131.9.93", "139.59.173.104" };      // ODN
            var vFixedSeeds = new List <NetworkAddress>();
            // Convert the pnSeeds array into usable address objects.
            Random   rand     = new Random();
            TimeSpan nOneWeek = TimeSpan.FromDays(7);
            for (int i = 0; i < seed.Length; i++)
            {
                // It'll only connect to one or two seed nodes because once it connects,
                // it'll get a pile of addresses with newer timestamps.
                NetworkAddress addr = new NetworkAddress();
                // Seed nodes are given a random 'last seen time' of between one and two
                // weeks ago.
                addr.Time     = DateTime.UtcNow - (TimeSpan.FromSeconds(rand.NextDouble() * nOneWeek.TotalSeconds)) - nOneWeek;
                addr.Endpoint = Utils.ParseIpEndpoint(seed[i], builder._Port);
                vFixedSeeds.Add(addr);
            }

            builder.AddSeeds(vFixedSeeds);
#endif
            return(builder.BuildAndRegister());
        }
Beispiel #9
0
        private static Network InitStratisTest()
        {
            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("0x98fa6ef0bca5b431f15fd79dc6f879dc45b83ed4b1bbe933a383ef438321958e"); // 372652

            var builder = new NetworkBuilder()
                .SetName("StratisTest")
                .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) })

                .AddDNSSeeds(new[]
                {
                    new DNSSeedData("testnet1.stratisplatform.com", "testnet1.stratisplatform.com"),
                    new DNSSeedData("testnet2.stratisplatform.com", "testnet2.stratisplatform.com"),
                    new DNSSeedData("testnet3.stratisplatform.com", "testnet3.stratisplatform.com"),
                    new DNSSeedData("testnet4.stratisplatform.com", "testnet4.stratisplatform.com")
                });

            builder.AddSeeds(new[]
            {
                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("191.235.85.131"), 3389), // fassa cloud node  
                new NetworkAddress(IPAddress.Parse("52.232.58.52"), 26178), // neurosploit public node
            }); 

            return builder.BuildAndRegister();
        }
Beispiel #10
0
        private static Network InitPurpleMain()
        {
            Block.BlockSignature  = true;
            Transaction.TimeStamp = true;

            var consensus = new Consensus();

            consensus.NetworkOptions = new NetworkOptions()
            {
                IsProofOfStake = true
            };

            consensus.GetPoWHash = (n, h) => Crypto.CryptoNight.Instance.Hash(h.ToBytes(options: n));

            consensus.SubsidyHalvingInterval      = 262800;
            consensus.MajorityEnforceBlockUpgrade = 750;
            consensus.MajorityRejectBlockOutdated = 950;
            consensus.MajorityWindow = 1000;
            consensus.BuriedDeployments[BuriedDeployments.BIP34] = 0;
            consensus.BuriedDeployments[BuriedDeployments.BIP65] = 0;
            consensus.BuriedDeployments[BuriedDeployments.BIP66] = 0;
            consensus.BIP34Hash                     = new uint256("0x00000301683c2faabee07661d29ad2d873b5274464fcea1f300912467d53ac1d");
            consensus.PowLimit                      = new Target(new uint256("00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"));
            consensus.PowTargetTimespan             = TimeSpan.FromSeconds(24 * 60 * 60); // 1 day
            consensus.PowTargetSpacing              = TimeSpan.FromSeconds(2 * 60);       // 2 minutes
            consensus.PowAllowMinDifficultyBlocks   = false;
            consensus.PowNoRetargeting              = false;
            consensus.RuleChangeActivationThreshold = 684; // 95% of 720
            consensus.MinerConfirmationWindow       = 720; // nPowTargetTimespan / nPowTargetSpacing

            consensus.BIP9Deployments[BIP9Deployments.TestDummy] = new BIP9DeploymentsParameters(28, 0, 0);
            consensus.BIP9Deployments[BIP9Deployments.CSV]       = new BIP9DeploymentsParameters(0, 0, 0);
            consensus.BIP9Deployments[BIP9Deployments.Segwit]    = new BIP9DeploymentsParameters(1, 0, 0);

            consensus.LastPOWBlock = 1324000;

            consensus.ProofOfStakeLimit   = new BigInteger(uint256.Parse("00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff").ToBytes(false));
            consensus.ProofOfStakeLimitV2 = new BigInteger(uint256.Parse("000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffff").ToBytes(false));

            consensus.CoinType = 174;

            consensus.DefaultAssumeValid = new uint256("0x00000301683c2faabee07661d29ad2d873b5274464fcea1f300912467d53ac1d");

            Block genesis = CreateGenesisBlock(1515944103, 51454, consensus.PowLimit, 1, Money.Zero);

            consensus.HashGenesisBlock = genesis.GetHash(consensus.NetworkOptions);

            Assert(consensus.HashGenesisBlock == uint256.Parse("0x00000301683c2faabee07661d29ad2d873b5274464fcea1f300912467d53ac1d"));
            Assert(genesis.Header.HashMerkleRoot == uint256.Parse("0xe0c01fb7ea26f7de5cc362056b01fd8de036c1a166d355e6f07bbf2dfab1c4ee"));

            var messageStart = new byte[4];

            messageStart[0] = 0x11;
            messageStart[1] = 0x10;
            messageStart[2] = 0x19;
            messageStart[3] = 0x07;
            var magic = BitConverter.ToUInt32(messageStart, 0);

            var builder = new NetworkBuilder()
                          .SetName("PurpleMain")
                          .SetConsensus(consensus)
                          .SetMagic(magic)
                          .SetGenesis(genesis)
                          .SetPort(16178)
                          .SetRPCPort(16174)
                          .SetTxFees(10000, 60000, 10000)

                          //.AddDNSSeeds(new[]
                          //{
                          //})

                          .SetBase58Bytes(Base58Type.PUBKEY_ADDRESS, new byte[] { (51) })
                          .SetBase58Bytes(Base58Type.SCRIPT_ADDRESS, new byte[] { (125) })
                          .SetBase58Bytes(Base58Type.SECRET_KEY, new byte[] { (63 + 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) })
                          .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.STEALTH_ADDRESS, new byte[] { 0x2a })
                          .SetBase58Bytes(Base58Type.ASSET_ID, new byte[] { 23 })
                          .SetBase58Bytes(Base58Type.COLORED_ADDRESS, new byte[] { 0x13 })
                          .SetBech32(Bech32Type.WITNESS_PUBKEY_ADDRESS, "bc")
                          .SetBech32(Bech32Type.WITNESS_SCRIPT_ADDRESS, "bc");

            //var seed = new[] { "" };
            //var fixedSeeds = new List<NetworkAddress>();
            //// Convert the pnSeeds array into usable address objects.
            //Random rand = new Random();
            //TimeSpan oneWeek = TimeSpan.FromDays(7);
            //for (int i = 0; i < seed.Length; i++)
            //{
            //    // It'll only connect to one or two seed nodes because once it connects,
            //    // it'll get a pile of addresses with newer timestamps.
            //    NetworkAddress addr = new NetworkAddress();
            //    // Seed nodes are given a random 'last seen time' of between one and two
            //    // weeks ago.
            //    addr.Time = DateTime.UtcNow - (TimeSpan.FromSeconds(rand.NextDouble() * oneWeek.TotalSeconds)) - oneWeek;
            //    addr.Endpoint = Utils.ParseIpEndpoint(seed[i], builder.Port);
            //    fixedSeeds.Add(addr);
            //}

            //builder.AddSeeds(fixedSeeds);
            return(builder.BuildAndRegister());
        }