C# Класс BitSharper.Transaction

Наследование: Message
Показать файл Открыть проект Примеры использования класса

Private Properties

Свойство Тип Описание
AddBlockAppearance void
ConnectForReorganize TransactionInput
DisconnectInputs bool
GetValueSentToMe ulong
HashTransactionForSignature byte[]
Transaction System

Открытые методы

Метод Описание
AddInput ( TransactionInput input ) : void

Adds an input directly, with no checking that it's valid.

AddInput ( TransactionOutput from ) : void

Adds an input to this transaction that imports value from the given output. Note that this input is NOT complete and after every input is added with addInput() and every output is added with addOutput(), signInputs() must be called to finalize the transaction and finish the inputs off. Otherwise it won't be accepted by the network.

AddOutput ( TransactionOutput to ) : void

Adds the given output to this transaction. The output must be completely initialized.

BitcoinSerializeToStream ( Stream stream ) : void
Equals ( object other ) : bool
GetHashCode ( ) : int
GetValueSentFromMe ( Wallet wallet ) : ulong

Calculates the sum of the inputs that are spending coins with keys in the wallet. This requires the transactions sending coins to those keys to be in the wallet. This method will not attempt to download the blocks containing the input transactions if the key is in the wallet but the transactions are not.

GetValueSentToMe ( Wallet wallet ) : ulong

Calculates the sum of the outputs that are sending coins to a key in the wallet.

IsEveryOutputSpent ( ) : bool
SignInputs ( SigHash hashType, Wallet wallet ) : void

Once a transaction has some inputs and outputs added, the signatures in the inputs can be calculated. The signature is over the transaction itself, to prove the redeemer actually created that transaction, so we have to do this step last.

This method is similar to SignatureHash in script.cpp

ToString ( ) : string
Transaction ( NetworkParameters @params, byte payloadBytes ) : System

Creates a transaction from the given serialized bytes, eg, from a block or a tx network message.

Transaction ( NetworkParameters @params, byte payload, int offset ) : System

Creates a transaction by reading payload starting from offset bytes in. Length of a transaction is fixed.

Защищенные методы

Метод Описание
Parse ( ) : void

Приватные методы

Метод Описание
AddBlockAppearance ( StoredBlock block ) : void

Adds the given block to the internal serializable set of blocks in which this transaction appears. This is used by the wallet to ensure transactions that appear on side chains are recorded properly even though the block stores do not save the transaction data at all.

ConnectForReorganize ( Transaction>.IDictionary transactions ) : TransactionInput

Connects all inputs using the provided transactions. If any input cannot be connected returns that input or null on success.

DisconnectInputs ( ) : bool
GetValueSentToMe ( Wallet wallet, bool includeSpent ) : ulong

Calculates the sum of the outputs that are sending coins to a key in the wallet. The flag controls whether to include spent outputs or not.

HashTransactionForSignature ( SigHash type, bool anyoneCanPay ) : byte[]
Transaction ( NetworkParameters @params ) : System

Описание методов

AddInput() публичный Метод

Adds an input directly, with no checking that it's valid.
public AddInput ( TransactionInput input ) : void
input TransactionInput
Результат void

AddInput() публичный Метод

Adds an input to this transaction that imports value from the given output. Note that this input is NOT complete and after every input is added with addInput() and every output is added with addOutput(), signInputs() must be called to finalize the transaction and finish the inputs off. Otherwise it won't be accepted by the network.
public AddInput ( TransactionOutput from ) : void
from TransactionOutput
Результат void

AddOutput() публичный Метод

Adds the given output to this transaction. The output must be completely initialized.
public AddOutput ( TransactionOutput to ) : void
to TransactionOutput
Результат void

BitcoinSerializeToStream() публичный Метод

public BitcoinSerializeToStream ( Stream stream ) : void
stream Stream
Результат void

Equals() публичный Метод

public Equals ( object other ) : bool
other object
Результат bool

GetHashCode() публичный Метод

public GetHashCode ( ) : int
Результат int

GetValueSentFromMe() публичный Метод

Calculates the sum of the inputs that are spending coins with keys in the wallet. This requires the transactions sending coins to those keys to be in the wallet. This method will not attempt to download the blocks containing the input transactions if the key is in the wallet but the transactions are not.
public GetValueSentFromMe ( Wallet wallet ) : ulong
wallet Wallet
Результат ulong

GetValueSentToMe() публичный Метод

Calculates the sum of the outputs that are sending coins to a key in the wallet.
public GetValueSentToMe ( Wallet wallet ) : ulong
wallet Wallet
Результат ulong

IsEveryOutputSpent() публичный Метод

public IsEveryOutputSpent ( ) : bool
Результат bool

Parse() защищенный Метод

protected Parse ( ) : void
Результат void

SignInputs() публичный Метод

Once a transaction has some inputs and outputs added, the signatures in the inputs can be calculated. The signature is over the transaction itself, to prove the redeemer actually created that transaction, so we have to do this step last.
This method is similar to SignatureHash in script.cpp
public SignInputs ( SigHash hashType, Wallet wallet ) : void
hashType SigHash This should always be set to SigHash.ALL currently. Other types are unused.
wallet Wallet A wallet is required to fetch the keys needed for signing.
Результат void

ToString() публичный Метод

public ToString ( ) : string
Результат string

Transaction() публичный Метод

Creates a transaction from the given serialized bytes, eg, from a block or a tx network message.
public Transaction ( NetworkParameters @params, byte payloadBytes ) : System
@params NetworkParameters
payloadBytes byte
Результат System

Transaction() публичный Метод

Creates a transaction by reading payload starting from offset bytes in. Length of a transaction is fixed.
public Transaction ( NetworkParameters @params, byte payload, int offset ) : System
@params NetworkParameters
payload byte
offset int
Результат System