public SmartCoin(SmartTransaction transaction, uint outputIndex, HdPubKey pubKey) { Transaction = transaction; Index = outputIndex; _transactionId = new Lazy <uint256>(() => Transaction.GetHash(), true); _outPoint = new Lazy <OutPoint>(() => new OutPoint(TransactionId, Index), true); _txOut = new Lazy <TxOut>(() => Transaction.Transaction.Outputs[Index], true); _coin = new Lazy <Coin>(() => new Coin(OutPoint, TxOut), true); _hashCode = new Lazy <int>(() => OutPoint.GetHashCode(), true); Height = transaction.Height; HdPubKey = pubKey; Transaction.WalletOutputs.Add(this); }