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;

                        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 ?? (reward / 5);

                reward       -= payeeReward;
                rewardToPool -= payeeReward;

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

            return(reward);
        }
        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);
        }