Documentation ¶
Index ¶
- type Input
- type Output
- type OutputCommitment
- type OutputCommitmentProof
- type OutputFactory
- type OutputID
- func (o OutputID) Alias() (alias string)
- func (o OutputID) Base58() (base58Encoded string)
- func (o OutputID) Bytes() (serialized []byte)
- func (o *OutputID) FromBase58(base58EncodedString string) (err error)
- func (o *OutputID) FromRandomness() (err error)
- func (o OutputID) Length() int
- func (o OutputID) RegisterAlias(alias string)
- func (o OutputID) String() (humanReadable string)
- func (o OutputID) UnregisterAlias()
- type OutputIDs
- type OutputStateProof
- type Outputs
- type Snapshot
- type Transaction
- type TransactionCommitment
- type TransactionID
- type TransactionIDs
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Input ¶
type Input interface { // String returns a human-readable version of the Input. String() (humanReadable string) }
Input is an entity that allows to "address" which Outputs are supposed to be used by a Transaction.
type Output ¶
type Output interface { // ID returns the identifier of the Output. ID() (id OutputID) // SetID sets the identifier of the Output. SetID(id OutputID) // Bytes returns a serialized version of the Output. Bytes() (serialized []byte, err error) // String returns a human-readable version of the Output. String() (humanReadable string) objectstorage.StorableObject }
Output is the container for the data produced by executing a Transaction.
type OutputCommitment ¶
type OutputCommitment struct { StateRoot types.Identifier `serix:"0"` NumberOfOutputs uint64 `serix:"1"` // contains filtered or unexported fields }
OutputCommitment represents a cryptographic commitment to the Outputs generated by a Transaction.
func (*OutputCommitment) Bytes ¶
func (o *OutputCommitment) Bytes() (serialized []byte)
Bytes returns a serialized version of the OutputCommitment.
func (*OutputCommitment) FromOutputs ¶
func (o *OutputCommitment) FromOutputs(outputs ...Output) (err error)
FromOutputs creates a new OutputCommitment from the given Outputs.
func (*OutputCommitment) Proof ¶
func (o *OutputCommitment) Proof(outputIndex uint64) (proof *OutputCommitmentProof, err error)
Proof generates a proof that the Output at the given index is included in the OutputCommitment.
type OutputCommitmentProof ¶
type OutputCommitmentProof struct { OutputCommitment *OutputCommitment `serix:"0"` ProofSet [][32]byte `serix:"1,lengthPrefixType=uint32"` ProofIndex uint64 `serix:"2"` }
OutputCommitmentProof is a cryptographic proof that an Output is part of an OutputCommitment.
func (*OutputCommitmentProof) Bytes ¶
func (o *OutputCommitmentProof) Bytes() (bytes []byte)
Bytes returns a serialized version of the OutputCommitmentProof.
func (*OutputCommitmentProof) Validate ¶
func (o *OutputCommitmentProof) Validate(output Output) (err error)
Validate validates the proof and checks if the given Output is indeed part of the OutputCommitment that is referenced in the proof.
type OutputFactory ¶
type OutputID ¶
type OutputID struct { TransactionID TransactionID `serix:"0"` Index uint16 `serix:"1"` }
OutputID is a unique identifier for an Output.
var EmptyOutputID OutputID
EmptyOutputID contains the null-value of the OutputID type.
func NewOutputID ¶
func NewOutputID(txID TransactionID, index uint16) OutputID
NewOutputID returns a new OutputID for the given details.
func (OutputID) Alias ¶
Alias returns the human-readable alias of the OutputID (or the base58 encoded bytes of no alias was set).
func (*OutputID) FromBase58 ¶
FromBase58 un-serializes an OutputID from a base58 encoded string.
func (*OutputID) FromRandomness ¶
FromRandomness generates a random OutputID.
func (OutputID) RegisterAlias ¶
RegisterAlias allows to register a human-readable alias for the OutputID which will be used as a replacement for the String method.
func (OutputID) UnregisterAlias ¶
func (o OutputID) UnregisterAlias()
UnregisterAlias allows to unregister a previously registered alias.
type OutputIDs ¶
type OutputIDs = *set.AdvancedSet[OutputID]
OutputIDs represents a collection of OutputIDs.
func NewOutputIDs ¶
NewOutputIDs returns a new OutputID collection with the given elements.
type OutputStateProof ¶
type OutputStateProof struct { OutputID OutputID TransactionCommitment TransactionCommitment OutputCommitmentProof *OutputCommitmentProof }
OutputStateProof represents a cryptographic proof that a specific Output is the one named in the OutputID referenced in the proof.
func (*OutputStateProof) Validate ¶
func (o *OutputStateProof) Validate(output Output) (err error)
Validate validates the proof and checks if the given Output is indeed the one that is referenced in the proof.
type Outputs ¶
type Outputs struct { // OrderedMap is the underlying data structure that holds the Outputs. orderedmap.OrderedMap[OutputID, Output] `serix:"0"` }
Outputs represents a collection of Output objects indexed by their OutputID.
func NewOutputs ¶
NewOutputs returns a new Output collection with the given elements.
func (*Outputs) ForEach ¶
ForEach executes the callback for each element in the collection (it aborts if the callback returns an error).
type Snapshot ¶
type Snapshot interface {
Outputs() (outputs []Output)
}
Snapshot is a snapshot of the ledger state.
type Transaction ¶
type Transaction interface { // ID returns the identifier of the Transaction. ID() (id TransactionID) // SetID sets the identifier of the Transaction. // // Note: Since determining the identifier of a Transaction is an operation that requires at least a few hashing // operations, we allow the ID to be set from the outside. // // This allows us to potentially skip the ID calculation in cases where the ID is known upfront (e.g. when loading // Transactions from the object storage). SetID(id TransactionID) // Inputs returns the inputs of the Transaction. Inputs() (inputs []Input) // String returns a human-readable version of the Transaction. String() (humanReadable string) objectstorage.StorableObject }
Transaction is the type that is used to describe instructions how to modify the ledger state.
type TransactionCommitment ¶
type TransactionCommitment types.Identifier
TransactionCommitment represents a cryptographic commitment to the content of a transaction.
type TransactionID ¶
type TransactionID struct {
types.Identifier `serix:"0"`
}
TransactionID is a unique identifier for a Transaction.
var EmptyTransactionID TransactionID
EmptyTransactionID contains the null-value of the TransactionID type.
func NewTransactionID ¶
func NewTransactionID(txData []byte) (newTransactionID TransactionID)
NewTransactionID returns a new TransactionID for the given data.
func (TransactionID) IsEmpty ¶
func (t TransactionID) IsEmpty() (isEmpty bool)
IsEmpty returns true if the TransactionID is empty.
func (TransactionID) Length ¶
func (t TransactionID) Length() (length int)
Length returns the byte length of a serialized TransactionID.
func (TransactionID) String ¶
func (t TransactionID) String() (humanReadable string)
String returns a human-readable version of the TransactionID.
type TransactionIDs ¶
type TransactionIDs = *set.AdvancedSet[TransactionID]
TransactionIDs represents a collection of TransactionIDs.
func NewTransactionIDs ¶
func NewTransactionIDs(ids ...TransactionID) (newTransactionIDs TransactionIDs)
NewTransactionIDs returns a new TransactionID collection with the given elements.