diff --git a/Src/Autarkysoft.Bitcoin/Blockchain/Transactions/Transaction.cs b/Src/Autarkysoft.Bitcoin/Blockchain/Transactions/Transaction.cs index 1fea5bca..680ec088 100644 --- a/Src/Autarkysoft.Bitcoin/Blockchain/Transactions/Transaction.cs +++ b/Src/Autarkysoft.Bitcoin/Blockchain/Transactions/Transaction.cs @@ -48,6 +48,21 @@ public Transaction(int ver, TxIn[] txIns, TxOut[] txOuts, LockTime lt, Witness[] WitnessList = witnesses; } + /// + /// Initializes a new instance of using hexadecimal string representation of the transaction. + /// + /// + /// Transaction data in hexadecimal format + public Transaction(string hex) + { + byte[] data = Base16.Decode(hex); + var stream = new FastStreamReader(data); + if (!TryDeserialize(stream, out string error)) + { + throw new ArgumentException(error); + } + } + private const int MaxTxSize = 4_000_000;