Documentation ¶
Index ¶
- Constants
- Variables
- func AliasInitialStateValid(inputs Outputs, transaction *Transaction) bool
- func BranchIDEventHandler(handler interface{}, params ...interface{})
- func IsAboveDustThreshold(m map[Color]uint64) bool
- func IsExactDustMinimum(b *ColoredBalances) bool
- func OutputFromObjectStorage(key []byte, data []byte) (output objectstorage.StorableObject, err error)
- func RegisterBranchIDAlias(branchID BranchID, alias string)
- func SafeAddUint64(a uint64, b uint64) (result uint64, valid bool)
- func SafeSubUint64(a uint64, b uint64) (result uint64, valid bool)
- func TransactionBalancesValid(inputs Outputs, outputs Outputs) (valid bool)
- func TransactionBranchIDUpdatedByForkEventHandler(handler interface{}, params ...interface{})
- func TransactionIDEventHandler(handler interface{}, params ...interface{})
- func UnlockBlocksValid(inputs Outputs, transaction *Transaction) (valid bool)
- func UnlockBlocksValidWithError(inputs Outputs, transaction *Transaction) (bool, error)
- func UnregisterBranchIDAliases()
- type AccessMana
- type Address
- func AddressFromBase58EncodedString(base58String string) (address Address, err error)
- func AddressFromBytes(bytes []byte) (address Address, consumedBytes int, err error)
- func AddressFromMarshalUtil(marshalUtil *marshalutil.MarshalUtil) (address Address, err error)
- func AddressFromSignature(sig Signature) (Address, error)
- type AddressOutputMapping
- func (a *AddressOutputMapping) Address() Address
- func (a *AddressOutputMapping) Bytes() []byte
- func (a *AddressOutputMapping) FromBytes(bytes []byte) (addressOutputMapping objectstorage.StorableObject, err error)
- func (a *AddressOutputMapping) FromMarshalUtil(marshalUtil *marshalutil.MarshalUtil) (addressOutputMapping *AddressOutputMapping, err error)
- func (a *AddressOutputMapping) FromObjectStorage(key, _ []byte) (objectstorage.StorableObject, error)
- func (a *AddressOutputMapping) ObjectStorageKey() []byte
- func (a *AddressOutputMapping) ObjectStorageValue() (value []byte)
- func (a *AddressOutputMapping) OutputID() OutputID
- func (a *AddressOutputMapping) String() (humanReadableConsumer string)
- type AddressType
- type AliasAddress
- func AliasAddressFromBase58EncodedString(base58String string) (address *AliasAddress, err error)
- func AliasAddressFromBytes(data []byte) (address *AliasAddress, consumedBytes int, err error)
- func AliasAddressFromMarshalUtil(marshalUtil *marshalutil.MarshalUtil) (address *AliasAddress, err error)
- func NewAliasAddress(data []byte) *AliasAddress
- func (a *AliasAddress) Array() (array [AddressLength]byte)
- func (a *AliasAddress) Base58() string
- func (a *AliasAddress) Bytes() []byte
- func (a *AliasAddress) Clone() Address
- func (a *AliasAddress) Digest() []byte
- func (a *AliasAddress) Equals(other Address) bool
- func (a *AliasAddress) IsNil() bool
- func (a *AliasAddress) String() string
- func (a *AliasAddress) Type() AddressType
- type AliasOutput
- func (a *AliasOutput) Address() Address
- func (a *AliasOutput) Balances() *ColoredBalances
- func (a *AliasOutput) Bytes() []byte
- func (a *AliasOutput) Clone() Output
- func (a *AliasOutput) Compare(other Output) int
- func (a *AliasOutput) DelegationTimeLockedNow(nowis time.Time) bool
- func (a *AliasOutput) DelegationTimelock() time.Time
- func (a *AliasOutput) FromBytes(data []byte) (output *AliasOutput, err error)
- func (a *AliasOutput) FromMarshalUtil(marshalUtil *marshalutil.MarshalUtil) (output *AliasOutput, err error)
- func (a *AliasOutput) FromObjectStorage(key, bytes []byte) (objectstorage.StorableObject, error)
- func (a *AliasOutput) GetAliasAddress() *AliasAddress
- func (a *AliasOutput) GetGovernanceMetadata() []byte
- func (a *AliasOutput) GetGoverningAddress() Address
- func (a *AliasOutput) GetImmutableData() []byte
- func (a *AliasOutput) GetIsGovernanceUpdated() bool
- func (a *AliasOutput) GetStateAddress() Address
- func (a *AliasOutput) GetStateData() []byte
- func (a *AliasOutput) GetStateIndex() uint32
- func (a *AliasOutput) ID() OutputID
- func (a *AliasOutput) Input() Input
- func (a *AliasOutput) IsDelegated() bool
- func (a *AliasOutput) IsOrigin() bool
- func (a *AliasOutput) IsSelfGoverned() bool
- func (a *AliasOutput) NewAliasOutputNext(governanceUpdate ...bool) *AliasOutput
- func (a *AliasOutput) ObjectStorageKey() []byte
- func (a *AliasOutput) ObjectStorageValue() []byte
- func (a *AliasOutput) SetAliasAddress(addr *AliasAddress)
- func (a *AliasOutput) SetBalances(balances map[Color]uint64) error
- func (a *AliasOutput) SetDelegationTimelock(timelock time.Time) error
- func (a *AliasOutput) SetGovernanceMetadata(data []byte) error
- func (a *AliasOutput) SetGoverningAddress(addr Address)
- func (a *AliasOutput) SetID(outputID OutputID) Output
- func (a *AliasOutput) SetImmutableData(data []byte) error
- func (a *AliasOutput) SetIsDelegated(isDelegated bool)
- func (a *AliasOutput) SetIsGovernanceUpdated(i bool)
- func (a *AliasOutput) SetIsOrigin(isOrigin bool)
- func (a *AliasOutput) SetStateAddress(addr Address) error
- func (a *AliasOutput) SetStateData(data []byte) error
- func (a *AliasOutput) SetStateIndex(index uint32)
- func (a *AliasOutput) String() string
- func (a *AliasOutput) Type() OutputType
- func (a *AliasOutput) UnlockValid(tx *Transaction, unlockBlock UnlockBlock, inputs []Output) (bool, error)
- func (a *AliasOutput) UpdateMintingColor() Output
- func (a *AliasOutput) WithDelegation() *AliasOutput
- func (a *AliasOutput) WithDelegationAndTimelock(lockUntil time.Time) *AliasOutput
- type AliasUnlockBlock
- type ArithmeticBranchIDs
- type BLSAddress
- func BLSAddressFromBase58EncodedString(base58String string) (address *BLSAddress, err error)
- func BLSAddressFromBytes(bytes []byte) (address *BLSAddress, consumedBytes int, err error)
- func BLSAddressFromMarshalUtil(marshalUtil *marshalutil.MarshalUtil) (address *BLSAddress, err error)
- func NewBLSAddress(publicKey []byte) *BLSAddress
- func (b *BLSAddress) Array() (array [AddressLength]byte)
- func (b *BLSAddress) Base58() string
- func (b *BLSAddress) Bytes() []byte
- func (b *BLSAddress) Clone() Address
- func (b *BLSAddress) Digest() []byte
- func (b *BLSAddress) Equals(other Address) bool
- func (b *BLSAddress) String() string
- func (b *BLSAddress) Type() AddressType
- type BLSSignature
- func BLSSignatureFromBase58EncodedString(base58String string) (signature *BLSSignature, err error)
- func BLSSignatureFromBytes(bytes []byte) (signature *BLSSignature, consumedBytes int, err error)
- func BLSSignatureFromMarshalUtil(marshalUtil *marshalutil.MarshalUtil) (signature *BLSSignature, err error)
- func NewBLSSignature(signature bls.SignatureWithPublicKey) *BLSSignature
- type Branch
- func (b *Branch) AddConflict(conflictID ConflictID) (added bool)
- func (b *Branch) Bytes() []byte
- func (b *Branch) Conflicts() (conflicts ConflictIDs)
- func (b *Branch) FromBytes(bytes []byte) (branch *Branch, err error)
- func (b *Branch) FromMarshalUtil(marshalUtil *marshalutil.MarshalUtil) (branch *Branch, err error)
- func (b *Branch) FromObjectStorage(key, bytes []byte) (conflictBranch objectstorage.StorableObject, err error)
- func (b *Branch) ID() BranchID
- func (b *Branch) InclusionState() (inclusionState InclusionState)
- func (b *Branch) ObjectStorageKey() []byte
- func (b *Branch) ObjectStorageValue() []byte
- func (b *Branch) Parents() BranchIDs
- func (b *Branch) SetParents(parentBranches BranchIDs) (modified bool)
- func (b *Branch) String() string
- type BranchDAG
- func (b *BranchDAG) AddBranchParent(branchID, newParentBranchID BranchID) (err error)
- func (b *BranchDAG) Branch(branchID BranchID, computeIfAbsentCallback ...func() *Branch) (cachedBranch *objectstorage.CachedObject[*Branch])
- func (b *BranchDAG) ChildBranches(branchID BranchID) (cachedChildBranches objectstorage.CachedObjects[*ChildBranch])
- func (b *BranchDAG) Conflict(conflictID ConflictID) *objectstorage.CachedObject[*Conflict]
- func (b *BranchDAG) ConflictMembers(conflictID ConflictID) (cachedConflictMembers objectstorage.CachedObjects[*ConflictMember])
- func (b *BranchDAG) CreateBranch(branchID BranchID, parentBranchIDs BranchIDs, conflictIDs ConflictIDs) (cachedBranch *objectstorage.CachedObject[*Branch], newBranchCreated bool, ...)
- func (b *BranchDAG) ForEachBranch(consumer func(branch *Branch))
- func (b *BranchDAG) ForEachConflictingBranchID(branchID BranchID, callback func(conflictingBranchID BranchID) bool)
- func (b *BranchDAG) ForEachConnectedConflictingBranchID(branchID BranchID, callback func(conflictingBranchID BranchID))
- func (b *BranchDAG) InclusionState(branchIDs BranchIDs) (inclusionState InclusionState)
- func (b *BranchDAG) Prune() (err error)
- func (b *BranchDAG) ResolvePendingBranchIDs(branchIDs BranchIDs) (pendingBranchIDs BranchIDs, err error)
- func (b *BranchDAG) SetBranchConfirmed(branchID BranchID) (modified bool)
- func (b *BranchDAG) Shutdown()
- type BranchDAGEvents
- type BranchID
- func BranchIDFromBase58(base58String string) (branchID BranchID, err error)
- func BranchIDFromBytes(bytes []byte) (branchID BranchID, consumedBytes int, err error)
- func BranchIDFromMarshalUtil(marshalUtil *marshalutil.MarshalUtil) (branchID BranchID, err error)
- func BranchIDFromRandomness() (branchID BranchID)
- func NewBranchID(transactionID TransactionID) (branchID BranchID)
- type BranchIDs
- func (b BranchIDs) Add(branchID BranchID) BranchIDs
- func (b BranchIDs) AddAll(branchIDs BranchIDs) BranchIDs
- func (b BranchIDs) Base58() (result []string)
- func (b BranchIDs) Bytes() []byte
- func (b BranchIDs) Clone() (clonedBranchIDs BranchIDs)
- func (b BranchIDs) Contains(targetBranchID BranchID) (contains bool)
- func (b BranchIDs) Equals(o BranchIDs) bool
- func (b BranchIDs) Intersect(branchIDs BranchIDs) (res BranchIDs)
- func (b BranchIDs) Is(targetBranch BranchID) (is bool)
- func (b BranchIDs) Slice() (list []BranchID)
- func (b BranchIDs) String() string
- func (b BranchIDs) Subtract(other BranchIDs) BranchIDs
- type BranchParentUpdate
- type ChildBranch
- func (c *ChildBranch) Bytes() (marshaledChildBranch []byte)
- func (c *ChildBranch) ChildBranchID() (childBranchID BranchID)
- func (c *ChildBranch) FromBytes(bytes []byte) (childBranch objectstorage.StorableObject, err error)
- func (c *ChildBranch) FromMarshalUtil(marshalUtil *marshalutil.MarshalUtil) (childBranch *ChildBranch, err error)
- func (c *ChildBranch) FromObjectStorage(key, bytes []byte) (childBranch objectstorage.StorableObject, err error)
- func (c *ChildBranch) ObjectStorageKey() (objectStorageKey []byte)
- func (c *ChildBranch) ObjectStorageValue() (objectStorageValue []byte)
- func (c *ChildBranch) ParentBranchID() (parentBranchID BranchID)
- func (c *ChildBranch) String() (humanReadableChildBranch string)
- type Color
- type ColoredBalances
- func ColoredBalancesFromBytes(bytes []byte) (coloredBalances *ColoredBalances, consumedBytes int, err error)
- func ColoredBalancesFromMarshalUtil(marshalUtil *marshalutil.MarshalUtil) (coloredBalances *ColoredBalances, err error)
- func NewColoredBalances(balances map[Color]uint64) (coloredBalances *ColoredBalances)
- func (c *ColoredBalances) Bytes() []byte
- func (c *ColoredBalances) Clone() *ColoredBalances
- func (c *ColoredBalances) ForEach(consumer func(color Color, balance uint64) bool)
- func (c *ColoredBalances) Get(color Color) (uint64, bool)
- func (c *ColoredBalances) Map() (balances map[Color]uint64)
- func (c *ColoredBalances) Size() int
- func (c *ColoredBalances) String() string
- type Conflict
- func (c *Conflict) Bytes() []byte
- func (c *Conflict) DecreaseMemberCount(optionalDelta ...int) (newMemberCount int)
- func (c *Conflict) FromBytes(bytes []byte) (conflict *Conflict, err error)
- func (c *Conflict) FromMarshalUtil(marshalUtil *marshalutil.MarshalUtil) (conflict *Conflict, err error)
- func (c *Conflict) FromObjectStorage(key, bytes []byte) (conflict objectstorage.StorableObject, err error)
- func (c *Conflict) ID() ConflictID
- func (c *Conflict) IncreaseMemberCount(optionalDelta ...int) (newMemberCount int)
- func (c *Conflict) MemberCount() int
- func (c *Conflict) ObjectStorageKey() []byte
- func (c *Conflict) ObjectStorageValue() []byte
- func (c *Conflict) String() string
- type ConflictID
- type ConflictIDs
- type ConflictMember
- func (c *ConflictMember) BranchID() BranchID
- func (c *ConflictMember) Bytes() []byte
- func (c *ConflictMember) ConflictID() ConflictID
- func (c *ConflictMember) FromBytes(bytes []byte) (conflictMember *ConflictMember, err error)
- func (c *ConflictMember) FromMarshalUtil(marshalUtil *marshalutil.MarshalUtil) (conflictMember *ConflictMember, err error)
- func (c *ConflictMember) FromObjectStorage(key, bytes []byte) (conflictMember objectstorage.StorableObject, err error)
- func (c *ConflictMember) ObjectStorageKey() []byte
- func (c *ConflictMember) ObjectStorageValue() []byte
- func (c *ConflictMember) String() string
- type Consumer
- func (c *Consumer) Bytes() []byte
- func (c *Consumer) ConsumedInput() OutputID
- func (c *Consumer) FromBytes(bytes []byte) (consumer *Consumer, err error)
- func (c *Consumer) FromMarshalUtil(marshalUtil *marshalutil.MarshalUtil) (consumer *Consumer, err error)
- func (c *Consumer) FromObjectStorage(key, bytes []byte) (objectstorage.StorableObject, error)
- func (c *Consumer) ObjectStorageKey() []byte
- func (c *Consumer) ObjectStorageValue() []byte
- func (c *Consumer) SetValid(valid types.TriBool) (updated bool)
- func (c *Consumer) String() (humanReadableConsumer string)
- func (c *Consumer) TransactionID() TransactionID
- func (c *Consumer) Valid() (valid types.TriBool)
- type ED25519Address
- func ED25519AddressFromBase58EncodedString(base58String string) (address *ED25519Address, err error)
- func ED25519AddressFromBytes(bytes []byte) (address *ED25519Address, consumedBytes int, err error)
- func ED25519AddressFromMarshalUtil(marshalUtil *marshalutil.MarshalUtil) (address *ED25519Address, err error)
- func NewED25519Address(publicKey ed25519.PublicKey) *ED25519Address
- func (e *ED25519Address) Array() (array [AddressLength]byte)
- func (e *ED25519Address) Base58() string
- func (e *ED25519Address) Bytes() []byte
- func (e *ED25519Address) Clone() Address
- func (e *ED25519Address) Digest() []byte
- func (e *ED25519Address) Equals(other Address) bool
- func (e *ED25519Address) String() string
- func (e *ED25519Address) Type() AddressType
- type ED25519Signature
- func ED25519SignatureFromBase58EncodedString(base58String string) (signature *ED25519Signature, err error)
- func ED25519SignatureFromBytes(bytes []byte) (signature *ED25519Signature, consumedBytes int, err error)
- func ED25519SignatureFromMarshalUtil(marshalUtil *marshalutil.MarshalUtil) (signature *ED25519Signature, err error)
- func NewED25519Signature(publicKey ed25519.PublicKey, signature ed25519.Signature) *ED25519Signature
- func (e *ED25519Signature) AddressSignatureValid(address Address, data []byte) bool
- func (e *ED25519Signature) Base58() string
- func (e *ED25519Signature) Bytes() []byte
- func (e *ED25519Signature) SignatureValid(data []byte) bool
- func (e *ED25519Signature) String() string
- func (e *ED25519Signature) Type() SignatureType
- type ExtendedLockedOutput
- func (o *ExtendedLockedOutput) Address() Address
- func (o *ExtendedLockedOutput) Balances() *ColoredBalances
- func (o *ExtendedLockedOutput) Bytes() []byte
- func (o *ExtendedLockedOutput) Clone() Output
- func (o *ExtendedLockedOutput) Compare(other Output) int
- func (o *ExtendedLockedOutput) FallbackAddress() (addy Address)
- func (o *ExtendedLockedOutput) FallbackOptions() (Address, time.Time)
- func (o *ExtendedLockedOutput) FromBytes(data []byte) (output *ExtendedLockedOutput, err error)
- func (o *ExtendedLockedOutput) FromMarshalUtil(marshalUtil *marshalutil.MarshalUtil) (output *ExtendedLockedOutput, err error)
- func (o *ExtendedLockedOutput) FromObjectStorage(key, bytes []byte) (objectstorage.StorableObject, error)
- func (o *ExtendedLockedOutput) GetPayload() []byte
- func (o *ExtendedLockedOutput) ID() OutputID
- func (o *ExtendedLockedOutput) Input() Input
- func (o *ExtendedLockedOutput) ObjectStorageKey() []byte
- func (o *ExtendedLockedOutput) ObjectStorageValue() []byte
- func (o *ExtendedLockedOutput) SetID(outputID OutputID) Output
- func (o *ExtendedLockedOutput) SetPayload(data []byte) error
- func (o *ExtendedLockedOutput) String() string
- func (o *ExtendedLockedOutput) TimeLock() time.Time
- func (o *ExtendedLockedOutput) TimeLockedNow(nowis time.Time) bool
- func (o *ExtendedLockedOutput) Type() OutputType
- func (o *ExtendedLockedOutput) UnlockAddressNow(nowis time.Time) Address
- func (o *ExtendedLockedOutput) UnlockValid(tx *Transaction, unlockBlock UnlockBlock, inputs []Output) (unlockValid bool, err error)
- func (o *ExtendedLockedOutput) UpdateMintingColor() Output
- func (o *ExtendedLockedOutput) WithFallbackOptions(addr Address, deadline time.Time) *ExtendedLockedOutput
- func (o *ExtendedLockedOutput) WithTimeLock(timelock time.Time) *ExtendedLockedOutput
- type IUTXODAG
- type InclusionState
- type Input
- type InputType
- type Inputs
- type Ledgerstate
- type Option
- type Options
- type Output
- type OutputID
- func NewOutputID(transactionID TransactionID, outputIndex uint16) (outputID OutputID)
- func OutputIDFromBase58(base58String string) (outputID OutputID, err error)
- func OutputIDFromBytes(bytes []byte) (outputID OutputID, consumedBytes int, err error)
- func OutputIDFromMarshalUtil(marshalUtil *marshalutil.MarshalUtil) (outputID OutputID, err error)
- type OutputMetadata
- func (o *OutputMetadata) AddBranchID(branchID BranchID) (modified bool)
- func (o *OutputMetadata) BranchIDs() BranchIDs
- func (o *OutputMetadata) Bytes() []byte
- func (o *OutputMetadata) ConsumerCount() int
- func (o *OutputMetadata) FromBytes(bytes []byte) (outputMetadata *OutputMetadata, err error)
- func (o *OutputMetadata) FromMarshalUtil(marshalUtil *marshalutil.MarshalUtil) (outputMetadata *OutputMetadata, err error)
- func (o *OutputMetadata) FromObjectStorage(key, bytes []byte) (objectstorage.StorableObject, error)
- func (o *OutputMetadata) GradeOfFinality() gof.GradeOfFinality
- func (o *OutputMetadata) GradeOfFinalityTime() time.Time
- func (o *OutputMetadata) ID() OutputID
- func (o *OutputMetadata) ObjectStorageKey() []byte
- func (o *OutputMetadata) ObjectStorageValue() []byte
- func (o *OutputMetadata) RegisterConsumer(consumer TransactionID) (previousConsumerCount int)
- func (o *OutputMetadata) SetBranchIDs(branchIDs BranchIDs) (modified bool)
- func (o *OutputMetadata) SetGradeOfFinality(gradeOfFinality gof.GradeOfFinality) (modified bool)
- func (o *OutputMetadata) SetSolid(solid bool) (modified bool)
- func (o *OutputMetadata) Solid() bool
- func (o *OutputMetadata) SolidificationTime() time.Time
- func (o *OutputMetadata) String() string
- type OutputType
- type Outputs
- func (o Outputs) ByID() (outputsByID OutputsByID)
- func (o Outputs) Bytes() []byte
- func (o Outputs) Clone() (clonedOutputs Outputs)
- func (o Outputs) Filter(condition func(output Output) bool) (filteredOutputs Outputs)
- func (o Outputs) Inputs() Inputs
- func (o Outputs) String() string
- func (o Outputs) Strings() (result []string)
- type OutputsByID
- type OutputsMetadata
- func (o OutputsMetadata) ByID() (outputsMetadataByID OutputsMetadataByID)
- func (o OutputsMetadata) ConflictIDs() (conflictIDs ConflictIDs)
- func (o OutputsMetadata) OutputIDs() (outputIDs []OutputID)
- func (o OutputsMetadata) SpentOutputsMetadata() (spentOutputsMetadata OutputsMetadata)
- func (o OutputsMetadata) String() string
- type OutputsMetadataByID
- type Record
- type ReferenceUnlockBlock
- func NewReferenceUnlockBlock(referencedIndex uint16) *ReferenceUnlockBlock
- func ReferenceUnlockBlockFromBytes(bytes []byte) (unlockBlock *ReferenceUnlockBlock, consumedBytes int, err error)
- func ReferenceUnlockBlockFromMarshalUtil(marshalUtil *marshalutil.MarshalUtil) (unlockBlock *ReferenceUnlockBlock, err error)
- type SigLockedColoredOutput
- func (s *SigLockedColoredOutput) Address() Address
- func (s *SigLockedColoredOutput) Balances() *ColoredBalances
- func (s *SigLockedColoredOutput) Bytes() []byte
- func (s *SigLockedColoredOutput) Clone() Output
- func (s *SigLockedColoredOutput) Compare(other Output) int
- func (s *SigLockedColoredOutput) FromBytes(bytes []byte) (output *SigLockedColoredOutput, err error)
- func (s *SigLockedColoredOutput) FromMarshalUtil(marshalUtil *marshalutil.MarshalUtil) (output *SigLockedColoredOutput, err error)
- func (s *SigLockedColoredOutput) FromObjectStorage(key, bytes []byte) (objectstorage.StorableObject, error)
- func (s *SigLockedColoredOutput) ID() OutputID
- func (s *SigLockedColoredOutput) Input() Input
- func (s *SigLockedColoredOutput) ObjectStorageKey() []byte
- func (s *SigLockedColoredOutput) ObjectStorageValue() []byte
- func (s *SigLockedColoredOutput) SetID(outputID OutputID) Output
- func (s *SigLockedColoredOutput) String() string
- func (s *SigLockedColoredOutput) Type() OutputType
- func (s *SigLockedColoredOutput) UnlockValid(tx *Transaction, unlockBlock UnlockBlock, inputs []Output) (unlockValid bool, err error)
- func (s *SigLockedColoredOutput) UpdateMintingColor() (updatedOutput Output)
- type SigLockedSingleOutput
- func (s *SigLockedSingleOutput) Address() Address
- func (s *SigLockedSingleOutput) Balances() *ColoredBalances
- func (s *SigLockedSingleOutput) Bytes() []byte
- func (s *SigLockedSingleOutput) Clone() Output
- func (s *SigLockedSingleOutput) Compare(other Output) int
- func (s *SigLockedSingleOutput) FromBytes(bytes []byte) (output *SigLockedSingleOutput, err error)
- func (s *SigLockedSingleOutput) FromMarshalUtil(marshalUtil *marshalutil.MarshalUtil) (output *SigLockedSingleOutput, err error)
- func (s *SigLockedSingleOutput) FromObjectStorage(key, bytes []byte) (objectstorage.StorableObject, error)
- func (s *SigLockedSingleOutput) ID() OutputID
- func (s *SigLockedSingleOutput) Input() Input
- func (s *SigLockedSingleOutput) ObjectStorageKey() []byte
- func (s *SigLockedSingleOutput) ObjectStorageValue() []byte
- func (s *SigLockedSingleOutput) SetID(outputID OutputID) Output
- func (s *SigLockedSingleOutput) String() string
- func (s *SigLockedSingleOutput) Type() OutputType
- func (s *SigLockedSingleOutput) UnlockValid(tx *Transaction, unlockBlock UnlockBlock, inputs []Output) (unlockValid bool, err error)
- func (s *SigLockedSingleOutput) UpdateMintingColor() Output
- type Signature
- type SignatureType
- type SignatureUnlockBlock
- func NewSignatureUnlockBlock(signature Signature) *SignatureUnlockBlock
- func SignatureUnlockBlockFromBytes(bytes []byte) (unlockBlock *SignatureUnlockBlock, consumedBytes int, err error)
- func SignatureUnlockBlockFromMarshalUtil(marshalUtil *marshalutil.MarshalUtil) (unlockBlock *SignatureUnlockBlock, err error)
- type Snapshot
- type Transaction
- func (t *Transaction) Bytes() []byte
- func (t *Transaction) Essence() *TransactionEssence
- func (t *Transaction) FromBytes(bytes []byte) (transaction *Transaction, err error)
- func (t *Transaction) FromMarshalUtil(marshalUtil *marshalutil.MarshalUtil) (transaction *Transaction, err error)
- func (t *Transaction) FromObjectStorage(key, bytes []byte) (objectstorage.StorableObject, error)
- func (t *Transaction) ID() TransactionID
- func (t *Transaction) ObjectStorageKey() []byte
- func (t *Transaction) ObjectStorageValue() []byte
- func (t *Transaction) ReferencedTransactionIDs() (referencedTransactionIDs TransactionIDs)
- func (t *Transaction) String() string
- func (t *Transaction) Type() payload.Type
- func (t *Transaction) UnlockBlocks() UnlockBlocks
- type TransactionBranchIDUpdatedByForkEvent
- type TransactionEssence
- func NewTransactionEssence(version TransactionEssenceVersion, timestamp time.Time, ...) *TransactionEssence
- func TransactionEssenceFromBytes(bytes []byte) (transactionEssence *TransactionEssence, consumedBytes int, err error)
- func TransactionEssenceFromMarshalUtil(marshalUtil *marshalutil.MarshalUtil) (transactionEssence *TransactionEssence, err error)
- func (t *TransactionEssence) AccessPledgeID() identity.ID
- func (t *TransactionEssence) Bytes() []byte
- func (t *TransactionEssence) ConsensusPledgeID() identity.ID
- func (t *TransactionEssence) Inputs() Inputs
- func (t *TransactionEssence) Outputs() Outputs
- func (t *TransactionEssence) Payload() payload.Payload
- func (t *TransactionEssence) SetPayload(p payload.Payload)
- func (t *TransactionEssence) String() string
- func (t *TransactionEssence) Timestamp() time.Time
- func (t *TransactionEssence) Version() TransactionEssenceVersion
- type TransactionEssenceVersion
- type TransactionID
- func TransactionIDFromBase58(base58String string) (transactionID TransactionID, err error)
- func TransactionIDFromBytes(bytes []byte) (transactionID TransactionID, consumedBytes int, err error)
- func TransactionIDFromMarshalUtil(marshalUtil *marshalutil.MarshalUtil) (transactionID TransactionID, err error)
- func TransactionIDFromRandomness() (transactionID TransactionID, err error)
- type TransactionIDs
- type TransactionMetadata
- func (t *TransactionMetadata) AddBranchID(branchID BranchID) (modified bool)
- func (t *TransactionMetadata) BranchIDs() BranchIDs
- func (t *TransactionMetadata) Bytes() []byte
- func (t *TransactionMetadata) FromBytes(bytes []byte) (transactionMetadata *TransactionMetadata, err error)
- func (t *TransactionMetadata) FromMarshalUtil(marshalUtil *marshalutil.MarshalUtil) (transactionMetadata *TransactionMetadata, err error)
- func (t *TransactionMetadata) FromObjectStorage(key, bytes []byte) (objectstorage.StorableObject, error)
- func (t *TransactionMetadata) GradeOfFinality() gof.GradeOfFinality
- func (t *TransactionMetadata) GradeOfFinalityTime() time.Time
- func (t *TransactionMetadata) ID() TransactionID
- func (t *TransactionMetadata) IsConflicting() bool
- func (t *TransactionMetadata) LazyBooked() (lazyBooked bool)
- func (t *TransactionMetadata) ObjectStorageKey() []byte
- func (t *TransactionMetadata) ObjectStorageValue() []byte
- func (t *TransactionMetadata) SetBranchIDs(branchIDs BranchIDs) (modified bool)
- func (t *TransactionMetadata) SetGradeOfFinality(gradeOfFinality gof.GradeOfFinality) (modified bool)
- func (t *TransactionMetadata) SetLazyBooked(lazyBooked bool) (modified bool)
- func (t *TransactionMetadata) SetSolid(solid bool) (modified bool)
- func (t *TransactionMetadata) Solid() bool
- func (t *TransactionMetadata) SolidificationTime() time.Time
- func (t *TransactionMetadata) String() string
- type UTXODAG
- func (u *UTXODAG) BookTransaction(transaction *Transaction) (targetBranchIDs BranchIDs, err error)
- func (u *UTXODAG) BranchGradeOfFinality(branchID BranchID) (gradeOfFinality gof.GradeOfFinality, err error)
- func (u *UTXODAG) CachedAddressOutputMapping(address Address) (cachedAddressOutputMappings objectstorage.CachedObjects[*AddressOutputMapping])
- func (u *UTXODAG) CachedConsumers(outputID OutputID) (cachedConsumers objectstorage.CachedObjects[*Consumer])
- func (u *UTXODAG) CachedOutput(outputID OutputID) (cachedOutput *objectstorage.CachedObject[Output])
- func (u *UTXODAG) CachedOutputMetadata(outputID OutputID) (cachedOutput *objectstorage.CachedObject[*OutputMetadata])
- func (u *UTXODAG) CachedTransaction(transactionID TransactionID) (cachedTransaction *objectstorage.CachedObject[*Transaction])
- func (u *UTXODAG) CachedTransactionMetadata(transactionID TransactionID) (cachedTransactionMetadata *objectstorage.CachedObject[*TransactionMetadata])
- func (u *UTXODAG) CheckTransaction(transaction *Transaction) (err error)
- func (u *UTXODAG) ConflictingTransactions(transaction *Transaction) (conflictingTransactions TransactionIDs)
- func (u *UTXODAG) ConsumedOutputs(transaction *Transaction) (cachedInputs objectstorage.CachedObjects[Output])
- func (u *UTXODAG) Events() *UTXODAGEvents
- func (u *UTXODAG) LoadSnapshot(snapshot *Snapshot)
- func (u *UTXODAG) ManageStoreAddressOutputMapping(output Output)
- func (u *UTXODAG) Shutdown()
- func (u *UTXODAG) StoreAddressOutputMapping(address Address, outputID OutputID)
- func (u *UTXODAG) Transaction(transactionID TransactionID) (transaction *Transaction)
- func (u *UTXODAG) TransactionBranchIDs(transactionID TransactionID) (branchIDs BranchIDs, err error)
- func (u *UTXODAG) TransactionGradeOfFinality(transactionID TransactionID) (gradeOfFinality gof.GradeOfFinality, err error)
- func (u *UTXODAG) Transactions() (transactions map[TransactionID]*Transaction)
- type UTXODAGEvents
- type UTXOInput
- type UnlockBlock
- type UnlockBlockType
- type UnlockBlocks
- type UnlockGraph
Constants ¶
const ( // UTXOInputType is the type of an Input that references an UTXO Output. UTXOInputType InputType = iota // MinInputCount defines the minimum amount of Inputs in a Transaction. MinInputCount = 1 // MaxInputCount defines the maximum amount of Inputs in a Transaction. MaxInputCount = 127 )
const ( // PrefixBranchStorage defines the storage prefix for the Branch object storage. PrefixBranchStorage byte = iota // PrefixChildBranchStorage defines the storage prefix for the ChildBranch object storage. PrefixChildBranchStorage // PrefixConflictStorage defines the storage prefix for the Conflict object storage. PrefixConflictStorage // PrefixConflictMemberStorage defines the storage prefix for the ConflictMember object storage. PrefixConflictMemberStorage // PrefixTransactionStorage defines the storage prefix for the Transaction object storage. PrefixTransactionStorage // PrefixTransactionMetadataStorage defines the storage prefix for the TransactionMetadata object storage. PrefixTransactionMetadataStorage // PrefixOutputStorage defines the storage prefix for the Output object storage. PrefixOutputStorage // PrefixOutputMetadataStorage defines the storage prefix for the OutputMetadata object storage. PrefixOutputMetadataStorage // PrefixConsumerStorage defines the storage prefix for the Consumer object storage. PrefixConsumerStorage // PrefixAddressOutputMappingStorage defines the storage prefix for the AddressOutputMapping object storage. PrefixAddressOutputMappingStorage )
const ( // MinOutputCount defines the minimum amount of Outputs in a Transaction. MinOutputCount = 1 // MaxOutputCount defines the maximum amount of Outputs in a Transaction. MaxOutputCount = 127 // MinOutputBalance defines the minimum balance per Output. MinOutputBalance = 1 // MaxOutputBalance defines the maximum balance on an Output (the supply). MaxOutputBalance = 2779530283277761 )
const AddressLength = 33
AddressLength contains the length of an address (type length = 1, digest length = 32).
const AliasAddressDigestSize = 32
AliasAddressDigestSize defines the length of the alias address digest in bytes.
const BranchIDLength = 32
BranchIDLength contains the amount of bytes that a marshaled version of the BranchID contains.
const ColorLength = 32
ColorLength represents the length of a Color (amount of bytes).
const ConflictIDLength = OutputIDLength
ConflictIDLength contains the amount of bytes that a marshaled version of the ConflictID contains.
const DustThresholdAliasOutputIOTA = uint64(100)
DustThresholdAliasOutputIOTA is minimum number of iotas enforced for the output to be correct TODO protocol-wide dust threshold configuration.
const MaxOutputPayloadSize = 4 * 1024
MaxOutputPayloadSize size limit on the data payload in the output.
const OutputIDLength = TransactionIDLength + marshalutil.Uint16Size
OutputIDLength contains the amount of bytes that a marshaled version of the OutputID contains.
const TransactionIDLength = 32
TransactionIDLength contains the amount of bytes that a marshaled version of the ID contains.
Variables ¶
var ( // UndefinedBranchID is the zero value of a BranchID and represents a branch that has not been set. UndefinedBranchID = BranchID{} // MasterBranchID is the identifier of the MasterBranch (root of the Branch DAG). MasterBranchID = BranchID{1} )
var ( // ErrTransactionInvalid is returned if a Transaction or any of its building blocks is considered to be invalid. ErrTransactionInvalid = errors.New("transaction invalid") // ErrTransactionNotSolid is returned if a Transaction is processed whose Inputs are not known. ErrTransactionNotSolid = errors.New("transaction not solid") )
var ChildBranchKeyPartition = objectstorage.PartitionKey(BranchIDLength, BranchIDLength)
ChildBranchKeyPartition defines the partition of the storage key of the ChildBranch model.
var ColorIOTA = Color{}
ColorIOTA is the zero value of the Color and represents uncolored tokens.
var ColorMint = Color{255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}
ColorMint represents a placeholder Color that indicates that tokens should be "colored" in their Output.
var ConflictMemberKeyPartition = objectstorage.PartitionKey(ConflictIDLength, BranchIDLength)
ConflictMemberKeyPartition defines the partition of the storage key of the ConflictMember model.
var ConsumerPartitionKeys = objectstorage.PartitionKey([]int{OutputIDLength, TransactionIDLength}...)
ConsumerPartitionKeys defines the "layout" of the key. This enables prefix iterations in the object storage.
var InputTypeNames = [...]string{
"UTXOInputType",
}
InputTypeNames contains the names of the existing InputTypes.
var TransactionType payload.Type
TransactionType represents the payload Type of a Transaction.
Functions ¶
func AliasInitialStateValid ¶ added in v0.7.5
func AliasInitialStateValid(inputs Outputs, transaction *Transaction) bool
AliasInitialStateValid is an internal utility function that checks if aliases are created by the transaction with valid initial states. Initial state of an alias is valid, if and only if:
- there is no "chained" alias with the same ID on the input side
- the alias itself has the origin flag set, and state index is 0.
func BranchIDEventHandler ¶ added in v0.8.0
func BranchIDEventHandler(handler interface{}, params ...interface{})
BranchIDEventHandler is an event handler for an event with a BranchID.
func IsAboveDustThreshold ¶ added in v0.6.0
IsAboveDustThreshold internal utility to check if balances pass dust constraint.
func IsExactDustMinimum ¶ added in v0.6.0
func IsExactDustMinimum(b *ColoredBalances) bool
IsExactDustMinimum checks if colored balances are exactly what is required by dust constraint.
func OutputFromObjectStorage ¶
func OutputFromObjectStorage(key []byte, data []byte) (output objectstorage.StorableObject, err error)
OutputFromObjectStorage restores an Output that was stored in the ObjectStorage.
func RegisterBranchIDAlias ¶ added in v0.5.7
RegisterBranchIDAlias registers an alias that will modify the String() output of the BranchID to show a human readable string instead of the base58 encoded version of itself.
func SafeAddUint64 ¶ added in v0.4.0
SafeAddUint64 adds two uint64 values. It returns the result and a valid flag that indicates whether the addition is valid without causing an overflow.
func SafeSubUint64 ¶ added in v0.4.0
SafeSubUint64 subtracts two uint64 values. It returns the result and a valid flag that indicates whether the subtraction is valid without causing an overflow.
func TransactionBalancesValid ¶ added in v0.4.0
TransactionBalancesValid is an internal utility function that checks if the sum of the balance changes equals to 0.
func TransactionBranchIDUpdatedByForkEventHandler ¶ added in v0.8.0
func TransactionBranchIDUpdatedByForkEventHandler(handler interface{}, params ...interface{})
TransactionBranchIDUpdatedByForkEventHandler is an event handler for an event with a TransactionBranchIDUpdatedByForkEvent.
func TransactionIDEventHandler ¶ added in v0.8.0
func TransactionIDEventHandler(handler interface{}, params ...interface{})
TransactionIDEventHandler is an event handler for an event with a TransactionID.
func UnlockBlocksValid ¶ added in v0.4.0
func UnlockBlocksValid(inputs Outputs, transaction *Transaction) (valid bool)
UnlockBlocksValid is an internal utility function that checks if the UnlockBlocks are matching the referenced Inputs.
func UnlockBlocksValidWithError ¶ added in v0.6.0
func UnlockBlocksValidWithError(inputs Outputs, transaction *Transaction) (bool, error)
UnlockBlocksValidWithError is an internal utility function that checks if the UnlockBlocks are matching the referenced Inputs. In case an unlockblock is invalid, it returns the error that caused it.
func UnregisterBranchIDAliases ¶ added in v0.5.7
func UnregisterBranchIDAliases()
UnregisterBranchIDAliases removes all aliases registered through the RegisterBranchIDAlias function.
Types ¶
type AccessMana ¶ added in v0.6.2
AccessMana defines the info for the aMana snapshot.
type Address ¶
type Address interface { // Type returns the AddressType of the Address. Type() AddressType // Digest returns the hashed version of the Addresses public key. Digest() []byte // Clone creates a copy of the Address. Clone() Address // Equals returns true if the two Addresses are equal. Equals(other Address) bool // Bytes returns a marshaled version of the Address. Bytes() []byte // Array returns an array of bytes that contains the marshaled version of the Address. Array() [AddressLength]byte // Base58 returns a base58 encoded version of the Address. Base58() string // String returns a human readable version of the Address for debug purposes. String() string }
Address is an interface for the different kind of Addresses that are supported by the ledger state.
func AddressFromBase58EncodedString ¶
AddressFromBase58EncodedString creates an Address from a base58 encoded string.
func AddressFromBytes ¶
AddressFromBytes unmarshals an Address from a sequence of bytes.
func AddressFromMarshalUtil ¶
func AddressFromMarshalUtil(marshalUtil *marshalutil.MarshalUtil) (address Address, err error)
AddressFromMarshalUtil reads an Address from the bytes in the given MarshalUtil.
func AddressFromSignature ¶ added in v0.6.0
AddressFromSignature returns address corresponding to the signature if it has one (for ed25519 and BLS).
type AddressOutputMapping ¶
type AddressOutputMapping struct { objectstorage.StorableObjectFlags // contains filtered or unexported fields }
AddressOutputMapping represents a mapping between Addresses and their corresponding Outputs. Since an Address can have a potentially unbounded amount of Outputs, we store this as a separate k/v pair instead of a marshaled list of spending Transactions inside the Output.
func NewAddressOutputMapping ¶ added in v0.4.0
func NewAddressOutputMapping(address Address, outputID OutputID) *AddressOutputMapping
NewAddressOutputMapping returns a new AddressOutputMapping.
func (*AddressOutputMapping) Address ¶
func (a *AddressOutputMapping) Address() Address
Address returns the Address of the AddressOutputMapping.
func (*AddressOutputMapping) Bytes ¶
func (a *AddressOutputMapping) Bytes() []byte
Bytes marshals the Consumer into a sequence of bytes.
func (*AddressOutputMapping) FromBytes ¶ added in v0.8.10
func (a *AddressOutputMapping) FromBytes(bytes []byte) (addressOutputMapping objectstorage.StorableObject, err error)
FromBytes unmarshals a AddressOutputMapping from a sequence of bytes.
func (*AddressOutputMapping) FromMarshalUtil ¶ added in v0.8.10
func (a *AddressOutputMapping) FromMarshalUtil(marshalUtil *marshalutil.MarshalUtil) (addressOutputMapping *AddressOutputMapping, err error)
FromMarshalUtil unmarshals an AddressOutputMapping using a MarshalUtil (for easier unmarshalling).
func (*AddressOutputMapping) FromObjectStorage ¶ added in v0.8.10
func (a *AddressOutputMapping) FromObjectStorage(key, _ []byte) (objectstorage.StorableObject, error)
FromObjectStorage creates an TransactionMetadata from sequences of key and bytes.
func (*AddressOutputMapping) ObjectStorageKey ¶
func (a *AddressOutputMapping) ObjectStorageKey() []byte
ObjectStorageKey returns the key that is used to store the object in the database. It is required to match the StorableObject interface.
func (*AddressOutputMapping) ObjectStorageValue ¶
func (a *AddressOutputMapping) ObjectStorageValue() (value []byte)
ObjectStorageValue marshals the Consumer into a sequence of bytes that are used as the value part in the object storage.
func (*AddressOutputMapping) OutputID ¶
func (a *AddressOutputMapping) OutputID() OutputID
OutputID returns the OutputID of the AddressOutputMapping.
func (*AddressOutputMapping) String ¶
func (a *AddressOutputMapping) String() (humanReadableConsumer string)
String returns a human-readable version of the Consumer.
type AddressType ¶
type AddressType byte
AddressType represents the type of the Address (different types encode different signature schemes).
const ( // ED25519AddressType represents an Address secured by the ED25519 signature scheme. ED25519AddressType AddressType = iota // BLSAddressType represents an Address secured by the BLS signature scheme. BLSAddressType // AliasAddressType represents ID used in AliasOutput and AliasLockOutput. AliasAddressType )
func (AddressType) String ¶
func (a AddressType) String() string
String returns a human readable representation of the AddressType.
type AliasAddress ¶ added in v0.6.0
type AliasAddress struct {
// contains filtered or unexported fields
}
AliasAddress represents a special type of Address which is not backed by a private key directly, but is indirectly backed by a private key defined by corresponding AliasOutput parameters.
func AliasAddressFromBase58EncodedString ¶ added in v0.6.0
func AliasAddressFromBase58EncodedString(base58String string) (address *AliasAddress, err error)
AliasAddressFromBase58EncodedString creates an AliasAddress from a base58 encoded string.
func AliasAddressFromBytes ¶ added in v0.6.0
func AliasAddressFromBytes(data []byte) (address *AliasAddress, consumedBytes int, err error)
AliasAddressFromBytes unmarshals an AliasAddress from a sequence of bytes.
func AliasAddressFromMarshalUtil ¶ added in v0.6.0
func AliasAddressFromMarshalUtil(marshalUtil *marshalutil.MarshalUtil) (address *AliasAddress, err error)
AliasAddressFromMarshalUtil parses a AliasAddress from the given MarshalUtil.
func NewAliasAddress ¶ added in v0.6.0
func NewAliasAddress(data []byte) *AliasAddress
NewAliasAddress creates a new AliasAddress from the given bytes used as seed. Normally the seed is an OutputID.
func (*AliasAddress) Array ¶ added in v0.6.0
func (a *AliasAddress) Array() (array [AddressLength]byte)
Array returns an array of bytes that contains the marshaled version of the Address.
func (*AliasAddress) Base58 ¶ added in v0.6.0
func (a *AliasAddress) Base58() string
Base58 returns a base58 encoded version of the Address.
func (*AliasAddress) Bytes ¶ added in v0.6.0
func (a *AliasAddress) Bytes() []byte
Bytes returns a marshaled version of the Address.
func (*AliasAddress) Clone ¶ added in v0.6.0
func (a *AliasAddress) Clone() Address
Clone creates a copy of the Address.
func (*AliasAddress) Digest ¶ added in v0.6.0
func (a *AliasAddress) Digest() []byte
Digest returns the hashed version of the Addresses public key.
func (*AliasAddress) Equals ¶ added in v0.6.0
func (a *AliasAddress) Equals(other Address) bool
Equals returns true if the two Addresses are equal.
func (*AliasAddress) IsNil ¶ added in v0.6.0
func (a *AliasAddress) IsNil() bool
IsNil returns if the alias address is zero value (uninitialized).
func (*AliasAddress) String ¶ added in v0.6.0
func (a *AliasAddress) String() string
String returns a human readable version of the addresses for debug purposes.
func (*AliasAddress) Type ¶ added in v0.6.0
func (a *AliasAddress) Type() AddressType
Type returns the AddressType of the Address.
type AliasOutput ¶ added in v0.6.0
type AliasOutput struct { objectstorage.StorableObjectFlags // contains filtered or unexported fields }
AliasOutput represents output which defines as AliasAddress. It can only be used in a chained manner.
func NewAliasOutputMint ¶ added in v0.6.0
func NewAliasOutputMint(balances map[Color]uint64, stateAddr Address, immutableData ...[]byte) (*AliasOutput, error)
NewAliasOutputMint creates new AliasOutput as minting output, i.e. the one which does not contain corresponding input.
func (*AliasOutput) Address ¶ added in v0.6.0
func (a *AliasOutput) Address() Address
Address AliasOutput is searchable in the ledger through its AliasAddress.
func (*AliasOutput) Balances ¶ added in v0.6.0
func (a *AliasOutput) Balances() *ColoredBalances
Balances return colored balances of the output.
func (*AliasOutput) Bytes ¶ added in v0.6.0
func (a *AliasOutput) Bytes() []byte
Bytes serialized form.
func (*AliasOutput) Clone ¶ added in v0.6.0
func (a *AliasOutput) Clone() Output
Clone clones the structure.
func (*AliasOutput) Compare ¶ added in v0.6.0
func (a *AliasOutput) Compare(other Output) int
Compare the two outputs.
func (*AliasOutput) DelegationTimeLockedNow ¶ added in v0.6.0
func (a *AliasOutput) DelegationTimeLockedNow(nowis time.Time) bool
DelegationTimeLockedNow determines if the alias output is delegation timelocked at a given time.
func (*AliasOutput) DelegationTimelock ¶ added in v0.6.0
func (a *AliasOutput) DelegationTimelock() time.Time
DelegationTimelock returns the delegation timelock. If the output is not delegated, or delegation timelock is not set, it returns the zero time object.
func (*AliasOutput) FromBytes ¶ added in v0.8.10
func (a *AliasOutput) FromBytes(data []byte) (output *AliasOutput, err error)
FromBytes unmarshals a ExtendedLockedOutput from a sequence of bytes.
func (*AliasOutput) FromMarshalUtil ¶ added in v0.8.10
func (a *AliasOutput) FromMarshalUtil(marshalUtil *marshalutil.MarshalUtil) (output *AliasOutput, err error)
FromMarshalUtil unmarshals a AliasOutput using a MarshalUtil (for easier unmarshaling).
func (*AliasOutput) FromObjectStorage ¶ added in v0.8.10
func (a *AliasOutput) FromObjectStorage(key, bytes []byte) (objectstorage.StorableObject, error)
FromObjectStorage creates an AliasOutput from sequences of key and bytes.
func (*AliasOutput) GetAliasAddress ¶ added in v0.6.0
func (a *AliasOutput) GetAliasAddress() *AliasAddress
GetAliasAddress calculates new ID if it is a minting output. Otherwise it takes stored value.
func (*AliasOutput) GetGovernanceMetadata ¶ added in v0.6.0
func (a *AliasOutput) GetGovernanceMetadata() []byte
GetGovernanceMetadata gets the governance metadata.
func (*AliasOutput) GetGoverningAddress ¶ added in v0.6.0
func (a *AliasOutput) GetGoverningAddress() Address
GetGoverningAddress return governing address. If self-governed, it is the same as state controlling address.
func (*AliasOutput) GetImmutableData ¶ added in v0.6.0
func (a *AliasOutput) GetImmutableData() []byte
GetImmutableData gets the state data.
func (*AliasOutput) GetIsGovernanceUpdated ¶ added in v0.6.0
func (a *AliasOutput) GetIsGovernanceUpdated() bool
GetIsGovernanceUpdated returns if the output was unlocked for governance in the transaction.
func (*AliasOutput) GetStateAddress ¶ added in v0.6.0
func (a *AliasOutput) GetStateAddress() Address
GetStateAddress return state controlling address.
func (*AliasOutput) GetStateData ¶ added in v0.6.0
func (a *AliasOutput) GetStateData() []byte
GetStateData gets the state data.
func (*AliasOutput) GetStateIndex ¶ added in v0.6.0
func (a *AliasOutput) GetStateIndex() uint32
GetStateIndex returns the state index.
func (*AliasOutput) ID ¶ added in v0.6.0
func (a *AliasOutput) ID() OutputID
ID is the ID of the output.
func (*AliasOutput) Input ¶ added in v0.6.0
func (a *AliasOutput) Input() Input
Input makes input from the output.
func (*AliasOutput) IsDelegated ¶ added in v0.6.0
func (a *AliasOutput) IsDelegated() bool
IsDelegated returns true if the output is delegated.
func (*AliasOutput) IsOrigin ¶ added in v0.6.0
func (a *AliasOutput) IsOrigin() bool
IsOrigin returns true if it starts the chain.
func (*AliasOutput) IsSelfGoverned ¶ added in v0.6.0
func (a *AliasOutput) IsSelfGoverned() bool
IsSelfGoverned returns if governing address is not set which means that stateAddress is same as governingAddress.
func (*AliasOutput) NewAliasOutputNext ¶ added in v0.6.0
func (a *AliasOutput) NewAliasOutputNext(governanceUpdate ...bool) *AliasOutput
NewAliasOutputNext creates new AliasOutput as state transition from the previous one.
func (*AliasOutput) ObjectStorageKey ¶ added in v0.6.0
func (a *AliasOutput) ObjectStorageKey() []byte
ObjectStorageKey a key.
func (*AliasOutput) ObjectStorageValue ¶ added in v0.6.0
func (a *AliasOutput) ObjectStorageValue() []byte
ObjectStorageValue binary form.
func (*AliasOutput) SetAliasAddress ¶ added in v0.6.0
func (a *AliasOutput) SetAliasAddress(addr *AliasAddress)
SetAliasAddress sets the alias address of the alias output.
func (*AliasOutput) SetBalances ¶ added in v0.6.0
func (a *AliasOutput) SetBalances(balances map[Color]uint64) error
SetBalances sets colored balances of the output.
func (*AliasOutput) SetDelegationTimelock ¶ added in v0.6.0
func (a *AliasOutput) SetDelegationTimelock(timelock time.Time) error
SetDelegationTimelock sets the delegation timelock. An error is returned if the output is not a delegated.
func (*AliasOutput) SetGovernanceMetadata ¶ added in v0.6.0
func (a *AliasOutput) SetGovernanceMetadata(data []byte) error
SetGovernanceMetadata sets governance metadata.
func (*AliasOutput) SetGoverningAddress ¶ added in v0.6.0
func (a *AliasOutput) SetGoverningAddress(addr Address)
SetGoverningAddress sets the governing address or nil for self-governing.
func (*AliasOutput) SetID ¶ added in v0.6.0
func (a *AliasOutput) SetID(outputID OutputID) Output
SetID set the output ID after unmarshalling.
func (*AliasOutput) SetImmutableData ¶ added in v0.6.0
func (a *AliasOutput) SetImmutableData(data []byte) error
SetImmutableData sets the immutable data field of the alias output.
func (*AliasOutput) SetIsDelegated ¶ added in v0.6.0
func (a *AliasOutput) SetIsDelegated(isDelegated bool)
SetIsDelegated sets the isDelegated field of the output.
func (*AliasOutput) SetIsGovernanceUpdated ¶ added in v0.6.0
func (a *AliasOutput) SetIsGovernanceUpdated(i bool)
SetIsGovernanceUpdated sets the isGovernanceUpdated flag.
func (*AliasOutput) SetIsOrigin ¶ added in v0.6.0
func (a *AliasOutput) SetIsOrigin(isOrigin bool)
SetIsOrigin sets the isOrigin field of the output.
func (*AliasOutput) SetStateAddress ¶ added in v0.6.0
func (a *AliasOutput) SetStateAddress(addr Address) error
SetStateAddress sets the state controlling address.
func (*AliasOutput) SetStateData ¶ added in v0.6.0
func (a *AliasOutput) SetStateData(data []byte) error
SetStateData sets state data.
func (*AliasOutput) SetStateIndex ¶ added in v0.6.0
func (a *AliasOutput) SetStateIndex(index uint32)
SetStateIndex sets the state index in the input. It is enforced to increment by 1 with each state transition.
func (*AliasOutput) String ¶ added in v0.6.0
func (a *AliasOutput) String() string
String human readable form.
func (*AliasOutput) Type ¶ added in v0.6.0
func (a *AliasOutput) Type() OutputType
Type return the type of the output.
func (*AliasOutput) UnlockValid ¶ added in v0.6.0
func (a *AliasOutput) UnlockValid(tx *Transaction, unlockBlock UnlockBlock, inputs []Output) (bool, error)
UnlockValid check unlock and validates chain.
func (*AliasOutput) UpdateMintingColor ¶ added in v0.6.0
func (a *AliasOutput) UpdateMintingColor() Output
UpdateMintingColor replaces minting code with computed color code, and calculates the alias address if it is a freshly minted alias output.
func (*AliasOutput) WithDelegation ¶ added in v0.6.0
func (a *AliasOutput) WithDelegation() *AliasOutput
WithDelegation returns the output as a delegateds alias output.
func (*AliasOutput) WithDelegationAndTimelock ¶ added in v0.6.0
func (a *AliasOutput) WithDelegationAndTimelock(lockUntil time.Time) *AliasOutput
WithDelegationAndTimelock returns the output as a delegated alias output and a set delegation timelock.
type AliasUnlockBlock ¶ added in v0.6.0
type AliasUnlockBlock struct {
// contains filtered or unexported fields
}
AliasUnlockBlock defines an UnlockBlock which contains an index of corresponding AliasOutput.
func AliasUnlockBlockFromBytes ¶ added in v0.6.0
func AliasUnlockBlockFromBytes(bytes []byte) (unlockBlock *AliasUnlockBlock, consumedBytes int, err error)
AliasUnlockBlockFromBytes unmarshals a AliasUnlockBlock from a sequence of bytes.
func AliasUnlockBlockFromMarshalUtil ¶ added in v0.6.0
func AliasUnlockBlockFromMarshalUtil(marshalUtil *marshalutil.MarshalUtil) (unlockBlock *AliasUnlockBlock, err error)
AliasUnlockBlockFromMarshalUtil unmarshals a AliasUnlockBlock using a MarshalUtil (for easier unmarshaling).
func NewAliasUnlockBlock ¶ added in v0.6.0
func NewAliasUnlockBlock(chainInputIndex uint16) *AliasUnlockBlock
NewAliasUnlockBlock is the constructor for AliasUnlockBlocks.
func (*AliasUnlockBlock) AliasInputIndex ¶ added in v0.6.0
func (r *AliasUnlockBlock) AliasInputIndex() uint16
AliasInputIndex returns the index of the input, the AliasOutput which contains AliasAddress.
func (*AliasUnlockBlock) Bytes ¶ added in v0.6.0
func (r *AliasUnlockBlock) Bytes() []byte
Bytes returns a marshaled version of the UnlockBlock.
func (*AliasUnlockBlock) String ¶ added in v0.6.0
func (r *AliasUnlockBlock) String() string
String returns a human readable version of the UnlockBlock.
func (*AliasUnlockBlock) Type ¶ added in v0.6.0
func (r *AliasUnlockBlock) Type() UnlockBlockType
Type returns the UnlockBlockType of the UnlockBlock.
type ArithmeticBranchIDs ¶ added in v0.8.6
ArithmeticBranchIDs represents an arithmetic collection of BranchIDs that allows us to add and subtract them from each other.
func NewArithmeticBranchIDs ¶ added in v0.8.6
func NewArithmeticBranchIDs(optionalBranchIDs ...BranchIDs) (newArithmeticBranchIDs ArithmeticBranchIDs)
NewArithmeticBranchIDs returns a new ArithmeticBranchIDs object.
func (ArithmeticBranchIDs) Add ¶ added in v0.8.6
func (a ArithmeticBranchIDs) Add(branchIDs BranchIDs)
Add adds all BranchIDs to the collection.
func (ArithmeticBranchIDs) BranchIDs ¶ added in v0.8.6
func (a ArithmeticBranchIDs) BranchIDs() (branchIDs BranchIDs)
BranchIDs returns the BranchIDs represented by this collection.
func (ArithmeticBranchIDs) String ¶ added in v0.8.6
func (a ArithmeticBranchIDs) String() string
String returns a human-readable version of the ArithmeticBranchIDs.
func (ArithmeticBranchIDs) Subtract ¶ added in v0.8.6
func (a ArithmeticBranchIDs) Subtract(branchIDs BranchIDs)
Subtract subtracts all BranchIDs from the collection.
type BLSAddress ¶
type BLSAddress struct {
// contains filtered or unexported fields
}
BLSAddress represents an Address that is secured by the BLS signature scheme.
func BLSAddressFromBase58EncodedString ¶
func BLSAddressFromBase58EncodedString(base58String string) (address *BLSAddress, err error)
BLSAddressFromBase58EncodedString creates an BLSAddress from a base58 encoded string.
func BLSAddressFromBytes ¶
func BLSAddressFromBytes(bytes []byte) (address *BLSAddress, consumedBytes int, err error)
BLSAddressFromBytes unmarshals an BLSAddress from a sequence of bytes.
func BLSAddressFromMarshalUtil ¶
func BLSAddressFromMarshalUtil(marshalUtil *marshalutil.MarshalUtil) (address *BLSAddress, err error)
BLSAddressFromMarshalUtil parses a BLSAddress from the given MarshalUtil.
func NewBLSAddress ¶
func NewBLSAddress(publicKey []byte) *BLSAddress
NewBLSAddress creates a new BLSAddress from the given public key.
func (*BLSAddress) Array ¶ added in v0.4.0
func (b *BLSAddress) Array() (array [AddressLength]byte)
Array returns an array of bytes that contains the marshaled version of the Address.
func (*BLSAddress) Base58 ¶
func (b *BLSAddress) Base58() string
Base58 returns a base58 encoded version of the Address.
func (*BLSAddress) Bytes ¶
func (b *BLSAddress) Bytes() []byte
Bytes returns a marshaled version of the Address.
func (*BLSAddress) Clone ¶
func (b *BLSAddress) Clone() Address
Clone creates a copy of the Address.
func (*BLSAddress) Digest ¶
func (b *BLSAddress) Digest() []byte
Digest returns the hashed version of the Addresses public key.
func (*BLSAddress) Equals ¶ added in v0.6.0
func (b *BLSAddress) Equals(other Address) bool
Equals returns true if the two Addresses are equal.
func (*BLSAddress) String ¶
func (b *BLSAddress) String() string
String returns a human readable version of the addresses for debug purposes.
func (*BLSAddress) Type ¶
func (b *BLSAddress) Type() AddressType
Type returns the AddressType of the Address.
type BLSSignature ¶
type BLSSignature struct {
Signature bls.SignatureWithPublicKey
}
BLSSignature represents a Signature created with the BLS signature scheme.
func BLSSignatureFromBase58EncodedString ¶
func BLSSignatureFromBase58EncodedString(base58String string) (signature *BLSSignature, err error)
BLSSignatureFromBase58EncodedString creates a BLSSignature from a base58 encoded string.
func BLSSignatureFromBytes ¶
func BLSSignatureFromBytes(bytes []byte) (signature *BLSSignature, consumedBytes int, err error)
BLSSignatureFromBytes unmarshals a BLSSignature from a sequence of bytes.
func BLSSignatureFromMarshalUtil ¶
func BLSSignatureFromMarshalUtil(marshalUtil *marshalutil.MarshalUtil) (signature *BLSSignature, err error)
BLSSignatureFromMarshalUtil unmarshals a BLSSignature using a MarshalUtil (for easier unmarshaling).
func NewBLSSignature ¶
func NewBLSSignature(signature bls.SignatureWithPublicKey) *BLSSignature
NewBLSSignature is the constructor of a BLSSignature.
func (*BLSSignature) AddressSignatureValid ¶
func (b *BLSSignature) AddressSignatureValid(address Address, data []byte) bool
AddressSignatureValid returns true if the Signature signs the given Address.
func (*BLSSignature) Base58 ¶
func (b *BLSSignature) Base58() string
Base58 returns a base58 encoded version of the Signature.
func (*BLSSignature) Bytes ¶
func (b *BLSSignature) Bytes() []byte
Bytes returns a marshaled version of the Signature.
func (*BLSSignature) SignatureValid ¶
func (b *BLSSignature) SignatureValid(data []byte) bool
SignatureValid returns true if the Signature signs the given data.
func (*BLSSignature) String ¶
func (b *BLSSignature) String() string
String returns a human readable version of the Signature.
func (*BLSSignature) Type ¶
func (b *BLSSignature) Type() SignatureType
Type returns the SignatureType of this Signature.
type Branch ¶
type Branch struct { objectstorage.StorableObjectFlags // contains filtered or unexported fields }
Branch represents a container for Transactions and Outputs representing a certain perception of the ledger state.
func NewBranch ¶ added in v0.8.10
func NewBranch(id BranchID, parents BranchIDs, conflicts ConflictIDs) *Branch
NewBranch creates a new Branch from the given details.
func (*Branch) AddConflict ¶ added in v0.8.10
func (b *Branch) AddConflict(conflictID ConflictID) (added bool)
AddConflict registers the membership of the Branch in the given Conflict.
func (*Branch) Conflicts ¶ added in v0.8.10
func (b *Branch) Conflicts() (conflicts ConflictIDs)
Conflicts returns the Conflicts that the Branch is part of.
func (*Branch) FromBytes ¶ added in v0.8.10
FromBytes unmarshals an Branch from a sequence of bytes.
func (*Branch) FromMarshalUtil ¶ added in v0.8.10
func (b *Branch) FromMarshalUtil(marshalUtil *marshalutil.MarshalUtil) (branch *Branch, err error)
FromMarshalUtil unmarshals an Branch using a MarshalUtil (for easier unmarshaling).
func (*Branch) FromObjectStorage ¶ added in v0.8.10
func (b *Branch) FromObjectStorage(key, bytes []byte) (conflictBranch objectstorage.StorableObject, err error)
FromObjectStorage creates an Branch from sequences of key and bytes.
func (*Branch) InclusionState ¶
func (b *Branch) InclusionState() (inclusionState InclusionState)
InclusionState returns the InclusionState of the Branch.
func (*Branch) ObjectStorageKey ¶ added in v0.8.10
ObjectStorageKey returns the key that is used to store the object in the database. It is required to match the StorableObject interface.
func (*Branch) ObjectStorageValue ¶ added in v0.8.10
ObjectStorageValue marshals the Branch into a sequence of bytes that are used as the value part in the object storage.
func (*Branch) SetParents ¶ added in v0.8.10
SetParents updates the parents of the Branch.
type BranchDAG ¶
type BranchDAG struct { Events *BranchDAGEvents // contains filtered or unexported fields }
BranchDAG represents the DAG of Branches which contains the business logic to manage the creation and maintenance of the Branches which represents containers for the different perceptions of the ledger state that exist in the tangle.
func NewBranchDAG ¶
func NewBranchDAG(ledgerstate *Ledgerstate) (newBranchDAG *BranchDAG)
NewBranchDAG returns a new BranchDAG instance that stores its state in the given KVStore.
func (*BranchDAG) AddBranchParent ¶ added in v0.8.10
AddBranchParent changes the parents of a Branch (also updating the references of the ChildBranches).
func (*BranchDAG) Branch ¶
func (b *BranchDAG) Branch(branchID BranchID, computeIfAbsentCallback ...func() *Branch) (cachedBranch *objectstorage.CachedObject[*Branch])
Branch retrieves the Branch with the given BranchID from the object storage.
func (*BranchDAG) ChildBranches ¶
func (b *BranchDAG) ChildBranches(branchID BranchID) (cachedChildBranches objectstorage.CachedObjects[*ChildBranch])
ChildBranches loads the references to the ChildBranches of the given Branch from the object storage.
func (*BranchDAG) Conflict ¶
func (b *BranchDAG) Conflict(conflictID ConflictID) *objectstorage.CachedObject[*Conflict]
Conflict loads a Conflict from the object storage.
func (*BranchDAG) ConflictMembers ¶
func (b *BranchDAG) ConflictMembers(conflictID ConflictID) (cachedConflictMembers objectstorage.CachedObjects[*ConflictMember])
ConflictMembers loads the referenced ConflictMembers of a Conflict from the object storage.
func (*BranchDAG) CreateBranch ¶ added in v0.8.10
func (b *BranchDAG) CreateBranch(branchID BranchID, parentBranchIDs BranchIDs, conflictIDs ConflictIDs) (cachedBranch *objectstorage.CachedObject[*Branch], newBranchCreated bool, err error)
CreateBranch retrieves the Branch that corresponds to the given details. It automatically creates and updates the Branch according to the new details if necessary.
func (*BranchDAG) ForEachBranch ¶ added in v0.5.3
ForEachBranch iterates over all the branches and executes consumer.
func (*BranchDAG) ForEachConflictingBranchID ¶ added in v0.5.7
func (b *BranchDAG) ForEachConflictingBranchID(branchID BranchID, callback func(conflictingBranchID BranchID) bool)
ForEachConflictingBranchID executes the callback for each Branch that is conflicting with the Branch identified by the given BranchID.
func (*BranchDAG) ForEachConnectedConflictingBranchID ¶ added in v0.8.6
func (b *BranchDAG) ForEachConnectedConflictingBranchID(branchID BranchID, callback func(conflictingBranchID BranchID))
ForEachConnectedConflictingBranchID executes the callback for each Branch that is connected through a chain of intersecting ConflictSets.
func (*BranchDAG) InclusionState ¶ added in v0.5.7
func (b *BranchDAG) InclusionState(branchIDs BranchIDs) (inclusionState InclusionState)
InclusionState returns the InclusionState of the given BranchIDs.
func (*BranchDAG) Prune ¶
Prune resets the database and deletes all objects (for testing or "node resets").
func (*BranchDAG) ResolvePendingBranchIDs ¶ added in v0.8.10
func (b *BranchDAG) ResolvePendingBranchIDs(branchIDs BranchIDs) (pendingBranchIDs BranchIDs, err error)
ResolvePendingBranchIDs returns the BranchIDs of the pending and rejected Branches that are addressed by the given BranchIDs.
func (*BranchDAG) SetBranchConfirmed ¶ added in v0.5.8
SetBranchConfirmed sets the InclusionState of the given Branch to be Confirmed.
type BranchDAGEvents ¶
type BranchID ¶
type BranchID [BranchIDLength]byte
BranchID is the data type that represents the identifier of a Branch.
func BranchIDFromBase58 ¶
BranchIDFromBase58 creates a BranchID from a base58 encoded string.
func BranchIDFromBytes ¶
BranchIDFromBytes unmarshals a BranchID from a sequence of bytes.
func BranchIDFromMarshalUtil ¶
func BranchIDFromMarshalUtil(marshalUtil *marshalutil.MarshalUtil) (branchID BranchID, err error)
BranchIDFromMarshalUtil unmarshals a BranchID using a MarshalUtil (for easier unmarshaling).
func BranchIDFromRandomness ¶ added in v0.5.7
func BranchIDFromRandomness() (branchID BranchID)
BranchIDFromRandomness returns a random BranchID which can for example be used for unit tests.
func NewBranchID ¶
func NewBranchID(transactionID TransactionID) (branchID BranchID)
NewBranchID creates a new BranchID from a TransactionID.
func (BranchID) TransactionID ¶ added in v0.5.8
func (b BranchID) TransactionID() (transactionID TransactionID)
TransactionID returns the TransactionID of its underlying conflicting Transaction.
type BranchIDs ¶
BranchIDs represents a collection of BranchIDs.
func BranchIDsFromMarshalUtil ¶
func BranchIDsFromMarshalUtil(marshalUtil *marshalutil.MarshalUtil) (branchIDs BranchIDs, err error)
BranchIDsFromMarshalUtil unmarshals a collection of BranchIDs using a MarshalUtil (for easier unmarshaling).
func NewBranchIDs ¶
NewBranchIDs creates a new collection of BranchIDs from the given BranchIDs.
func (BranchIDs) Add ¶
Add adds a BranchID to the collection and returns the collection to enable chaining.
func (BranchIDs) AddAll ¶ added in v0.8.0
AddAll adds all BranchIDs to the collection and returns the collection to enable chaining.
func (BranchIDs) Equals ¶ added in v0.8.10
Equals returns whether the BranchIDs and other BranchIDs are equal.
func (BranchIDs) Intersect ¶ added in v0.8.0
Intersect removes all BranchIDs from the collection that are not contained in the argument collection. It returns the collection to enable chaining.
func (BranchIDs) Is ¶ added in v0.8.10
Is checks if the given target BranchID is the only BranchID within BranchIDs.
type BranchParentUpdate ¶ added in v0.8.6
BranchParentUpdate contains the new branch parents of a branch.
type ChildBranch ¶
type ChildBranch struct { objectstorage.StorableObjectFlags // contains filtered or unexported fields }
ChildBranch represents the relationship between a Branch and its children. Since a Branch can have a potentially unbounded amount of child Branches, we store this as a separate k/v pair instead of a marshaled list of children inside the Branch.
func NewChildBranch ¶
func NewChildBranch(parentBranchID, childBranchID BranchID) *ChildBranch
NewChildBranch is the constructor of the ChildBranch reference.
func (*ChildBranch) Bytes ¶
func (c *ChildBranch) Bytes() (marshaledChildBranch []byte)
Bytes returns a marshaled version of the ChildBranch.
func (*ChildBranch) ChildBranchID ¶
func (c *ChildBranch) ChildBranchID() (childBranchID BranchID)
ChildBranchID returns the BranchID of the child Branch in the BranchDAG.
func (*ChildBranch) FromBytes ¶ added in v0.8.10
func (c *ChildBranch) FromBytes(bytes []byte) (childBranch objectstorage.StorableObject, err error)
FromBytes unmarshals a ChildBranch from a sequence of bytes.
func (*ChildBranch) FromMarshalUtil ¶ added in v0.8.10
func (c *ChildBranch) FromMarshalUtil(marshalUtil *marshalutil.MarshalUtil) (childBranch *ChildBranch, err error)
FromMarshalUtil unmarshals an ChildBranch using a MarshalUtil (for easier unmarshaling).
func (*ChildBranch) FromObjectStorage ¶ added in v0.8.10
func (c *ChildBranch) FromObjectStorage(key, bytes []byte) (childBranch objectstorage.StorableObject, err error)
FromObjectStorage creates an ChildBranch from sequences of key and bytes.
func (*ChildBranch) ObjectStorageKey ¶
func (c *ChildBranch) ObjectStorageKey() (objectStorageKey []byte)
ObjectStorageKey returns the key that is used to store the object in the database. It is required to match the StorableObject interface.
func (*ChildBranch) ObjectStorageValue ¶
func (c *ChildBranch) ObjectStorageValue() (objectStorageValue []byte)
ObjectStorageValue marshals the AggregatedBranch into a sequence of bytes that are used as the value part in the object storage.
func (*ChildBranch) ParentBranchID ¶
func (c *ChildBranch) ParentBranchID() (parentBranchID BranchID)
ParentBranchID returns the BranchID of the parent Branch in the BranchDAG.
func (*ChildBranch) String ¶
func (c *ChildBranch) String() (humanReadableChildBranch string)
String returns a human readable version of the ChildBranch.
type Color ¶
type Color [ColorLength]byte
Color represents a marker that is associated to a token balance and that can give tokens a certain "meaning".
func ColorFromBase58EncodedString ¶
ColorFromBase58EncodedString creates a Color from a base58 encoded string.
func ColorFromBytes ¶
ColorFromBytes unmarshals a Color from a sequence of bytes.
func ColorFromMarshalUtil ¶
func ColorFromMarshalUtil(marshalUtil *marshalutil.MarshalUtil) (color Color, err error)
ColorFromMarshalUtil unmarshals a Color using a MarshalUtil (for easier unmarshalling).
type ColoredBalances ¶
type ColoredBalances struct {
// contains filtered or unexported fields
}
ColoredBalances represents a collection of balances associated to their respective Color that maintains a deterministic order of the present Colors.
func ColoredBalancesFromBytes ¶
func ColoredBalancesFromBytes(bytes []byte) (coloredBalances *ColoredBalances, consumedBytes int, err error)
ColoredBalancesFromBytes unmarshals ColoredBalances from a sequence of bytes.
func ColoredBalancesFromMarshalUtil ¶
func ColoredBalancesFromMarshalUtil(marshalUtil *marshalutil.MarshalUtil) (coloredBalances *ColoredBalances, err error)
ColoredBalancesFromMarshalUtil unmarshals ColoredBalances using a MarshalUtil (for easier unmarshalling).
func NewColoredBalances ¶
func NewColoredBalances(balances map[Color]uint64) (coloredBalances *ColoredBalances)
NewColoredBalances returns a new deterministically ordered collection of ColoredBalances.
func (*ColoredBalances) Bytes ¶
func (c *ColoredBalances) Bytes() []byte
Bytes returns a marshaled version of the ColoredBalances.
func (*ColoredBalances) Clone ¶
func (c *ColoredBalances) Clone() *ColoredBalances
Clone returns a copy of the ColoredBalances.
func (*ColoredBalances) ForEach ¶
func (c *ColoredBalances) ForEach(consumer func(color Color, balance uint64) bool)
ForEach calls the consumer for each element in the collection and aborts the iteration if the consumer returns false.
func (*ColoredBalances) Get ¶
func (c *ColoredBalances) Get(color Color) (uint64, bool)
Get returns the balance of the given Color and a boolean value indicating if the requested Color existed.
func (*ColoredBalances) Map ¶
func (c *ColoredBalances) Map() (balances map[Color]uint64)
Map returns a vanilla golang map (unordered) containing the existing balances. Since the ColoredBalances are immutable to ensure the deterministic ordering, this method can be used to retrieve a copy of the current values prior to some modification (like setting the updated colors of a minting transaction) which can then be used to create a new ColoredBalances object.
func (*ColoredBalances) Size ¶
func (c *ColoredBalances) Size() int
Size returns the amount of individual balances in the ColoredBalances.
func (*ColoredBalances) String ¶
func (c *ColoredBalances) String() string
String returns a human-readable version of the ColoredBalances.
type Conflict ¶
type Conflict struct { objectstorage.StorableObjectFlags // contains filtered or unexported fields }
Conflict represents a set of Branches that are conflicting with each other.
func NewConflict ¶
func NewConflict(conflictID ConflictID) *Conflict
NewConflict is the constructor for new Conflicts.
func (*Conflict) DecreaseMemberCount ¶
DecreaseMemberCount decreases the MemberCount of this Conflict.
func (*Conflict) FromBytes ¶ added in v0.8.10
FromBytes unmarshals a Conflict from a sequence of bytes.
func (*Conflict) FromMarshalUtil ¶ added in v0.8.10
func (c *Conflict) FromMarshalUtil(marshalUtil *marshalutil.MarshalUtil) (conflict *Conflict, err error)
FromMarshalUtil unmarshals a Conflict using a MarshalUtil (for easier unmarshaling).
func (*Conflict) FromObjectStorage ¶ added in v0.8.10
func (c *Conflict) FromObjectStorage(key, bytes []byte) (conflict objectstorage.StorableObject, err error)
FromObjectStorage creates a Conflict from sequences of key and bytes.
func (*Conflict) ID ¶
func (c *Conflict) ID() ConflictID
ID returns the identifier of this Conflict.
func (*Conflict) IncreaseMemberCount ¶
IncreaseMemberCount increase the MemberCount of this Conflict.
func (*Conflict) MemberCount ¶
MemberCount returns the amount of Branches that are part of this Conflict.
func (*Conflict) ObjectStorageKey ¶
ObjectStorageKey returns the key that is used to store the object in the database. It is required to match the StorableObject interface.
func (*Conflict) ObjectStorageValue ¶
ObjectStorageValue marshals the Conflict into a sequence of bytes. The ID is not serialized here as it is only used as a key in the ObjectStorage.
type ConflictID ¶
type ConflictID [ConflictIDLength]byte
ConflictID is the data type that represents the identifier of a Conflict.
func ConflictIDFromMarshalUtil ¶
func ConflictIDFromMarshalUtil(marshalUtil *marshalutil.MarshalUtil) (conflictID ConflictID, err error)
ConflictIDFromMarshalUtil unmarshals a ConflictID using a MarshalUtil (for easier unmarshaling).
func ConflictIDFromRandomness ¶ added in v0.5.7
func ConflictIDFromRandomness() (conflictID ConflictID)
ConflictIDFromRandomness returns a random ConflictID which can for example be used for unit tests.
func NewConflictID ¶
func NewConflictID(outputID OutputID) (conflictID ConflictID)
NewConflictID creates a new ConflictID from an OutputID.
func (ConflictID) Base58 ¶
func (c ConflictID) Base58() string
Base58 returns a base58 encoded version of the ConflictID.
func (ConflictID) Bytes ¶
func (c ConflictID) Bytes() []byte
Bytes returns a marshaled version of the ConflictID.
func (ConflictID) OutputID ¶ added in v0.5.3
func (c ConflictID) OutputID() (outputID OutputID)
OutputID returns the OutputID that the ConflictID represents.
func (ConflictID) String ¶
func (c ConflictID) String() string
String returns a human readable version of the ConflictID.
type ConflictIDs ¶
type ConflictIDs map[ConflictID]types.Empty
ConflictIDs represents a collection of ConflictIDs.
func ConflictIDsFromMarshalUtil ¶
func ConflictIDsFromMarshalUtil(marshalUtil *marshalutil.MarshalUtil) (conflictIDs ConflictIDs, err error)
ConflictIDsFromMarshalUtil unmarshals a collection of ConflictIDs using a MarshalUtil (for easier unmarshaling).
func NewConflictIDs ¶
func NewConflictIDs(optionalConflictIDs ...ConflictID) (conflictIDs ConflictIDs)
NewConflictIDs creates a new collection of ConflictIDs from the given list of ConflictIDs.
func (ConflictIDs) Add ¶ added in v0.8.0
func (c ConflictIDs) Add(conflictID ConflictID) ConflictIDs
Add adds a ConflictID to the collection and returns the collection to enable chaining.
func (ConflictIDs) Bytes ¶
func (c ConflictIDs) Bytes() []byte
Bytes returns a marshaled version of the ConflictIDs.
func (ConflictIDs) Clone ¶
func (c ConflictIDs) Clone() (clonedConflictIDs ConflictIDs)
Clone creates a copy of the ConflictIDs.
func (ConflictIDs) Slice ¶
func (c ConflictIDs) Slice() (list []ConflictID)
Slice returns a slice of ConflictIDs.
func (ConflictIDs) String ¶
func (c ConflictIDs) String() string
String returns a human readable version of the ConflictIDs.
type ConflictMember ¶
type ConflictMember struct { objectstorage.StorableObjectFlags // contains filtered or unexported fields }
ConflictMember represents the relationship between a Conflict and its Branches. Since an Output can have a potentially unbounded amount of conflicting Consumers, we store the membership of the Branches in the corresponding Conflicts as a separate k/v pair instead of a marshaled list of members inside the Branch.
func NewConflictMember ¶
func NewConflictMember(conflictID ConflictID, branchID BranchID) *ConflictMember
NewConflictMember is the constructor of the ConflictMember reference.
func (*ConflictMember) BranchID ¶
func (c *ConflictMember) BranchID() BranchID
BranchID returns the identifier of the Branch that this ConflictMember references.
func (*ConflictMember) Bytes ¶
func (c *ConflictMember) Bytes() []byte
Bytes returns a marshaled version of this ConflictMember.
func (*ConflictMember) ConflictID ¶
func (c *ConflictMember) ConflictID() ConflictID
ConflictID returns the identifier of the Conflict that this ConflictMember belongs to.
func (*ConflictMember) FromBytes ¶ added in v0.8.10
func (c *ConflictMember) FromBytes(bytes []byte) (conflictMember *ConflictMember, err error)
FromBytes unmarshals a ConflictMember from a sequence of bytes.
func (*ConflictMember) FromMarshalUtil ¶ added in v0.8.10
func (c *ConflictMember) FromMarshalUtil(marshalUtil *marshalutil.MarshalUtil) (conflictMember *ConflictMember, err error)
FromMarshalUtil unmarshals an ConflictMember using a MarshalUtil (for easier unmarshaling).
func (*ConflictMember) FromObjectStorage ¶ added in v0.8.10
func (c *ConflictMember) FromObjectStorage(key, bytes []byte) (conflictMember objectstorage.StorableObject, err error)
FromObjectStorage creates an ConflictMember from sequences of key and bytes.
func (*ConflictMember) ObjectStorageKey ¶
func (c *ConflictMember) ObjectStorageKey() []byte
ObjectStorageKey returns the key that is used to store the object in the database. It is required to match the StorableObject interface.
func (*ConflictMember) ObjectStorageValue ¶
func (c *ConflictMember) ObjectStorageValue() []byte
ObjectStorageValue marshals the Output into a sequence of bytes. The ID is not serialized here as it is only used as a key in the ObjectStorage.
func (*ConflictMember) String ¶
func (c *ConflictMember) String() string
String returns a human readable version of this ConflictMember.
type Consumer ¶
type Consumer struct { objectstorage.StorableObjectFlags // contains filtered or unexported fields }
Consumer represents the relationship between an Output and its spending Transactions. Since an Output can have a potentially unbounded amount of spending Transactions, we store this as a separate k/v pair instead of a marshaled list of spending Transactions inside the Output.
func NewConsumer ¶
func NewConsumer(consumedInput OutputID, transactionID TransactionID, valid types.TriBool) *Consumer
NewConsumer creates a Consumer object from the given information.
func (*Consumer) ConsumedInput ¶
ConsumedInput returns the OutputID of the consumed Input.
func (*Consumer) FromBytes ¶ added in v0.8.10
FromBytes unmarshals a Consumer from a sequence of bytes.
func (*Consumer) FromMarshalUtil ¶ added in v0.8.10
func (c *Consumer) FromMarshalUtil(marshalUtil *marshalutil.MarshalUtil) (consumer *Consumer, err error)
FromMarshalUtil unmarshals a Consumer using a MarshalUtil (for easier unmarshalling).
func (*Consumer) FromObjectStorage ¶ added in v0.8.10
func (c *Consumer) FromObjectStorage(key, bytes []byte) (objectstorage.StorableObject, error)
FromObjectStorage creates an Consumer from sequences of key and bytes.
func (*Consumer) ObjectStorageKey ¶
ObjectStorageKey returns the key that is used to store the object in the database. It is required to match the StorableObject interface.
func (*Consumer) ObjectStorageValue ¶
ObjectStorageValue marshals the Consumer into a sequence of bytes that are used as the value part in the object storage.
func (*Consumer) SetValid ¶
SetValid updates the valid flag of the Consumer and returns true if the value was changed.
func (*Consumer) TransactionID ¶
func (c *Consumer) TransactionID() TransactionID
TransactionID returns the TransactionID of the consuming Transaction.
type ED25519Address ¶
type ED25519Address struct {
// contains filtered or unexported fields
}
ED25519Address represents an Address that is secured by the ED25519 signature scheme.
func ED25519AddressFromBase58EncodedString ¶
func ED25519AddressFromBase58EncodedString(base58String string) (address *ED25519Address, err error)
ED25519AddressFromBase58EncodedString creates an ED25519Address from a base58 encoded string.
func ED25519AddressFromBytes ¶
func ED25519AddressFromBytes(bytes []byte) (address *ED25519Address, consumedBytes int, err error)
ED25519AddressFromBytes unmarshals an ED25519Address from a sequence of bytes.
func ED25519AddressFromMarshalUtil ¶
func ED25519AddressFromMarshalUtil(marshalUtil *marshalutil.MarshalUtil) (address *ED25519Address, err error)
ED25519AddressFromMarshalUtil is a method that parses an ED25519Address from the given MarshalUtil.
func NewED25519Address ¶
func NewED25519Address(publicKey ed25519.PublicKey) *ED25519Address
NewED25519Address creates a new ED25519Address from the given public key.
func (*ED25519Address) Array ¶ added in v0.4.0
func (e *ED25519Address) Array() (array [AddressLength]byte)
Array returns an array of bytes that contains the marshaled version of the Address.
func (*ED25519Address) Base58 ¶
func (e *ED25519Address) Base58() string
Base58 returns a base58 encoded version of the address.
func (*ED25519Address) Bytes ¶
func (e *ED25519Address) Bytes() []byte
Bytes returns a marshaled version of the Address.
func (*ED25519Address) Clone ¶
func (e *ED25519Address) Clone() Address
Clone creates a copy of the Address.
func (*ED25519Address) Digest ¶
func (e *ED25519Address) Digest() []byte
Digest returns the hashed version of the Addresses public key.
func (*ED25519Address) Equals ¶ added in v0.6.0
func (e *ED25519Address) Equals(other Address) bool
Equals returns true if the two Addresses are equal.
func (*ED25519Address) String ¶
func (e *ED25519Address) String() string
String returns a human readable version of the addresses for debug purposes.
func (*ED25519Address) Type ¶
func (e *ED25519Address) Type() AddressType
Type returns the AddressType of the Address.
type ED25519Signature ¶
ED25519Signature represents a Signature created with the ed25519 signature scheme.
func ED25519SignatureFromBase58EncodedString ¶
func ED25519SignatureFromBase58EncodedString(base58String string) (signature *ED25519Signature, err error)
ED25519SignatureFromBase58EncodedString creates an ED25519Signature from a base58 encoded string.
func ED25519SignatureFromBytes ¶
func ED25519SignatureFromBytes(bytes []byte) (signature *ED25519Signature, consumedBytes int, err error)
ED25519SignatureFromBytes unmarshals a ED25519Signature from a sequence of bytes.
func ED25519SignatureFromMarshalUtil ¶
func ED25519SignatureFromMarshalUtil(marshalUtil *marshalutil.MarshalUtil) (signature *ED25519Signature, err error)
ED25519SignatureFromMarshalUtil unmarshals a ED25519Signature using a MarshalUtil (for easier unmarshaling).
func NewED25519Signature ¶
func NewED25519Signature(publicKey ed25519.PublicKey, signature ed25519.Signature) *ED25519Signature
NewED25519Signature is the constructor of an ED25519Signature.
func (*ED25519Signature) AddressSignatureValid ¶
func (e *ED25519Signature) AddressSignatureValid(address Address, data []byte) bool
AddressSignatureValid returns true if the Signature signs the given Address.
func (*ED25519Signature) Base58 ¶
func (e *ED25519Signature) Base58() string
Base58 returns a base58 encoded version of the Signature.
func (*ED25519Signature) Bytes ¶
func (e *ED25519Signature) Bytes() []byte
Bytes returns a marshaled version of the Signature.
func (*ED25519Signature) SignatureValid ¶
func (e *ED25519Signature) SignatureValid(data []byte) bool
SignatureValid returns true if the Signature signs the given data.
func (*ED25519Signature) String ¶
func (e *ED25519Signature) String() string
String returns a human readable version of the Signature.
func (*ED25519Signature) Type ¶
func (e *ED25519Signature) Type() SignatureType
Type returns the SignatureType of this Signature.
type ExtendedLockedOutput ¶ added in v0.6.0
type ExtendedLockedOutput struct { objectstorage.StorableObjectFlags // contains filtered or unexported fields }
ExtendedLockedOutput is an Extension of SigLockedColoredOutput. If extended options not enabled, it behaves as SigLockedColoredOutput. In addition it has options: - fallback address and fallback timeout - can be unlocked by AliasUnlockBlock (if address is of AliasAddress type) - can be time locked until deadline - data payload for arbitrary metadata (size limits apply).
func NewExtendedLockedOutput ¶ added in v0.6.0
func NewExtendedLockedOutput(balances map[Color]uint64, address Address) *ExtendedLockedOutput
NewExtendedLockedOutput is the constructor for a ExtendedLockedOutput.
func (*ExtendedLockedOutput) Address ¶ added in v0.6.0
func (o *ExtendedLockedOutput) Address() Address
Address returns the Address that the Output is associated to.
func (*ExtendedLockedOutput) Balances ¶ added in v0.6.0
func (o *ExtendedLockedOutput) Balances() *ColoredBalances
Balances returns the funds that are associated with the Output.
func (*ExtendedLockedOutput) Bytes ¶ added in v0.6.0
func (o *ExtendedLockedOutput) Bytes() []byte
Bytes returns a marshaled version of the Output.
func (*ExtendedLockedOutput) Clone ¶ added in v0.6.0
func (o *ExtendedLockedOutput) Clone() Output
Clone creates a copy of the Output.
func (*ExtendedLockedOutput) Compare ¶ added in v0.6.0
func (o *ExtendedLockedOutput) Compare(other Output) int
Compare offers a comparator for Outputs which returns -1 if the other Output is bigger, 1 if it is smaller and 0 if they are the same.
func (*ExtendedLockedOutput) FallbackAddress ¶ added in v0.6.0
func (o *ExtendedLockedOutput) FallbackAddress() (addy Address)
FallbackAddress returns the fallback address that the Output is associated to.
func (*ExtendedLockedOutput) FallbackOptions ¶ added in v0.6.0
func (o *ExtendedLockedOutput) FallbackOptions() (Address, time.Time)
FallbackOptions returns fallback options of the output. The address is nil if fallback options are not set.
func (*ExtendedLockedOutput) FromBytes ¶ added in v0.8.10
func (o *ExtendedLockedOutput) FromBytes(data []byte) (output *ExtendedLockedOutput, err error)
FromBytes unmarshals a ExtendedLockedOutput from a sequence of bytes.
func (*ExtendedLockedOutput) FromMarshalUtil ¶ added in v0.8.10
func (o *ExtendedLockedOutput) FromMarshalUtil(marshalUtil *marshalutil.MarshalUtil) (output *ExtendedLockedOutput, err error)
FromMarshalUtil unmarshals a ExtendedLockedOutput using a MarshalUtil (for easier unmarshalling).
func (*ExtendedLockedOutput) FromObjectStorage ¶ added in v0.8.10
func (o *ExtendedLockedOutput) FromObjectStorage(key, bytes []byte) (objectstorage.StorableObject, error)
FromObjectStorage creates an ExtendedLockedOutput from sequences of key and bytes.
func (*ExtendedLockedOutput) GetPayload ¶ added in v0.6.0
func (o *ExtendedLockedOutput) GetPayload() []byte
GetPayload return a data payload associated with the output.
func (*ExtendedLockedOutput) ID ¶ added in v0.6.0
func (o *ExtendedLockedOutput) ID() OutputID
ID returns the identifier of the Output that is used to address the Output in the UTXODAG.
func (*ExtendedLockedOutput) Input ¶ added in v0.6.0
func (o *ExtendedLockedOutput) Input() Input
Input returns an Input that references the Output.
func (*ExtendedLockedOutput) ObjectStorageKey ¶ added in v0.6.0
func (o *ExtendedLockedOutput) ObjectStorageKey() []byte
ObjectStorageKey returns the key that is used to store the object in the database. It is required to match the StorableObject interface.
func (*ExtendedLockedOutput) ObjectStorageValue ¶ added in v0.6.0
func (o *ExtendedLockedOutput) ObjectStorageValue() []byte
ObjectStorageValue marshals the Output into a sequence of bytes. The ID is not serialized here as it is only used as a key in the ObjectStorage.
func (*ExtendedLockedOutput) SetID ¶ added in v0.6.0
func (o *ExtendedLockedOutput) SetID(outputID OutputID) Output
SetID allows to set the identifier of the Output. We offer a setter for the property since Outputs that are created to become part of a transaction usually do not have an identifier, yet as their identifier depends on the TransactionID that is only determinable after the Transaction has been fully constructed. The ID is therefore only accessed when the Output is supposed to be persisted by the node.
func (*ExtendedLockedOutput) SetPayload ¶ added in v0.6.0
func (o *ExtendedLockedOutput) SetPayload(data []byte) error
SetPayload sets the payload field of the output.
func (*ExtendedLockedOutput) String ¶ added in v0.6.0
func (o *ExtendedLockedOutput) String() string
String returns a human readable version of the Output.
func (*ExtendedLockedOutput) TimeLock ¶ added in v0.6.0
func (o *ExtendedLockedOutput) TimeLock() time.Time
TimeLock is a time after which output can be unlocked.
func (*ExtendedLockedOutput) TimeLockedNow ¶ added in v0.6.0
func (o *ExtendedLockedOutput) TimeLockedNow(nowis time.Time) bool
TimeLockedNow checks if output is unlocked for the specific moment.
func (*ExtendedLockedOutput) Type ¶ added in v0.6.0
func (o *ExtendedLockedOutput) Type() OutputType
Type returns the type of the Output which allows us to generically handle Outputs of different types.
func (*ExtendedLockedOutput) UnlockAddressNow ¶ added in v0.6.0
func (o *ExtendedLockedOutput) UnlockAddressNow(nowis time.Time) Address
UnlockAddressNow return unlock address which is valid for the specific moment of time.
func (*ExtendedLockedOutput) UnlockValid ¶ added in v0.6.0
func (o *ExtendedLockedOutput) UnlockValid(tx *Transaction, unlockBlock UnlockBlock, inputs []Output) (unlockValid bool, err error)
UnlockValid determines if the given Transaction and the corresponding UnlockBlock are allowed to spend the Output.
func (*ExtendedLockedOutput) UpdateMintingColor ¶ added in v0.6.0
func (o *ExtendedLockedOutput) UpdateMintingColor() Output
UpdateMintingColor replaces the ColorMint in the balances of the Output with the hash of the OutputID. It returns a copy of the original Output with the modified balances.
func (*ExtendedLockedOutput) WithFallbackOptions ¶ added in v0.6.0
func (o *ExtendedLockedOutput) WithFallbackOptions(addr Address, deadline time.Time) *ExtendedLockedOutput
WithFallbackOptions adds fallback options to the output and returns the updated version.
func (*ExtendedLockedOutput) WithTimeLock ¶ added in v0.6.0
func (o *ExtendedLockedOutput) WithTimeLock(timelock time.Time) *ExtendedLockedOutput
WithTimeLock adds timelock to the output and returns the updated version.
type IUTXODAG ¶ added in v0.7.4
type IUTXODAG interface { // Events returns all events of the UTXODAG Events() *UTXODAGEvents // Shutdown shuts down the UTXODAG and persists its state. Shutdown() // CheckTransaction contains fast checks that have to be performed before booking a Transaction. CheckTransaction(transaction *Transaction) (err error) // BookTransaction books a Transaction into the ledger state. BookTransaction(transaction *Transaction) (targetBranch BranchID, err error) // CachedTransaction retrieves the Transaction with the given TransactionID from the object storage. CachedTransaction(transactionID TransactionID) (cachedTransaction *objectstorage.CachedObject[*Transaction]) // Transaction returns a specific transaction, consumed. Transaction(transactionID TransactionID) (transaction *Transaction) // Transactions returns all the transactions, consumed. Transactions() (transactions map[TransactionID]*Transaction) // CachedTransactionMetadata retrieves the TransactionMetadata with the given TransactionID from the object storage. CachedTransactionMetadata(transactionID TransactionID) (cachedTransactionMetadata *objectstorage.CachedObject[*TransactionMetadata]) // CachedOutput retrieves the Output with the given OutputID from the object storage. CachedOutput(outputID OutputID) (cachedOutput *objectstorage.CachedObject[Output]) // CachedOutputMetadata retrieves the OutputMetadata with the given OutputID from the object storage. CachedOutputMetadata(outputID OutputID) (cachedOutput *objectstorage.CachedObject[*OutputMetadata]) // CachedConsumers retrieves the Consumers of the given OutputID from the object storage. CachedConsumers(outputID OutputID) (cachedConsumers *objectstorage.CachedObjects[*Consumer]) // LoadSnapshot creates a set of outputs in the UTXODAG, that are forming the genesis for future transactions. LoadSnapshot(snapshot *Snapshot) // CachedAddressOutputMapping retrieves the outputs for the given address. CachedAddressOutputMapping(address Address) (cachedAddressOutputMappings *objectstorage.CachedObject[*AddressOutputMapping]) // ConsumedOutputs returns the consumed (cached)Outputs of the given Transaction. ConsumedOutputs(transaction *Transaction) (cachedInputs *objectstorage.CachedObjects[Output]) // ManageStoreAddressOutputMapping manages how to store the address-output mapping dependent on which type of output it is. ManageStoreAddressOutputMapping(output Output) // StoreAddressOutputMapping stores the address-output mapping. StoreAddressOutputMapping(address Address, outputID OutputID) // TransactionGradeOfFinality returns the GradeOfFinality of the Transaction with the given TransactionID. TransactionGradeOfFinality(transactionID TransactionID) (gradeOfFinality gof.GradeOfFinality, err error) // BranchGradeOfFinality returns the GradeOfFinality of the Branch with the given BranchID. BranchGradeOfFinality(branchID BranchID) (gradeOfFinality gof.GradeOfFinality, err error) // ConflictingTransactions returns the TransactionIDs that are conflicting with the given Transaction. ConflictingTransactions(transaction *Transaction) (conflictingTransactions TransactionIDs) }
IUTXODAG is the interface for UTXODAG which is the core of the ledger state that is formed by Transactions consuming Inputs and creating Outputs. It represents all the methods that helps to keep track of the balances and the different perceptions of potential conflicts.
type InclusionState ¶
type InclusionState uint8
InclusionState represents the confirmation status of elements in the ledger.
const ( // Pending represents elements that have neither been confirmed nor rejected. Pending InclusionState = iota // Confirmed represents elements that have been confirmed and will stay part of the ledger state forever. Confirmed // Rejected represents elements that have been rejected and will not be included in the ledger state. Rejected )
func InclusionStateFromBytes ¶
func InclusionStateFromBytes(bytes []byte) (inclusionState InclusionState, consumedBytes int, err error)
InclusionStateFromBytes unmarshals an InclusionState from a sequence of bytes.
func InclusionStateFromMarshalUtil ¶
func InclusionStateFromMarshalUtil(marshalUtil *marshalutil.MarshalUtil) (inclusionState InclusionState, err error)
InclusionStateFromMarshalUtil unmarshals an InclusionState from using a MarshalUtil (for easier unmarshalling).
func (InclusionState) Bytes ¶
func (i InclusionState) Bytes() []byte
Bytes returns a marshaled representation of the InclusionState.
func (InclusionState) String ¶
func (i InclusionState) String() string
String returns a human-readable representation of the InclusionState.
type Input ¶
type Input interface { // Type returns the type of the Input. Type() InputType // Bytes returns a marshaled version of the Input. Bytes() []byte // String returns a human readable version of the Input. String() string // Base58 returns the base58 encoded input. Base58() string // Compare offers a comparator for Inputs which returns -1 if other Input is bigger, 1 if it is smaller and 0 if they // are the same. Compare(other Input) int }
Input is a generic interface for different kinds of Inputs.
func InputFromBytes ¶
InputFromBytes unmarshals an Input from a sequence of bytes.
func InputFromMarshalUtil ¶
func InputFromMarshalUtil(marshalUtil *marshalutil.MarshalUtil) (input Input, err error)
InputFromMarshalUtil unmarshals an Input using a MarshalUtil (for easier unmarshaling).
type Inputs ¶
type Inputs []Input
Inputs represents a collection of Inputs that ensures a deterministic order.
func InputsFromBytes ¶
InputsFromBytes unmarshals a collection of Inputs from a sequence of bytes.
func InputsFromMarshalUtil ¶
func InputsFromMarshalUtil(marshalUtil *marshalutil.MarshalUtil) (inputs Inputs, err error)
InputsFromMarshalUtil unmarshals a collection of Inputs using a MarshalUtil (for easier unmarshaling).
func NewInputs ¶
NewInputs returns a deterministically ordered collection of Inputs removing existing duplicates.
type Ledgerstate ¶ added in v0.8.6
Ledgerstate is a data structure that follows the principles of the quadruple entry accounting.
func New ¶ added in v0.8.6
func New(options ...Option) (ledgerstate *Ledgerstate)
New is the constructor for the Ledgerstate.
func (*Ledgerstate) Configure ¶ added in v0.8.6
func (l *Ledgerstate) Configure(options ...Option)
Configure modifies the configuration of the Ledgerstate.
func (*Ledgerstate) Shutdown ¶ added in v0.8.6
func (l *Ledgerstate) Shutdown()
Shutdown marks the Ledgerstate as stopped, so it will not accept any new Transactions.
type Option ¶ added in v0.8.6
type Option func(*Options)
Option represents the return type of optional parameters that can be handed into the constructor of the Ledgerstate to configure its behavior.
func CacheTimeProvider ¶ added in v0.8.6
func CacheTimeProvider(cacheTimeProvider *database.CacheTimeProvider) Option
CacheTimeProvider is an Option for the Tangle that allows to override hard coded cache time.
func LazyBookingEnabled ¶ added in v0.8.6
LazyBookingEnabled is an Option for the Ledgerstate that allows to specify if the ledger state should lazy book conflicts that look like they have been decided already.
type Options ¶ added in v0.8.6
type Options struct { Store kvstore.KVStore CacheTimeProvider *database.CacheTimeProvider LazyBookingEnabled bool }
Options is a container for all configurable parameters of the Ledgerstate.
type Output ¶
type Output interface { // ID returns the identifier of the Output that is used to address the Output in the UTXODAG. ID() OutputID // SetID allows to set the identifier of the Output. We offer a setter for the property since Outputs that are // created to become part of a transaction usually do not have an identifier, yet as their identifier depends on // the TransactionID that is only determinable after the Transaction has been fully constructed. The ID is therefore // only accessed when the Output is supposed to be persisted. SetID(outputID OutputID) Output // Type returns the OutputType which allows us to generically handle Outputs of different types. Type() OutputType // Balances returns the funds that are associated with the Output. Balances() *ColoredBalances // Address returns the address that is associated to the output. Address() Address // UnlockValid determines if the given Transaction and the corresponding UnlockBlock are allowed to spend the // Output. UnlockValid(tx *Transaction, unlockBlock UnlockBlock, inputs []Output) (bool, error) // UpdateMintingColor replaces the ColorMint in the balances of the Output with the hash of the OutputID. It returns a // copy of the original Output with the modified balances. UpdateMintingColor() Output // Input returns an Input that references the Output. Input() Input // Clone creates a copy of the Output. Clone() Output // Bytes returns a marshaled version of the Output. Bytes() []byte // String returns a human readable version of the Output for debug purposes. String() string // Compare offers a comparator for Outputs which returns -1 if the other Output is bigger, 1 if it is smaller and 0 // if they are the same. Compare(other Output) int // StorableObject makes Outputs storable in the ObjectStorage. objectstorage.StorableObject }
Output is a generic interface for the different types of Outputs (with different unlock behaviors).
func OutputFromBytes ¶
OutputFromBytes unmarshals an Output from a sequence of bytes.
func OutputFromMarshalUtil ¶
func OutputFromMarshalUtil(marshalUtil *marshalutil.MarshalUtil) (output Output, err error)
OutputFromMarshalUtil unmarshals an Output using a MarshalUtil (for easier unmarshaling).
type OutputID ¶
type OutputID [OutputIDLength]byte
OutputID is the data type that represents the identifier of an Output (which consists of a TransactionID and the index of the Output in the Transaction that created it).
var EmptyOutputID OutputID
EmptyOutputID represents the zero-value of an OutputID.
func NewOutputID ¶
func NewOutputID(transactionID TransactionID, outputIndex uint16) (outputID OutputID)
NewOutputID is the constructor for the OutputID.
func OutputIDFromBase58 ¶
OutputIDFromBase58 creates an OutputID from a base58 encoded string.
func OutputIDFromBytes ¶
OutputIDFromBytes unmarshals an OutputID from a sequence of bytes.
func OutputIDFromMarshalUtil ¶
func OutputIDFromMarshalUtil(marshalUtil *marshalutil.MarshalUtil) (outputID OutputID, err error)
OutputIDFromMarshalUtil unmarshals an OutputID using a MarshalUtil (for easier unmarshaling).
func (OutputID) OutputIndex ¶
OutputIndex returns the Output index part of an OutputID.
func (OutputID) TransactionID ¶
func (o OutputID) TransactionID() (transactionID TransactionID)
TransactionID returns the TransactionID part of an OutputID.
type OutputMetadata ¶
type OutputMetadata struct { objectstorage.StorableObjectFlags // contains filtered or unexported fields }
OutputMetadata contains additional Output information that are derived from the local perception of the node.
func NewOutputMetadata ¶
func NewOutputMetadata(outputID OutputID) *OutputMetadata
NewOutputMetadata creates a new empty OutputMetadata object.
func (*OutputMetadata) AddBranchID ¶ added in v0.8.10
func (o *OutputMetadata) AddBranchID(branchID BranchID) (modified bool)
AddBranchID adds an identifier of the Branch that the Output was booked in.
func (*OutputMetadata) BranchIDs ¶ added in v0.8.10
func (o *OutputMetadata) BranchIDs() BranchIDs
BranchIDs returns the identifiers of the Branches that the Output was booked in.
func (*OutputMetadata) Bytes ¶
func (o *OutputMetadata) Bytes() []byte
Bytes marshals the OutputMetadata into a sequence of bytes.
func (*OutputMetadata) ConsumerCount ¶
func (o *OutputMetadata) ConsumerCount() int
ConsumerCount returns the number of transactions that have spent the Output.
func (*OutputMetadata) FromBytes ¶ added in v0.8.10
func (o *OutputMetadata) FromBytes(bytes []byte) (outputMetadata *OutputMetadata, err error)
FromBytes unmarshals an OutputMetadata object from a sequence of bytes.
func (*OutputMetadata) FromMarshalUtil ¶ added in v0.8.10
func (o *OutputMetadata) FromMarshalUtil(marshalUtil *marshalutil.MarshalUtil) (outputMetadata *OutputMetadata, err error)
FromMarshalUtil unmarshals an OutputMetadata object using a MarshalUtil (for easier unmarshalling).
func (*OutputMetadata) FromObjectStorage ¶ added in v0.8.10
func (o *OutputMetadata) FromObjectStorage(key, bytes []byte) (objectstorage.StorableObject, error)
FromObjectStorage creates an OutputMetadata from sequences of key and bytes.
func (*OutputMetadata) GradeOfFinality ¶ added in v0.8.0
func (o *OutputMetadata) GradeOfFinality() gof.GradeOfFinality
GradeOfFinality returns the grade of finality.
func (*OutputMetadata) GradeOfFinalityTime ¶ added in v0.8.0
func (o *OutputMetadata) GradeOfFinalityTime() time.Time
GradeOfFinalityTime returns the time the Output's gradeOfFinality was set.
func (*OutputMetadata) ID ¶
func (o *OutputMetadata) ID() OutputID
ID returns the OutputID of the Output that the OutputMetadata belongs to.
func (*OutputMetadata) ObjectStorageKey ¶
func (o *OutputMetadata) ObjectStorageKey() []byte
ObjectStorageKey returns the key that is used to store the object in the database. It is required to match the StorableObject interface.
func (*OutputMetadata) ObjectStorageValue ¶
func (o *OutputMetadata) ObjectStorageValue() []byte
ObjectStorageValue marshals the OutputMetadata into a sequence of bytes. The ID is not serialized here as it is only used as a key in the ObjectStorage.
func (*OutputMetadata) RegisterConsumer ¶
func (o *OutputMetadata) RegisterConsumer(consumer TransactionID) (previousConsumerCount int)
RegisterConsumer increases the consumer count of an Output and stores the first Consumer that was ever registered. It returns the previous consumer count.
func (*OutputMetadata) SetBranchIDs ¶ added in v0.8.10
func (o *OutputMetadata) SetBranchIDs(branchIDs BranchIDs) (modified bool)
SetBranchIDs sets the identifiers of the Branches that the Output was booked in.
func (*OutputMetadata) SetGradeOfFinality ¶ added in v0.8.0
func (o *OutputMetadata) SetGradeOfFinality(gradeOfFinality gof.GradeOfFinality) (modified bool)
SetGradeOfFinality updates the grade of finality. It returns true if it was modified.
func (*OutputMetadata) SetSolid ¶
func (o *OutputMetadata) SetSolid(solid bool) (modified bool)
SetSolid updates the solid flag of the Output. It returns true if the solid flag was modified and updates the solidification time if the Output was marked as solid.
func (*OutputMetadata) Solid ¶
func (o *OutputMetadata) Solid() bool
Solid returns true if the Output has been marked as solid.
func (*OutputMetadata) SolidificationTime ¶
func (o *OutputMetadata) SolidificationTime() time.Time
SolidificationTime returns the time when the Output was marked as solid.
func (*OutputMetadata) String ¶
func (o *OutputMetadata) String() string
String returns a human readable version of the OutputMetadata.
type OutputType ¶
type OutputType uint8
OutputType represents the type of an Output. Outputs of different types can have different unlock rules and allow for some relatively basic smart contract logic.
const ( // SigLockedSingleOutputType represents an Output holding vanilla IOTA tokens that gets unlocked by a signature. SigLockedSingleOutputType OutputType = iota // SigLockedColoredOutputType represents an Output that holds colored coins that gets unlocked by a signature. SigLockedColoredOutputType // AliasOutputType represents an Output which makes a chain with optional governance. AliasOutputType // ExtendedLockedOutputType represents an Output which extends SigLockedColoredOutput with alias locking and fallback. ExtendedLockedOutputType )
func OutputTypeFromString ¶ added in v0.6.0
func OutputTypeFromString(ot string) (OutputType, error)
OutputTypeFromString returns the output type from a string.
func (OutputType) String ¶
func (o OutputType) String() string
String returns a human readable representation of the OutputType.
type Outputs ¶
type Outputs []Output
Outputs represents a list of Outputs that can be used in a Transaction.
func NewOutputs ¶
NewOutputs returns a deterministically ordered collection of Outputs. It removes duplicates in the parameters and sorts the Outputs to ensure syntactical correctness.
func OutputsFromMarshalUtil ¶
func OutputsFromMarshalUtil(marshalUtil *marshalutil.MarshalUtil) (outputs Outputs, err error)
OutputsFromMarshalUtil unmarshals a collection of Outputs using a MarshalUtil (for easier unmarshaling).
func (Outputs) ByID ¶
func (o Outputs) ByID() (outputsByID OutputsByID)
ByID returns a map of Outputs where the key is the OutputID.
func (Outputs) Filter ¶ added in v0.5.3
Filter removes all elements from the Outputs that do not pass the given condition.
type OutputsByID ¶
OutputsByID represents a map of Outputs where every Output is stored with its corresponding OutputID as the key.
func NewOutputsByID ¶
func NewOutputsByID(optionalOutputs ...Output) (outputsByID OutputsByID)
NewOutputsByID returns a map of Outputs where every Output is stored with its corresponding OutputID as the key.
func (OutputsByID) Clone ¶
func (o OutputsByID) Clone() (clonedOutputs OutputsByID)
Clone creates a copy of the OutputsByID.
func (OutputsByID) Inputs ¶
func (o OutputsByID) Inputs() Inputs
Inputs returns the Inputs that reference the Outputs.
func (OutputsByID) Outputs ¶
func (o OutputsByID) Outputs() Outputs
Outputs returns a list of Outputs from the OutputsByID.
func (OutputsByID) String ¶
func (o OutputsByID) String() string
String returns a human readable version of the OutputsByID.
type OutputsMetadata ¶
type OutputsMetadata []*OutputMetadata
OutputsMetadata represents a list of OutputMetadata objects.
func (OutputsMetadata) ByID ¶
func (o OutputsMetadata) ByID() (outputsMetadataByID OutputsMetadataByID)
ByID returns a map of OutputsMetadata where the key is the OutputID.
func (OutputsMetadata) ConflictIDs ¶
func (o OutputsMetadata) ConflictIDs() (conflictIDs ConflictIDs)
ConflictIDs returns the ConflictIDs that are the equivalent of the OutputIDs in the list.
func (OutputsMetadata) OutputIDs ¶
func (o OutputsMetadata) OutputIDs() (outputIDs []OutputID)
OutputIDs returns the OutputIDs of the Outputs in the list.
func (OutputsMetadata) SpentOutputsMetadata ¶ added in v0.8.6
func (o OutputsMetadata) SpentOutputsMetadata() (spentOutputsMetadata OutputsMetadata)
SpentOutputsMetadata returns the spent elements of the list of OutputsMetadata objects.
func (OutputsMetadata) String ¶
func (o OutputsMetadata) String() string
String returns a human-readable version of the OutputsMetadata.
type OutputsMetadataByID ¶
type OutputsMetadataByID map[OutputID]*OutputMetadata
OutputsMetadataByID represents a map of OutputMetadatas where every OutputMetadata is stored with its corresponding OutputID as the key.
func (OutputsMetadataByID) ConflictIDs ¶
func (o OutputsMetadataByID) ConflictIDs() (conflictIDs ConflictIDs)
ConflictIDs turns the list of OutputMetadata objects into their corresponding ConflictIDs.
func (OutputsMetadataByID) Filter ¶
func (o OutputsMetadataByID) Filter(outputIDsToInclude []OutputID) (intersectionOfInputs OutputsMetadataByID)
Filter returns the OutputsMetadataByID that are sharing a set membership with the given Inputs.
func (OutputsMetadataByID) IDs ¶
func (o OutputsMetadataByID) IDs() (outputIDs []OutputID)
IDs returns the OutputIDs that are used as keys in the collection.
func (OutputsMetadataByID) String ¶
func (o OutputsMetadataByID) String() string
String returns a human readable version of the OutputsMetadataByID.
type Record ¶ added in v0.6.2
type Record struct { Essence *TransactionEssence UnlockBlocks UnlockBlocks UnspentOutputs []bool }
Record defines a record of the snapshot.
type ReferenceUnlockBlock ¶
type ReferenceUnlockBlock struct {
// contains filtered or unexported fields
}
ReferenceUnlockBlock defines an UnlockBlock which references a previous UnlockBlock (which must not be another ReferenceUnlockBlock).
func NewReferenceUnlockBlock ¶
func NewReferenceUnlockBlock(referencedIndex uint16) *ReferenceUnlockBlock
NewReferenceUnlockBlock is the constructor for ReferenceUnlockBlocks.
func ReferenceUnlockBlockFromBytes ¶
func ReferenceUnlockBlockFromBytes(bytes []byte) (unlockBlock *ReferenceUnlockBlock, consumedBytes int, err error)
ReferenceUnlockBlockFromBytes unmarshals a ReferenceUnlockBlock from a sequence of bytes.
func ReferenceUnlockBlockFromMarshalUtil ¶
func ReferenceUnlockBlockFromMarshalUtil(marshalUtil *marshalutil.MarshalUtil) (unlockBlock *ReferenceUnlockBlock, err error)
ReferenceUnlockBlockFromMarshalUtil unmarshals a ReferenceUnlockBlock using a MarshalUtil (for easier unmarshaling).
func (*ReferenceUnlockBlock) Bytes ¶
func (r *ReferenceUnlockBlock) Bytes() []byte
Bytes returns a marshaled version of the UnlockBlock.
func (*ReferenceUnlockBlock) ReferencedIndex ¶
func (r *ReferenceUnlockBlock) ReferencedIndex() uint16
ReferencedIndex returns the index of the referenced UnlockBlock.
func (*ReferenceUnlockBlock) String ¶
func (r *ReferenceUnlockBlock) String() string
String returns a human readable version of the UnlockBlock.
func (*ReferenceUnlockBlock) Type ¶
func (r *ReferenceUnlockBlock) Type() UnlockBlockType
Type returns the UnlockBlockType of the UnlockBlock.
type SigLockedColoredOutput ¶
type SigLockedColoredOutput struct { objectstorage.StorableObjectFlags // contains filtered or unexported fields }
SigLockedColoredOutput is an Output that holds colored balances and that can be unlocked by providing a signature for an Address.
func NewSigLockedColoredOutput ¶
func NewSigLockedColoredOutput(balances *ColoredBalances, address Address) *SigLockedColoredOutput
NewSigLockedColoredOutput is the constructor for a SigLockedColoredOutput.
func (*SigLockedColoredOutput) Address ¶
func (s *SigLockedColoredOutput) Address() Address
Address returns the Address that the Output is associated to.
func (*SigLockedColoredOutput) Balances ¶
func (s *SigLockedColoredOutput) Balances() *ColoredBalances
Balances returns the funds that are associated with the Output.
func (*SigLockedColoredOutput) Bytes ¶
func (s *SigLockedColoredOutput) Bytes() []byte
Bytes returns a marshaled version of the Output.
func (*SigLockedColoredOutput) Clone ¶
func (s *SigLockedColoredOutput) Clone() Output
Clone creates a copy of the Output.
func (*SigLockedColoredOutput) Compare ¶
func (s *SigLockedColoredOutput) Compare(other Output) int
Compare offers a comparator for Outputs which returns -1 if the other Output is bigger, 1 if it is smaller and 0 if they are the same.
func (*SigLockedColoredOutput) FromBytes ¶ added in v0.8.10
func (s *SigLockedColoredOutput) FromBytes(bytes []byte) (output *SigLockedColoredOutput, err error)
FromBytes unmarshals a SigLockedColoredOutput from a sequence of bytes.
func (*SigLockedColoredOutput) FromMarshalUtil ¶ added in v0.8.10
func (s *SigLockedColoredOutput) FromMarshalUtil(marshalUtil *marshalutil.MarshalUtil) (output *SigLockedColoredOutput, err error)
FromMarshalUtil unmarshals a SigLockedColoredOutput using a MarshalUtil (for easier unmarshaling).
func (*SigLockedColoredOutput) FromObjectStorage ¶ added in v0.8.10
func (s *SigLockedColoredOutput) FromObjectStorage(key, bytes []byte) (objectstorage.StorableObject, error)
FromObjectStorage creates an SigLockedColoredOutput from sequences of key and bytes.
func (*SigLockedColoredOutput) ID ¶
func (s *SigLockedColoredOutput) ID() OutputID
ID returns the identifier of the Output that is used to address the Output in the UTXODAG.
func (*SigLockedColoredOutput) Input ¶
func (s *SigLockedColoredOutput) Input() Input
Input returns an Input that references the Output.
func (*SigLockedColoredOutput) ObjectStorageKey ¶
func (s *SigLockedColoredOutput) ObjectStorageKey() []byte
ObjectStorageKey returns the key that is used to store the object in the database. It is required to match the StorableObject interface.
func (*SigLockedColoredOutput) ObjectStorageValue ¶
func (s *SigLockedColoredOutput) ObjectStorageValue() []byte
ObjectStorageValue marshals the Output into a sequence of bytes. The ID is not serialized here as it is only used as a key in the ObjectStorage.
func (*SigLockedColoredOutput) SetID ¶
func (s *SigLockedColoredOutput) SetID(outputID OutputID) Output
SetID allows to set the identifier of the Output. We offer a setter for the property since Outputs that are created to become part of a transaction usually do not have an identifier, yet as their identifier depends on the TransactionID that is only determinable after the Transaction has been fully constructed. The ID is therefore only accessed when the Output is supposed to be persisted by the node.
func (*SigLockedColoredOutput) String ¶
func (s *SigLockedColoredOutput) String() string
String returns a human readable version of the Output.
func (*SigLockedColoredOutput) Type ¶
func (s *SigLockedColoredOutput) Type() OutputType
Type returns the type of the Output which allows us to generically handle Outputs of different types.
func (*SigLockedColoredOutput) UnlockValid ¶
func (s *SigLockedColoredOutput) UnlockValid(tx *Transaction, unlockBlock UnlockBlock, inputs []Output) (unlockValid bool, err error)
UnlockValid determines if the given Transaction and the corresponding UnlockBlock are allowed to spend the Output.
func (*SigLockedColoredOutput) UpdateMintingColor ¶ added in v0.4.0
func (s *SigLockedColoredOutput) UpdateMintingColor() (updatedOutput Output)
UpdateMintingColor replaces the ColorMint in the balances of the Output with the hash of the OutputID. It returns a copy of the original Output with the modified balances.
type SigLockedSingleOutput ¶
type SigLockedSingleOutput struct { objectstorage.StorableObjectFlags // contains filtered or unexported fields }
SigLockedSingleOutput is an Output that holds exactly one uncolored balance and that can be unlocked by providing a signature for an Address.
func NewSigLockedSingleOutput ¶
func NewSigLockedSingleOutput(balance uint64, address Address) *SigLockedSingleOutput
NewSigLockedSingleOutput is the constructor for a SigLockedSingleOutput.
func (*SigLockedSingleOutput) Address ¶
func (s *SigLockedSingleOutput) Address() Address
Address returns the Address that the Output is associated to.
func (*SigLockedSingleOutput) Balances ¶
func (s *SigLockedSingleOutput) Balances() *ColoredBalances
Balances returns the funds that are associated with the Output.
func (*SigLockedSingleOutput) Bytes ¶
func (s *SigLockedSingleOutput) Bytes() []byte
Bytes returns a marshaled version of the Output.
func (*SigLockedSingleOutput) Clone ¶
func (s *SigLockedSingleOutput) Clone() Output
Clone creates a copy of the Output.
func (*SigLockedSingleOutput) Compare ¶
func (s *SigLockedSingleOutput) Compare(other Output) int
Compare offers a comparator for Outputs which returns -1 if the other Output is bigger, 1 if it is smaller and 0 if they are the same.
func (*SigLockedSingleOutput) FromBytes ¶ added in v0.8.10
func (s *SigLockedSingleOutput) FromBytes(bytes []byte) (output *SigLockedSingleOutput, err error)
FromBytes unmarshals a SigLockedSingleOutput from a sequence of bytes.
func (*SigLockedSingleOutput) FromMarshalUtil ¶ added in v0.8.10
func (s *SigLockedSingleOutput) FromMarshalUtil(marshalUtil *marshalutil.MarshalUtil) (output *SigLockedSingleOutput, err error)
FromMarshalUtil unmarshals a SigLockedSingleOutput using a MarshalUtil (for easier unmarshaling).
func (*SigLockedSingleOutput) FromObjectStorage ¶ added in v0.8.10
func (s *SigLockedSingleOutput) FromObjectStorage(key, bytes []byte) (objectstorage.StorableObject, error)
FromObjectStorage creates an SigLockedSingleOutput from sequences of key and bytes.
func (*SigLockedSingleOutput) ID ¶
func (s *SigLockedSingleOutput) ID() OutputID
ID returns the identifier of the Output that is used to address the Output in the UTXODAG.
func (*SigLockedSingleOutput) Input ¶
func (s *SigLockedSingleOutput) Input() Input
Input returns an Input that references the Output.
func (*SigLockedSingleOutput) ObjectStorageKey ¶
func (s *SigLockedSingleOutput) ObjectStorageKey() []byte
ObjectStorageKey returns the key that is used to store the object in the database. It is required to match the StorableObject interface.
func (*SigLockedSingleOutput) ObjectStorageValue ¶
func (s *SigLockedSingleOutput) ObjectStorageValue() []byte
ObjectStorageValue marshals the Output into a sequence of bytes. The ID is not serialized here as it is only used as a key in the ObjectStorage.
func (*SigLockedSingleOutput) SetID ¶
func (s *SigLockedSingleOutput) SetID(outputID OutputID) Output
SetID allows to set the identifier of the Output. We offer a setter for the property since Outputs that are created to become part of a transaction usually do not have an identifier, yet as their identifier depends on the TransactionID that is only determinable after the Transaction has been fully constructed. The ID is therefore only accessed when the Output is supposed to be persisted by the node.
func (*SigLockedSingleOutput) String ¶
func (s *SigLockedSingleOutput) String() string
String returns a human readable version of the Output.
func (*SigLockedSingleOutput) Type ¶
func (s *SigLockedSingleOutput) Type() OutputType
Type returns the type of the Output which allows us to generically handle Outputs of different types.
func (*SigLockedSingleOutput) UnlockValid ¶
func (s *SigLockedSingleOutput) UnlockValid(tx *Transaction, unlockBlock UnlockBlock, inputs []Output) (unlockValid bool, err error)
UnlockValid determines if the given Transaction and the corresponding UnlockBlock are allowed to spend the Output.
func (*SigLockedSingleOutput) UpdateMintingColor ¶ added in v0.6.0
func (s *SigLockedSingleOutput) UpdateMintingColor() Output
UpdateMintingColor does nothing for SigLockedSingleOutput.
type Signature ¶
type Signature interface { // Type returns the SignatureType of this Signature. Type() SignatureType // SignatureValid returns true if the Signature signs the given data. SignatureValid(data []byte) bool // AddressSignatureValid returns true if the Signature signs the given Address. AddressSignatureValid(address Address, data []byte) bool // Bytes returns a marshaled version of the Signature. Bytes() []byte // Base58 returns a base58 encoded version of the Signature. Base58() string // String returns a human readable version of the Signature. String() string }
Signature is an interface for the different kinds of Signatures that are supported by the ledger state.
func SignatureFromBase58EncodedString ¶
SignatureFromBase58EncodedString creates a Signature from a base58 encoded string.
func SignatureFromBytes ¶
SignatureFromBytes unmarshals a Signature from a sequence of bytes.
func SignatureFromMarshalUtil ¶
func SignatureFromMarshalUtil(marshalUtil *marshalutil.MarshalUtil) (signature Signature, err error)
SignatureFromMarshalUtil unmarshals a Signature using a MarshalUtil (for easier unmarshaling).
type SignatureType ¶
type SignatureType uint8
SignatureType represents the type of the signature scheme.
const ( // ED25519SignatureType represents an ED25519 Signature. ED25519SignatureType SignatureType = iota // BLSSignatureType represents a BLS Signature. BLSSignatureType )
func (SignatureType) String ¶
func (s SignatureType) String() string
String returns a human readable representation of the SignatureType.
type SignatureUnlockBlock ¶
type SignatureUnlockBlock struct {
// contains filtered or unexported fields
}
SignatureUnlockBlock represents an UnlockBlock that contains a Signature for an Address.
func NewSignatureUnlockBlock ¶
func NewSignatureUnlockBlock(signature Signature) *SignatureUnlockBlock
NewSignatureUnlockBlock is the constructor for SignatureUnlockBlock objects.
func SignatureUnlockBlockFromBytes ¶
func SignatureUnlockBlockFromBytes(bytes []byte) (unlockBlock *SignatureUnlockBlock, consumedBytes int, err error)
SignatureUnlockBlockFromBytes unmarshals a SignatureUnlockBlock from a sequence of bytes.
func SignatureUnlockBlockFromMarshalUtil ¶
func SignatureUnlockBlockFromMarshalUtil(marshalUtil *marshalutil.MarshalUtil) (unlockBlock *SignatureUnlockBlock, err error)
SignatureUnlockBlockFromMarshalUtil unmarshals a SignatureUnlockBlock using a MarshalUtil (for easier unmarshaling).
func (*SignatureUnlockBlock) AddressSignatureValid ¶
func (s *SignatureUnlockBlock) AddressSignatureValid(address Address, signedData []byte) bool
AddressSignatureValid returns true if the UnlockBlock correctly signs the given Address.
func (*SignatureUnlockBlock) Bytes ¶
func (s *SignatureUnlockBlock) Bytes() []byte
Bytes returns a marshaled version of the UnlockBlock.
func (*SignatureUnlockBlock) Signature ¶ added in v0.6.0
func (s *SignatureUnlockBlock) Signature() Signature
Signature return the signature itself.
func (*SignatureUnlockBlock) String ¶
func (s *SignatureUnlockBlock) String() string
String returns a human readable version of the UnlockBlock.
func (*SignatureUnlockBlock) Type ¶
func (s *SignatureUnlockBlock) Type() UnlockBlockType
Type returns the UnlockBlockType of the UnlockBlock.
type Snapshot ¶ added in v0.4.0
type Snapshot struct { Transactions map[TransactionID]Record AccessManaByNode map[identity.ID]AccessMana }
Snapshot defines a snapshot of the ledger state.
type Transaction ¶
type Transaction struct { objectstorage.StorableObjectFlags // contains filtered or unexported fields }
Transaction represents a payload that executes a value transfer in the ledger state.
func NewTransaction ¶
func NewTransaction(essence *TransactionEssence, unlockBlocks UnlockBlocks) (transaction *Transaction)
NewTransaction creates a new Transaction from the given details.
func (*Transaction) Bytes ¶
func (t *Transaction) Bytes() []byte
Bytes returns a marshaled version of the Transaction.
func (*Transaction) Essence ¶
func (t *Transaction) Essence() *TransactionEssence
Essence returns the TransactionEssence of the Transaction.
func (*Transaction) FromBytes ¶ added in v0.8.10
func (t *Transaction) FromBytes(bytes []byte) (transaction *Transaction, err error)
FromBytes unmarshals a Transaction from a sequence of bytes.
func (*Transaction) FromMarshalUtil ¶ added in v0.8.10
func (t *Transaction) FromMarshalUtil(marshalUtil *marshalutil.MarshalUtil) (transaction *Transaction, err error)
FromMarshalUtil unmarshals a Transaction using a MarshalUtil (for easier unmarshalling).
func (*Transaction) FromObjectStorage ¶ added in v0.8.10
func (t *Transaction) FromObjectStorage(key, bytes []byte) (objectstorage.StorableObject, error)
FromObjectStorage creates a Transaction from sequences of key and bytes.
func (*Transaction) ID ¶
func (t *Transaction) ID() TransactionID
ID returns the identifier of the Transaction. Since calculating the TransactionID is a resource intensive operation we calculate this value lazy and use double checked locking.
func (*Transaction) ObjectStorageKey ¶
func (t *Transaction) ObjectStorageKey() []byte
ObjectStorageKey returns the key that is used to store the object in the database. It is required to match the StorableObject interface.
func (*Transaction) ObjectStorageValue ¶
func (t *Transaction) ObjectStorageValue() []byte
ObjectStorageValue marshals the Transaction into a sequence of bytes. The ID is not serialized here as it is only used as a key in the ObjectStorage.
func (*Transaction) ReferencedTransactionIDs ¶
func (t *Transaction) ReferencedTransactionIDs() (referencedTransactionIDs TransactionIDs)
ReferencedTransactionIDs returns a set of TransactionIDs whose Outputs were used as Inputs in this Transaction.
func (*Transaction) String ¶
func (t *Transaction) String() string
String returns a human readable version of the Transaction.
func (*Transaction) Type ¶
func (t *Transaction) Type() payload.Type
Type returns the Type of the Payload.
func (*Transaction) UnlockBlocks ¶
func (t *Transaction) UnlockBlocks() UnlockBlocks
UnlockBlocks returns the UnlockBlocks of the Transaction.
type TransactionBranchIDUpdatedByForkEvent ¶ added in v0.8.0
type TransactionBranchIDUpdatedByForkEvent struct { TransactionID TransactionID ForkedBranchID BranchID }
TransactionBranchIDUpdatedByForkEvent is an event that gets triggered, whenever the BranchID of a Transaction is changed.
type TransactionEssence ¶
type TransactionEssence struct {
// contains filtered or unexported fields
}
TransactionEssence contains the transfer related information of the Transaction (without the unlocking details).
func NewTransactionEssence ¶
func NewTransactionEssence( version TransactionEssenceVersion, timestamp time.Time, accessPledgeID identity.ID, consensusPledgeID identity.ID, inputs Inputs, outputs Outputs, ) *TransactionEssence
NewTransactionEssence creates a new TransactionEssence from the given details.
func TransactionEssenceFromBytes ¶
func TransactionEssenceFromBytes(bytes []byte) (transactionEssence *TransactionEssence, consumedBytes int, err error)
TransactionEssenceFromBytes unmarshals a TransactionEssence from a sequence of bytes.
func TransactionEssenceFromMarshalUtil ¶
func TransactionEssenceFromMarshalUtil(marshalUtil *marshalutil.MarshalUtil) (transactionEssence *TransactionEssence, err error)
TransactionEssenceFromMarshalUtil unmarshals a TransactionEssence using a MarshalUtil (for easier unmarshaling).
func (*TransactionEssence) AccessPledgeID ¶
func (t *TransactionEssence) AccessPledgeID() identity.ID
AccessPledgeID returns the access mana pledge nodeID of the TransactionEssence.
func (*TransactionEssence) Bytes ¶
func (t *TransactionEssence) Bytes() []byte
Bytes returns a marshaled version of the TransactionEssence.
func (*TransactionEssence) ConsensusPledgeID ¶
func (t *TransactionEssence) ConsensusPledgeID() identity.ID
ConsensusPledgeID returns the consensus mana pledge nodeID of the TransactionEssence.
func (*TransactionEssence) Inputs ¶
func (t *TransactionEssence) Inputs() Inputs
Inputs returns the Inputs of the TransactionEssence.
func (*TransactionEssence) Outputs ¶
func (t *TransactionEssence) Outputs() Outputs
Outputs returns the Outputs of the TransactionEssence.
func (*TransactionEssence) Payload ¶
func (t *TransactionEssence) Payload() payload.Payload
Payload returns the optional Payload of the TransactionEssence.
func (*TransactionEssence) SetPayload ¶ added in v0.4.0
func (t *TransactionEssence) SetPayload(p payload.Payload)
SetPayload set the optional Payload of the TransactionEssence.
func (*TransactionEssence) String ¶
func (t *TransactionEssence) String() string
String returns a human readable version of the TransactionEssence.
func (*TransactionEssence) Timestamp ¶
func (t *TransactionEssence) Timestamp() time.Time
Timestamp returns the timestamp of the TransactionEssence.
func (*TransactionEssence) Version ¶ added in v0.4.0
func (t *TransactionEssence) Version() TransactionEssenceVersion
Version returns the Version of the TransactionEssence.
type TransactionEssenceVersion ¶
type TransactionEssenceVersion uint8
TransactionEssenceVersion represents a version number for the TransactionEssence which can be used to ensure backward compatibility if the structure ever needs to get changed.
func TransactionEssenceVersionFromMarshalUtil ¶
func TransactionEssenceVersionFromMarshalUtil(marshalUtil *marshalutil.MarshalUtil) (version TransactionEssenceVersion, err error)
TransactionEssenceVersionFromMarshalUtil unmarshals a TransactionEssenceVersion using a MarshalUtil (for easier unmarshaling).
func (TransactionEssenceVersion) Bytes ¶
func (t TransactionEssenceVersion) Bytes() []byte
Bytes returns a marshaled version of the TransactionEssenceVersion.
func (TransactionEssenceVersion) Compare ¶
func (t TransactionEssenceVersion) Compare(other TransactionEssenceVersion) int
Compare offers a comparator for TransactionEssenceVersions which returns -1 if the other TransactionEssenceVersion is bigger, 1 if it is smaller and 0 if they are the same.
func (TransactionEssenceVersion) String ¶
func (t TransactionEssenceVersion) String() string
String returns a human readable version of the TransactionEssenceVersion.
type TransactionID ¶
type TransactionID [TransactionIDLength]byte
TransactionID is the type that represents the identifier of a Transaction.
var GenesisTransactionID TransactionID
GenesisTransactionID represents the identifier of the genesis Transaction.
func TransactionIDFromBase58 ¶
func TransactionIDFromBase58(base58String string) (transactionID TransactionID, err error)
TransactionIDFromBase58 creates a TransactionID from a base58 encoded string.
func TransactionIDFromBytes ¶
func TransactionIDFromBytes(bytes []byte) (transactionID TransactionID, consumedBytes int, err error)
TransactionIDFromBytes unmarshals a TransactionID from a sequence of bytes.
func TransactionIDFromMarshalUtil ¶
func TransactionIDFromMarshalUtil(marshalUtil *marshalutil.MarshalUtil) (transactionID TransactionID, err error)
TransactionIDFromMarshalUtil unmarshals a TransactionID using a MarshalUtil (for easier unmarshaling).
func TransactionIDFromRandomness ¶
func TransactionIDFromRandomness() (transactionID TransactionID, err error)
TransactionIDFromRandomness returns a random TransactionID which can for example be used in unit tests.
func (TransactionID) Base58 ¶
func (i TransactionID) Base58() string
Base58 returns a base58 encoded version of the TransactionID.
func (TransactionID) Bytes ¶
func (i TransactionID) Bytes() []byte
Bytes returns a marshaled version of the TransactionID.
func (TransactionID) String ¶
func (i TransactionID) String() string
String creates a human readable version of the TransactionID.
type TransactionIDs ¶
type TransactionIDs map[TransactionID]types.Empty
TransactionIDs represents a collection of TransactionIDs.
func (TransactionIDs) Base58s ¶ added in v0.5.7
func (t TransactionIDs) Base58s() (transactionIDs []string)
Base58s returns a slice of base58 encoded versions of the contained TransactionIDs.
func (TransactionIDs) Clone ¶ added in v0.4.1
func (t TransactionIDs) Clone() (transactionIDs TransactionIDs)
Clone returns a copy of the collection of TransactionIDs.
func (TransactionIDs) String ¶ added in v0.5.7
func (t TransactionIDs) String() (result string)
String returns a human readable version of the TransactionIDs.
type TransactionMetadata ¶
type TransactionMetadata struct { objectstorage.StorableObjectFlags // contains filtered or unexported fields }
TransactionMetadata contains additional information about a Transaction that is derived from the local perception of a node.
func NewTransactionMetadata ¶
func NewTransactionMetadata(transactionID TransactionID) *TransactionMetadata
NewTransactionMetadata creates a new empty TransactionMetadata object.
func (*TransactionMetadata) AddBranchID ¶ added in v0.8.10
func (t *TransactionMetadata) AddBranchID(branchID BranchID) (modified bool)
AddBranchID adds an identifier of the Branch that the Transaction was booked in.
func (*TransactionMetadata) BranchIDs ¶ added in v0.8.10
func (t *TransactionMetadata) BranchIDs() BranchIDs
BranchIDs returns the identifiers of the Branches that the Transaction was booked in.
func (*TransactionMetadata) Bytes ¶
func (t *TransactionMetadata) Bytes() []byte
Bytes marshals the TransactionMetadata into a sequence of bytes.
func (*TransactionMetadata) FromBytes ¶ added in v0.8.10
func (t *TransactionMetadata) FromBytes(bytes []byte) (transactionMetadata *TransactionMetadata, err error)
FromBytes unmarshals an TransactionMetadata object from a sequence of bytes.
func (*TransactionMetadata) FromMarshalUtil ¶ added in v0.8.10
func (t *TransactionMetadata) FromMarshalUtil(marshalUtil *marshalutil.MarshalUtil) (transactionMetadata *TransactionMetadata, err error)
FromMarshalUtil unmarshals an TransactionMetadata object using a MarshalUtil (for easier unmarshaling).
func (*TransactionMetadata) FromObjectStorage ¶ added in v0.8.10
func (t *TransactionMetadata) FromObjectStorage(key, bytes []byte) (objectstorage.StorableObject, error)
FromObjectStorage creates an TransactionMetadata from sequences of key and bytes.
func (*TransactionMetadata) GradeOfFinality ¶ added in v0.8.0
func (t *TransactionMetadata) GradeOfFinality() gof.GradeOfFinality
GradeOfFinality returns the grade of finality.
func (*TransactionMetadata) GradeOfFinalityTime ¶ added in v0.8.0
func (t *TransactionMetadata) GradeOfFinalityTime() time.Time
GradeOfFinalityTime returns the time when the Transaction's gradeOfFinality was set.
func (*TransactionMetadata) ID ¶
func (t *TransactionMetadata) ID() TransactionID
ID returns the TransactionID of the Transaction that the TransactionMetadata belongs to.
func (*TransactionMetadata) IsConflicting ¶ added in v0.8.6
func (t *TransactionMetadata) IsConflicting() bool
IsConflicting returns true if the Transaction is conflicting with another Transaction (has its own Branch).
func (*TransactionMetadata) LazyBooked ¶
func (t *TransactionMetadata) LazyBooked() (lazyBooked bool)
LazyBooked returns a boolean flag that indicates if the Transaction has been analyzed regarding the conflicting status of its consumed Branches.
func (*TransactionMetadata) ObjectStorageKey ¶
func (t *TransactionMetadata) ObjectStorageKey() []byte
ObjectStorageKey returns the key that is used to store the object in the database. It is required to match the StorableObject interface.
func (*TransactionMetadata) ObjectStorageValue ¶
func (t *TransactionMetadata) ObjectStorageValue() []byte
ObjectStorageValue marshals the TransactionMetadata into a sequence of bytes. The ID is not serialized here as it is only used as a key in the ObjectStorage.
func (*TransactionMetadata) SetBranchIDs ¶ added in v0.8.10
func (t *TransactionMetadata) SetBranchIDs(branchIDs BranchIDs) (modified bool)
SetBranchIDs sets the identifiers of the Branches that the Transaction was booked in.
func (*TransactionMetadata) SetGradeOfFinality ¶ added in v0.8.0
func (t *TransactionMetadata) SetGradeOfFinality(gradeOfFinality gof.GradeOfFinality) (modified bool)
SetGradeOfFinality updates the grade of finality. It returns true if it was modified.
func (*TransactionMetadata) SetLazyBooked ¶
func (t *TransactionMetadata) SetLazyBooked(lazyBooked bool) (modified bool)
SetLazyBooked updates the lazy booked flag of the Output. It returns true if the value was modified.
func (*TransactionMetadata) SetSolid ¶
func (t *TransactionMetadata) SetSolid(solid bool) (modified bool)
SetSolid updates the solid flag of the Transaction. It returns true if the solid flag was modified and updates the solidification time if the Transaction was marked as solid.
func (*TransactionMetadata) Solid ¶
func (t *TransactionMetadata) Solid() bool
Solid returns true if the Transaction has been marked as solid.
func (*TransactionMetadata) SolidificationTime ¶
func (t *TransactionMetadata) SolidificationTime() time.Time
SolidificationTime returns the time when the Transaction was marked as solid.
func (*TransactionMetadata) String ¶
func (t *TransactionMetadata) String() string
String returns a human readable version of the TransactionMetadata.
type UTXODAG ¶
type UTXODAG struct {
// contains filtered or unexported fields
}
UTXODAG represents the DAG that is formed by Transactions consuming Inputs and creating Outputs. It forms the core of the ledger state and keeps track of the balances and the different perceptions of potential conflicts.
func NewUTXODAG ¶
func NewUTXODAG(ledgerstate *Ledgerstate) (utxoDAG *UTXODAG)
NewUTXODAG create a new UTXODAG from the given details.
func (*UTXODAG) BookTransaction ¶
func (u *UTXODAG) BookTransaction(transaction *Transaction) (targetBranchIDs BranchIDs, err error)
BookTransaction books a Transaction into the ledger state.
func (*UTXODAG) BranchGradeOfFinality ¶ added in v0.8.0
func (u *UTXODAG) BranchGradeOfFinality(branchID BranchID) (gradeOfFinality gof.GradeOfFinality, err error)
BranchGradeOfFinality returns the GradeOfFinality of the Branch with the given BranchID.
func (*UTXODAG) CachedAddressOutputMapping ¶ added in v0.6.2
func (u *UTXODAG) CachedAddressOutputMapping(address Address) (cachedAddressOutputMappings objectstorage.CachedObjects[*AddressOutputMapping])
CachedAddressOutputMapping retrieves the outputs for the given address.
func (*UTXODAG) CachedConsumers ¶ added in v0.6.2
func (u *UTXODAG) CachedConsumers(outputID OutputID) (cachedConsumers objectstorage.CachedObjects[*Consumer])
CachedConsumers retrieves the Consumers of the given OutputID from the object storage.
func (*UTXODAG) CachedOutput ¶ added in v0.6.2
func (u *UTXODAG) CachedOutput(outputID OutputID) (cachedOutput *objectstorage.CachedObject[Output])
CachedOutput retrieves the Output with the given OutputID from the object storage.
func (*UTXODAG) CachedOutputMetadata ¶ added in v0.6.2
func (u *UTXODAG) CachedOutputMetadata(outputID OutputID) (cachedOutput *objectstorage.CachedObject[*OutputMetadata])
CachedOutputMetadata retrieves the OutputMetadata with the given OutputID from the object storage.
func (*UTXODAG) CachedTransaction ¶ added in v0.6.2
func (u *UTXODAG) CachedTransaction(transactionID TransactionID) (cachedTransaction *objectstorage.CachedObject[*Transaction])
CachedTransaction retrieves the Transaction with the given TransactionID from the object storage.
func (*UTXODAG) CachedTransactionMetadata ¶ added in v0.6.2
func (u *UTXODAG) CachedTransactionMetadata(transactionID TransactionID) (cachedTransactionMetadata *objectstorage.CachedObject[*TransactionMetadata])
CachedTransactionMetadata retrieves the TransactionMetadata with the given TransactionID from the object storage.
func (*UTXODAG) CheckTransaction ¶
func (u *UTXODAG) CheckTransaction(transaction *Transaction) (err error)
CheckTransaction contains fast checks that have to be performed before booking a Transaction.
func (*UTXODAG) ConflictingTransactions ¶ added in v0.8.0
func (u *UTXODAG) ConflictingTransactions(transaction *Transaction) (conflictingTransactions TransactionIDs)
ConflictingTransactions returns the TransactionIDs that are conflicting with the given Transaction.
func (*UTXODAG) ConsumedOutputs ¶ added in v0.4.1
func (u *UTXODAG) ConsumedOutputs(transaction *Transaction) (cachedInputs objectstorage.CachedObjects[Output])
ConsumedOutputs returns the consumed (cached)Outputs of the given Transaction.
func (*UTXODAG) Events ¶
func (u *UTXODAG) Events() *UTXODAGEvents
Events returns all events of the UTXODAG.
func (*UTXODAG) LoadSnapshot ¶
LoadSnapshot creates a set of outputs in the UTXODAG, that are forming the genesis for future transactions.
func (*UTXODAG) ManageStoreAddressOutputMapping ¶ added in v0.6.2
ManageStoreAddressOutputMapping manages how to store the address-output mapping dependent on which type of output it is.
func (*UTXODAG) Shutdown ¶
func (u *UTXODAG) Shutdown()
Shutdown shuts down the UTXODAG and persists its state.
func (*UTXODAG) StoreAddressOutputMapping ¶ added in v0.4.0
StoreAddressOutputMapping stores the address-output mapping.
func (*UTXODAG) Transaction ¶
func (u *UTXODAG) Transaction(transactionID TransactionID) (transaction *Transaction)
Transaction returns a specific transaction, consumed.
func (*UTXODAG) TransactionBranchIDs ¶ added in v0.8.6
func (u *UTXODAG) TransactionBranchIDs(transactionID TransactionID) (branchIDs BranchIDs, err error)
TransactionBranchIDs returns the BranchIDs of the given Transaction.
func (*UTXODAG) TransactionGradeOfFinality ¶ added in v0.8.0
func (u *UTXODAG) TransactionGradeOfFinality(transactionID TransactionID) (gradeOfFinality gof.GradeOfFinality, err error)
TransactionGradeOfFinality returns the GradeOfFinality of the Transaction with the given TransactionID.
func (*UTXODAG) Transactions ¶ added in v0.6.2
func (u *UTXODAG) Transactions() (transactions map[TransactionID]*Transaction)
Transactions returns all the transactions, consumed.
type UTXODAGEvents ¶
type UTXODAGEvents struct { // TransactionBranchIDUpdatedByFork gets triggered when the BranchID of a Transaction is changed after the initial booking. TransactionBranchIDUpdatedByFork *events.Event }
UTXODAGEvents is a container for all the UTXODAG related events.
type UTXOInput ¶
type UTXOInput struct {
// contains filtered or unexported fields
}
UTXOInput represents a reference to an Output in the UTXODAG.
func NewUTXOInput ¶
NewUTXOInput is the constructor for UTXOInputs.
func UTXOInputFromMarshalUtil ¶
func UTXOInputFromMarshalUtil(marshalUtil *marshalutil.MarshalUtil) (input *UTXOInput, err error)
UTXOInputFromMarshalUtil unmarshals a UTXOInput using a MarshalUtil (for easier unmarshaling).
func (*UTXOInput) Base58 ¶ added in v0.4.0
Base58 returns the base58 encoded referenced output ID of this input.
func (*UTXOInput) Compare ¶
Compare offers a comparator for Inputs which returns -1 if other Input is bigger, 1 if it is smaller and 0 if they are the same.
func (*UTXOInput) ReferencedOutputID ¶
ReferencedOutputID returns the OutputID that this Input references.
type UnlockBlock ¶
type UnlockBlock interface { // Type returns the UnlockBlockType of the UnlockBlock. Type() UnlockBlockType // Bytes returns a marshaled version of the UnlockBlock. Bytes() []byte // String returns a human readable version of the UnlockBlock. String() string }
UnlockBlock represents a generic interface to address the different kinds of unlock information that are required to authorize the spending of different Output types.
func UnlockBlockFromBytes ¶
func UnlockBlockFromBytes(bytes []byte) (unlockBlock UnlockBlock, consumedBytes int, err error)
UnlockBlockFromBytes unmarshals an UnlockBlock from a sequence of bytes.
func UnlockBlockFromMarshalUtil ¶
func UnlockBlockFromMarshalUtil(marshalUtil *marshalutil.MarshalUtil) (unlockBlock UnlockBlock, err error)
UnlockBlockFromMarshalUtil unmarshals an UnlockBlock using a MarshalUtil (for easier unmarshaling).
type UnlockBlockType ¶
type UnlockBlockType uint8
UnlockBlockType represents the type of the UnlockBlock. Different types of UnlockBlocks can unlock different types of Outputs.
const ( // SignatureUnlockBlockType represents the type of a SignatureUnlockBlock. SignatureUnlockBlockType UnlockBlockType = iota // ReferenceUnlockBlockType represents the type of a ReferenceUnlockBlock. ReferenceUnlockBlockType // AliasUnlockBlockType represents the type of a AliasUnlockBlock. AliasUnlockBlockType )
func (UnlockBlockType) String ¶
func (a UnlockBlockType) String() string
String returns a human readable representation of the UnlockBlockType.
type UnlockBlocks ¶
type UnlockBlocks []UnlockBlock
UnlockBlocks is slice of UnlockBlocks that offers additional methods for easier marshaling and unmarshaling.
func UnlockBlocksFromBytes ¶
func UnlockBlocksFromBytes(bytes []byte) (unlockBlocks UnlockBlocks, consumedBytes int, err error)
UnlockBlocksFromBytes unmarshals UnlockBlocks from a sequence of bytes.
func UnlockBlocksFromMarshalUtil ¶
func UnlockBlocksFromMarshalUtil(marshalUtil *marshalutil.MarshalUtil) (unlockBlocks UnlockBlocks, err error)
UnlockBlocksFromMarshalUtil unmarshals UnlockBlocks using a MarshalUtil (for easier unmarshaling).
func (UnlockBlocks) Bytes ¶
func (u UnlockBlocks) Bytes() []byte
Bytes returns a marshaled version of the UnlockBlocks.
func (UnlockBlocks) String ¶
func (u UnlockBlocks) String() string
String returns a human readable version of the UnlockBlocks.
type UnlockGraph ¶ added in v0.6.0
type UnlockGraph struct { // Vertices are the unlock blocks themselves, identified by their index // uint16 is enough Vertices []uint16 // maps unlockBlock to referenced unlocked block // each vertex has at most 1 referenced unlock block, so one outgoing edge Edges map[uint16]uint16 }
UnlockGraph builds a graph from the references of the unlock blocks with the aim of detecting cycles.
func NewUnlockGraph ¶ added in v0.6.0
func NewUnlockGraph(blocks UnlockBlocks) (*UnlockGraph, error)
NewUnlockGraph creates a new UnlockGraph and checks semantic validity of the unlock block references.
func (*UnlockGraph) IsCycleDetected ¶ added in v0.6.0
func (g *UnlockGraph) IsCycleDetected() bool
IsCycleDetected checks if a cycle is detected by checking the dfs paths from every node.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package utxodb mocks Value Tangle ledger by implementing fully synchronous in-memory database of GoShimmer value transactions.
|
Package utxodb mocks Value Tangle ledger by implementing fully synchronous in-memory database of GoShimmer value transactions. |
Package utxoutil is used to build value transaction Package utxoutil contains number of utility functions useful while manipulating outputs and constructing transactions.
|
Package utxoutil is used to build value transaction Package utxoutil contains number of utility functions useful while manipulating outputs and constructing transactions. |