Exemple #1
0
        public void validatorAsCandidate()
        {
            var     lib                  = new RecentCore(NodeUrl);
            var     wallet               = lib.importWalletFromSeedPhrase("combine close before lawsuit asthma glimpse yard debate mixture stool adjust ride");
            var     balance              = lib.getBalance().Result;
            decimal witnessesFunds       = 100m;
            var     currentBalance       = lib.getBalance().Result;
            var     epoch                = lib.getCurrentValidatorsEpoch().Result + 1;
            var     requiredStakingFunds = lib.getRequiredStakingFunds(epoch).Result;
            var     candidates           = lib.getCandidatesDetailsByEpoch(epoch).Result;
            var     totalRequiedFunds    = requiredStakingFunds + witnessesFunds;

            if (candidates.Select(u => u.address.ToLower()).ToList().IndexOf(wallet.address.ToLower()) == -1)
            {
                if (currentBalance < totalRequiedFunds + 1m)
                {
                    var validator2Lib    = new RecentCore(NodeUrl);
                    var validator2Wallet = validator2Lib.importWalletFromPK("E5ADE4B50BA041A9C77DBA91401BEA949393F2C24433B0338702E7AE06443089");
                    var validato2Balance = validator2Lib.getBalance().Result;

                    var txTransfer = validator2Lib.transfer(totalRequiedFunds - currentBalance + 1m, wallet.address, false, true, null).Result;
                }

                var tx = lib.validatorAsCandidate(requiredStakingFunds, witnessesFunds, false, true, null).Result;
            }
        }
Exemple #2
0
        public void voteValidatorAsServiceProvider()
        {
            var lib    = new RecentCore(NodeUrl);
            var wallet = lib.importWalletFromSeedPhrase("combine close before lawsuit asthma glimpse yard debate mixture stool adjust ride");
            var epoch  = lib.getCurrentValidatorsEpoch().Result + 1;

            var  candidates = lib.getCandidatesDetailsByEpoch(epoch).Result;
            var  candidate  = candidates.FirstOrDefault();
            uint freeMBs    = 1;
            var  balance    = lib.getBalance().Result;

            if (candidate != null)
            {
                var tx = lib.voteValidatorAsServiceProvider(candidate.address, freeMBs, false, true, null).Result;
            }
        }