/// <summary>
        /// Deserialize the transaction hex string.
        /// </summary>
        /// <param name="rawTx">Transaction hex string</param>
        /// <returns>Bitcoin Transaction</returns>
        public static TxModel DecodeRawTx(string rawTx)
        {
            if (Transaction.TryParse(Base16.ToByteArray(rawTx), out Transaction tx))
            {
                TxModel result = new TxModel()
                {
                    Version    = tx.Version,
                    TxInCount  = tx.TxInCount.Number,
                    TxInList   = new ObservableCollection <TxInModel>(tx.TxInList.Select(x => new TxInModel(x))),
                    TxOutCount = tx.TxOutCount.Number,
                    TxOutList  = new ObservableCollection <TxOut>(tx.TxOutList),
                    LockTime   = tx.LockTime,
                    TxId       = tx.GetTransactionID(),
                    WtxId      = tx.GetWitnessTransactionID(),
                    IsRbf      = tx.TxInList.Any(x => x.Sequence != uint.MaxValue)
                };

                return(result);
            }
            throw new ArgumentException("Can not parse the given transaction!");
        }
        /// <summary>
        /// Creates a Raw Unsigned bitcoin transaction Transaction.
        /// </summary>
        /// <param name="txToSpend">List of UTXOs to spend.</param>
        /// <param name="receiveAddr">List of receiving addresses and the amount to be paid to each.</param>
        /// <param name="wallet">Type of the wallet (Electrum does not recognize normal type of scriptSig placeholder).</param>
        /// <returns>Raw unsigned transaction string.</returns>
        public static string CreateRawTx(uint ver, List <UTXO> txToSpend, List <ReceivingAddress> receiveAddr, uint lockTime, WalletType wallet)
        {
            TxIn[] tIns = txToSpend.Select(x => new TxIn()
            {
                Outpoint = new Outpoint()
                {
                    Index = x.OutIndex, TxId = x.TxHash
                },
                ScriptSig       = BuildScriptSig(x.Address, wallet),
                ScriptSigLength = new CompactInt((ulong)BuildScriptSig(x.Address, wallet).Length / 2),
                Sequence        = uint.MaxValue
            }).ToArray();

            TxOut[] tOuts = receiveAddr.Select(x => new TxOut()
            {
                Amount         = x.PaymentSatoshi,
                PkScript       = BuildScriptPub(x.Address),
                PkScriptLength = new CompactInt((ulong)BuildScriptPub(x.Address).Length / 2)
            }).ToArray();

            Transaction tx = new Transaction(ver, (ulong)txToSpend.Count, tIns, (ulong)receiveAddr.Count, tOuts, lockTime);

            return(tx.Serialize().ToBase16());
        }