Documentation ¶
Index ¶
- Constants
- Variables
- func MoneyRange(v int64) bool
- type Input
- type JoinSplit
- type Output
- type Transaction
- func (t *Transaction) GetHeader() uint32
- func (t *Transaction) IsCoinBase() bool
- func (t *Transaction) IsEqual(other *Transaction) bool
- func (t *Transaction) MarshalBinary() ([]byte, error)
- func (t *Transaction) ReadFrom(r io.Reader) (n int64, err error)
- func (t *Transaction) TxHash() chainhash.Hash
- func (t *Transaction) UnmarshalBinary(data []byte) error
- func (tx *Transaction) Validate(params *chaincfg.Params) error
- func (t *Transaction) WriteTo(w io.Writer) (n int64, err error)
Constants ¶
View Source
const ( MaxBlockBaseSize = 2000000 NumJoinSplitInputs = 2 NumJoinSplitOutputs = 2 SproutVersionGroupID uint32 = 0 OverwinterFlagMask uint32 = 0x80000000 OverwinterVersionGroupID = 0x03C48270 TxExpiryHeightThreshold uint32 = 500000000 SproutMinCurrentVersion uint32 = 1 SproutMaxCurrentVersion = 2 OverwinterMinCurrentVersion = 3 OverwinterMaxCurrentVersion = 3 )
Variables ¶
View Source
var ( ErrOverwinterTxVersionTooLow = fmt.Errorf("overwinter transaction version too low") ErrUnknownTxVersionGroupID = fmt.Errorf("transaction has unknown version group id") ErrTxExpiryHeightIsTooHigh = fmt.Errorf("transaction expiry height is too high") ErrTxVersionTooLow = fmt.Errorf("transaction version too low") ErrTxVersionTooHigh = fmt.Errorf("transaction version too high") ErrNoTxInputs = fmt.Errorf("transaction has no inputs") ErrNoTxOutputs = fmt.Errorf("transaction has no outputs") ErrDuplicateTxInputs = fmt.Errorf("transaction contains duplicate inputs") ErrDuplicateTxNullifiers = fmt.Errorf("transaction contains duplicate nullifiers") ErrPrevOutIsNull = fmt.Errorf("transaction input refers to null previous output") ErrCoinBaseTxHasJoinSplits = fmt.Errorf("coinbase transaction has joinsplits") ErrCoinBaseTxHasOutputs = fmt.Errorf("coinbase transaction has outputs") )
Functions ¶
func MoneyRange ¶
Types ¶
type JoinSplit ¶
type JoinSplit struct { // A value v_{pub}^{old} that the JoinSplit transfer removes from the // transparent value pool. VPubOld uint64 // A value v_{pub}^{new} that the JoinSplit transfer inserts into the // transparent value pool. VPubNew uint64 // A merkle root of the note commitment tree at some block height in the // past, or the merkle root produced by a previous JoinSplit transfer in this // transaction. // // JoinSplits are always anchored to a root in the note commitment tree at // some point in the blockchain history or in the history of the current // transaction. Anchor [32]byte // A sequence of nullifiers of the input notes $nf$_{1..N^{old}}^{old} // // Nullifiers are used to prevent double-spends. They are derived from the // secrets placed in the note and the secret spend-authority key known by the // spender. Nullifiers [NumJoinSplitInputs][32]byte // A sequence of note commitments for the output notes $cm$_{1..N^{new}}^{new} // // Note commitments are introduced into the commitment tree, blinding the // public about the values and destinations involved in the JoinSplit. The // presence of a commitment in the note commitment tree is required to spend // it. Commitments [NumJoinSplitOutputs][32]byte // A Curve25519 public key epk. EphemeralKey [32]byte // A 256-bit seed that must be chosen independently at random for each // JoinSplit description. RandomSeed [32]byte // A sequence of message authentication tags h_{1..N^{old}} that bind h^{Sig} // to each a_{sk} of the JoinSplit description. // // The verification of the JoinSplit requires these MACs to be provided as an // input. Macs [NumJoinSplitInputs][32]byte // An encoding of the zero-knowledge proof \pi_{ZKJoinSplit} // // This is a zk-SNARK which ensures that this JoinSplit is valid. Proof [296]byte // A sequence of ciphertext components for the encrypted output notes, // C_{1..N^{new}}^{enc} // // These contain trapdoors, values and other information that the recipient // needs, including a memo field. It is encrypted using the scheme // implemented in crypto/NoteEncryption.cpp Ciphertexts [NumJoinSplitOutputs][601]byte }
type Output ¶
func (*Output) SerializeSize ¶
SerializeSize returns the number of bytes it would take to serialize the the transaction output.
type Transaction ¶
type Transaction struct { IsOverwinter bool Version uint32 VersionGroupID uint32 Inputs []Input Outputs []Output LockTime uint32 ExpiryHeight uint32 JoinSplits []JoinSplit JoinSplitPubKey [32]byte JoinSplitSignature [64]byte }
func (*Transaction) GetHeader ¶
func (t *Transaction) GetHeader() uint32
func (*Transaction) IsCoinBase ¶
func (t *Transaction) IsCoinBase() bool
IsCoinBase determines whether or not a transaction is a coinbase. A coinbase is a special transaction created by miners that has no inputs. This is represented in the block chain by a transaction with a single input that has a previous output transaction index set to the maximum value along with a zero hash.
func (*Transaction) IsEqual ¶
func (t *Transaction) IsEqual(other *Transaction) bool
func (*Transaction) MarshalBinary ¶
func (t *Transaction) MarshalBinary() ([]byte, error)
func (*Transaction) TxHash ¶
func (t *Transaction) TxHash() chainhash.Hash
TxHash generates the Hash for the transaction.
func (*Transaction) UnmarshalBinary ¶
func (t *Transaction) UnmarshalBinary(data []byte) error
Click to show internal directories.
Click to hide internal directories.