public StratisMain()
        {
            // 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;
            uint magic = BitConverter.ToUInt32(messageStart, 0); //0x5223570;

            this.Name        = "StratisMain";
            this.Magic       = magic;
            this.DefaultPort = 16178;
            this.DefaultMaxOutboundConnections = 16;
            this.DefaultMaxInboundConnections  = 109;
            this.RPCPort               = 16174;
            this.MaxTipAge             = 2 * 60 * 60;
            this.MinTxFee              = 10000;
            this.FallbackFee           = 10000;
            this.MinRelayTxFee         = 10000;
            this.RootFolderName        = StratisRootFolderName;
            this.DefaultConfigFilename = StratisDefaultConfigFilename;
            this.MaxTimeOffsetSeconds  = 25 * 60;
            this.CoinTicker            = "STRAT";

            var consensusFactory = new PosConsensusFactory();

            // Create the genesis block.
            this.GenesisTime    = 1470467000;
            this.GenesisNonce   = 1831645;
            this.GenesisBits    = 0x1e0fffff;
            this.GenesisVersion = 1;
            this.GenesisReward  = Money.Zero;

            Block genesisBlock = CreateStratisGenesisBlock(consensusFactory, this.GenesisTime, this.GenesisNonce, this.GenesisBits, this.GenesisVersion, this.GenesisReward);

            this.Genesis = genesisBlock;

            // Taken from StratisX.
            var consensusOptions = new PosConsensusOptions(
                maxBlockBaseSize: 1_000_000,
                maxStandardVersion: 2,
                maxStandardTxWeight: 100_000,
                maxBlockSigopsCost: 20_000,
                maxStandardTxSigopsCost: 20_000 / 5
                );

            var buriedDeployments = new BuriedDeploymentsArray
            {
                [BuriedDeployments.BIP34] = 0,
                [BuriedDeployments.BIP65] = 0,
                [BuriedDeployments.BIP66] = 0
            };

            var bip9Deployments = new StratisBIP9Deployments()
            {
                [StratisBIP9Deployments.ColdStaking] = new BIP9DeploymentsParameters(2,
                                                                                     new DateTime(2018, 12, 1, 0, 0, 0, DateTimeKind.Utc),
                                                                                     new DateTime(2019, 12, 1, 0, 0, 0, DateTimeKind.Utc))
            };

            this.Consensus = new NBitcoin.Consensus(
                consensusFactory: consensusFactory,
                consensusOptions: consensusOptions,
                coinType: 105,
                hashGenesisBlock: genesisBlock.GetHash(),
                subsidyHalvingInterval: 210000,
                majorityEnforceBlockUpgrade: 750,
                majorityRejectBlockOutdated: 950,
                majorityWindow: 1000,
                buriedDeployments: buriedDeployments,
                bip9Deployments: bip9Deployments,
                bip34Hash: new uint256("0x000000000000024b89b42a942fe0d9fea3bb44ab7bd1b19115dd6a759c0808b8"),
                ruleChangeActivationThreshold: 1916,                                                                   // 95% of 2016
                minerConfirmationWindow: 2016,                                                                         // nPowTargetTimespan / nPowTargetSpacing
                maxReorgLength: 500,
                defaultAssumeValid: new uint256("0x55a8205ae4bbf18f4d238c43f43005bd66e0b1f679b39e2c5c62cf6903693a5e"), // 795970
                maxMoney: long.MaxValue,
                coinbaseMaturity: 50,
                premineHeight: 2,
                premineReward: Money.Coins(98000000),
                proofOfWorkReward: Money.Coins(4),
                powTargetTimespan: TimeSpan.FromSeconds(14 * 24 * 60 * 60), // two weeks
                powTargetSpacing: TimeSpan.FromSeconds(10 * 60),
                powAllowMinDifficultyBlocks: false,
                powNoRetargeting: false,
                powLimit: new Target(new uint256("00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")),
                minimumChainWork: null,
                isProofOfStake: true,
                lastPowBlock: 12500,
                proofOfStakeLimit: new BigInteger(uint256.Parse("00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff").ToBytes(false)),
                proofOfStakeLimitV2: new BigInteger(uint256.Parse("000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffff").ToBytes(false)),
                proofOfStakeReward: Money.COIN
                );

            this.Base58Prefixes = new byte[12][];
            this.Base58Prefixes[(int)Base58Type.PUBKEY_ADDRESS]             = new byte[] { (63) };
            this.Base58Prefixes[(int)Base58Type.SCRIPT_ADDRESS]             = new byte[] { (125) };
            this.Base58Prefixes[(int)Base58Type.SECRET_KEY]                 = new byte[] { (63 + 128) };
            this.Base58Prefixes[(int)Base58Type.ENCRYPTED_SECRET_KEY_NO_EC] = new byte[] { 0x01, 0x42 };
            this.Base58Prefixes[(int)Base58Type.ENCRYPTED_SECRET_KEY_EC]    = new byte[] { 0x01, 0x43 };
            this.Base58Prefixes[(int)Base58Type.EXT_PUBLIC_KEY]             = new byte[] { (0x04), (0x88), (0xB2), (0x1E) };
            this.Base58Prefixes[(int)Base58Type.EXT_SECRET_KEY]             = new byte[] { (0x04), (0x88), (0xAD), (0xE4) };
            this.Base58Prefixes[(int)Base58Type.PASSPHRASE_CODE]            = new byte[] { 0x2C, 0xE9, 0xB3, 0xE1, 0xFF, 0x39, 0xE2 };
            this.Base58Prefixes[(int)Base58Type.CONFIRMATION_CODE]          = new byte[] { 0x64, 0x3B, 0xF6, 0xA8, 0x9A };
            this.Base58Prefixes[(int)Base58Type.STEALTH_ADDRESS]            = new byte[] { 0x2a };
            this.Base58Prefixes[(int)Base58Type.ASSET_ID]        = new byte[] { 23 };
            this.Base58Prefixes[(int)Base58Type.COLORED_ADDRESS] = new byte[] { 0x13 };

            this.Checkpoints = new Dictionary <int, CheckpointInfo>
            {
                { 0, new CheckpointInfo(new uint256("0x0000066e91e46e5a264d42c89e1204963b2ee6be230b443e9159020539d972af"), new uint256("0x0000000000000000000000000000000000000000000000000000000000000000")) },
                { 2, new CheckpointInfo(new uint256("0xbca5936f638181e74a5f1e9999c95b0ce77da48c2688399e72bcc53a00c61eff"), new uint256("0x7d61c139a471821caa6b7635a4636e90afcfe5e195040aecbc1ad7d24924db1e")) }, // Premine
                { 50, new CheckpointInfo(new uint256("0x0353b43f4ce80bf24578e7c0141d90d7962fb3a4b4b4e5a17925ca95e943b816"), new uint256("0x7c2af3b10d13f9d2bc6063baaf7f0860d90d870c994378144f9bf85d0d555061")) },
                { 100, new CheckpointInfo(new uint256("0x688468a8aa48cd1c2197e42e7d8acd42760b7e2ac4bcab9d18ac149a673e16f6"), new uint256("0xcf2b1e9e76aaa3d96f255783eb2d907bf6ccb9c1deeb3617149278f0e4a1ab1b")) },
                { 150, new CheckpointInfo(new uint256("0xe4ae9663519abec15e28f68bdb2cb89a739aee22f53d1573048d69141db6ee5d"), new uint256("0xa6c17173e958dc716cc0892ce33dad8bc327963d78a16c436264ceae43d584ce")) },
                { 2000, new CheckpointInfo(new uint256("0x7902db2766bb6a5a1c5b9624afc733ab2ffff5875b867d87c3b74821290aaca2"), new uint256("0x0b0b48c5ad4557b973f7c9e9e7d4fcc828c7c084e6d31b359c07c6810d24d922")) },
                { 4000, new CheckpointInfo(new uint256("0x383c951dcd8250d42141a2341dbcb449d59f87cc3b1b60d0e34765b8ebc25f41"), new uint256("0x9270895f93216d4dac1cfca1fbf5d4b3c468b719d37f9c2dbc4fe887e41fd55b")) },
                { 10000, new CheckpointInfo(new uint256("0xad873f39e811afd15aba794bd40aaeaa4843eddf193d56f4a23007834e5aefb0"), new uint256("0x895eab2f44472715e45d5ef1dab893a9c3d9860dc4c4eecd02b4c365f19bf08f")) },
                { 127500, new CheckpointInfo(new uint256("0x4773ca7512489df22de03aa03938412fab5b46154b05df004b97bcbeaa184078"), new uint256("0x619743c02ebaff06b90fcc5c60c52dba8aa3fdb6ba3800aae697cbb3c5483f17")) },
                { 128943, new CheckpointInfo(new uint256("0x36bcaa27a53d3adf22b2064150a297adb02ac39c24263a5ceb73856832d49679"), new uint256("0xa3a6fd04e41fcaae411a3990aaabcf5e086d2d06c72c849182b27b4de8c2c42a")) },
                { 136601, new CheckpointInfo(new uint256("0xf5c5210c55ff1ef9c04715420a82728e1647f3473e31dc478b3745a97b4a6d10"), new uint256("0x42058fabe21f7b118a9e358eaf9ef574dadefd024244899e71f2f6d618161e16")) }, // Hardfork to V2 - Drifting Bug Fix
                { 170000, new CheckpointInfo(new uint256("0x22b10952e0cf7e85bfc81c38f1490708f195bff34d2951d193cc20e9ca1fc9d5"), new uint256("0xa4942a6c99cba397cf2b18e4b912930fe1e64a7413c3d97c5a926c2af9073091")) },
                { 200000, new CheckpointInfo(new uint256("0x2391dd493be5d0ff0ef57c3b08c73eefeecc2701b80f983054bb262f7a146989"), new uint256("0x253152d129e82c30c584197deb6833502eff3ec2f30014008f75842d7bb48453")) },
                { 250000, new CheckpointInfo(new uint256("0x681c70fab7c1527246138f0cf937f0eb013838b929fbe9a831af02a60fc4bf55"), new uint256("0x24eed95e00c90618aa9d137d2ee273267285c444c9cde62a25a3e880c98a3685")) },
                { 300000, new CheckpointInfo(new uint256("0xd10ca8c2f065a49ae566c7c9d7a2030f4b8b7f71e4c6fc6b2a02509f94cdcd44"), new uint256("0x39c4dd765b49652935524248b4de4ccb604df086d0723bcd81faf5d1c2489304")) },
                { 350000, new CheckpointInfo(new uint256("0xe2b76d1a068c4342f91db7b89b66e0f2146d3a4706c21f3a262737bb7339253a"), new uint256("0xd1dd94985eaaa028c893687a7ddf89143dcf0176918f958c2d01f33d64910399")) },
                { 390000, new CheckpointInfo(new uint256("0x4682737abc2a3257fdf4c3c119deb09cbac75981969e2ffa998b4f76b7c657bb"), new uint256("0xd84b204ee94499ff65262328a428851fb4f4d2741e928cdd088fdf1deb5413b8")) },
                { 394000, new CheckpointInfo(new uint256("0x42857fa2bc15d45cdcaae83411f755b95985da1cb464ee23f6d40936df523e9f"), new uint256("0x2314b336906a2ed2a39cbdf6fc0622530709c62dbb3a3729de17154fc9d1a7c4")) },
                { 400000, new CheckpointInfo(new uint256("0x4938d5cf450b4e2d9072558971223555055aa3987b634a8bb2e97f95d1a3c501"), new uint256("0x1756c127f0ac7029cf095a6c3ed9b7d206d0e36744d8b3cef306002f9f901a31")) },
                { 450000, new CheckpointInfo(new uint256("0x7699e07ac18c25ac042deb6b985e2decfd6034cb6361de2152a2d704ef785bac"), new uint256("0xa140a86a03c4f852d8a651f6386a02a0262e7bbf841ede8b54541c011c51ba0e")) },
                { 500000, new CheckpointInfo(new uint256("0x558700d99239e64017d10910466719fe1edc6f863bd3de254b89ba828818ea47"), new uint256("0x6a0b7dab4a7aa9ea2477cddffe5a976c9423454835054a39c19d37613002638f")) },
                { 550000, new CheckpointInfo(new uint256("0x83d074957f509772b1fbbfaeb7bdc52932c540d54e205b92a7d4e92f68957eb4"), new uint256("0x012b63ad7d50606f2cafb1a7806ea90f4981c56b5407725aeeff34e3c584433c")) },
                { 600000, new CheckpointInfo(new uint256("0xcd05c75c0c47060d78508095c0766452f80e2defb6a4641ac603742a2ccf2207"), new uint256("0x1f25507e09b199a71d5879811376856e5fb3da1da3d522204c017eec3b6c4dad")) },
                { 650000, new CheckpointInfo(new uint256("0xa2814a439b33662f43bdbc8ab089d368524975bb53a08326395e57456cba8d39"), new uint256("0x192a2ef70e2280cf05aa5655f496a109b2445d0ddda62531e9bce9aaced1fe54")) },
                { 700000, new CheckpointInfo(new uint256("0x782b2506bb67bb448ff56aa946f7aad6b63a6b27d8c5818725a56b568f25b9ce"), new uint256("0xf23dc64b130d80790a83a86913f619afaeef10e1fd24e4b42af9387ec935edd6")) },
                { 750000, new CheckpointInfo(new uint256("0x4db98bd41a2f9ee845cc89ac03109686f615f4d0dcd81e0488005c1616fa692c"), new uint256("0x9f620af75bc27a0e4b503deaf7f052ba112a49bb74fb6446350642bc2ac9d93b")) },
                { 800000, new CheckpointInfo(new uint256("0x161da1d97d35d6897dbdae110617bb839805f8b02d33ac23d227a87cacbfac78"), new uint256("0xe95049a313345f26bfa90094ceb6400f43359fc43fc5f1471918d98bc4ab3bac")) },
                { 850000, new CheckpointInfo(new uint256("0xc3a249b01795b22858aa00fd0973471fcd769a14f4f9cf0abe6651ac3e6ade19"), new uint256("0x5de8766ed4cfcc3ce9d74f38196596c6f91b9ff62cbd20abbfa991dca54d2bd4")) },
                { 1000000, new CheckpointInfo(new uint256("0x3cdd812d9a7e249e7ad825cb372fbb0889f5b515a4a924a4aa3281d8e334d559"), new uint256("0x36a51839ceb5866b3251c9e5e0049a0209fe0b1861b2ada118fe00a8cacf62df")) }
            };

            var encoder = new Bech32Encoder("bc");

            this.Bech32Encoders = new Bech32Encoder[2];
            this.Bech32Encoders[(int)Bech32Type.WITNESS_PUBKEY_ADDRESS] = encoder;
            this.Bech32Encoders[(int)Bech32Type.WITNESS_SCRIPT_ADDRESS] = encoder;

            this.DNSSeeds = new List <DNSSeedData>
            {
                new DNSSeedData("mainnet1.stratisplatform.com", "mainnet1.stratisplatform.com"),
                new DNSSeedData("mainnet2.stratisnetwork.com", "mainnet2.stratisnetwork.com"),
                new DNSSeedData("mainnet3.stratisplatform.com", "mainnet3.stratisplatform.com"),
                new DNSSeedData("mainnet4.stratisnetwork.com", "mainnet4.stratisnetwork.com")
            };

            string[] seedNodes = { "101.200.198.155", "103.24.76.21", "104.172.24.79", "13.78.39.87", "23.102.35.247" };
            this.SeedNodes = ConvertToNetworkAddresses(seedNodes, this.DefaultPort).ToList();

            this.StandardScriptsRegistry = new StratisStandardScriptsRegistry();

            Assert(this.Consensus.HashGenesisBlock == uint256.Parse("0x0000066e91e46e5a264d42c89e1204963b2ee6be230b443e9159020539d972af"));
            Assert(this.Genesis.Header.HashMerkleRoot == uint256.Parse("0x65a26bc20b0351aebf05829daefa8f7db2f800623439f3c114257c91447f1518"));
        }
        public StratisTest()
        {
            // 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;
            uint magic = BitConverter.ToUInt32(messageStart, 0); // 0x11213171;

            this.Name        = "StratisTest";
            this.NetworkType = NetworkType.Testnet;
            this.Magic       = magic;
            this.DefaultPort = 26178;
            this.DefaultMaxOutboundConnections = 16;
            this.DefaultMaxInboundConnections  = 109;
            this.DefaultRPCPort        = 26174;
            this.DefaultAPIPort        = 38221;
            this.CoinTicker            = "TSTRAT";
            this.DefaultBanTimeSeconds = 16000; // 500 (MaxReorg) * 64 (TargetSpacing) / 2 = 4 hours, 26 minutes and 40 seconds

            var powLimit = new Target(new uint256("0000ffff00000000000000000000000000000000000000000000000000000000"));

            var consensusFactory = new PosConsensusFactory();

            // Create the genesis block.
            this.GenesisTime    = 1470467000;
            this.GenesisNonce   = 1831645;
            this.GenesisBits    = 0x1e0fffff;
            this.GenesisVersion = 1;
            this.GenesisReward  = Money.Zero;

            Block genesisBlock = CreateStratisGenesisBlock(consensusFactory, this.GenesisTime, this.GenesisNonce, this.GenesisBits, this.GenesisVersion, this.GenesisReward);

            genesisBlock.Header.Time  = 1493909211;
            genesisBlock.Header.Nonce = 2433759;
            genesisBlock.Header.Bits  = powLimit;

            this.Genesis = genesisBlock;

            // Taken from StratisX.
            var consensusOptions = new PosConsensusOptions(
                maxBlockBaseSize: 1_000_000,
                maxStandardVersion: 2,
                maxStandardTxWeight: 100_000,
                maxBlockSigopsCost: 20_000,
                maxStandardTxSigopsCost: 20_000 / 5
                );

            var buriedDeployments = new BuriedDeploymentsArray
            {
                [BuriedDeployments.BIP34] = 0,
                [BuriedDeployments.BIP65] = 0,
                [BuriedDeployments.BIP66] = 0
            };

            var bip9Deployments = new StratisBIP9Deployments()
            {
                [StratisBIP9Deployments.ColdStaking] = new BIP9DeploymentsParameters(2,
                                                                                     new DateTime(2018, 11, 1, 0, 0, 0, DateTimeKind.Utc),
                                                                                     new DateTime(2019, 6, 1, 0, 0, 0, DateTimeKind.Utc))
            };

            this.Consensus = new NBitcoin.Consensus(
                consensusFactory: consensusFactory,
                consensusOptions: consensusOptions,
                coinType: 105,
                hashGenesisBlock: genesisBlock.GetHash(),
                subsidyHalvingInterval: 210000,
                majorityEnforceBlockUpgrade: 750,
                majorityRejectBlockOutdated: 950,
                majorityWindow: 1000,
                buriedDeployments: buriedDeployments,
                bip9Deployments: bip9Deployments,
                bip34Hash: new uint256("0x000000000000024b89b42a942fe0d9fea3bb44ab7bd1b19115dd6a759c0808b8"),
                ruleChangeActivationThreshold: 1916,                                                                   // 95% of 2016
                minerConfirmationWindow: 2016,                                                                         // nPowTargetTimespan / nPowTargetSpacing
                maxReorgLength: 500,
                defaultAssumeValid: new uint256("0xc9a15c9dd87c6219b273f93442b87fdaf9eebb4f3059d8ed8239c41a4ab3e730"), // 780785
                maxMoney: long.MaxValue,
                coinbaseMaturity: 10,
                premineHeight: 2,
                premineReward: Money.Coins(98000000),
                proofOfWorkReward: Money.Coins(4),
                powTargetTimespan: TimeSpan.FromSeconds(14 * 24 * 60 * 60), // two weeks
                powTargetSpacing: TimeSpan.FromSeconds(10 * 60),
                powAllowMinDifficultyBlocks: false,
                posNoRetargeting: false,
                powNoRetargeting: false,
                powLimit: powLimit,
                minimumChainWork: null,
                isProofOfStake: true,
                lastPowBlock: 12500,
                proofOfStakeLimit: new BigInteger(uint256.Parse("00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff").ToBytes(false)),
                proofOfStakeLimitV2: new BigInteger(uint256.Parse("000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffff").ToBytes(false)),
                proofOfStakeReward: Money.COIN
                );

            this.Base58Prefixes[(int)Base58Type.PUBKEY_ADDRESS] = new byte[] { (65) };
            this.Base58Prefixes[(int)Base58Type.SCRIPT_ADDRESS] = new byte[] { (196) };
            this.Base58Prefixes[(int)Base58Type.SECRET_KEY]     = new byte[] { (65 + 128) };

            this.Checkpoints = new Dictionary <int, CheckpointInfo>
            {
                { 0, new CheckpointInfo(new uint256("0x00000e246d7b73b88c9ab55f2e5e94d9e22d471def3df5ea448f5576b1d156b9"), new uint256("0x0000000000000000000000000000000000000000000000000000000000000000")) },
                { 2, new CheckpointInfo(new uint256("0x56959b1c8498631fb0ca5fe7bd83319dccdc6ac003dccb3171f39f553ecfa2f2"), new uint256("0x13f4c27ca813aefe2d9018077f8efeb3766796b9144fcc4cd51803bf4376ab02")) },
                { 50000, new CheckpointInfo(new uint256("0xb42c18eacf8fb5ed94eac31943bd364451d88da0fd44cc49616ffea34d530ad4"), new uint256("0x824934ddc5f935e854ac59ae7f5ed25f2d29a7c3914cac851f3eddb4baf96d78")) },
                { 100000, new CheckpointInfo(new uint256("0xf9e2f7561ee4b92d3bde400d251363a0e8924204c326da7f4ad9ccc8863aad79"), new uint256("0xdef8d92d20becc71f662ee1c32252aca129f1bf4744026b116d45d9bfe67e9fb")) },
                { 150000, new CheckpointInfo(new uint256("0x08b7c20a450252ddf9ce41dbeb92ecf54932beac9090dc8250e933ad3a175381"), new uint256("0xf05dad15f733ae0acbd34adc449be9429099dbee5fa9ecd8e524cf28e9153adb")) },
                { 200000, new CheckpointInfo(new uint256("0x8609cc873222a0573615788dc32e377b88bfd6a0015791f627d969ee3a415115"), new uint256("0xfa28c1f20a8162d133607c6a1c8997833befac3efd9076567258a7683ac181fa")) },
                { 250000, new CheckpointInfo(new uint256("0xdd664e15ac679a6f3b96a7176303956661998174a697ad8231f154f1e32ff4a3"), new uint256("0x19fc0fa29418f8b19cbb6557c1c79dfd0eff6779c0eaaec5d245c5cdf3c96d78")) },
                { 300000, new CheckpointInfo(new uint256("0x2409eb5ae72c80d5b37c77903d75a8e742a33843ab633935ce6e5264db962e23"), new uint256("0xf5ec7af55516b8e264ed280e9a5dba0180a4a9d3713351bfea275b18f3f1514e")) },
                { 350000, new CheckpointInfo(new uint256("0x36811041e9060f4b4c26dc20e0850dca5efaabb60618e3456992e9c0b1b2120e"), new uint256("0xbfda55ef0756bcee8485e15527a2b8ca27ca877aa09c88e363ef8d3253cdfd1c")) },
                { 400000, new CheckpointInfo(new uint256("0xb6abcb933d3e3590345ca5d3abb697461093313f8886568ac8ae740d223e56f6"), new uint256("0xfaf5fcebee3ec0df5155393a99da43de18b12e620fef5edb111a791ecbfaa63a")) },
                { 650000, new CheckpointInfo(new uint256("0x7065de13f14749798ebf70993af4debeb5bb2a968f5862ca232a2436fbac2fd0"), new uint256("0x175eb3708ffd9a1ca5938b0df0bf1f55af39ec8e2e4c396ed97c1406c4a5d701")) },
                { 720000, new CheckpointInfo(new uint256("0x041fb27f49f96be3a10034db0148290e9e2551b1c6196823b46521c36c69fbe2"), new uint256("0xba96e9c84c4134a2204d07e41b7738a9ae6e56c4322f443dcfe11421f1643e6e")) }, // 14-01-2019
                { 900000, new CheckpointInfo(new uint256("0xd48702aabf727570d96bbcd8bad220427a35113efa90c3adc91ae94a4b09c6e5"), new uint256("0x31515a27d55f819131f2dc0a263f46fb63c56ec0ff129bcb0b1c13d5922a62c2")) } // 14-01-2019
            };

            this.DNSSeeds = new List <DNSSeedData>
            {
                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")
            };

            this.SeedNodes = new List <NetworkAddress>
            {
                new NetworkAddress(IPAddress.Parse("51.140.231.125"), 26178), // danger cloud node
                new NetworkAddress(IPAddress.Parse("13.70.81.5"), 26178),     // beard cloud node
                new NetworkAddress(IPAddress.Parse("191.235.85.131"), 26178), // fassa cloud node
            };

            this.StandardScriptsRegistry = new StratisStandardScriptsRegistry();

            // 64 below should be changed to TargetSpacingSeconds when we move that field.
            Assert(this.DefaultBanTimeSeconds <= this.Consensus.MaxReorgLength * 64 / 2);
            Assert(this.Consensus.HashGenesisBlock == uint256.Parse("0x00000e246d7b73b88c9ab55f2e5e94d9e22d471def3df5ea448f5576b1d156b9"));

            this.RegisterRules(this.Consensus);
            this.RegisterMempoolRules(this.Consensus);
        }
示例#3
0
        public StratisRegTest()
        {
            var messageStart = new byte[4];

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

            this.Name        = "StratisRegTest";
            this.NetworkType = NetworkType.Regtest;
            this.Magic       = magic;
            this.DefaultPort = 18444;
            this.DefaultMaxOutboundConnections = 16;
            this.DefaultMaxInboundConnections  = 109;
            this.DefaultRPCPort = 18442;
            this.DefaultAPIPort = 38221;
            this.CoinTicker     = "TSTRAT";

            var powLimit = new Target(new uint256("7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"));

            var consensusFactory = new PosConsensusFactory();

            // Create the genesis block.
            this.GenesisTime    = 1470467000;
            this.GenesisNonce   = 1831645;
            this.GenesisBits    = 0x1e0fffff;
            this.GenesisVersion = 1;
            this.GenesisReward  = Money.Zero;

            Block genesisBlock = CreateStratisGenesisBlock(consensusFactory, this.GenesisTime, this.GenesisNonce, this.GenesisBits, this.GenesisVersion, this.GenesisReward);

            genesisBlock.Header.Time  = 1494909211;
            genesisBlock.Header.Nonce = 2433759;
            genesisBlock.Header.Bits  = powLimit;

            this.Genesis = genesisBlock;

            // Taken from StratisX.
            var consensusOptions = new PosConsensusOptions(
                maxBlockBaseSize: 1_000_000,
                maxStandardVersion: 2,
                maxStandardTxWeight: 100_000,
                maxBlockSigopsCost: 20_000,
                maxStandardTxSigopsCost: 20_000 / 5
                );

            var buriedDeployments = new BuriedDeploymentsArray
            {
                [BuriedDeployments.BIP34] = 0,
                [BuriedDeployments.BIP65] = 0,
                [BuriedDeployments.BIP66] = 0
            };

            var bip9Deployments = new StratisBIP9Deployments()
            {
                // Always active on StratisRegTest.
                [StratisBIP9Deployments.ColdStaking] = new BIP9DeploymentsParameters(1, BIP9DeploymentsParameters.AlwaysActive, 999999999)
            };

            this.Consensus = new NBitcoin.Consensus(
                consensusFactory: consensusFactory,
                consensusOptions: consensusOptions,
                coinType: 105,
                hashGenesisBlock: genesisBlock.GetHash(),
                subsidyHalvingInterval: 210000,
                majorityEnforceBlockUpgrade: 750,
                majorityRejectBlockOutdated: 950,
                majorityWindow: 1000,
                buriedDeployments: buriedDeployments,
                bip9Deployments: bip9Deployments,
                bip34Hash: new uint256("0x000000000000024b89b42a942fe0d9fea3bb44ab7bd1b19115dd6a759c0808b8"),
                ruleChangeActivationThreshold: 1916, // 95% of 2016
                minerConfirmationWindow: 2016,       // nPowTargetTimespan / nPowTargetSpacing
                maxReorgLength: 500,
                defaultAssumeValid: null,            // turn off assumevalid for regtest.
                maxMoney: long.MaxValue,
                coinbaseMaturity: 10,
                premineHeight: 2,
                premineReward: Money.Coins(98000000),
                proofOfWorkReward: Money.Coins(4),
                powTargetTimespan: TimeSpan.FromSeconds(14 * 24 * 60 * 60), // two weeks
                powTargetSpacing: TimeSpan.FromSeconds(10 * 60),
                powAllowMinDifficultyBlocks: true,
                posNoRetargeting: true,
                powNoRetargeting: true,
                powLimit: powLimit,
                minimumChainWork: null,
                isProofOfStake: true,
                lastPowBlock: 12500,
                proofOfStakeLimit: new BigInteger(uint256.Parse("00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff").ToBytes(false)),
                proofOfStakeLimitV2: new BigInteger(uint256.Parse("000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffff").ToBytes(false)),
                proofOfStakeReward: Money.COIN
                );

            this.Base58Prefixes[(int)Base58Type.PUBKEY_ADDRESS] = new byte[] { (65) };
            this.Base58Prefixes[(int)Base58Type.SCRIPT_ADDRESS] = new byte[] { (196) };
            this.Base58Prefixes[(int)Base58Type.SECRET_KEY]     = new byte[] { (65 + 128) };

            this.Checkpoints = new Dictionary <int, CheckpointInfo>()
            {
                // Fake checkpoint to prevent PH to be activated.
                // TODO: Once PH is complete, this should be removed
                // { 100_000 , new CheckpointInfo(uint256.Zero, uint256.Zero) }
            };
            this.DNSSeeds  = new List <DNSSeedData>();
            this.SeedNodes = new List <NetworkAddress>();

            Assert(this.Consensus.HashGenesisBlock == uint256.Parse("0x93925104d664314f581bc7ecb7b4bad07bcfabd1cfce4256dbd2faddcf53bd1f"));
        }
示例#4
0
        public SolarisMain()
        {
            // 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] = 0x36;
            messageStart[2] = 0x23;
            messageStart[3] = 0x06;
            uint magic = BitConverter.ToUInt32(messageStart, 0); //0x6233671;

            this.Name        = "SolarisMain";
            this.NetworkType = NetworkType.Mainnet;
            this.Magic       = magic;
            this.DefaultPort = 60000;
            this.DefaultMaxOutboundConnections = 16;
            this.DefaultMaxInboundConnections  = 109;
            this.DefaultRPCPort        = 61000;
            this.DefaultAPIPort        = 62000;
            this.MaxTipAge             = 2 * 60 * 60;
            this.MinTxFee              = 10000;
            this.FallbackFee           = 10000;
            this.MinRelayTxFee         = 10000;
            this.RootFolderName        = SolarisRootFolderName;
            this.DefaultConfigFilename = SolarisDefaultConfigFilename;
            this.MaxTimeOffsetSeconds  = 25 * 60;
            this.CoinTicker            = "XLR";

            var consensusFactory = new PosConsensusFactory();

            // Create the genesis block.
            this.GenesisTime    = 1572266171;
            this.GenesisNonce   = 1834723;
            this.GenesisBits    = 0x1e0fffff;
            this.GenesisVersion = 1;
            this.GenesisReward  = Money.Zero;

            Block genesisBlock = CreateSolarisGenesisBlock(consensusFactory, this.GenesisTime, this.GenesisNonce, this.GenesisBits, this.GenesisVersion, this.GenesisReward);

            this.Genesis = genesisBlock;

            // Taken from SolarisX.
            var consensusOptions = new PosConsensusOptions(
                maxBlockBaseSize: 1_000_000,
                maxStandardVersion: 2,
                maxStandardTxWeight: 100_000,
                maxBlockSigopsCost: 20_000,
                maxStandardTxSigopsCost: 20_000 / 5
                );

            var buriedDeployments = new BuriedDeploymentsArray
            {
                [BuriedDeployments.BIP34] = 0,
                [BuriedDeployments.BIP65] = 0,
                [BuriedDeployments.BIP66] = 0
            };

            var bip9Deployments = new StratisBIP9Deployments
            {
                [StratisBIP9Deployments.ColdStaking] = new BIP9DeploymentsParameters(2, BIP9DeploymentsParameters.AlwaysActive, 999999999)
            };

            this.Consensus = new Consensus(
                consensusFactory: consensusFactory,
                consensusOptions: consensusOptions,
                coinType: 450,
                hashGenesisBlock: genesisBlock.GetHash(),
                subsidyHalvingInterval: 210000,
                majorityEnforceBlockUpgrade: 750,
                majorityRejectBlockOutdated: 950,
                majorityWindow: 1000,
                buriedDeployments: buriedDeployments,
                bip9Deployments: bip9Deployments,
                bip34Hash: new uint256("0x0000000000000000000000000000000000000000000000000000000000000000"),
                ruleChangeActivationThreshold: 1916,                                                                   // 95% of 2016
                minerConfirmationWindow: 2016,                                                                         // nPowTargetTimespan / nPowTargetSpacing
                maxReorgLength: 500,
                defaultAssumeValid: new uint256("0x0000000000000000000000000000000000000000000000000000000000000000"), // 0
                maxMoney: long.MaxValue,
                coinbaseMaturity: 50,
                premineHeight: 2,
                premineReward: Money.Coins(2032000),
                proofOfWorkReward: Money.Coins(0.25m),
                powTargetTimespan: TimeSpan.FromSeconds(14 * 24 * 60 * 60), // two weeks
                powTargetSpacing: TimeSpan.FromSeconds(10 * 60),
                powAllowMinDifficultyBlocks: false,
                posNoRetargeting: false,
                powNoRetargeting: false,
                powLimit: new Target(new uint256("00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")),
                minimumChainWork: null,
                isProofOfStake: true,
                lastPowBlock: 2500,
                proofOfStakeLimit: new BigInteger(uint256.Parse("00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff").ToBytes(false)),
                proofOfStakeLimitV2: new BigInteger(uint256.Parse("000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffff").ToBytes(false)),
                proofOfStakeReward: Money.Coins(0.25m)
                );

            this.Base58Prefixes = new byte[12][];
            this.Base58Prefixes[(int)Base58Type.PUBKEY_ADDRESS]             = new byte[] { (75) };
            this.Base58Prefixes[(int)Base58Type.SCRIPT_ADDRESS]             = new byte[] { (125) };
            this.Base58Prefixes[(int)Base58Type.SECRET_KEY]                 = new byte[] { (63 + 128) };
            this.Base58Prefixes[(int)Base58Type.ENCRYPTED_SECRET_KEY_NO_EC] = new byte[] { 0x01, 0x42 };
            this.Base58Prefixes[(int)Base58Type.ENCRYPTED_SECRET_KEY_EC]    = new byte[] { 0x01, 0x43 };
            this.Base58Prefixes[(int)Base58Type.EXT_PUBLIC_KEY]             = new byte[] { (0x04), (0x88), (0xB2), (0x1E) };
            this.Base58Prefixes[(int)Base58Type.EXT_SECRET_KEY]             = new byte[] { (0x04), (0x88), (0xAD), (0xE4) };
            this.Base58Prefixes[(int)Base58Type.PASSPHRASE_CODE]            = new byte[] { 0x2C, 0xE9, 0xB3, 0xE1, 0xFF, 0x39, 0xE2 };
            this.Base58Prefixes[(int)Base58Type.CONFIRMATION_CODE]          = new byte[] { 0x64, 0x3B, 0xF6, 0xA8, 0x9A };
            this.Base58Prefixes[(int)Base58Type.STEALTH_ADDRESS]            = new byte[] { 0x2a };
            this.Base58Prefixes[(int)Base58Type.ASSET_ID]        = new byte[] { 23 };
            this.Base58Prefixes[(int)Base58Type.COLORED_ADDRESS] = new byte[] { 0x13 };

            this.Checkpoints = new Dictionary <int, CheckpointInfo>
            {
                { 0, new CheckpointInfo(new uint256("0xa3a98f72634c7d098164926b83ff136b66d1cafbb9aeb5a3b8d18da02937f79f"), new uint256("0x0000000000000000000000000000000000000000000000000000000000000000")) },
                { 1409, new CheckpointInfo(new uint256("0xd2f9c43c57fbb066daf940f80e9ce1a63d5d444e9e337b1491f79c36288ab0da"), new uint256("0x602e263081a44650085947dbe99fd0c51041389d79fb9c3f379f8a403a74d977")) },
                { 2900, new CheckpointInfo(new uint256("0x21e7bce830a7646e2ea049b7f37a42f032e09e8b2526cbf8d69fb094014826eb"), new uint256("0x83590685c1d2dfcb0ca9220af9447677a375cbfaaaf4305be309bb7141e41a47")) },
                { 191746, new CheckpointInfo(new uint256("0xf0120c783073c531cccb269d01029aaddd995efa4d8bad2546ec7b7c48f9415e"), new uint256("0xb6fe3b405b5016c94c29a98c2a90c83f70769c9c1718b157d44c6910099637a9")) },
                { 318939, new CheckpointInfo(new uint256("0x7cc0ec2e39e4199de65a2d804dd7f62f0d0b297d1bc42698fdfe4aa212422b98"), new uint256("0x4870f1e1e188188ff75ee08614ddecd8209128dceebb2edef8df1f77cc81db4a")) }
            };

            this.Bech32Encoders = new Bech32Encoder[2];
            this.Bech32Encoders[(int)Bech32Type.WITNESS_PUBKEY_ADDRESS] = null;
            this.Bech32Encoders[(int)Bech32Type.WITNESS_SCRIPT_ADDRESS] = null;

            this.DNSSeeds = new List <DNSSeedData>
            {
                new DNSSeedData("node1.solarisdns.network", "node1.solarisdns.network"),
                new DNSSeedData("node2.solarisdns.network", "node2.solarisdns.network"),
                new DNSSeedData("node3.solarisdns.network", "node3.solarisdns.network"),
                new DNSSeedData("node4.solarisdns.network", "node4.solarisdns.network"),
                new DNSSeedData("node5.solarisdns.network", "node5.solarisdns.network")
            };

            this.SeedNodes = new List <NetworkAddress>
            {
                new NetworkAddress(IPAddress.Parse("3.125.89.141"), 60000),   //Official node 1 (Frankfurt)
                new NetworkAddress(IPAddress.Parse("18.139.112.210"), 60000), //Official node 2 (Singapore)
                new NetworkAddress(IPAddress.Parse("18.211.206.174"), 60000), //Official node 3 (USA East)
                new NetworkAddress(IPAddress.Parse("54.219.124.108"), 60000), //Official node 4 (USA West)
                new NetworkAddress(IPAddress.Parse("136.144.247.170"), 60000) //Official node 5 (The Netherlands)
            };

            this.StandardScriptsRegistry = new StratisStandardScriptsRegistry();

            Assert(this.Consensus.HashGenesisBlock == uint256.Parse("0xa3a98f72634c7d098164926b83ff136b66d1cafbb9aeb5a3b8d18da02937f79f"));
            Assert(this.Genesis.Header.HashMerkleRoot == uint256.Parse("0x64ebe67e26861a4608c4315a7cb5671e7d15fb7546989b2621bfb806bbc6ad08"));
        }
示例#5
0
        public X42Test()
        {
            // 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] = 0x42;
            messageStart[1] = 0x66;
            messageStart[2] = 0x52;
            messageStart[3] = 0x04;
            uint magic = BitConverter.ToUInt32(messageStart, 0); //0x4526642

            this.Name                          = "x42Test";
            this.NetworkType                   = NetworkType.Testnet;
            this.Magic                         = magic;
            this.DefaultPort                   = 62342;
            this.DefaultRPCPort                = 62343;
            this.DefaultAPIPort                = 42221;
            this.DefaultSignalRPort            = 42223;
            this.DefaultMaxOutboundConnections = 16;
            this.DefaultMaxInboundConnections  = 109;
            this.MaxTipAge                     = 2 * 60 * 60;
            this.MinTxFee                      = Money.Zero;
            this.FallbackFee                   = Money.Zero;
            this.MinRelayTxFee                 = Money.Zero;
            this.RootFolderName                = x42RootFolderName;
            this.DefaultConfigFilename         = x42DefaultConfigFilename;
            this.MaxTimeOffsetSeconds          = 25 * 60;
            this.CoinTicker                    = "Tx42";
            this.DefaultBanTimeSeconds         = 16000; // 500 (MaxReorg) * 64 (TargetSpacing) / 2 = 4 hours, 26 minutes and 40 seconds

            var powLimit = new Target(new uint256("0000ffff00000000000000000000000000000000000000000000000000000000"));

            var consensusFactory = new PosConsensusFactory();

            // Create the testnet genesis block.
            this.GenesisTime    = 1588635707;
            this.GenesisNonce   = 2433759;
            this.GenesisBits    = powLimit;
            this.GenesisVersion = 1;
            this.GenesisReward  = Money.Zero;

            Block genesisBlock = CreateX42GenesisBlock(consensusFactory, this.GenesisTime, this.GenesisNonce, this.GenesisBits, this.GenesisVersion, this.GenesisReward);

            this.Genesis = genesisBlock;

            var consensusOptions = new PosConsensusOptions(
                maxBlockBaseSize: 1_000_000,
                maxStandardVersion: 2,
                maxStandardTxWeight: 100_000,
                maxBlockSigopsCost: 20_000,
                maxStandardTxSigopsCost: 20_000 / 5
                );

            var buriedDeployments = new BuriedDeploymentsArray
            {
                [BuriedDeployments.BIP34] = 0,
                [BuriedDeployments.BIP65] = 0,
                [BuriedDeployments.BIP66] = 0
            };

            var bip9Deployments = new StratisBIP9Deployments()
            {
                [StratisBIP9Deployments.ColdStaking] = new BIP9DeploymentsParameters("ColdStaking", 2,
                                                                                     new DateTime(2018, 12, 1, 0, 0, 0, DateTimeKind.Utc),
                                                                                     new DateTime(2019, 12, 1, 0, 0, 0, DateTimeKind.Utc),
                                                                                     BIP9DeploymentsParameters.DefaultMainnetThreshold)
            };

            this.Consensus = new X42Consensus(
                consensusFactory: consensusFactory,
                consensusOptions: consensusOptions,
                coinType: 424242,
                hashGenesisBlock: genesisBlock.GetHash(),
                subsidyHalvingInterval: 210000,
                majorityEnforceBlockUpgrade: 750,
                majorityRejectBlockOutdated: 950,
                majorityWindow: 1000,
                buriedDeployments: buriedDeployments,
                bip9Deployments: bip9Deployments,
                bip34Hash: new uint256("0x000000000000024b89b42a942fe0d9fea3bb44ab7bd1b19115dd6a759c0808b8"),
                minerConfirmationWindow: 2016, // nPowTargetTimespan / nPowTargetSpacing
                maxReorgLength: 500,
                defaultAssumeValid: null,
                maxMoney: Money.Coins(42 * 1000000),
                coinbaseMaturity: 10,
                premineHeight: 2,
                premineReward: Money.Coins(10.5m * 1000000),
                proofOfWorkReward: Money.Zero,
                powTargetTimespan: TimeSpan.FromSeconds(14 * 24 * 60 * 60), // two weeks
                powTargetSpacing: TimeSpan.FromSeconds(60),
                powAllowMinDifficultyBlocks: false,
                posNoRetargeting: false,
                powNoRetargeting: false,
                powLimit: powLimit,
                minimumChainWork: null,
                isProofOfStake: true,
                lastPowBlock: 523,
                proofOfStakeLimitV2: new BigInteger(uint256.Parse("000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffff").ToBytes(false)),
                proofOfStakeReward: Money.Coins(20),
                subsidyLimit: 100000,
                proofOfStakeRewardAfterSubsidyLimit: Money.Coins(5),
                lastProofOfStakeRewardHeight: 1000000
                );

            this.Base58Prefixes[(int)Base58Type.PUBKEY_ADDRESS] = new byte[] { (65) };
            this.Base58Prefixes[(int)Base58Type.SCRIPT_ADDRESS] = new byte[] { (196) };
            this.Base58Prefixes[(int)Base58Type.SECRET_KEY]     = new byte[] { (65 + 128) };

            this.Checkpoints = new Dictionary <int, CheckpointInfo>
            {
                { 0, new CheckpointInfo(new uint256("0x11bd504102b42b24680d7b4f9b9e9521adc1b690253494d108193cdfcdd2ef0b"), new uint256("0x0000000000000000000000000000000000000000000000000000000000000000")) }, // Genisis
            };

            var encoder = new Bech32Encoder("bc");

            this.Bech32Encoders = new Bech32Encoder[2];
            this.Bech32Encoders[(int)Bech32Type.WITNESS_PUBKEY_ADDRESS] = encoder;
            this.Bech32Encoders[(int)Bech32Type.WITNESS_SCRIPT_ADDRESS] = encoder;

            this.DNSSeeds = new List <DNSSeedData>
            {
                new DNSSeedData("testnet1.x42seed.host", "testnet1.x42seed.host"),
            };

            string[] seedNodes = { "63.32.82.169" };
            this.SeedNodes = ConvertToNetworkAddresses(seedNodes, this.DefaultPort).ToList();

            this.StandardScriptsRegistry = new StratisStandardScriptsRegistry();

            Assert(this.Consensus.HashGenesisBlock == uint256.Parse("0x11bd504102b42b24680d7b4f9b9e9521adc1b690253494d108193cdfcdd2ef0b"));
            Assert(this.Genesis.Header.HashMerkleRoot == uint256.Parse("0x87e7f7df2fbe9fa56c627e59342e0d8142eb5e44c5e5769609059a60f17d0702"));

            this.RegisterRules(this.Consensus);
            this.RegisterMempoolRules(this.Consensus);
        }
        public StratisRegTest()
        {
            var messageStart = new byte[4];

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

            this.Name        = "StratisRegTest";
            this.NetworkType = NetworkType.Regtest;
            this.Magic       = magic;
            this.DefaultPort = 18444;
            this.DefaultMaxOutboundConnections = 16;
            this.DefaultMaxInboundConnections  = 109;
            this.DefaultRPCPort        = 18442;
            this.DefaultAPIPort        = 38221;
            this.CoinTicker            = "TSTRAT";
            this.DefaultBanTimeSeconds = 16000; // 500 (MaxReorg) * 64 (TargetSpacing) / 2 = 4 hours, 26 minutes and 40 seconds

            var powLimit = new Target(new uint256("7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"));

            var consensusFactory = new PosConsensusFactory();

            // Create the genesis block.
            this.GenesisTime    = 1470467000;
            this.GenesisNonce   = 1831645;
            this.GenesisBits    = 0x1e0fffff;
            this.GenesisVersion = 1;
            this.GenesisReward  = Money.Zero;

            Block genesisBlock = CreateStratisGenesisBlock(consensusFactory, this.GenesisTime, this.GenesisNonce, this.GenesisBits, this.GenesisVersion, this.GenesisReward);

            genesisBlock.Header.Time  = 1494909211;
            genesisBlock.Header.Nonce = 2433759;
            genesisBlock.Header.Bits  = powLimit;

            this.Genesis = genesisBlock;

            // Taken from StratisX.
            var consensusOptions = new PosConsensusOptions(
                maxBlockBaseSize: 1_000_000,
                maxStandardVersion: 2,
                maxStandardTxWeight: 100_000,
                maxBlockSigopsCost: 20_000,
                maxStandardTxSigopsCost: 20_000 / 5,
                witnessScaleFactor: 4
                );

            var buriedDeployments = new BuriedDeploymentsArray
            {
                [BuriedDeployments.BIP34] = 0,
                [BuriedDeployments.BIP65] = 0,
                [BuriedDeployments.BIP66] = 0
            };

            var bip9Deployments = new StratisBIP9Deployments()
            {
                // Always active on StratisRegTest.
                [StratisBIP9Deployments.TestDummy]   = new BIP9DeploymentsParameters("TestDummy", 28, BIP9DeploymentsParameters.AlwaysActive, 999999999, BIP9DeploymentsParameters.AlwaysActive),
                [StratisBIP9Deployments.CSV]         = new BIP9DeploymentsParameters("CSV", 0, BIP9DeploymentsParameters.AlwaysActive, 999999999, BIP9DeploymentsParameters.AlwaysActive),
                [StratisBIP9Deployments.Segwit]      = new BIP9DeploymentsParameters("Segwit", 1, BIP9DeploymentsParameters.AlwaysActive, 999999999, BIP9DeploymentsParameters.AlwaysActive),
                [StratisBIP9Deployments.ColdStaking] = new BIP9DeploymentsParameters("ColdStaking", 2, BIP9DeploymentsParameters.AlwaysActive, 999999999, BIP9DeploymentsParameters.AlwaysActive),
            };

            this.Consensus = new NBitcoin.Consensus(
                consensusFactory: consensusFactory,
                consensusOptions: consensusOptions,
                coinType: 105,
                hashGenesisBlock: genesisBlock.GetHash(),
                subsidyHalvingInterval: 210000,
                majorityEnforceBlockUpgrade: 750,
                majorityRejectBlockOutdated: 950,
                majorityWindow: 1000,
                buriedDeployments: buriedDeployments,
                bip9Deployments: bip9Deployments,
                bip34Hash: new uint256("0x000000000000024b89b42a942fe0d9fea3bb44ab7bd1b19115dd6a759c0808b8"),
                minerConfirmationWindow: 2016, // nPowTargetTimespan / nPowTargetSpacing
                maxReorgLength: 500,
                defaultAssumeValid: null,      // turn off assumevalid for regtest.
                maxMoney: long.MaxValue,
                coinbaseMaturity: 10,
                premineHeight: 2,
                premineReward: Money.Coins(98000000),
                proofOfWorkReward: Money.Coins(4),
                targetTimespan: TimeSpan.FromSeconds(14 * 24 * 60 * 60), // two weeks
                targetSpacing: TimeSpan.FromSeconds(64),
                powAllowMinDifficultyBlocks: true,
                posNoRetargeting: true,
                powNoRetargeting: true,
                powLimit: powLimit,
                minimumChainWork: null,
                isProofOfStake: true,
                lastPowBlock: 12500,
                proofOfStakeLimit: new BigInteger(uint256.Parse("00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff").ToBytes(false)),
                proofOfStakeLimitV2: new BigInteger(uint256.Parse("000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffff").ToBytes(false)),
                proofOfStakeReward: Money.COIN
                );

            this.Consensus.PosEmptyCoinbase = true;

            this.Base58Prefixes[(int)Base58Type.PUBKEY_ADDRESS] = new byte[] { (65) };
            this.Base58Prefixes[(int)Base58Type.SCRIPT_ADDRESS] = new byte[] { (196) };
            this.Base58Prefixes[(int)Base58Type.SECRET_KEY]     = new byte[] { (65 + 128) };

            this.Bech32Encoders = new Bech32Encoder[2];
            var encoder = new Bech32Encoder("tstrat");

            this.Bech32Encoders[(int)Bech32Type.WITNESS_PUBKEY_ADDRESS] = encoder;
            this.Bech32Encoders[(int)Bech32Type.WITNESS_SCRIPT_ADDRESS] = encoder;

            this.Checkpoints = new Dictionary <int, CheckpointInfo>();

            this.DNSSeeds  = new List <DNSSeedData>();
            this.SeedNodes = new List <NetworkAddress>();

            this.StandardScriptsRegistry = new StratisStandardScriptsRegistry();

            // 64 below should be changed to TargetSpacingSeconds when we move that field.
            Assert(this.DefaultBanTimeSeconds <= this.Consensus.MaxReorgLength * 64 / 2);
            Assert(this.Consensus.HashGenesisBlock == uint256.Parse("0x93925104d664314f581bc7ecb7b4bad07bcfabd1cfce4256dbd2faddcf53bd1f"));

            this.RegisterRules(this.Consensus);
            this.RegisterMempoolRules(this.Consensus);
        }
        public SolarisTest()
        {
            // 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] = 0x72;
            messageStart[1] = 0x46;
            messageStart[2] = 0x33;
            messageStart[3] = 0x16;
            uint magic = BitConverter.ToUInt32(messageStart, 0); //0x6233671;

            this.Name        = "SolarisTest";
            this.NetworkType = NetworkType.Testnet;
            this.Magic       = magic;
            this.DefaultPort = 60009;
            this.DefaultMaxOutboundConnections = 16;
            this.DefaultMaxInboundConnections  = 109;
            this.DefaultRPCPort        = 61009;
            this.DefaultAPIPort        = 62009;
            this.MaxTipAge             = 2 * 60 * 60;
            this.MinTxFee              = 10000;
            this.FallbackFee           = 10000;
            this.MinRelayTxFee         = 10000;
            this.RootFolderName        = SolarisRootFolderName;
            this.DefaultConfigFilename = SolarisDefaultConfigFilename;
            this.MaxTimeOffsetSeconds  = 25 * 60;
            this.CoinTicker            = "TXLR";

            var consensusFactory = new PosConsensusFactory();

            // Create the genesis block.
            this.GenesisTime    = 1566229188;
            this.GenesisNonce   = 479144;
            this.GenesisBits    = 0x1e0fffff;
            this.GenesisVersion = 1;
            this.GenesisReward  = Money.Zero;

            Block genesisBlock = CreateSolarisGenesisBlock(consensusFactory, this.GenesisTime, this.GenesisNonce, this.GenesisBits, this.GenesisVersion, this.GenesisReward);

            this.Genesis = genesisBlock;

            // Taken from SolarisX.
            var consensusOptions = new PosConsensusOptions(
                maxBlockBaseSize: 1_000_000,
                maxStandardVersion: 2,
                maxStandardTxWeight: 100_000,
                maxBlockSigopsCost: 20_000,
                maxStandardTxSigopsCost: 20_000 / 5
                );

            var buriedDeployments = new BuriedDeploymentsArray
            {
                [BuriedDeployments.BIP34] = 0,
                [BuriedDeployments.BIP65] = 0,
                [BuriedDeployments.BIP66] = 0
            };

            var bip9Deployments = new StratisBIP9Deployments
            {
                [StratisBIP9Deployments.ColdStaking] = new BIP9DeploymentsParameters(2, BIP9DeploymentsParameters.AlwaysActive, 999999999)
            };

            this.Consensus = new Consensus(
                consensusFactory: consensusFactory,
                consensusOptions: consensusOptions,
                coinType: 105,
                hashGenesisBlock: genesisBlock.GetHash(),
                subsidyHalvingInterval: 210000,
                majorityEnforceBlockUpgrade: 750,
                majorityRejectBlockOutdated: 950,
                majorityWindow: 1000,
                buriedDeployments: buriedDeployments,
                bip9Deployments: bip9Deployments,
                bip34Hash: new uint256("0x198559121e1a041779e58f332d643bb1f1d760d4ca1e5add6d48d2e9ff881b99"),
                ruleChangeActivationThreshold: 1916,                                                                   // 95% of 2016
                minerConfirmationWindow: 2016,                                                                         // nPowTargetTimespan / nPowTargetSpacing
                maxReorgLength: 500,
                defaultAssumeValid: new uint256("0x198559121e1a041779e58f332d643bb1f1d760d4ca1e5add6d48d2e9ff881b99"), // 0
                maxMoney: long.MaxValue,
                coinbaseMaturity: 50,
                premineHeight: 2,
                premineReward: Money.Coins(2187524),
                proofOfWorkReward: Money.Coins(0.25m),
                powTargetTimespan: TimeSpan.FromSeconds(14 * 24 * 60 * 60), // two weeks
                powTargetSpacing: TimeSpan.FromSeconds(10 * 60),
                powAllowMinDifficultyBlocks: false,
                posNoRetargeting: false,
                powNoRetargeting: false,
                powLimit: new Target(new uint256("00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")),
                minimumChainWork: null,
                isProofOfStake: true,
                lastPowBlock: 250,
                proofOfStakeLimit: new BigInteger(uint256.Parse("00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff").ToBytes(false)),
                proofOfStakeLimitV2: new BigInteger(uint256.Parse("000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffff").ToBytes(false)),
                proofOfStakeReward: Money.Coins(0.25m)
                );

            this.Base58Prefixes = new byte[12][];
            this.Base58Prefixes[(int)Base58Type.PUBKEY_ADDRESS]             = new byte[] { (75) };
            this.Base58Prefixes[(int)Base58Type.SCRIPT_ADDRESS]             = new byte[] { (125) };
            this.Base58Prefixes[(int)Base58Type.SECRET_KEY]                 = new byte[] { (63 + 128) };
            this.Base58Prefixes[(int)Base58Type.ENCRYPTED_SECRET_KEY_NO_EC] = new byte[] { 0x01, 0x42 };
            this.Base58Prefixes[(int)Base58Type.ENCRYPTED_SECRET_KEY_EC]    = new byte[] { 0x01, 0x43 };
            this.Base58Prefixes[(int)Base58Type.EXT_PUBLIC_KEY]             = new byte[] { (0x04), (0x88), (0xB2), (0x1E) };
            this.Base58Prefixes[(int)Base58Type.EXT_SECRET_KEY]             = new byte[] { (0x04), (0x88), (0xAD), (0xE4) };
            this.Base58Prefixes[(int)Base58Type.PASSPHRASE_CODE]            = new byte[] { 0x2C, 0xE9, 0xB3, 0xE1, 0xFF, 0x39, 0xE2 };
            this.Base58Prefixes[(int)Base58Type.CONFIRMATION_CODE]          = new byte[] { 0x64, 0x3B, 0xF6, 0xA8, 0x9A };
            this.Base58Prefixes[(int)Base58Type.STEALTH_ADDRESS]            = new byte[] { 0x2a };
            this.Base58Prefixes[(int)Base58Type.ASSET_ID]        = new byte[] { 23 };
            this.Base58Prefixes[(int)Base58Type.COLORED_ADDRESS] = new byte[] { 0x13 };

            this.Checkpoints = new Dictionary <int, CheckpointInfo>
            {
                { 0, new CheckpointInfo(new uint256("0x198559121e1a041779e58f332d643bb1f1d760d4ca1e5add6d48d2e9ff881b99"), new uint256("0x0000000000000000000000000000000000000000000000000000000000000000")) }
            };

            this.Bech32Encoders = new Bech32Encoder[2];
            this.Bech32Encoders[(int)Bech32Type.WITNESS_PUBKEY_ADDRESS] = null;
            this.Bech32Encoders[(int)Bech32Type.WITNESS_SCRIPT_ADDRESS] = null;

            this.DNSSeeds = new List <DNSSeedData>
            {
                new DNSSeedData("testnet1.solarisplatform.com", "testnet1.solarisplatform.com"),
                new DNSSeedData("testnet2.solarisplatform.com", "testnet2.solarisplatform.com")
            };

            this.SeedNodes = new List <NetworkAddress>
            {
                new NetworkAddress(IPAddress.Parse("176.223.143.14"), this.DefaultPort), //Official node 1
                new NetworkAddress(IPAddress.Parse("176.223.129.235"), this.DefaultPort) //Official node 2
            };

            this.StandardScriptsRegistry = new StratisStandardScriptsRegistry();

            Assert(this.Consensus.HashGenesisBlock == uint256.Parse("0x198559121e1a041779e58f332d643bb1f1d760d4ca1e5add6d48d2e9ff881b99"));
            Assert(this.Genesis.Header.HashMerkleRoot == uint256.Parse("0x5d96c5816f511f09c90c86c576473b8836de0506ef2a3505685f3e146c7d4ad3"));
        }
示例#8
0
        public X42Main()
        {
            // 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;
            uint magic = BitConverter.ToUInt32(messageStart, 0); //0x5223570;

            this.Name        = "x42Main";
            this.Magic       = magic;
            this.DefaultPort = 52342;
            this.RPCPort     = 52343;
            this.DefaultMaxOutboundConnections = 16;
            this.DefaultMaxInboundConnections  = 109;
            this.MaxTipAge             = 2 * 60 * 60;
            this.MinTxFee              = Money.Zero;
            this.FallbackFee           = Money.Zero;
            this.MinRelayTxFee         = Money.Zero;
            this.RootFolderName        = x42RootFolderName;
            this.DefaultConfigFilename = x42DefaultConfigFilename;
            this.MaxTimeOffsetSeconds  = 25 * 60;
            this.CoinTicker            = "x42";

            var consensusFactory = new PosConsensusFactory();

            // Create the genesis block.
            this.GenesisTime    = 1533106324;
            this.GenesisNonce   = 246101626;
            this.GenesisBits    = 0x1e0fffff;
            this.GenesisVersion = 1;
            this.GenesisReward  = Money.Zero;

            Block genesisBlock = CreateX42GenesisBlock(consensusFactory, this.GenesisTime, this.GenesisNonce, this.GenesisBits, this.GenesisVersion, this.GenesisReward);

            this.Genesis = genesisBlock;

            var consensusOptions = new PosConsensusOptions(
                maxBlockBaseSize: 1_000_000,
                maxStandardVersion: 2,
                maxStandardTxWeight: 100_000,
                maxBlockSigopsCost: 20_000,
                maxStandardTxSigopsCost: 20_000 / 5
                );

            var buriedDeployments = new BuriedDeploymentsArray
            {
                [BuriedDeployments.BIP34] = 0,
                [BuriedDeployments.BIP65] = 0,
                [BuriedDeployments.BIP66] = 0
            };

            var bip9Deployments = new StratisBIP9Deployments()
            {
                [StratisBIP9Deployments.ColdStaking] = new BIP9DeploymentsParameters(2,
                                                                                     new DateTime(2018, 12, 1, 0, 0, 0, DateTimeKind.Utc),
                                                                                     new DateTime(2019, 12, 1, 0, 0, 0, DateTimeKind.Utc))
            };

            this.Consensus = new X42Consensus(
                consensusFactory: consensusFactory,
                consensusOptions: consensusOptions,
                coinType: 424242,
                hashGenesisBlock: genesisBlock.GetHash(),
                subsidyHalvingInterval: 210000,
                majorityEnforceBlockUpgrade: 750,
                majorityRejectBlockOutdated: 950,
                majorityWindow: 1000,
                buriedDeployments: buriedDeployments,
                bip9Deployments: bip9Deployments,
                bip34Hash: new uint256("0x000000000000024b89b42a942fe0d9fea3bb44ab7bd1b19115dd6a759c0808b8"),
                ruleChangeActivationThreshold: 1916, // 95% of 2016
                minerConfirmationWindow: 2016,       // nPowTargetTimespan / nPowTargetSpacing
                maxReorgLength: 500,
                defaultAssumeValid: null,
                maxMoney: Money.Coins(42 * 1000000),
                coinbaseMaturity: 50,
                premineHeight: 2,
                premineReward: Money.Coins(10.5m * 1000000),
                proofOfWorkReward: Money.Zero,
                powTargetTimespan: TimeSpan.FromSeconds(14 * 24 * 60 * 60), // two weeks
                powTargetSpacing: TimeSpan.FromSeconds(60),
                powAllowMinDifficultyBlocks: false,
                posNoRetargeting: false,
                powNoRetargeting: false,
                powLimit: new Target(new uint256("7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")),
                minimumChainWork: null,
                isProofOfStake: true,
                lastPowBlock: 523,
                proofOfStakeLimitV2: new BigInteger(uint256.Parse("000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffff").ToBytes(false)),
                proofOfStakeReward: Money.Coins(20),
                subsidyLimit: 550000,
                proofOfStakeRewardAfterSubsidyLimit: Money.Coins(5),
                lastProofOfStakeRewardHeight: 4652092
                );

            this.Base58Prefixes = new byte[12][];
            this.Base58Prefixes[(int)Base58Type.PUBKEY_ADDRESS]             = new byte[] { (75) };
            this.Base58Prefixes[(int)Base58Type.SCRIPT_ADDRESS]             = new byte[] { (125) };
            this.Base58Prefixes[(int)Base58Type.SECRET_KEY]                 = new byte[] { (75 + 128) };
            this.Base58Prefixes[(int)Base58Type.ENCRYPTED_SECRET_KEY_NO_EC] = new byte[] { 0x01, 0x42 };
            this.Base58Prefixes[(int)Base58Type.ENCRYPTED_SECRET_KEY_EC]    = new byte[] { 0x01, 0x43 };
            this.Base58Prefixes[(int)Base58Type.EXT_PUBLIC_KEY]             = new byte[] { (0x04), (0x88), (0xB2), (0x1E) };
            this.Base58Prefixes[(int)Base58Type.EXT_SECRET_KEY]             = new byte[] { (0x04), (0x88), (0xAD), (0xE4) };
            this.Base58Prefixes[(int)Base58Type.PASSPHRASE_CODE]            = new byte[] { 0x2C, 0xE9, 0xB3, 0xE1, 0xFF, 0x39, 0xE2 };
            this.Base58Prefixes[(int)Base58Type.CONFIRMATION_CODE]          = new byte[] { 0x64, 0x3B, 0xF6, 0xA8, 0x9A };
            this.Base58Prefixes[(int)Base58Type.STEALTH_ADDRESS]            = new byte[] { 0x2a };
            this.Base58Prefixes[(int)Base58Type.ASSET_ID]        = new byte[] { 23 };
            this.Base58Prefixes[(int)Base58Type.COLORED_ADDRESS] = new byte[] { 0x13 };

            this.Checkpoints = new Dictionary <int, CheckpointInfo>
            {
                { 0, new CheckpointInfo(new uint256("0x04ffe583707a96c1c2eb54af33a4b1dc6d9d8e09fea8c9a7b097ba88f0cb64c4"), new uint256("0x0000000000000000000000000000000000000000000000000000000000000000")) },   // Genisis
                { 2, new CheckpointInfo(new uint256("0x1a64847f52fce72763a9eaa99bed6a896556917cd16f491bbdec070b40514282"), new uint256("0xa55d7663540264e7ed1e7195ecd0050303187eaf9485edeec70806491b5a53d1")) },   // Premine
                { 523, new CheckpointInfo(new uint256("0x1ca01c02f5989a198433cbe83e0eb26d9166d6aaaa9c20d6b765d5bace7829f1"), new uint256("0xbf04ecd478d78d302aa65293dde85036954b76216b0812104315c8a5ad139525")) }, // Last POW Block
                { 20000, new CheckpointInfo(new uint256("0x79976dfc025e982239a0bd62099475e6abf839c73aba5805b5cbe4091744c09a"), new uint256("0x250690dd6f264565c5ce16d84d250d67eb940d084c253e4006cdba3091fd66b6")) },
                { 150000, new CheckpointInfo(new uint256("0xe3eb190c9672ffdb2852d80c1c9f3cb693356c9555db0903d0443ea9e5191bf3"), new uint256("0x45abba0dbe4dba26adc32c232d780c741d0cd7a4e30067626981d69c53a7aff5")) },
                { 200000, new CheckpointInfo(new uint256("0xaa276a1c51c025ff1a21fd4b07bfa5d55effc173840e054dd851b20dbb1f2f17"), new uint256("0x63d4bc7b0272703e94ae79103970ea324dc85221e88a51c39a170744848c0cc7")) }
            };

            var encoder = new Bech32Encoder("bc");

            this.Bech32Encoders = new Bech32Encoder[2];
            this.Bech32Encoders[(int)Bech32Type.WITNESS_PUBKEY_ADDRESS] = encoder;
            this.Bech32Encoders[(int)Bech32Type.WITNESS_SCRIPT_ADDRESS] = encoder;

            this.DNSSeeds = new List <DNSSeedData>
            {
                new DNSSeedData("mainnet1.x42seed.host", "mainnet1.x42seed.host"),
                new DNSSeedData("mainnetnode1.x42seed.host", "mainnetnode1.x42seed.host"),
                new DNSSeedData("tech.x42.cloud", "tech.x42.cloud"),
            };

            string[] seedNodes = { "34.255.35.42", "52.211.235.48", "52.210.106.220" };
            this.SeedNodes = ConvertToNetworkAddresses(seedNodes, this.DefaultPort).ToList();

            this.StandardScriptsRegistry = new StratisStandardScriptsRegistry();

            Assert(this.Consensus.HashGenesisBlock == uint256.Parse("0x04ffe583707a96c1c2eb54af33a4b1dc6d9d8e09fea8c9a7b097ba88f0cb64c4"));
            Assert(this.Genesis.Header.HashMerkleRoot == uint256.Parse("0x6e3439a32382f83dee4f94a6f8bdd38908bcf0c82ec09aba85c5321357f01f67"));
        }
示例#9
0
        public EXOSTest()
        {
            // 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] = 0x25;
            messageStart[1] = 0x16;
            messageStart[2] = 0x74;
            messageStart[3] = 0x62;
            uint magic = BitConverter.ToUInt32(messageStart, 0);

            this.Name        = "EXOSTest";
            this.NetworkType = NetworkType.Testnet;
            this.Magic       = magic;
            this.DefaultPort = 14562;
            this.DefaultMaxOutboundConnections = 16;
            this.DefaultMaxInboundConnections  = 109;
            this.DefaultRPCPort        = 14561;
            this.DefaultAPIPort        = 39121;
            this.DefaultSignalRPort    = 38621;
            this.CoinTicker            = "TEXOS";
            this.DefaultBanTimeSeconds = 16000; // 500 (MaxReorg) * 64 (TargetSpacing) / 2 = 4 hours, 26 minutes and 40 seconds

            var powLimit = new Target(new uint256("0000ffff00000000000000000000000000000000000000000000000000000000"));

            var consensusFactory = new PosConsensusFactory();

            // Create the genesis block.
            this.GenesisTime    = 1523205120;
            this.GenesisNonce   = 842767;
            this.GenesisBits    = 0x1e0fffff;
            this.GenesisVersion = 1;
            this.GenesisReward  = Money.Zero;

            Block genesisBlock = CreateStratisGenesisBlock(consensusFactory, this.GenesisTime, this.GenesisNonce, this.GenesisBits, this.GenesisVersion, this.GenesisReward);

            genesisBlock.Header.Time  = 1572376229;
            genesisBlock.Header.Nonce = 40540;
            genesisBlock.Header.Bits  = powLimit;

            this.Genesis = genesisBlock;

            // Taken from StratisX.
            var consensusOptions = new PosConsensusOptions(
                maxBlockBaseSize: 1_000_000,
                maxStandardVersion: 2,
                maxStandardTxWeight: 100_000,
                maxBlockSigopsCost: 20_000,
                maxStandardTxSigopsCost: 20_000 / 5
                );

            var buriedDeployments = new BuriedDeploymentsArray
            {
                [BuriedDeployments.BIP34] = 0,
                [BuriedDeployments.BIP65] = 0,
                [BuriedDeployments.BIP66] = 0
            };

            var bip9Deployments = new StratisBIP9Deployments()
            {
                [StratisBIP9Deployments.ColdStaking] = new BIP9DeploymentsParameters(2,
                                                                                     new DateTime(2018, 11, 1, 0, 0, 0, DateTimeKind.Utc),
                                                                                     new DateTime(2019, 6, 1, 0, 0, 0, DateTimeKind.Utc))
            };

            this.Consensus = new NBitcoin.Consensus(
                consensusFactory: consensusFactory,
                consensusOptions: consensusOptions,
                coinType: 248,
                hashGenesisBlock: genesisBlock.GetHash(),
                subsidyHalvingInterval: 210000,
                majorityEnforceBlockUpgrade: 750,
                majorityRejectBlockOutdated: 950,
                majorityWindow: 1000,
                buriedDeployments: buriedDeployments,
                bip9Deployments: bip9Deployments,
                bip34Hash: new uint256("0x0000059bb2c2048493efcb0f1a034972b3ce4089d54c93b69aaab212fb369887"),
                ruleChangeActivationThreshold: 1916,                                                                   // 95% of 2016
                minerConfirmationWindow: 2016,                                                                         // nPowTargetTimespan / nPowTargetSpacing
                maxReorgLength: 500,
                defaultAssumeValid: new uint256("0xffed8f737ce62b33e5bdd675d0243686bc67f8d7041dd3d7e49ddc3062dec785"), // 78000
                maxMoney: long.MaxValue,
                coinbaseMaturity: 10,
                premineHeight: 2,
                premineReward: Money.Coins(300000000),
                proofOfWorkReward: Money.Coins(12),
                powTargetTimespan: TimeSpan.FromSeconds(14 * 24 * 60 * 60), // two weeks
                powTargetSpacing: TimeSpan.FromSeconds(10 * 60),
                powAllowMinDifficultyBlocks: false,
                posNoRetargeting: false,
                powNoRetargeting: false,
                powLimit: powLimit,
                minimumChainWork: null,
                isProofOfStake: true,
                lastPowBlock: 45000,
                proofOfStakeLimit: new BigInteger(uint256.Parse("00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff").ToBytes(false)),
                proofOfStakeLimitV2: new BigInteger(uint256.Parse("000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffff").ToBytes(false)),
                proofOfStakeReward: Money.COIN
                );

            this.Base58Prefixes[(int)Base58Type.PUBKEY_ADDRESS] = new byte[] { (75) };
            this.Base58Prefixes[(int)Base58Type.SCRIPT_ADDRESS] = new byte[] { (206) };
            this.Base58Prefixes[(int)Base58Type.SECRET_KEY]     = new byte[] { (75 + 128) };
            this.Base58Prefixes[(int)Base58Type.EXT_PUBLIC_KEY] = new byte[] { (0x04), (0x35), (0x87), (0xCF) };
            this.Base58Prefixes[(int)Base58Type.EXT_SECRET_KEY] = new byte[] { (0x04), (0x35), (0x83), (0x94) };

            this.Checkpoints = new Dictionary <int, CheckpointInfo>
            {
                { 0, new CheckpointInfo(new uint256("0x00000bf810e65773b5a0e5a43ea656080e10108424dcf475abc4228bfc52148f"), new uint256("0000000000000000000000000000000000000000000000000000000000000000")) },
                { 2, new CheckpointInfo(new uint256("0xc523b576d127b614a25ff9f15542f9d6dbcc45ac143ea1add589a42912a645ae"), new uint256("0x271e210bf4e0ae765dbb6803fb968326de4d616bff19301ba872347d22cbf240")) },
                { 10, new CheckpointInfo(new uint256("0x12a9b2dcdcf1714313f96661f4b7ce577fb5d7fcdf1bc734c38a67c4098c044a"), new uint256("0x32d31ea17bc2140df3b57d3530f45c6424c5b0916da20ebb546c8b0555d0ac47")) },
                { 50, new CheckpointInfo(new uint256("0x0071b0576f1ce5d58330df7c1c36687979168f2abce842c002180592a1a163aa"), new uint256("0x454a45229abced2334ac9f3647082e3586bb58d3d464043c5000bc4fc7f31b87")) },
                { 100, new CheckpointInfo(new uint256("0x68212577007f1038109ea256fcf3537bc86d489ff644aff63c383374333917b7"), new uint256("0xd7c7fd41315ff4f60286da63cec92ca48013fcfdd3cf0985f444e3c809e20337")) },
                { 500, new CheckpointInfo(new uint256("0x7be041a5823d33f0d8554156f3bc0b306f8ec174d89b9f581084b4ea9bd84b73"), new uint256("0xa13acf2577637fa6e9f4d84adf54077ba36f88ad7a07007e57deb6d10265b0a7")) },
                { 1000, new CheckpointInfo(new uint256("0xa1a254d3c4e4977ab3e0fd8e408c12b7bede46f61e5f0eb4edc50338d139369a"), new uint256("0x5623a38e093499ccb0785204a9e6f8369bd504f91c4ee089623d88161c788b8f")) },
                { 5000, new CheckpointInfo(new uint256("0xb5b24c870687522318003fe3a0654e067040587166e29b7dcdb9718443ea4bbf"), new uint256("0x7ef275a27cf82312a1de8dcb7e4c64f3a371fa8c4f41d9f1505b1ff0322e451d")) },
                { 10000, new CheckpointInfo(new uint256("0x5793cf5687e09615058a7054f5c0e146248db8917e601c0b72b245773539f795"), new uint256("0x43ff4cdacba13b2ded8f0844f1cbb2762bcf98fe38f2764e19f50f0ebca331da")) },
                { 15000, new CheckpointInfo(new uint256("0x7754d2d2533994f9a551bad2d784b0cc47eceb652c51bdcda1dc4c360455d35b"), new uint256("0x726afc5c97690157afd022ad39ff080dad4ebbafa2a625f6d13cf90662b46267")) },
                { 30000, new CheckpointInfo(new uint256("0x7836bc776fcd5eae89e53519f05ddf43e3a73c57d9ff13092b063cd11334a1e9"), new uint256("0xa6d60033722f26566107739101bd29d7770df01ce68088989fffe370d16048ab")) },
                { 45000, new CheckpointInfo(new uint256("0x6a0df2a0a66aef10b99e294e0db496e6faeec07a59e434f93be50de1eb327f8d"), new uint256("0xae0fc9185d908f431c78e7035f2d27d35cd0c1f6f523ce46e50fc08784607b60")) },
                { 47000, new CheckpointInfo(new uint256("0xa9bfd5f2206e2579a1f948aefa9f1425824cb7182cd6d7ef3408776a47d24f75"), new uint256("0x48db745eebcb19aa2f9d07404b90f624c6a1657180620fb5701165770f4296a6")) }
            };

            this.DNSSeeds = new List <DNSSeedData>
            {
                new DNSSeedData("testseednode1.oexo.cloud", "testseednode1.oexo.cloud"),
                new DNSSeedData("testseednode2.oexo.net", "testseednode2.oexo.net"),
                new DNSSeedData("testseednode3.oexo.cloud", "testseednode3.oexo.cloud"),
                new DNSSeedData("testseednode4.oexo.net", "testseednode4.oexo.net")
            };

            this.SeedNodes = new List <NetworkAddress>
            {
            };
            var hostnames = new[] { "vps151.oexo.cloud", "vps152.oexo.net", "vps251.oexo.cloud", "vps252.oexo.net" };

            foreach (string host in hostnames)
            {
                var            addressList = Dns.GetHostAddresses(host).GetValue(0).ToString();
                NetworkAddress addr        = new NetworkAddress
                {
                    Endpoint = Utils.ParseIpEndpoint(addressList, this.DefaultPort)
                };
                this.SeedNodes.Add(addr);
            }

            this.StandardScriptsRegistry = new StratisStandardScriptsRegistry();

            // 64 below should be changed to TargetSpacingSeconds when we move that field.
            Assert(this.DefaultBanTimeSeconds <= this.Consensus.MaxReorgLength * 64 / 2);
            Assert(this.Consensus.HashGenesisBlock == uint256.Parse("0x00000bf810e65773b5a0e5a43ea656080e10108424dcf475abc4228bfc52148f"));

            this.RegisterRules(this.Consensus);
        }
示例#10
0
        public X42Main()
        {
            // 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] = 0x42;
            messageStart[1] = 0x66;
            messageStart[2] = 0x52;
            messageStart[3] = 0x03;
            uint magic = BitConverter.ToUInt32(messageStart, 0); //0x3526642

            this.Name                          = "x42Main";
            this.NetworkType                   = NetworkType.Mainnet;
            this.Magic                         = magic;
            this.DefaultPort                   = 52342;
            this.DefaultRPCPort                = 52343;
            this.DefaultAPIPort                = 42220;
            this.DefaultSignalRPort            = 42222;
            this.DefaultMaxOutboundConnections = 16;
            this.DefaultMaxInboundConnections  = 109;
            this.MaxTipAge                     = 2 * 60 * 60;
            this.MinTxFee                      = Money.Zero;
            this.FallbackFee                   = Money.Zero;
            this.MinRelayTxFee                 = Money.Zero;
            this.MinDataStoreFee               = 10000;
            this.RootFolderName                = x42RootFolderName;
            this.DefaultConfigFilename         = x42DefaultConfigFilename;
            this.MaxTimeOffsetSeconds          = 25 * 60;
            this.CoinTicker                    = "x42";
            this.DefaultBanTimeSeconds         = 16000; // 500 (MaxReorg) * 64 (TargetSpacing) / 2 = 4 hours, 26 minutes and 40 seconds

            var consensusFactory = new PosConsensusFactory();

            // Create the genesis block.
            this.GenesisTime    = 1533106324;
            this.GenesisNonce   = 246101626;
            this.GenesisBits    = 0x1e0fffff;
            this.GenesisVersion = 1;
            this.GenesisReward  = Money.Zero;

            Block genesisBlock = CreateX42GenesisBlock(consensusFactory, this.GenesisTime, this.GenesisNonce, this.GenesisBits, this.GenesisVersion, this.GenesisReward);

            this.Genesis = genesisBlock;

            var consensusOptions = new PosConsensusOptions(
                maxBlockBaseSize: 1_000_000,
                maxStandardVersion: 2,
                maxStandardTxWeight: 100_000,
                maxBlockSigopsCost: 20_000,
                maxStandardTxSigopsCost: 20_000 / 5
                );

            var buriedDeployments = new BuriedDeploymentsArray
            {
                [BuriedDeployments.BIP34] = 0,
                [BuriedDeployments.BIP65] = 0,
                [BuriedDeployments.BIP66] = 0
            };

            var bip9Deployments = new StratisBIP9Deployments()
            {
                [StratisBIP9Deployments.ColdStaking] = new BIP9DeploymentsParameters("ColdStaking", 27, BIP9DeploymentsParameters.AlwaysActive, 999999999, BIP9DeploymentsParameters.DefaultMainnetThreshold),
                [StratisBIP9Deployments.CSV]         = new BIP9DeploymentsParameters("CSV", 0, BIP9DeploymentsParameters.AlwaysActive, 999999999, BIP9DeploymentsParameters.DefaultMainnetThreshold),
                [StratisBIP9Deployments.Segwit]      = new BIP9DeploymentsParameters("Segwit", 1, new DateTime(2020, 3, 1, 0, 0, 0, DateTimeKind.Utc), new DateTime(2021, 3, 1, 0, 0, 0, DateTimeKind.Utc), BIP9DeploymentsParameters.DefaultMainnetThreshold)
            };

            this.Consensus = new X42Consensus(
                consensusFactory: consensusFactory,
                consensusOptions: consensusOptions,
                coinType: 424242,
                hashGenesisBlock: genesisBlock.GetHash(),
                subsidyHalvingInterval: 210000,
                majorityEnforceBlockUpgrade: 750,
                majorityRejectBlockOutdated: 950,
                majorityWindow: 1000,
                buriedDeployments: buriedDeployments,
                bip9Deployments: bip9Deployments,
                bip34Hash: new uint256("0x000000000000024b89b42a942fe0d9fea3bb44ab7bd1b19115dd6a759c0808b8"),
                minerConfirmationWindow: 2016,                                                                       // nPowTargetTimespan / nPowTargetSpacing
                maxReorgLength: 500,
                defaultAssumeValid: new uint256("24f78aa61fd87545356e570740e9f3018f7a27b9004cc89d083ca302646f6210"), // 630000
                maxMoney: Money.Coins(42 * 1000000),
                coinbaseMaturity: 50,
                premineHeight: 2,
                premineReward: Money.Coins(10.5m * 1000000),
                proofOfWorkReward: Money.Zero,
                powTargetTimespan: TimeSpan.FromSeconds(14 * 24 * 60 * 60), // two weeks
                powTargetSpacing: TimeSpan.FromSeconds(60),
                powAllowMinDifficultyBlocks: false,
                posNoRetargeting: false,
                powNoRetargeting: false,
                powLimit: new Target(new uint256("7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")),
                minimumChainWork: null,
                isProofOfStake: true,
                lastPowBlock: 523,
                proofOfStakeLimitV2: new BigInteger(uint256.Parse("000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffff").ToBytes(false)),
                proofOfStakeReward: Money.Coins(20),
                subsidyLimit: 400000,
                proofOfStakeRewardAfterSubsidyLimit: Money.Coins(2),
                lastProofOfStakeRewardHeight: 12155230
                );

            this.Base58Prefixes = new byte[12][];
            this.Base58Prefixes[(int)Base58Type.PUBKEY_ADDRESS]             = new byte[] { (75) };
            this.Base58Prefixes[(int)Base58Type.SCRIPT_ADDRESS]             = new byte[] { (125) };
            this.Base58Prefixes[(int)Base58Type.SECRET_KEY]                 = new byte[] { (75 + 128) };
            this.Base58Prefixes[(int)Base58Type.ENCRYPTED_SECRET_KEY_NO_EC] = new byte[] { 0x01, 0x42 };
            this.Base58Prefixes[(int)Base58Type.ENCRYPTED_SECRET_KEY_EC]    = new byte[] { 0x01, 0x43 };
            this.Base58Prefixes[(int)Base58Type.EXT_PUBLIC_KEY]             = new byte[] { (0x04), (0x88), (0xB2), (0x1E) };
            this.Base58Prefixes[(int)Base58Type.EXT_SECRET_KEY]             = new byte[] { (0x04), (0x88), (0xAD), (0xE4) };
            this.Base58Prefixes[(int)Base58Type.PASSPHRASE_CODE]            = new byte[] { 0x2C, 0xE9, 0xB3, 0xE1, 0xFF, 0x39, 0xE2 };
            this.Base58Prefixes[(int)Base58Type.CONFIRMATION_CODE]          = new byte[] { 0x64, 0x3B, 0xF6, 0xA8, 0x9A };
            this.Base58Prefixes[(int)Base58Type.STEALTH_ADDRESS]            = new byte[] { 0x2a };
            this.Base58Prefixes[(int)Base58Type.ASSET_ID]        = new byte[] { 23 };
            this.Base58Prefixes[(int)Base58Type.COLORED_ADDRESS] = new byte[] { 0x13 };

            this.Checkpoints = new Dictionary <int, CheckpointInfo>
            {
                { 0, new CheckpointInfo(new uint256("0x04ffe583707a96c1c2eb54af33a4b1dc6d9d8e09fea8c9a7b097ba88f0cb64c4"), new uint256("0x0000000000000000000000000000000000000000000000000000000000000000")) },   // Genisis
                { 2, new CheckpointInfo(new uint256("0x1a64847f52fce72763a9eaa99bed6a896556917cd16f491bbdec070b40514282"), new uint256("0xa55d7663540264e7ed1e7195ecd0050303187eaf9485edeec70806491b5a53d1")) },   // Premine
                { 523, new CheckpointInfo(new uint256("0x1ca01c02f5989a198433cbe83e0eb26d9166d6aaaa9c20d6b765d5bace7829f1"), new uint256("0xbf04ecd478d78d302aa65293dde85036954b76216b0812104315c8a5ad139525")) }, // Last POW Block
                { 20000, new CheckpointInfo(new uint256("0x79976dfc025e982239a0bd62099475e6abf839c73aba5805b5cbe4091744c09a"), new uint256("0x250690dd6f264565c5ce16d84d250d67eb940d084c253e4006cdba3091fd66b6")) },
                { 200000, new CheckpointInfo(new uint256("0xaa276a1c51c025ff1a21fd4b07bfa5d55effc173840e054dd851b20dbb1f2f17"), new uint256("0x63d4bc7b0272703e94ae79103970ea324dc85221e88a51c39a170744848c0cc7")) },
                { 300000, new CheckpointInfo(new uint256("0xff72e73ee8f87c0de9bf82c3bb758f4905c3e005493f2ed1faede7c120961750"), new uint256("0x2097fc9edfb8dfe287db45bbce820e168c50be32c9840b1cddf56b297011fc69")) },
                { 500000, new CheckpointInfo(new uint256("0x7f9a88ebb32f47090ec37a110c5a05c1162a604dfbfb69c8d492e771cdb63289"), new uint256("0x19db6890c5c934e883bc99eb197509b0a81f19faeefcf49fd7fa6dab83644bfb")) },
                { 634600, new CheckpointInfo(new uint256("0x5c0eb47bc96ba437e6d2550aceaa73ad9a4568110de83380d6a7b5f00aee7308"), new uint256("0x12ef7b665a07cef572c9b8d9ee44f41230d6a65e960d372f9396194ed6f51e53")) }
            };

            var encoder = new Bech32Encoder(this.CoinTicker.ToLowerInvariant());

            this.Bech32Encoders = new Bech32Encoder[2];
            this.Bech32Encoders[(int)Bech32Type.WITNESS_PUBKEY_ADDRESS] = encoder;
            this.Bech32Encoders[(int)Bech32Type.WITNESS_SCRIPT_ADDRESS] = encoder;

            this.DNSSeeds = new List <DNSSeedData>
            {
                new DNSSeedData("mainnet1.x42seed.host", "mainnet1.x42seed.host"),
                new DNSSeedData("mainnetnode1.x42seed.host", "mainnetnode1.x42seed.host"),
                new DNSSeedData("tech.x42.cloud", "tech.x42.cloud"),
            };

            this.SeedNodes = new List <NetworkAddress>
            {
                new NetworkAddress(IPAddress.Parse("34.255.35.42"), 52342),
                new NetworkAddress(IPAddress.Parse("52.211.235.48"), 52342),
                new NetworkAddress(IPAddress.Parse("63.32.82.169"), 52342),
            };

            this.StandardScriptsRegistry = new StratisStandardScriptsRegistry();

            // 64 below should be changed to TargetSpacingSeconds when we move that field.
            Assert(this.DefaultBanTimeSeconds <= this.Consensus.MaxReorgLength * 64 / 2);
            Assert(this.Consensus.HashGenesisBlock == uint256.Parse("0x04ffe583707a96c1c2eb54af33a4b1dc6d9d8e09fea8c9a7b097ba88f0cb64c4"));
            Assert(this.Genesis.Header.HashMerkleRoot == uint256.Parse("0x6e3439a32382f83dee4f94a6f8bdd38908bcf0c82ec09aba85c5321357f01f67"));

            this.RegisterRules(this.Consensus);
            this.RegisterMempoolRules(this.Consensus);
        }
        public AmsterdamCoinMain()
        {
            // 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] = 0x82;
            messageStart[1] = 0x81;
            messageStart[2] = 0x80;
            messageStart[3] = 0x11;
            uint magic = BitConverter.ToUInt32(messageStart, 0); //0x6233671;

            this.Name        = "AmsterdamCoinMain";
            this.NetworkType = NetworkType.Mainnet;
            this.Magic       = magic;
            this.DefaultPort = 50000;
            this.DefaultMaxOutboundConnections = 16;
            this.DefaultMaxInboundConnections  = 109;
            this.DefaultRPCPort        = 51000;
            this.DefaultAPIPort        = 63000;
            this.MaxTipAge             = 2 * 60 * 60;
            this.MinTxFee              = 10000;
            this.FallbackFee           = 10000;
            this.MinRelayTxFee         = 10000;
            this.RootFolderName        = AmsterdamCoinRootFolderName;
            this.DefaultConfigFilename = AmsterdamCoinDefaultConfigFilename;
            this.MaxTimeOffsetSeconds  = 25 * 60;
            this.CoinTicker            = "AMS";

            var consensusFactory = new PosConsensusFactory();

            // Create the genesis block.
            this.GenesisTime    = 1585312300;
            this.GenesisNonce   = 1904723;
            this.GenesisBits    = 0x1e0fffff;
            this.GenesisVersion = 1;
            this.GenesisReward  = Money.Zero;

            Block genesisBlock = CreateAmsterdamCoinGenesisBlock(consensusFactory, this.GenesisTime, this.GenesisNonce, this.GenesisBits, this.GenesisVersion, this.GenesisReward);

            this.Genesis = genesisBlock;

            // Taken from SolarisX.
            var consensusOptions = new PosConsensusOptions(
                maxBlockBaseSize: 1_000_000,
                maxStandardVersion: 2,
                maxStandardTxWeight: 100_000,
                maxBlockSigopsCost: 20_000,
                maxStandardTxSigopsCost: 20_000 / 5
                );

            var buriedDeployments = new BuriedDeploymentsArray
            {
                [BuriedDeployments.BIP34] = 0,
                [BuriedDeployments.BIP65] = 0,
                [BuriedDeployments.BIP66] = 0
            };

            var bip9Deployments = new StratisBIP9Deployments
            {
                [StratisBIP9Deployments.ColdStaking] = new BIP9DeploymentsParameters(2, BIP9DeploymentsParameters.AlwaysActive, 999999999)
            };

            this.Consensus = new Consensus(
                consensusFactory: consensusFactory,
                consensusOptions: consensusOptions,
                coinType: 524,
                hashGenesisBlock: genesisBlock.GetHash(),
                subsidyHalvingInterval: 210000,
                majorityEnforceBlockUpgrade: 750,
                majorityRejectBlockOutdated: 950,
                majorityWindow: 1000,
                buriedDeployments: buriedDeployments,
                bip9Deployments: bip9Deployments,
                bip34Hash: new uint256("0x0000000000000000000000000000000000000000000000000000000000000000"),
                ruleChangeActivationThreshold: 1916,                                                                   // 95% of 2016
                minerConfirmationWindow: 2016,                                                                         // nPowTargetTimespan / nPowTargetSpacing
                maxReorgLength: 500,
                defaultAssumeValid: new uint256("0x0000000000000000000000000000000000000000000000000000000000000000"), // 0
                maxMoney: long.MaxValue,
                coinbaseMaturity: 50,
                premineHeight: 1,
                premineReward: Money.Coins(144754435m),
                proofOfWorkReward: Money.Coins(2m),
                powTargetTimespan: TimeSpan.FromSeconds(14 * 24 * 60 * 60), // two weeks
                powTargetSpacing: TimeSpan.FromSeconds(10 * 60),
                powAllowMinDifficultyBlocks: false,
                posNoRetargeting: false,
                powNoRetargeting: false,
                powLimit: new Target(new uint256("00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")),
                minimumChainWork: null,
                isProofOfStake: true,
                lastPowBlock: 2500,
                proofOfStakeLimit: new BigInteger(uint256.Parse("00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff").ToBytes(false)),
                proofOfStakeLimitV2: new BigInteger(uint256.Parse("000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffff").ToBytes(false)),
                proofOfStakeReward: Money.Coins(2m)
                );

            this.Base58Prefixes = new byte[12][];
            this.Base58Prefixes[(int)Base58Type.PUBKEY_ADDRESS]             = new byte[] { (83) };
            this.Base58Prefixes[(int)Base58Type.SCRIPT_ADDRESS]             = new byte[] { (125) };
            this.Base58Prefixes[(int)Base58Type.SECRET_KEY]                 = new byte[] { (63 + 128) };
            this.Base58Prefixes[(int)Base58Type.ENCRYPTED_SECRET_KEY_NO_EC] = new byte[] { 0x01, 0x42 };
            this.Base58Prefixes[(int)Base58Type.ENCRYPTED_SECRET_KEY_EC]    = new byte[] { 0x01, 0x43 };
            this.Base58Prefixes[(int)Base58Type.EXT_PUBLIC_KEY]             = new byte[] { (0x04), (0x88), (0xB2), (0x1E) };
            this.Base58Prefixes[(int)Base58Type.EXT_SECRET_KEY]             = new byte[] { (0x04), (0x88), (0xAD), (0xE4) };
            this.Base58Prefixes[(int)Base58Type.PASSPHRASE_CODE]            = new byte[] { 0x2C, 0xE9, 0xB3, 0xE1, 0xFF, 0x39, 0xE2 };
            this.Base58Prefixes[(int)Base58Type.CONFIRMATION_CODE]          = new byte[] { 0x64, 0x3B, 0xF6, 0xA8, 0x9A };
            this.Base58Prefixes[(int)Base58Type.STEALTH_ADDRESS]            = new byte[] { 0x2a };
            this.Base58Prefixes[(int)Base58Type.ASSET_ID]        = new byte[] { 23 };
            this.Base58Prefixes[(int)Base58Type.COLORED_ADDRESS] = new byte[] { 0x13 };

            this.Checkpoints = new Dictionary <int, CheckpointInfo>
            {
                { 0, new CheckpointInfo(new uint256("0x18fccdeafad47d3e10a391d761881fca81c8ad32e3e6fa9576363712ab88982e"), new uint256("0x0000000000000000000000000000000000000000000000000000000000000000")) },
                { 2, new CheckpointInfo(new uint256("0x862e8e39013620d1f12b939d3036d1b29205858f159db0c97ee68604ebb72751"), new uint256("0x7889a02d48988af51ab85035d17185968bd403815d737638597234edb11ad7c2")) },
                { 500, new CheckpointInfo(new uint256("0x20423c8b1a3692c8340540548f4b16e0dc6b74faea68f5058832e0f6af99f41b"), new uint256("0x98f9f469f6abcfc9e196599b099d8c5a71b8240e8c1ca63b6fd1f269919f0519")) }
            };

            this.Bech32Encoders = new Bech32Encoder[2];
            this.Bech32Encoders[(int)Bech32Type.WITNESS_PUBKEY_ADDRESS] = null;
            this.Bech32Encoders[(int)Bech32Type.WITNESS_SCRIPT_ADDRESS] = null;

            this.DNSSeeds = new List <DNSSeedData>
            {
                new DNSSeedData("node1.amsterdamcoin.network", "node1.amsterdamcoin.network"),
                new DNSSeedData("node2.amsterdamcoin.network", "node2.amsterdamcoin.network"),
                new DNSSeedData("node3.amsterdamcoin.network", "node3.amsterdamcoin.network"),
                new DNSSeedData("node4.amsterdamcoin.network", "node4.amsterdamcoin.network"),
                new DNSSeedData("node5.amsterdamcoin.network", "node5.amsterdamcoin.network"),
                new DNSSeedData("node6.amsterdamcoin.network", "node6.amsterdamcoin.network")
            };

            this.SeedNodes = new List <NetworkAddress>
            {
                new NetworkAddress(IPAddress.Parse("176.223.131.60"), 50000), //Official node 1
                new NetworkAddress(IPAddress.Parse("85.214.223.236"), 50000), //Official node 2
                new NetworkAddress(IPAddress.Parse("85.214.241.80"), 50000),  //Official node 3
                new NetworkAddress(IPAddress.Parse("85.214.130.77"), 50000),  //Official node 4
                new NetworkAddress(IPAddress.Parse("81.169.238.113"), 50000), //Official node 5
                new NetworkAddress(IPAddress.Parse("81.169.234.147"), 50000), //Official node 6
            };

            this.StandardScriptsRegistry = new StratisStandardScriptsRegistry();

            Assert(this.Consensus.HashGenesisBlock == uint256.Parse("0x18fccdeafad47d3e10a391d761881fca81c8ad32e3e6fa9576363712ab88982e"));
            Assert(this.Genesis.Header.HashMerkleRoot == uint256.Parse("0x739b30bbbf51bc06f54c049db4bbf93747800dc6efcdcf29249c1cd6e19f2a36"));
        }
        public StratisTest()
        {
            // 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;
            uint magic = BitConverter.ToUInt32(messageStart, 0); // 0x11213171;

            this.Name        = "StratisTest";
            this.Magic       = magic;
            this.DefaultPort = 26178;
            this.RPCPort     = 26174;
            this.CoinTicker  = "TSTRAT";

            var powLimit = new Target(new uint256("0000ffff00000000000000000000000000000000000000000000000000000000"));

            var consensusFactory = new PosConsensusFactory();

            // Create the genesis block.
            this.GenesisTime    = 1470467000;
            this.GenesisNonce   = 1831645;
            this.GenesisBits    = 0x1e0fffff;
            this.GenesisVersion = 1;
            this.GenesisReward  = Money.Zero;

            Block genesisBlock = CreateStratisGenesisBlock(consensusFactory, this.GenesisTime, this.GenesisNonce, this.GenesisBits, this.GenesisVersion, this.GenesisReward);

            genesisBlock.Header.Time  = 1493909211;
            genesisBlock.Header.Nonce = 2433759;
            genesisBlock.Header.Bits  = powLimit;

            this.Genesis = genesisBlock;

            // Taken from StratisX.
            var consensusOptions = new PosConsensusOptions(
                maxBlockBaseSize: 1_000_000,
                maxStandardVersion: 2,
                maxStandardTxWeight: 100_000,
                maxBlockSigopsCost: 20_000,
                maxStandardTxSigopsCost: 20_000 / 5,
                provenHeadersActivationHeight: 10_000_000 // TODO: Set it to the real value once it is known.
                );

            var buriedDeployments = new BuriedDeploymentsArray
            {
                [BuriedDeployments.BIP34] = 0,
                [BuriedDeployments.BIP65] = 0,
                [BuriedDeployments.BIP66] = 0
            };

            var bip9Deployments = new StratisBIP9Deployments();

            this.Consensus = new NBitcoin.Consensus(
                consensusFactory: consensusFactory,
                consensusOptions: consensusOptions,
                coinType: 105,
                hashGenesisBlock: genesisBlock.GetHash(),
                subsidyHalvingInterval: 210000,
                majorityEnforceBlockUpgrade: 750,
                majorityRejectBlockOutdated: 950,
                majorityWindow: 1000,
                buriedDeployments: buriedDeployments,
                bip9Deployments: bip9Deployments,
                bip34Hash: new uint256("0x000000000000024b89b42a942fe0d9fea3bb44ab7bd1b19115dd6a759c0808b8"),
                ruleChangeActivationThreshold: 1916,                                                                   // 95% of 2016
                minerConfirmationWindow: 2016,                                                                         // nPowTargetTimespan / nPowTargetSpacing
                maxReorgLength: 500,
                defaultAssumeValid: new uint256("0x98fa6ef0bca5b431f15fd79dc6f879dc45b83ed4b1bbe933a383ef438321958e"), // 372652
                maxMoney: long.MaxValue,
                coinbaseMaturity: 10,
                premineHeight: 2,
                premineReward: Money.Coins(98000000),
                proofOfWorkReward: Money.Coins(4),
                powTargetTimespan: TimeSpan.FromSeconds(14 * 24 * 60 * 60), // two weeks
                powTargetSpacing: TimeSpan.FromSeconds(10 * 60),
                powAllowMinDifficultyBlocks: false,
                powNoRetargeting: false,
                powLimit: powLimit,
                minimumChainWork: null,
                isProofOfStake: true,
                lastPowBlock: 12500,
                proofOfStakeLimit: new BigInteger(uint256.Parse("00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff").ToBytes(false)),
                proofOfStakeLimitV2: new BigInteger(uint256.Parse("000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffff").ToBytes(false)),
                proofOfStakeReward: Money.COIN
                );

            this.Base58Prefixes[(int)Base58Type.PUBKEY_ADDRESS] = new byte[] { (65) };
            this.Base58Prefixes[(int)Base58Type.SCRIPT_ADDRESS] = new byte[] { (196) };
            this.Base58Prefixes[(int)Base58Type.SECRET_KEY]     = new byte[] { (65 + 128) };

            this.Checkpoints = new Dictionary <int, CheckpointInfo>
            {
                { 0, new CheckpointInfo(new uint256("0x00000e246d7b73b88c9ab55f2e5e94d9e22d471def3df5ea448f5576b1d156b9"), new uint256("0x0000000000000000000000000000000000000000000000000000000000000000")) },
                { 2, new CheckpointInfo(new uint256("0x56959b1c8498631fb0ca5fe7bd83319dccdc6ac003dccb3171f39f553ecfa2f2"), new uint256("0x13f4c27ca813aefe2d9018077f8efeb3766796b9144fcc4cd51803bf4376ab02")) },
                { 50000, new CheckpointInfo(new uint256("0xb42c18eacf8fb5ed94eac31943bd364451d88da0fd44cc49616ffea34d530ad4"), new uint256("0x824934ddc5f935e854ac59ae7f5ed25f2d29a7c3914cac851f3eddb4baf96d78")) },
                { 100000, new CheckpointInfo(new uint256("0xf9e2f7561ee4b92d3bde400d251363a0e8924204c326da7f4ad9ccc8863aad79"), new uint256("0xdef8d92d20becc71f662ee1c32252aca129f1bf4744026b116d45d9bfe67e9fb")) },
                { 150000, new CheckpointInfo(new uint256("0x08b7c20a450252ddf9ce41dbeb92ecf54932beac9090dc8250e933ad3a175381"), new uint256("0xf05dad15f733ae0acbd34adc449be9429099dbee5fa9ecd8e524cf28e9153adb")) },
                { 200000, new CheckpointInfo(new uint256("0x8609cc873222a0573615788dc32e377b88bfd6a0015791f627d969ee3a415115"), new uint256("0xfa28c1f20a8162d133607c6a1c8997833befac3efd9076567258a7683ac181fa")) },
                { 250000, new CheckpointInfo(new uint256("0xdd664e15ac679a6f3b96a7176303956661998174a697ad8231f154f1e32ff4a3"), new uint256("0x19fc0fa29418f8b19cbb6557c1c79dfd0eff6779c0eaaec5d245c5cdf3c96d78")) },
                { 300000, new CheckpointInfo(new uint256("0x2409eb5ae72c80d5b37c77903d75a8e742a33843ab633935ce6e5264db962e23"), new uint256("0xf5ec7af55516b8e264ed280e9a5dba0180a4a9d3713351bfea275b18f3f1514e")) },
                { 350000, new CheckpointInfo(new uint256("0x36811041e9060f4b4c26dc20e0850dca5efaabb60618e3456992e9c0b1b2120e"), new uint256("0xbfda55ef0756bcee8485e15527a2b8ca27ca877aa09c88e363ef8d3253cdfd1c")) },
                { 400000, new CheckpointInfo(new uint256("0xb6abcb933d3e3590345ca5d3abb697461093313f8886568ac8ae740d223e56f6"), new uint256("0xfaf5fcebee3ec0df5155393a99da43de18b12e620fef5edb111a791ecbfaa63a")) }
            };

            this.DNSSeeds = new List <DNSSeedData>
            {
                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")
            };

            this.SeedNodes = new List <NetworkAddress>
            {
                new NetworkAddress(IPAddress.Parse("51.140.231.125"), this.DefaultPort), // 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
            };

            Assert(this.Consensus.HashGenesisBlock == uint256.Parse("0x00000e246d7b73b88c9ab55f2e5e94d9e22d471def3df5ea448f5576b1d156b9"));
        }
示例#13
0
        public EXOSMain()
        {
            // 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] = 0x28;
            messageStart[1] = 0x62;
            messageStart[2] = 0x48;
            messageStart[3] = 0x76;
            uint magic = BitConverter.ToUInt32(messageStart, 0);

            this.Name        = "EXOSMain";
            this.NetworkType = NetworkType.Mainnet;
            this.Magic       = magic;
            this.DefaultPort = 4562;
            this.DefaultMaxOutboundConnections = 16;
            this.DefaultMaxInboundConnections  = 109;
            this.DefaultRPCPort        = 4561;
            this.DefaultAPIPort        = 39120; //EXOS
            this.DefaultSignalRPort    = 39620;
            this.MaxTipAge             = 2 * 60 * 60;
            this.MinTxFee              = 10000;
            this.FallbackFee           = 10000;
            this.MinRelayTxFee         = 10000;
            this.RootFolderName        = StratisRootFolderName;
            this.DefaultConfigFilename = StratisDefaultConfigFilename;
            this.MaxTimeOffsetSeconds  = 25 * 60;
            this.CoinTicker            = "EXOS";
            this.DefaultBanTimeSeconds = 16000; // 500 (MaxReorg) * 64 (TargetSpacing) / 2 = 4 hours, 26 minutes and 40 seconds

            var consensusFactory = new PosConsensusFactory();

            // Create the genesis block.
            this.GenesisTime    = 1523205120;
            this.GenesisNonce   = 842767;
            this.GenesisBits    = 0x1e0fffff;
            this.GenesisVersion = 1;
            this.GenesisReward  = Money.Zero;

            Block genesisBlock = CreateStratisGenesisBlock(consensusFactory, this.GenesisTime, this.GenesisNonce, this.GenesisBits, this.GenesisVersion, this.GenesisReward);

            this.Genesis = genesisBlock;

            // Taken from FluidQt.
            var consensusOptions = new PosConsensusOptions(
                maxBlockBaseSize: 1_000_000,
                maxStandardVersion: 2,
                maxStandardTxWeight: 100_000,
                maxBlockSigopsCost: 20_000,
                maxStandardTxSigopsCost: 20_000 / 5
                );

            var buriedDeployments = new BuriedDeploymentsArray
            {
                [BuriedDeployments.BIP34] = 0,
                [BuriedDeployments.BIP65] = 0,
                [BuriedDeployments.BIP66] = 0
            };

            var bip9Deployments = new StratisBIP9Deployments()
            {
                [StratisBIP9Deployments.ColdStaking] = new BIP9DeploymentsParameters(2,
                                                                                     new DateTime(2018, 12, 1, 0, 0, 0, DateTimeKind.Utc),
                                                                                     new DateTime(2019, 12, 1, 0, 0, 0, DateTimeKind.Utc))
            };

            this.Consensus = new NBitcoin.Consensus(
                consensusFactory: consensusFactory,
                consensusOptions: consensusOptions,
                coinType: 248,
                hashGenesisBlock: genesisBlock.GetHash(),
                subsidyHalvingInterval: 210000,
                majorityEnforceBlockUpgrade: 750,
                majorityRejectBlockOutdated: 950,
                majorityWindow: 1000,
                buriedDeployments: buriedDeployments,
                bip9Deployments: bip9Deployments,
                bip34Hash: new uint256("0x000000000000024b89b42a942fe0d9fea3bb44ab7bd1b19115dd6a759c0808b8"),
                ruleChangeActivationThreshold: 1916,                                                                   // 95% of 2016
                minerConfirmationWindow: 2016,                                                                         // nPowTargetTimespan / nPowTargetSpacing
                maxReorgLength: 500,
                defaultAssumeValid: new uint256("0xc31bf78b55f17c1755cb474bd820eb1db8aa564a0d794ac47b415a8f25237a26"), //
                maxMoney: long.MaxValue,
                coinbaseMaturity: 50,
                premineHeight: 2,
                premineReward: Money.Coins(300000000),
                proofOfWorkReward: Money.Coins(12),
                powTargetTimespan: TimeSpan.FromSeconds(14 * 24 * 60 * 60), // two weeks
                powTargetSpacing: TimeSpan.FromSeconds(10 * 60),
                powAllowMinDifficultyBlocks: false,
                posNoRetargeting: false,
                powNoRetargeting: false,
                powLimit: new Target(new uint256("00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")),
                minimumChainWork: null,
                isProofOfStake: true,
                lastPowBlock: 45000,
                proofOfStakeLimit: new BigInteger(uint256.Parse("00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff").ToBytes(false)),
                proofOfStakeLimitV2: new BigInteger(uint256.Parse("000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffff").ToBytes(false)),
                proofOfStakeReward: Money.COIN
                );

            this.Base58Prefixes = new byte[12][];
            this.Base58Prefixes[(int)Base58Type.PUBKEY_ADDRESS]             = new byte[] { (28) };
            this.Base58Prefixes[(int)Base58Type.SCRIPT_ADDRESS]             = new byte[] { (87) };
            this.Base58Prefixes[(int)Base58Type.SECRET_KEY]                 = new byte[] { (28 + 128) };
            this.Base58Prefixes[(int)Base58Type.ENCRYPTED_SECRET_KEY_NO_EC] = new byte[] { 0x01, 0x42 };
            this.Base58Prefixes[(int)Base58Type.ENCRYPTED_SECRET_KEY_EC]    = new byte[] { 0x01, 0x43 };
            this.Base58Prefixes[(int)Base58Type.EXT_PUBLIC_KEY]             = new byte[] { (0x04), (0x88), (0xB2), (0x1E) };
            this.Base58Prefixes[(int)Base58Type.EXT_SECRET_KEY]             = new byte[] { (0x04), (0x88), (0xAD), (0xE4) };
            this.Base58Prefixes[(int)Base58Type.PASSPHRASE_CODE]            = new byte[] { 0x2C, 0xE9, 0xB3, 0xE1, 0xFF, 0x39, 0xE2 };
            this.Base58Prefixes[(int)Base58Type.CONFIRMATION_CODE]          = new byte[] { 0x64, 0x3B, 0xF6, 0xA8, 0x9A };
            this.Base58Prefixes[(int)Base58Type.STEALTH_ADDRESS]            = new byte[] { 0x2a };
            this.Base58Prefixes[(int)Base58Type.ASSET_ID]        = new byte[] { 23 };
            this.Base58Prefixes[(int)Base58Type.COLORED_ADDRESS] = new byte[] { 0x13 };

            this.Checkpoints = new Dictionary <int, CheckpointInfo>
            {
                { 0, new CheckpointInfo(new uint256("0x00000036090a68c523471da7a4f0f958c1b4403fef74a003be7f71877699cab7"), new uint256("0x0000000000000000000000000000000000000000000000000000000000000000")) },
                { 2, new CheckpointInfo(new uint256("0x892f74fe6b462ec612dc745f19b7f299ffb94aabb17a0826a03092c0eb6f83ec"), new uint256("0x8e61edcdfee2e948c7b6885b91a853cb82ba22ae5a5ef97776f2fb381f99cb09")) },
                { 10, new CheckpointInfo(new uint256("0xd7c9e4381c4b9331be82d13e0b40b932ac624f3fa8b4e80fb8e9f22769095c0a"), new uint256("0x221232ad2caa1635d2b1302b6eafc0254255a7bf5a2d3ea25ac6ac91f6e1c256")) },
                { 50, new CheckpointInfo(new uint256("0x71b54f5cb27d2b0b1dd34ba89c7ff4fa8e8b37da727373cf98134069fb84803e"), new uint256("0x8aaf92c1d948ba107711997b9d56c08ace5e6d3ab11dfbf2ffffc19798eff454")) },
                { 100, new CheckpointInfo(new uint256("0xf1fbdb26299ca5bac77963cc2ffd9e1830c3f106b87b235b5c731b4b3259d383"), new uint256("0xfeef70b0e16e80bb2f977ebc3f9aa72e4a5c052d2825e9fe6ee8a593555760ea")) },
                { 500, new CheckpointInfo(new uint256("0x72bc96ba513fb55431f335de897bb8ce80d898e17a3d4d5e05c48d1670d5f234"), new uint256("0x5e39f38d0a7f68b0aa59c0a5317d6b9ac1c208f01fe56df079f1d0d9d3da3b09")) },
                { 1000, new CheckpointInfo(new uint256("0xf8f562cd694b5ca517aca2e1cd5b953c22a185e715209bfc2a6ae8eb0a524289"), new uint256("0xa1f55377eef150d1c6863d77c618cf397080ddcdfaa0da2038f1682019c83631")) },
                { 5000, new CheckpointInfo(new uint256("0x9fbc9dc45a507a287d043b43a55e0623aca4368ca5c655bc1a7a97eef4951d1a"), new uint256("0x77412fe812a6f4d59b8cce8f4bd2ac7e8bfb5dc56b542348e66f9a4bc7c00441")) },
                { 10000, new CheckpointInfo(new uint256("0x45e01c13af7625b7289ed12f687864d485f603c2b5dcccfff26789bcbbc20439"), new uint256("0x2ccca90aa37406865a6feb5ec198f01d045a64a2aca5ff56ac96c88fe37d2514")) },
                { 14000, new CheckpointInfo(new uint256("0xecd5ae5e58ddde01087a4c7f2033252acc7237a7aa958f4cd0eb016b3c11cd0e"), new uint256("0xd608bfd6f8b4be11f1a0acd50f0cd269b35d40b9b298c564b0a79b9771025c19")) },
                { 18000, new CheckpointInfo(new uint256("0x42ee388a72f85e8a63ed81bdaa4d87040a009cff8471f15e5711ab824faedaa7"), new uint256("0x912d1fcd0f1aa5217893cdda2c536cdbed6039af4cb3dc10a9e9f9f8e7522e6e")) },
                { 20000, new CheckpointInfo(new uint256("0xead9d788c5e0a275d9a8434487248d5b5ed1db14de8ea1627dd70ad1e5fb5f5b"), new uint256("0xcaa8a9f4374e56ef86743040f089e022c50a9cb6cdeb432d66bc077aaf9e8078")) },
                { 25000, new CheckpointInfo(new uint256("0x9e889f90ee0a249a84c2c090117be70de8d53466a5f0bb312fde435ad50080f0"), new uint256("0xd49c521e4c46fb798dd366afbec6c90020d295228e32f0582f9fd5ce2674f3a0")) },
                { 30000, new CheckpointInfo(new uint256("0xcd878a41441aca4e2903941c374d0caf17d7080fd1c5e37aca9caab63e82f333"), new uint256("0xa58e327073c17ed360cfe6747ac2fe9ec6bff3f5be00415b3d2897ccf39d5189")) },
                { 35500, new CheckpointInfo(new uint256("0x3196c8456be83bc810ef0f6e2b34a0962435e89d0844b9db8070487d5ec91afa"), new uint256("0x309d454e9906e40c9472762633188af3957d586be33994a7586c23accb99bd40")) },
                { 40000, new CheckpointInfo(new uint256("0x4d7b1d7115714d16dce3266087309e898e02a7dc1eb8d3f450c8473836de5a19"), new uint256("0x14eb31bf1e59918b45f74afe0d179475a3a83dfc11e33c974520e5567c8ffb8e")) },
                { 45000, new CheckpointInfo(new uint256("0x5f110ad2e1fbbb98bcd4d85167c7904631304bbd311144118f631d59795c0f00"), new uint256("0xf4171d8e19d71d032915363acef2a52f29c0833fe6d685fd0cf7d98efa2942bb")) },
                { 47000, new CheckpointInfo(new uint256("0x0b834c3a8d77939f5fc2e372bc03925a1170e8d386671a8d0f21fa8e5a9d440e"), new uint256("0x5d96f845bf42cc466e5857952fd5e00e27a51c21cdb8b4399f71da1ae4bbba2b")) },
                { 60000, new CheckpointInfo(new uint256("0xe904061cd883995fa96fa162927f771a3e0a834866cf741da1bf6f64d9807aab"), new uint256("0xd6778815c7b9989ea2ddba8d69e7b7c94a7cd48320b1295e5c23784b31b184d9")) },
                { 80000, new CheckpointInfo(new uint256("0x4991919485bc0c4f1f3b89dde06f90cca64b6eee2887a8f2105ed1f7219b056e"), new uint256("0x5f667b4d09a5e0e6fb6f41a7f220f4b769bc225c3feb6f826f84c1a2aedc144a")) },
                { 100000, new CheckpointInfo(new uint256("0x5be1f76165c7133562cdcb3beeac6413aea18e538883e379d5929c6eb26999d1"), new uint256("0x2e0dc1a4fce268f5a85b41a4a9e37032a26b77a6a22d7eae2df5dd4b1e004353")) },
                { 125000, new CheckpointInfo(new uint256("0xd2f245d326e4e0f1e9e22f548496ca9e47025721d7fece27e071a9f63628f0b8"), new uint256("0x6884864f6017c768868774e600907c104efd3b1e2c529411f7d88a1c11a0478e")) },
                { 150000, new CheckpointInfo(new uint256("0x4b4325e2c02654284de2719033c0defba485bd08a6259ca67372600447bf084e"), new uint256("0x358255ae11f9e061268ee9a4947ab275b4c0c12cc4d38b1a581801e1e85da1cb")) },
                { 200000, new CheckpointInfo(new uint256("0x4e4e40dc5cc007135f5113e1ebb22b06c39cff15637b5f51d93340a9cad0dfdf"), new uint256("0xc12688b1c2f4f95762ddac23d078b5a3b4fa02b5c351ad1f544839ff4ef5c061")) },
                { 250000, new CheckpointInfo(new uint256("0x20c97546de02e60c2d53a9c95e65956a3d89e81eb5f7075882fac2d6cc24d316"), new uint256("0x4e2533fd3cf6c03c1eeeea174df123d9a60d50b15e39ee39ea9450514c473731")) },
                { 300000, new CheckpointInfo(new uint256("0x1dca0bf2f051429e911fa9b232fcdf69bbaed667fa55451a3ff4d6450ae5dc52"), new uint256("0xf424bdc3c5ce706a531986bf5ace04ad29d8f141396e36f71ff873a3ec26bb09")) },
                { 350000, new CheckpointInfo(new uint256("0x8ab2fa51dc9c83200f3b2c662648f479f656635ce5c847209f74c2636d45e5c8"), new uint256("0x322303ee24efdb0a07524b95ad9949c278fd4a7aa2cd259f7ac611333b4bc792")) },
                { 400000, new CheckpointInfo(new uint256("0x78da79e80c94c2a175276eb4b903a15395d4213e8814d1f1fabc225e05c56e69"), new uint256("0xc7179fa14c296ebc661f2f1db32d4492cc176d86fe64ad14fb2058ac0f132294")) },
                { 450000, new CheckpointInfo(new uint256("0xfaa749cba84d1111affe61cb8c14ba43a452a265a136066554a22cfa14cabfcd"), new uint256("0x651884ceb30069212c90b5fb3a11d2e6263c0a5c76d6b9b92274ffd6cb3b8fea")) },
                { 600000, new CheckpointInfo(new uint256("0xa4bf14b94da99b72abafb66624e0f238bef68f9141f79f811f618d67bd8149d1"), new uint256("0x99199a7ac240838d58e362e834e43fc52b74e146f84ce3d879d4c213a4799745")) },
                { 790000, new CheckpointInfo(new uint256("0x11610eefff99c06e8fe4667adb07f8598c339ed04e6eed5414b115fb7d4cfd49"), new uint256("0x46cb091b43846e21b547ebf3787deab210628919421180d4cc8275d276fe1cda")) }
            };

            this.Bech32Encoders = new Bech32Encoder[2];
            // Bech32 is currently unsupported on Stratis - once supported uncomment lines below
            //var encoder = new Bech32Encoder("bc");
            //this.Bech32Encoders[(int)Bech32Type.WITNESS_PUBKEY_ADDRESS] = encoder;
            //this.Bech32Encoders[(int)Bech32Type.WITNESS_SCRIPT_ADDRESS] = encoder;
            this.Bech32Encoders[(int)Bech32Type.WITNESS_PUBKEY_ADDRESS] = null;
            this.Bech32Encoders[(int)Bech32Type.WITNESS_SCRIPT_ADDRESS] = null;

            this.DNSSeeds = new List <DNSSeedData>
            {
                new DNSSeedData("seednode1.oexo.cloud", "seednode1.oexo.cloud"),
                new DNSSeedData("seednode2.oexo.net", "seednode2.oexo.net"),
                new DNSSeedData("seednode3.oexo.cloud", "seednode3.oexo.cloud"),
                new DNSSeedData("seednode4.oexo.net", "seednode4.oexo.net")
            };

            this.SeedNodes = new List <NetworkAddress>
            {
            };

            var hostnames = new[] { "vps101.oexo.cloud", "vps102.oexo.net", "vps201.oexo.cloud", "vps202.oexo.net" };

            foreach (string host in hostnames)
            {
                var            addressList = Dns.GetHostAddresses(host).GetValue(0).ToString();
                NetworkAddress addr        = new NetworkAddress
                {
                    Endpoint = Utils.ParseIpEndpoint(addressList, this.DefaultPort)
                };
                this.SeedNodes.Add(addr);
            }

            this.StandardScriptsRegistry = new StratisStandardScriptsRegistry();

            // 64 below should be changed to TargetSpacingSeconds when we move that field.
            Assert(this.DefaultBanTimeSeconds <= this.Consensus.MaxReorgLength * 64 / 2);
            Assert(this.Consensus.HashGenesisBlock == uint256.Parse("0x00000036090a68c523471da7a4f0f958c1b4403fef74a003be7f71877699cab7"));
            Assert(this.Genesis.Header.HashMerkleRoot == uint256.Parse("0x85c4a8a116eb457ff74bb64908e71c6780bff7e69ad3dadc9df6cd753c21f937"));

            this.RegisterRules(this.Consensus);
        }
示例#14
0
        public X42Test()
        {
            // 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;
            uint magic = BitConverter.ToUInt32(messageStart, 0); //0x5223570;

            this.Name        = "x42Test";
            this.Magic       = magic;
            this.DefaultPort = 62342;
            this.RPCPort     = 62343;
            this.DefaultMaxOutboundConnections = 16;
            this.DefaultMaxInboundConnections  = 109;
            this.MaxTipAge             = 2 * 60 * 60;
            this.MinTxFee              = Money.Zero;
            this.FallbackFee           = Money.Zero;
            this.MinRelayTxFee         = Money.Zero;
            this.RootFolderName        = x42RootFolderName;
            this.DefaultConfigFilename = x42DefaultConfigFilename;
            this.MaxTimeOffsetSeconds  = 25 * 60;
            this.CoinTicker            = "Tx42";

            var powLimit = new Target(new uint256("0000ffff00000000000000000000000000000000000000000000000000000000"));

            var consensusFactory = new PosConsensusFactory();

            // Create the testnet genesis block.
            this.GenesisTime    = 1547913523;
            this.GenesisNonce   = 2433759;
            this.GenesisBits    = powLimit;
            this.GenesisVersion = 1;
            this.GenesisReward  = Money.Zero;

            Block genesisBlock = CreateX42GenesisBlock(consensusFactory, this.GenesisTime, this.GenesisNonce, this.GenesisBits, this.GenesisVersion, this.GenesisReward);

            this.Genesis = genesisBlock;

            var consensusOptions = new PosConsensusOptions(
                maxBlockBaseSize: 1_000_000,
                maxStandardVersion: 2,
                maxStandardTxWeight: 100_000,
                maxBlockSigopsCost: 20_000,
                maxStandardTxSigopsCost: 20_000 / 5
                );

            var buriedDeployments = new BuriedDeploymentsArray
            {
                [BuriedDeployments.BIP34] = 0,
                [BuriedDeployments.BIP65] = 0,
                [BuriedDeployments.BIP66] = 0
            };

            var bip9Deployments = new StratisBIP9Deployments()
            {
                [StratisBIP9Deployments.ColdStaking] = new BIP9DeploymentsParameters(2,
                                                                                     new DateTime(2018, 12, 1, 0, 0, 0, DateTimeKind.Utc),
                                                                                     new DateTime(2019, 12, 1, 0, 0, 0, DateTimeKind.Utc))
            };

            this.Consensus = new X42Consensus(
                consensusFactory: consensusFactory,
                consensusOptions: consensusOptions,
                coinType: 424242,
                hashGenesisBlock: genesisBlock.GetHash(),
                subsidyHalvingInterval: 210000,
                majorityEnforceBlockUpgrade: 750,
                majorityRejectBlockOutdated: 950,
                majorityWindow: 1000,
                buriedDeployments: buriedDeployments,
                bip9Deployments: bip9Deployments,
                bip34Hash: new uint256("0x000000000000024b89b42a942fe0d9fea3bb44ab7bd1b19115dd6a759c0808b8"),
                ruleChangeActivationThreshold: 1916, // 95% of 2016
                minerConfirmationWindow: 2016,       // nPowTargetTimespan / nPowTargetSpacing
                maxReorgLength: 500,
                defaultAssumeValid: null,
                maxMoney: Money.Coins(42 * 1000000),
                coinbaseMaturity: 10,
                premineHeight: 2,
                premineReward: Money.Coins(10.5m * 1000000),
                proofOfWorkReward: Money.Zero,
                powTargetTimespan: TimeSpan.FromSeconds(14 * 24 * 60 * 60), // two weeks
                powTargetSpacing: TimeSpan.FromSeconds(60),
                powAllowMinDifficultyBlocks: false,
                posNoRetargeting: false,
                powNoRetargeting: false,
                powLimit: powLimit,
                minimumChainWork: null,
                isProofOfStake: true,
                lastPowBlock: 523,
                proofOfStakeLimitV2: new BigInteger(uint256.Parse("000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffff").ToBytes(false)),
                proofOfStakeReward: Money.Coins(20),
                subsidyLimit: 1000,
                proofOfStakeRewardAfterSubsidyLimit: Money.Coins(5),
                lastProofOfStakeRewardHeight: 3000
                );

            this.Base58Prefixes[(int)Base58Type.PUBKEY_ADDRESS] = new byte[] { (65) };
            this.Base58Prefixes[(int)Base58Type.SCRIPT_ADDRESS] = new byte[] { (196) };
            this.Base58Prefixes[(int)Base58Type.SECRET_KEY]     = new byte[] { (65 + 128) };

            this.Checkpoints = new Dictionary <int, CheckpointInfo>
            {
                { 0, new CheckpointInfo(new uint256("0x8f4fd479064ac44e1ca633754cc0de1bdc5b0d61562722e29beb32daf9bd8ce9"), new uint256("0x0000000000000000000000000000000000000000000000000000000000000000")) }, // Genisis
            };

            var encoder = new Bech32Encoder("bc");

            this.Bech32Encoders = new Bech32Encoder[2];
            this.Bech32Encoders[(int)Bech32Type.WITNESS_PUBKEY_ADDRESS] = encoder;
            this.Bech32Encoders[(int)Bech32Type.WITNESS_SCRIPT_ADDRESS] = encoder;

            this.DNSSeeds = new List <DNSSeedData>
            {
                new DNSSeedData("testnet1.x42seed.host", "testnet1.x42seed.host"),
            };

            string[] seedNodes = { "63.32.82.169" };
            this.SeedNodes = ConvertToNetworkAddresses(seedNodes, this.DefaultPort).ToList();

            this.StandardScriptsRegistry = new StratisStandardScriptsRegistry();

            Assert(this.Consensus.HashGenesisBlock == uint256.Parse("0x8f4fd479064ac44e1ca633754cc0de1bdc5b0d61562722e29beb32daf9bd8ce9"));
            Assert(this.Genesis.Header.HashMerkleRoot == uint256.Parse("0x288d7d5bbd1fb96f3550c2cc6a127fe382b6d967694a352b06c5101412b14d09"));
        }
示例#15
0
        public EXOSRegTest()
        {
            var messageStart = new byte[4];

            messageStart[0] = 0x4a;
            messageStart[1] = 0xdb;
            messageStart[2] = 0xea;
            messageStart[3] = 0xfc;
            uint magic = BitConverter.ToUInt32(messageStart, 0); // 0xefc0f2cd

            this.Name        = "EXOSRegTest";
            this.NetworkType = NetworkType.Regtest;
            this.Magic       = magic;
            this.DefaultPort = 15888;
            this.DefaultMaxOutboundConnections = 16;
            this.DefaultMaxInboundConnections  = 109;
            this.DefaultRPCPort        = 15889;
            this.DefaultAPIPort        = 39122;
            this.CoinTicker            = "TEXOS";
            this.DefaultBanTimeSeconds = 16000; // 500 (MaxReorg) * 64 (TargetSpacing) / 2 = 4 hours, 26 minutes and 40 seconds

            var powLimit = new Target(new uint256("7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"));

            var consensusFactory = new PosConsensusFactory();

            // Create the genesis block.
            this.GenesisTime    = 1523205120;
            this.GenesisNonce   = 842767;
            this.GenesisBits    = 0x1e0fffff;
            this.GenesisVersion = 1;
            this.GenesisReward  = Money.Zero;

            Block genesisBlock = CreateStratisGenesisBlock(consensusFactory, this.GenesisTime, this.GenesisNonce, this.GenesisBits, this.GenesisVersion, this.GenesisReward);

            genesisBlock.Header.Time  = 1391501792;
            genesisBlock.Header.Nonce = 4249953;
            genesisBlock.Header.Bits  = powLimit;

            this.Genesis = genesisBlock;

            // Taken from StratisX.
            var consensusOptions = new PosConsensusOptions(
                maxBlockBaseSize: 1_000_000,
                maxStandardVersion: 2,
                maxStandardTxWeight: 100_000,
                maxBlockSigopsCost: 20_000,
                maxStandardTxSigopsCost: 20_000 / 5
                );

            var buriedDeployments = new BuriedDeploymentsArray
            {
                [BuriedDeployments.BIP34] = 0,
                [BuriedDeployments.BIP65] = 0,
                [BuriedDeployments.BIP66] = 0
            };

            var bip9Deployments = new StratisBIP9Deployments()
            {
                // Always active on StratisRegTest.
                [StratisBIP9Deployments.ColdStaking] = new BIP9DeploymentsParameters(1, BIP9DeploymentsParameters.AlwaysActive, 999999999)
            };

            this.Consensus = new NBitcoin.Consensus(
                consensusFactory: consensusFactory,
                consensusOptions: consensusOptions,
                coinType: 105,
                hashGenesisBlock: genesisBlock.GetHash(),
                subsidyHalvingInterval: 210000,
                majorityEnforceBlockUpgrade: 750,
                majorityRejectBlockOutdated: 950,
                majorityWindow: 1000,
                buriedDeployments: buriedDeployments,
                bip9Deployments: bip9Deployments,
                bip34Hash: new uint256("0x000000000000024b89b42a942fe0d9fea3bb44ab7bd1b19115dd6a759c0808b8"),
                ruleChangeActivationThreshold: 1916, // 95% of 2016
                minerConfirmationWindow: 2016,       // nPowTargetTimespan / nPowTargetSpacing
                maxReorgLength: 500,
                defaultAssumeValid: null,            // turn off assumevalid for regtest.
                maxMoney: long.MaxValue,
                coinbaseMaturity: 10,
                premineHeight: 2,
                premineReward: Money.Coins(300000000),
                proofOfWorkReward: Money.Coins(12),
                powTargetTimespan: TimeSpan.FromSeconds(14 * 24 * 60 * 60), // two weeks
                powTargetSpacing: TimeSpan.FromSeconds(10 * 60),
                powAllowMinDifficultyBlocks: true,
                posNoRetargeting: true,
                powNoRetargeting: true,
                powLimit: powLimit,
                minimumChainWork: null,
                isProofOfStake: true,
                lastPowBlock: 45000,
                proofOfStakeLimit: new BigInteger(uint256.Parse("00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff").ToBytes(false)),
                proofOfStakeLimitV2: new BigInteger(uint256.Parse("000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffff").ToBytes(false)),
                proofOfStakeReward: Money.COIN
                );

            this.Base58Prefixes[(int)Base58Type.PUBKEY_ADDRESS] = new byte[] { (75) };
            this.Base58Prefixes[(int)Base58Type.SCRIPT_ADDRESS] = new byte[] { (206) };
            this.Base58Prefixes[(int)Base58Type.SECRET_KEY]     = new byte[] { (75 + 128) };
            this.Base58Prefixes[(int)Base58Type.EXT_PUBLIC_KEY] = new byte[] { (0x04), (0x35), (0x87), (0xCF) };
            this.Base58Prefixes[(int)Base58Type.EXT_SECRET_KEY] = new byte[] { (0x04), (0x35), (0x83), (0x94) };

            this.Checkpoints = new Dictionary <int, CheckpointInfo>()
            {
                // Fake checkpoint to prevent PH to be activated.
                // TODO: Once PH is complete, this should be removed
                // { 100_000 , new CheckpointInfo(uint256.Zero, uint256.Zero) }
            };
            this.DNSSeeds  = new List <DNSSeedData>();
            this.SeedNodes = new List <NetworkAddress>();

            this.StandardScriptsRegistry = new StratisStandardScriptsRegistry();

            // 64 below should be changed to TargetSpacingSeconds when we move that field.
            Assert(this.DefaultBanTimeSeconds <= this.Consensus.MaxReorgLength * 64 / 2);
            Assert(this.Consensus.HashGenesisBlock == uint256.Parse("0x00000755a53922ad3443a7609ee700ca246a547783116f2085fff1e486e56085"));

            this.RegisterRules(this.Consensus);
        }