Documentation ¶
Index ¶
- type TXInput
- type TXOutput
- type TXOutputs
- type Transaction
- func (t *Transaction) Hash() []byte
- func (t *Transaction) ID() []byte
- func (t *Transaction) IsCoinbase() bool
- func (t *Transaction) Serialize() []byte
- func (t *Transaction) Sign(privateKey ecdsa.PrivateKey, prevTxs map[string]Transaction)
- func (t *Transaction) String() string
- func (t *Transaction) TrimmedCopy() Transaction
- func (t *Transaction) Verify(prevTxs map[string]Transaction) bool
- func (t *Transaction) Vin() []TXInput
- func (t *Transaction) Vout() []TXOutput
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type TXInput ¶
type TXInput struct {
// contains filtered or unexported fields
}
TXInput represents a transaction input
func NewTXInput ¶
NewTXInput create a new TXInput
type TXOutput ¶
type TXOutput struct {
// contains filtered or unexported fields
}
TXOutput represents a transaction output
func NewTXOutput ¶
NewTXOutput create a new TXOutput
func (*TXOutput) IsLockedWithKey ¶
IsLockedWithKey checks if the output can be used by the owner of the pubkey
func (*TXOutput) PubKeyHash ¶
type TXOutputs ¶
type TXOutputs struct {
// contains filtered or unexported fields
}
TXOutputs collects TXOutput
func DeserializeOutputs ¶
DeserializeOutputs deserializes TXOutputs
type Transaction ¶
type Transaction struct {
// contains filtered or unexported fields
}
func BuildTransaction ¶
func BuildTransaction(inputs []TXInput, outputs []TXOutput) *Transaction
BuildTransaction creates a coinbase transaction
func DeserializeTransaction ¶
func DeserializeTransaction(data []byte) Transaction
DeserializeTransaction deserializes a transaction
func NewCoinbaseTX ¶
func NewCoinbaseTX(to, data string) *Transaction
NewCoinbaseTX creates a new coinbase transaction
func (*Transaction) Hash ¶
func (t *Transaction) Hash() []byte
Hash returns the hash of the Transaction
func (*Transaction) ID ¶
func (t *Transaction) ID() []byte
func (*Transaction) IsCoinbase ¶
func (t *Transaction) IsCoinbase() bool
IsCoinbase checks whether the transaction is coinbase
func (*Transaction) Serialize ¶
func (t *Transaction) Serialize() []byte
Serialize returns a serialized Transaction
func (*Transaction) Sign ¶
func (t *Transaction) Sign(privateKey ecdsa.PrivateKey, prevTxs map[string]Transaction)
Sign signs each input of a Transaction
func (*Transaction) String ¶
func (t *Transaction) String() string
String returns a human-readable representation of a transaction
func (*Transaction) TrimmedCopy ¶
func (t *Transaction) TrimmedCopy() Transaction
TrimmedCopy creates a trimmed copy of Transaction to be used in signing
func (*Transaction) Verify ¶
func (t *Transaction) Verify(prevTxs map[string]Transaction) bool
Verify verifies signatures of Transaction inputs
func (*Transaction) Vin ¶
func (t *Transaction) Vin() []TXInput
func (*Transaction) Vout ¶
func (t *Transaction) Vout() []TXOutput