internal TransactionOutput(NetworkParameters @params, Transaction parent, ulong value, Address to) : base(@params) { _value = value; _scriptBytes = Script.CreateOutputScript(to); ParentTransaction = parent; _availableForSpending = true; }
/// <summary> /// Adds a coinbase transaction to the block. This exists for unit tests. /// </summary> internal void AddCoinbaseTransaction(byte[] pubKeyTo) { Transactions = new List <Transaction>(); var coinbase = new Transaction(Params); // A real coinbase transaction has some stuff in the scriptSig like the extraNonce and difficulty. The // transactions are distinguished by every TX output going to a different key. // // Here we will do things a bit differently so a new address isn't needed every time. We'll put a simple // counter in the scriptSig so every transaction has a different hash. coinbase.AddInput(new TransactionInput(Params, coinbase, new[] { (byte)_txCounter++ })); coinbase.AddOutput(new TransactionOutput(Params, coinbase, Script.CreateOutputScript(pubKeyTo))); Transactions.Add(coinbase); }