Ejemplo n.º 1
0
        protected virtual void CreatePayloadOutputs(Transaction tx, Money reward)
        {
            if (coinbasepayloadParameters.CoinbasePayload != null)
            {
                CoinbasePayload[] coinbasepayloads;
                if (coinbasepayloadParameters.CoinbasePayload.Type == JTokenType.Array)
                {
                    coinbasepayloads = coinbasepayloadParameters.CoinbasePayload.ToObject <CoinbasePayload[]>();
                }
                else
                {
                    coinbasepayloads = new[] { coinbasepayloadParameters.CoinbasePayload.ToObject <CoinbasePayload>() }
                };

                foreach (var CoinbasePayee in coinbasepayloads)
                {
                    if (!string.IsNullOrEmpty(CoinbasePayee.Payee))
                    {
                        var payeeAddress = BitcoinUtils.CashAddrToDestination(CoinbasePayee.Payee, network, true);
                        var payeeReward  = CoinbasePayee.Amount;

                        tx.Outputs.Add(payeeReward, payeeAddress);
                    }
                }
            }
        }
Ejemplo n.º 2
0
        protected virtual void CreateCoinbaseDevRewardOutputs(Transaction tx)
        {
            if (CoinbaseDevRewardParams.CoinbaseDevReward != null)
            {
                CoinbaseDevReward[] CBRewards;
                CBRewards = new[] { CoinbaseDevRewardParams.CoinbaseDevReward.ToObject <CoinbaseDevReward>() };

                foreach (var CBReward in CBRewards)
                {
                    if (!string.IsNullOrEmpty(CBReward.Payee))
                    {
                        var payeeAddress = BitcoinUtils.AddressToDestination(CBReward.Payee, network);
                        var payeeReward  = CBReward.Value;
                        tx.Outputs.Add(payeeReward, payeeAddress);
                    }
                }
            }
        }
Ejemplo n.º 3
0
        protected virtual Transaction CreatePayeeOutputTransaction()
        {
            rewardToPool = new Money(BlockTemplate.CoinbaseValue, MoneyUnit.Satoshi);

            var tx = Transaction.Create(network);

            if (payeeParameters?.PayeeAmount > 0)
            {
                var payeeReward = new Money(payeeParameters.PayeeAmount.Value, MoneyUnit.Satoshi);
                rewardToPool -= payeeReward;

                tx.Outputs.Add(payeeReward, BitcoinUtils.AddressToDestination(payeeParameters.Payee, network));
            }

            tx.Outputs.Insert(0, new TxOut(rewardToPool, poolAddressDestination));

            return(tx);
        }
Ejemplo n.º 4
0
 protected virtual Money CreateFounderOutputs(Transaction tx, Money reward)
 {
     if (FounderParameters.Founder != null)
     {
         Founder[] founders = new[] { FounderParameters.Founder.ToObject <Founder>() };
         foreach (var Founder in founders)
         {
             if (!string.IsNullOrEmpty(Founder.Payee))
             {
                 var payeeAddress = coin.IsFounderPayeeMultisig ? BitcoinUtils.MultiSigAddressToDestination(Founder.Payee, network) : BitcoinUtils.AddressToDestination(Founder.Payee, network);
                 var payeeReward  = Founder.Amount;
                 reward       -= payeeReward;
                 rewardToPool -= payeeReward;
                 tx.Outputs.Add(payeeReward, payeeAddress);
             }
         }
     }
     return(reward);
 }
Ejemplo n.º 5
0
        protected virtual Money CreateTreasuryOutputs(Transaction tx, Money reward)
        {
            if (TreasuryParams.Treasury != null)
            {
                Treasury[] CBRewards;
                CBRewards = new[] { TreasuryParams.Treasury.ToObject <Treasury>() };

                foreach (var CBReward in CBRewards)
                {
                    if (!string.IsNullOrEmpty(CBReward.Payee))
                    {
                        var payeeAddress = BitcoinUtils.AddressToDestination(CBReward.Payee, network);
                        var payeeReward  = CBReward.Amount;
                        tx.Outputs.Add(payeeReward, payeeAddress);
                    }
                }
            }
            return(reward);
        }
Ejemplo n.º 6
0
        protected virtual Money CreateTreasuryOutputs(Transaction tx, Money reward)
        {
            if (TreasuryParameters.Treasury != null)
            {
                Treasury[] treasurys = new[] { TreasuryParameters.Treasury.ToObject <Treasury>() };
                foreach (var Treasury in treasurys)
                {
                    if (!string.IsNullOrEmpty(Treasury.Address))
                    {
                        var payeeAddress = coin.IsTreasuryAddressMultisig ? BitcoinUtils.MultiSigAddressToDestination(Treasury.Address, network) : BitcoinUtils.AddressToDestination(Treasury.Address, network);
                        var payeeReward  = Treasury.Amount;

                        reward       -= payeeReward;
                        rewardToPool -= payeeReward;

                        tx.Outputs.Add(payeeReward, payeeAddress);
                    }
                }
            }
            return(reward);
        }
Ejemplo n.º 7
0
        protected virtual Money CreateMasternodeOutputs(Transaction tx, Money reward)
        {
            if (masterNodeParameters.Masternode != null)
            {
                Masternode[] masternodes;

                // Dash v13 Multi-Master-Nodes
                if (masterNodeParameters.Masternode.Type == JTokenType.Array)
                {
                    masternodes = masterNodeParameters.Masternode.ToObject <Masternode[]>();
                }
                else
                {
                    masternodes = new[] { masterNodeParameters.Masternode.ToObject <Masternode>() }
                };

                foreach (var masterNode in masternodes)
                {
                    if (!string.IsNullOrEmpty(masterNode.Payee))
                    {
                        var payeeAddress = BitcoinUtils.AddressToDestination(masterNode.Payee, network);
                        var payeeReward  = masterNode.Amount;
                        if (!(poolConfig.Template.Symbol == "IDX" || poolConfig.Template.Symbol == "VGC" || poolConfig.Template.Symbol == "SHRX" ||
                              poolConfig.Template.Symbol == "RTM" || poolConfig.Template.Symbol == "XZC"))
                        {
                            reward       -= payeeReward;
                            rewardToPool -= payeeReward;
                        }
                        tx.Outputs.Add(payeeReward, payeeAddress);
                    }
                }
            }

            if (masterNodeParameters.SuperBlocks != null && masterNodeParameters.SuperBlocks.Length > 0)
            {
                foreach (var superBlock in masterNodeParameters.SuperBlocks)
                {
                    var payeeAddress = BitcoinUtils.AddressToDestination(superBlock.Payee, network);
                    var payeeReward  = superBlock.Amount;

                    reward       -= payeeReward;
                    rewardToPool -= payeeReward;

                    tx.Outputs.Add(payeeReward, payeeAddress);
                }
            }

            if (!string.IsNullOrEmpty(masterNodeParameters.Payee))
            {
                var payeeAddress = BitcoinUtils.AddressToDestination(masterNodeParameters.Payee, network);
                var payeeReward  = masterNodeParameters.PayeeAmount;
                if (!(poolConfig.Template.Symbol == "IDX" || poolConfig.Template.Symbol == "VGC" || poolConfig.Template.Symbol == "SHRX" ||
                      poolConfig.Template.Symbol == "RTM" || poolConfig.Template.Symbol == "XZC"))
                {
                    reward       -= payeeReward;
                    rewardToPool -= payeeReward;
                }

                tx.Outputs.Add(payeeReward, payeeAddress);
            }

            return(reward);
        }