Documentation ¶
Index ¶
- Constants
- func IsSortedAndUniqueTransferableInputs(ins []*TransferableInput) bool
- func IsSortedAndUniqueTransferableInputsWithSigners(ins []*TransferableInput, signers [][]*crypto.PrivateKeySECP256K1R) bool
- func IsSortedAndUniqueUTXOIDs(utxos []*UTXOID) bool
- func IsSortedTransferableOutputs(outs []*TransferableOutput, c codec.Manager) bool
- func SortTransferableInputs(ins []*TransferableInput)
- func SortTransferableInputsWithSigners(ins []*TransferableInput, signers [][]*crypto.PrivateKeySECP256K1R)
- func SortTransferableOutputs(outs []*TransferableOutput, c codec.Manager)
- func SortUTXOIDs(utxos []*UTXOID)
- func UniqueID(id ids.ID, prefix uint64, cacher cache.Cacher) ids.ID
- func VerifyTx(feeAmount uint64, feeAssetID ids.ID, allIns [][]*TransferableInput, ...) error
- type Addressable
- type Amounter
- type Asset
- type BaseTx
- type FlowChecker
- type Metadata
- type PrefixedState
- type State
- func (s *State) AddID(key []byte, id ids.ID) error
- func (s *State) IDs(key []byte, start []byte, limit int) ([]ids.ID, error)
- func (s *State) RemoveID(key []byte, id ids.ID) error
- func (s *State) SetStatus(id ids.ID, status choices.Status) error
- func (s *State) SetUTXO(id ids.ID, utxo *UTXO) error
- func (s *State) Status(id ids.ID) (choices.Status, error)
- func (s *State) UTXO(id ids.ID) (*UTXO, error)
- type TestAddressable
- type TestTransferable
- type TestVerifiable
- type TransferableIn
- type TransferableInput
- type TransferableOut
- type TransferableOutput
- type UTXO
- type UTXOID
Constants ¶
const MaxMemoSize = 256
MaxMemoSize is the maximum number of bytes in the memo field
Variables ¶
This section is empty.
Functions ¶
func IsSortedAndUniqueTransferableInputs ¶
func IsSortedAndUniqueTransferableInputs(ins []*TransferableInput) bool
IsSortedAndUniqueTransferableInputs ...
func IsSortedAndUniqueTransferableInputsWithSigners ¶
func IsSortedAndUniqueTransferableInputsWithSigners(ins []*TransferableInput, signers [][]*crypto.PrivateKeySECP256K1R) bool
IsSortedAndUniqueTransferableInputsWithSigners returns true if the inputs are sorted and unique
func IsSortedAndUniqueUTXOIDs ¶
IsSortedAndUniqueUTXOIDs ...
func IsSortedTransferableOutputs ¶
func IsSortedTransferableOutputs(outs []*TransferableOutput, c codec.Manager) bool
IsSortedTransferableOutputs returns true if output objects are sorted
func SortTransferableInputs ¶
func SortTransferableInputs(ins []*TransferableInput)
SortTransferableInputs ...
func SortTransferableInputsWithSigners ¶
func SortTransferableInputsWithSigners(ins []*TransferableInput, signers [][]*crypto.PrivateKeySECP256K1R)
SortTransferableInputsWithSigners sorts the inputs and signers based on the input's utxo ID
func SortTransferableOutputs ¶
func SortTransferableOutputs(outs []*TransferableOutput, c codec.Manager)
SortTransferableOutputs sorts output objects
func VerifyTx ¶
func VerifyTx( feeAmount uint64, feeAssetID ids.ID, allIns [][]*TransferableInput, allOuts [][]*TransferableOutput, c codec.Manager, ) error
VerifyTx verifies that the inputs and outputs flowcheck, including a fee. Additionally, this verifies that the inputs and outputs are sorted.
Types ¶
type Addressable ¶
type Addressable interface {
Addresses() [][]byte
}
Addressable is the interface a feature extension must provide to be able to be tracked as a part of the utxo set for a set of addresses
type Amounter ¶
type Amounter interface { // Amount returns how much value this element represents of the asset in its // transaction. Amount() uint64 }
Amounter is a data structure that has an amount of something associated with it
type BaseTx ¶
type BaseTx struct { Metadata NetworkID uint32 `serialize:"true" json:"networkID"` // ID of the network this chain lives on BlockchainID ids.ID `serialize:"true" json:"blockchainID"` // ID of the chain on which this transaction exists (prevents replay attacks) Outs []*TransferableOutput `serialize:"true" json:"outputs"` // The outputs of this transaction Ins []*TransferableInput `serialize:"true" json:"inputs"` // The inputs to this transaction Memo []byte `serialize:"true" json:"memo"` // Memo field contains arbitrary bytes, up to maxMemoSize }
BaseTx is the basis of all standard transactions.
func (*BaseTx) ConsumedAssetIDs ¶
ConsumedAssetIDs returns the IDs of the assets this transaction consumes
func (*BaseTx) InputUTXOs ¶
InputUTXOs track which UTXOs this transaction is consuming.
func (*BaseTx) MetadataVerify ¶
MetadataVerify ensures that transaction metadata is valid
func (*BaseTx) NumCredentials ¶
NumCredentials returns the number of expected credentials
type FlowChecker ¶
type FlowChecker struct {
// contains filtered or unexported fields
}
FlowChecker ...
func (*FlowChecker) Consume ¶
func (fc *FlowChecker) Consume(assetID ids.ID, amount uint64)
Consume ...
type Metadata ¶
type Metadata struct {
// contains filtered or unexported fields
}
Metadata ...
func (*Metadata) Initialize ¶
Initialize set the bytes and ID
func (*Metadata) UnsignedBytes ¶
UnsignedBytes returns the unsigned binary representation of this data
type PrefixedState ¶
type PrefixedState struct {
// contains filtered or unexported fields
}
PrefixedState wraps a state object. By prefixing the state, there will be no collisions between different types of objects that have the same hash.
func NewPrefixedState ¶
func NewPrefixedState( db database.Database, genesisCodec, codec codec.Manager, myChain, peerChain ids.ID, ) *PrefixedState
NewPrefixedState ...
func (*PrefixedState) FundUTXO ¶
func (s *PrefixedState) FundUTXO(utxo *UTXO) error
FundUTXO adds the provided utxo to the database
func (*PrefixedState) Funds ¶
Funds returns the mapping from the 32 byte representation of an address to a list of utxo IDs that reference the address. All returned UTXO IDs have IDs greater than [start]. (ids.Empty is the "least" ID.) Returns at most [limit] UTXO IDs.
type State ¶
type State struct { Cache cache.Cacher DB database.Database GenesisCodec codec.Manager Codec codec.Manager }
State is a thin wrapper around a database to provide, caching, serialization, and de-serialization.
func (*State) IDs ¶
IDs returns the slice of IDs associated with [id], starting after [start]. If start is ids.Empty, starts at beginning. Returns at most [limit] IDs.
type TestAddressable ¶
type TestAddressable struct { TestTransferable `serialize:"true"` Addrs [][]byte `serialize:"true"` }
TestAddressable ...
type TestTransferable ¶
type TestTransferable struct { TestVerifiable Val uint64 `serialize:"true"` }
TestTransferable ...
type TransferableIn ¶
type TransferableIn interface { verify.Verifiable Amounter }
TransferableIn is the interface a feature extension must provide to transfer value between features extensions.
type TransferableInput ¶
type TransferableInput struct { UTXOID `serialize:"true"` Asset `serialize:"true"` In TransferableIn `serialize:"true" json:"input"` }
TransferableInput ...
func (*TransferableInput) Input ¶
func (in *TransferableInput) Input() TransferableIn
Input returns the feature extension input that this Input is using.
func (*TransferableInput) Verify ¶
func (in *TransferableInput) Verify() error
Verify implements the verify.Verifiable interface
type TransferableOut ¶
TransferableOut is the interface a feature extension must provide to transfer value between features extensions.
type TransferableOutput ¶
type TransferableOutput struct { Asset `serialize:"true"` Out TransferableOut `serialize:"true" json:"output"` }
TransferableOutput ...
func (*TransferableOutput) Output ¶
func (out *TransferableOutput) Output() TransferableOut
Output returns the feature extension output that this Output is using.
func (*TransferableOutput) Verify ¶
func (out *TransferableOutput) Verify() error
Verify implements the verify.Verifiable interface
type UTXO ¶
type UTXO struct { UTXOID `serialize:"true"` Asset `serialize:"true"` Out verify.State `serialize:"true" json:"output"` }
UTXO ...
type UTXOID ¶
type UTXOID struct { // Serialized: TxID ids.ID `serialize:"true" json:"txID"` OutputIndex uint32 `serialize:"true" json:"outputIndex"` // Symbol is false if the UTXO should be part of the DB Symbol bool `json:"-"` // contains filtered or unexported fields }
UTXOID ...
func (*UTXOID) InputSource ¶
InputSource returns the source of the UTXO that this input is spending