types

package
v0.0.0-...-dc1a8b5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 21, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const GenesisTime uint64 = 1681971084

GenesisTime min timestamp Thursday, April 20, 2023 6:11:24 AM GMT+00:00 Epoch (or Unix time or POSIX time or Unix timestamp) is the number of seconds that have elapsed since January 1, 1970 (midnight UTC/GMT)

View Source
const SystemIdentifierLength = 4

Variables

View Source
var (
	ErrInputRecordIsNil      = errors.New("input record is nil")
	ErrHashIsNil             = errors.New("hash is nil")
	ErrBlockHashIsNil        = errors.New("block hash is nil")
	ErrPreviousHashIsNil     = errors.New("previous hash is nil")
	ErrSummaryValueIsNil     = errors.New("summary value is nil")
	ErrInvalidPartitionRound = errors.New("partition round is 0")
)
View Source
var (
	ErrSystemDescriptionIsNil = errors.New("system description record is nil")
	ErrT2TimeoutIsNil         = errors.New("t2 timeout is zero")
)
View Source
var (
	ErrUnicitySealIsNil          = errors.New("unicity seal is nil")
	ErrSignerIsNil               = errors.New("signer is nil")
	ErrUnicitySealHashIsNil      = errors.New("hash is nil")
	ErrInvalidRootRound          = errors.New("invalid root round number")
	ErrUnicitySealSignatureIsNil = errors.New("no signatures")
	ErrRootValidatorInfoMissing  = errors.New("root node info is missing")
)
View Source
var (
	Cbor = cborHandler{}
)
View Source
var (
	ErrBlockIsNil = errors.New("block is nil")
)
View Source
var ErrUnicityCertificateIsNil = errors.New("unicity certificate is nil")
View Source
var ErrUnicityTreeCertificateIsNil = errors.New("unicity tree certificate is nil")

Functions

func AssertEqualIR

func AssertEqualIR(a, b *InputRecord) error

func CheckNonEquivocatingCertificates

func CheckNonEquivocatingCertificates(prevUC, newUC *UnicityCertificate) error

CheckNonEquivocatingCertificates checks if provided certificates are equivocating NB! order is important, also it is assumed that validity of both UCs is checked before The algorithm is based on Yellowpaper: "Algorithm 6 Checking two UC-s for equivocation"

func EqualIR

func EqualIR(a, b *InputRecord) bool

func NewTimestamp

func NewTimestamp() uint64

NewTimestamp - returns timestamp in seconds from epoch

func NewTxProof

func NewTxProof(block *Block, txIndex int, algorithm crypto.Hash) (*TxProof, *TransactionRecord, error)

func VerifyTxProof

func VerifyTxProof(proof *TxProof, txRecord *TransactionRecord, tb RootTrustBase, hashAlgorithm crypto.Hash) error

func VerifyUnitStateProof

func VerifyUnitStateProof(u *UnitStateProof, algorithm crypto.Hash, unitData *StateUnitData, ucv UnicityCertificateValidator) error

Types

type Block

type Block struct {
	Header             *Header
	Transactions       []*TransactionRecord
	UnicityCertificate *UnicityCertificate
	// contains filtered or unexported fields
}

func (*Block) GetBlockFees

func (b *Block) GetBlockFees() uint64

func (*Block) GetProposerID

func (b *Block) GetProposerID() string

func (*Block) GetRoundNumber

func (b *Block) GetRoundNumber() uint64

func (*Block) Hash

func (b *Block) Hash(algorithm crypto.Hash) ([]byte, error)

Hash returns the hash of the block. Hash of a block is computed as hash of block header fields and tree hash of transactions.

func (*Block) HeaderHash

func (b *Block) HeaderHash(algorithm crypto.Hash) []byte

func (*Block) InputRecord

func (b *Block) InputRecord() (*InputRecord, error)

func (*Block) IsValid

func (b *Block) IsValid(algorithm crypto.Hash, systemDescriptionHash []byte) error

func (*Block) SystemID

func (b *Block) SystemID() SystemID

type Bytes

type Bytes []byte

func (Bytes) MarshalText

func (b Bytes) MarshalText() ([]byte, error)

func (*Bytes) UnmarshalText

func (b *Bytes) UnmarshalText(src []byte) error

type ClientMetadata

type ClientMetadata struct {
	Timeout           uint64
	MaxTransactionFee uint64
	FeeCreditRecordID []byte
	ReferenceNumber   []byte
	// contains filtered or unexported fields
}

func (*ClientMetadata) AddToHasher

func (c *ClientMetadata) AddToHasher(hasher hash.Hash)

type FeeCreditBill

type FeeCreditBill struct {
	UnitID         UnitID         `json:"unit_id,omitempty"`
	OwnerPredicate PredicateBytes `json:"owner_predicate,omitempty"`
	// contains filtered or unexported fields
}

type GenericChainItem

type GenericChainItem struct {
	Hash []byte
	Left bool
	// contains filtered or unexported fields
}
type Header struct {
	SystemID          SystemID
	ShardID           []byte
	ProposerID        string
	PreviousBlockHash []byte
	// contains filtered or unexported fields
}

func (*Header) Hash

func (h *Header) Hash(algorithm crypto.Hash) []byte

func (*Header) IsValid

func (h *Header) IsValid() error

type InputRecord

type InputRecord struct {
	PreviousHash    []byte `json:"previous_hash,omitempty"`      // previously certified state hash
	Hash            []byte `json:"hash,omitempty"`               // state hash to be certified
	BlockHash       []byte `json:"block_hash,omitempty"`         // hash of the block
	SummaryValue    []byte `json:"summary_value,omitempty"`      // summary value to certified
	RoundNumber     uint64 `json:"round_number,omitempty"`       // transaction system's round number
	SumOfEarnedFees uint64 `json:"sum_of_earned_fees,omitempty"` // sum of the actual fees over all transaction records in the block
	// contains filtered or unexported fields
}

func (*InputRecord) AddToHasher

func (x *InputRecord) AddToHasher(hasher hash.Hash)

func (*InputRecord) Bytes

func (x *InputRecord) Bytes() []byte

func (*InputRecord) IsValid

func (x *InputRecord) IsValid() error

func (*InputRecord) NewRepeatIR

func (x *InputRecord) NewRepeatIR() *InputRecord

NewRepeatIR - creates new repeat IR from current IR

func (*InputRecord) String

func (x *InputRecord) String() string

type NodeInfo

type NodeInfo struct {
	NodeID    string `json:"nodeId"`    // node identifier derived from node's encryption public key
	PublicKey []byte `json:"publicKey"` // the trust base signing public key
	Stake     uint64 `json:"stake"`     // amount of staked alpha for this node, currently unused as each nodes get equal votes regardless of stake
	// contains filtered or unexported fields
}

func NewNodeInfo

func NewNodeInfo(nodeID string, stake uint64, verifier abcrypto.Verifier) *NodeInfo

NewNodeInfo creates new NodeInfo, caching the verifier in private field.

func (*NodeInfo) Bytes

func (n *NodeInfo) Bytes() []byte

Bytes serializes all fields.

type Option

type Option func(c *trustBaseConf)

func WithQuorumThreshold

func WithQuorumThreshold(threshold uint64) Option

WithQuorumThreshold overrides the default 2/3+1 quorum threshold.

type Payload

type Payload struct {
	SystemID       SystemID
	Type           string
	UnitID         UnitID
	Attributes     RawCBOR
	StateLock      *StateLock
	ClientMetadata *ClientMetadata
	// contains filtered or unexported fields
}

func (*Payload) Bytes

func (p *Payload) Bytes() ([]byte, error)

func (*Payload) BytesWithAttributeSigBytes

func (p *Payload) BytesWithAttributeSigBytes(attrs SigBytesProvider) ([]byte, error)

BytesWithAttributeSigBytes TODO: AB-1016 remove this hack

func (*Payload) HasStateLock

func (p *Payload) HasStateLock() bool

func (*Payload) SetAttributes

func (p *Payload) SetAttributes(attr any) error

SetAttributes serializes "attr" and assigns the result to payload's Attributes field. The "attr" is expected to be one of the transaction attribute structs but there is no validation! The Payload.UnmarshalAttributes can be used to decode the attributes.

func (*Payload) UnmarshalAttributes

func (p *Payload) UnmarshalAttributes(v any) error

type PredicateBytes

type PredicateBytes = Bytes

type ProofGenerator

type ProofGenerator func(bytesToSign []byte) (proof []byte, err error)

type RawCBOR

type RawCBOR []byte

func (RawCBOR) MarshalCBOR

func (r RawCBOR) MarshalCBOR() ([]byte, error)

MarshalCBOR returns r or CBOR nil if r is empty.

func (*RawCBOR) UnmarshalCBOR

func (r *RawCBOR) UnmarshalCBOR(data []byte) error

UnmarshalCBOR copies data into r unless it's CBOR "nil marker" - in that case r is set to empty slice.

type RootTrustBase

type RootTrustBase interface {
	VerifyQuorumSignatures(data []byte, signatures map[string][]byte) (error, []error)
	VerifySignature(data []byte, sig []byte, nodeID string) (uint64, error)
	GetQuorumThreshold() uint64
	GetMaxFaultyNodes() uint64
}

type RootTrustBaseV0

type RootTrustBaseV0 struct {
	Epoch             uint64               `json:"epoch"`             // current epoch number
	EpochStartRound   uint64               `json:"epochStartRound"`   // root chain round number when the epoch begins
	RootNodes         map[string]*NodeInfo `json:"rootNodes"`         // list of all root nodes for the current epoch
	QuorumThreshold   uint64               `json:"quorumThreshold"`   // amount of alpha required to reach consensus, currently each node gets equal amount of voting power i.e. +1 for each node
	StateHash         []byte               `json:"stateHash"`         // unicity tree root hash
	ChangeRecordHash  []byte               `json:"changeRecordHash"`  // epoch change request hash
	PreviousEntryHash []byte               `json:"previousEntryHash"` // previous trust base entry hash
	Signatures        map[string][]byte    `json:"signatures"`        // signatures of previous epoch validators, over all fields except for the signatures fields itself
	// contains filtered or unexported fields
}

func NewTrustBaseFromFile

func NewTrustBaseFromFile(trustBaseFile string) (*RootTrustBaseV0, error)

NewTrustBaseFromFile loads trust base from file and caches verifiers.

func NewTrustBaseGenesis

func NewTrustBaseGenesis(nodes []*NodeInfo, unicityTreeRootHash []byte, opts ...Option) (*RootTrustBaseV0, error)

NewTrustBaseGenesis creates new unsigned root trust base with default genesis parameters.

func (*RootTrustBaseV0) GetMaxFaultyNodes

func (r *RootTrustBaseV0) GetMaxFaultyNodes() uint64

GetMaxFaultyNodes returns max allowed faulty nodes, only works if one node == one vote.

func (*RootTrustBaseV0) GetQuorumThreshold

func (r *RootTrustBaseV0) GetQuorumThreshold() uint64

GetQuorumThreshold returns the quorum threshold for the latest trust base entry.

func (*RootTrustBaseV0) GetVerifiers

func (r *RootTrustBaseV0) GetVerifiers() (map[string]abcrypto.Verifier, error)

GetVerifiers returns the cached verifiers.

func (*RootTrustBaseV0) Hash

func (r *RootTrustBaseV0) Hash(hashAlgo crypto.Hash) []byte

Hash hashes the entire structure including the signatures.

func (*RootTrustBaseV0) SigBytes

func (r *RootTrustBaseV0) SigBytes() []byte

SigBytes serializes all fields expect for the signatures field.

func (*RootTrustBaseV0) Sign

func (r *RootTrustBaseV0) Sign(nodeID string, signer abcrypto.Signer) error

Sign signs the trust base entry, storing the signature to Signatures map.

func (*RootTrustBaseV0) VerifyQuorumSignatures

func (r *RootTrustBaseV0) VerifyQuorumSignatures(data []byte, signatures map[string][]byte) (error, []error)

VerifyQuorumSignatures verifies that the data is signed by enough root nodes so that quorum is reached, returns error if quorum is not reached, also returns list of any signature verification errors, regardless if quorum is reached or not.

func (*RootTrustBaseV0) VerifySignature

func (r *RootTrustBaseV0) VerifySignature(data []byte, sig []byte, nodeID string) (uint64, error)

VerifySignature verifies that the data is signed by the given root validator, returns the validator's stake if it is signed.

type ServerMetadata

type ServerMetadata struct {
	ActualFee         uint64
	TargetUnits       []UnitID
	SuccessIndicator  TxStatus
	ProcessingDetails RawCBOR
	// contains filtered or unexported fields
}

func (*ServerMetadata) GetActualFee

func (sm *ServerMetadata) GetActualFee() uint64

func (*ServerMetadata) UnmarshalDetails

func (sm *ServerMetadata) UnmarshalDetails(v any) error

type SigBytesProvider

type SigBytesProvider interface {
	SigBytes() ([]byte, error)
}

type SignatureMap

type SignatureMap map[string][]byte

func (SignatureMap) AddToHasher

func (s SignatureMap) AddToHasher(hasher hash.Hash)

func (SignatureMap) MarshalCBOR

func (s SignatureMap) MarshalCBOR() ([]byte, error)

func (*SignatureMap) UnmarshalCBOR

func (s *SignatureMap) UnmarshalCBOR(b []byte) error

type StateLock

type StateLock struct {
	ExecutionPredicate []byte // predicate for executing state locked Tx
	RollbackPredicate  []byte // predicate for discarding state locked Tx
	// contains filtered or unexported fields
}

func (StateLock) IsValid

func (s StateLock) IsValid() error

type StateTreeCert

type StateTreeCert struct {
	LeftSummaryHash   Bytes                `json:"leftSummaryHash"`
	LeftSummaryValue  uint64               `json:"leftSummaryValue,string"`
	RightSummaryHash  Bytes                `json:"rightSummaryHash"`
	RightSummaryValue uint64               `json:"rightSummaryValue,string"`
	Path              []*StateTreePathItem `json:"path"`
	// contains filtered or unexported fields
}

type StateTreePathItem

type StateTreePathItem struct {
	UnitID              UnitID `json:"unitId"`       // (ι′)
	LogsHash            Bytes  `json:"logsHash"`     // (z)
	Value               uint64 `json:"value,string"` // (V)
	SiblingSummaryHash  Bytes  `json:"siblingSummaryHash"`
	SiblingSummaryValue uint64 `json:"siblingSummaryValue,string"`
	// contains filtered or unexported fields
}

type StateUnitData

type StateUnitData struct {
	Data   RawCBOR
	Bearer PredicateBytes
}

func (*StateUnitData) Hash

func (sd *StateUnitData) Hash(hashAlgo crypto.Hash) []byte

func (*StateUnitData) UnmarshalData

func (sd *StateUnitData) UnmarshalData(v any) error

type SystemDescriptionRecord

type SystemDescriptionRecord struct {
	SystemIdentifier SystemID       `json:"system_identifier,omitempty"`
	T2Timeout        uint32         `json:"t2timeout,omitempty"`
	FeeCreditBill    *FeeCreditBill `json:"fee_credit_bill,omitempty"`
	// contains filtered or unexported fields
}

func (*SystemDescriptionRecord) AddToHasher

func (x *SystemDescriptionRecord) AddToHasher(hasher hash.Hash)

func (*SystemDescriptionRecord) GetSystemIdentifier

func (x *SystemDescriptionRecord) GetSystemIdentifier() SystemID

func (*SystemDescriptionRecord) Hash

func (x *SystemDescriptionRecord) Hash(hashAlgorithm crypto.Hash) []byte

func (*SystemDescriptionRecord) IsValid

func (x *SystemDescriptionRecord) IsValid() error

type SystemID

type SystemID uint32

func BytesToSystemID

func BytesToSystemID(b []byte) (SystemID, error)

func (SystemID) Bytes

func (sid SystemID) Bytes() []byte

func (SystemID) String

func (sid SystemID) String() string

type TransactionOrder

type TransactionOrder struct {
	Payload     *Payload
	OwnerProof  []byte
	FeeProof    []byte
	StateUnlock []byte // two CBOR data items: [0|1]+[<state lock/rollback predicate input>]
	// contains filtered or unexported fields
}

func (*TransactionOrder) GetClientFeeCreditRecordID

func (t *TransactionOrder) GetClientFeeCreditRecordID() []byte

func (*TransactionOrder) GetClientMaxTxFee

func (t *TransactionOrder) GetClientMaxTxFee() uint64

func (*TransactionOrder) Hash

func (t *TransactionOrder) Hash(algorithm crypto.Hash) []byte

func (*TransactionOrder) HashForNewUnitID

func (t *TransactionOrder) HashForNewUnitID(hashFunc crypto.Hash, extra ...[]byte) []byte

HashForNewUnitID generates hash for new unit identifier calculation.

func (*TransactionOrder) PayloadBytes

func (t *TransactionOrder) PayloadBytes() ([]byte, error)

func (*TransactionOrder) PayloadType

func (t *TransactionOrder) PayloadType() string

func (*TransactionOrder) SetOwnerProof

func (t *TransactionOrder) SetOwnerProof(proofer ProofGenerator) error

SetOwnerProof assigns the bytes returned by the function provided as argument to the OwnerProof field unless the function (or reading data to be signed by that function) returned error.

func (*TransactionOrder) SystemID

func (t *TransactionOrder) SystemID() SystemID

func (*TransactionOrder) Timeout

func (t *TransactionOrder) Timeout() uint64

func (*TransactionOrder) UnitID

func (t *TransactionOrder) UnitID() UnitID

func (*TransactionOrder) UnmarshalAttributes

func (t *TransactionOrder) UnmarshalAttributes(v any) error

type TransactionRecord

type TransactionRecord struct {
	TransactionOrder *TransactionOrder
	ServerMetadata   *ServerMetadata
	// contains filtered or unexported fields
}

TransactionRecord is a transaction order with "server-side" metadata added to it. TransactionRecord is a structure that is added to the block.

func (*TransactionRecord) Bytes

func (t *TransactionRecord) Bytes() ([]byte, error)

func (*TransactionRecord) GetActualFee

func (t *TransactionRecord) GetActualFee() uint64

func (*TransactionRecord) Hash

func (t *TransactionRecord) Hash(algorithm crypto.Hash) []byte

func (*TransactionRecord) UnmarshalProcessingDetails

func (t *TransactionRecord) UnmarshalProcessingDetails(v any) error

type TxProof

type TxProof struct {
	BlockHeaderHash    []byte
	Chain              []*GenericChainItem
	UnicityCertificate *UnicityCertificate
	// contains filtered or unexported fields
}

TxProof is a transaction execution proof.

func (*TxProof) GetUnicityTreeSystemDescriptionHash

func (p *TxProof) GetUnicityTreeSystemDescriptionHash() []byte

type TxRecordProof

type TxRecordProof struct {
	TxRecord *TransactionRecord
	TxProof  *TxProof
	// contains filtered or unexported fields
}

type TxStatus

type TxStatus uint64
const (
	// TxStatusFailed is the status code of a transaction if execution failed.
	TxStatusFailed TxStatus = 0
	// TxStatusSuccessful is the status code of a transaction if execution succeeded.
	TxStatusSuccessful TxStatus = 1
)

type Uint64

type Uint64 uint64

func (Uint64) MarshalText

func (u Uint64) MarshalText() ([]byte, error)

func (*Uint64) UnmarshalText

func (u *Uint64) UnmarshalText(src []byte) error

type UnicityCertificate

type UnicityCertificate struct {
	InputRecord            *InputRecord            `json:"input_record,omitempty"`
	UnicityTreeCertificate *UnicityTreeCertificate `json:"unicity_tree_certificate,omitempty"`
	UnicitySeal            *UnicitySeal            `json:"unicity_seal,omitempty"`
	// contains filtered or unexported fields
}

func (*UnicityCertificate) GetFeeSum

func (x *UnicityCertificate) GetFeeSum() uint64

func (*UnicityCertificate) GetPreviousStateHash

func (x *UnicityCertificate) GetPreviousStateHash() []byte

func (*UnicityCertificate) GetRootRoundNumber

func (x *UnicityCertificate) GetRootRoundNumber() uint64

func (*UnicityCertificate) GetRoundNumber

func (x *UnicityCertificate) GetRoundNumber() uint64

func (*UnicityCertificate) GetStateHash

func (x *UnicityCertificate) GetStateHash() []byte

func (*UnicityCertificate) GetSummaryValue

func (x *UnicityCertificate) GetSummaryValue() []byte

func (*UnicityCertificate) Hash

func (x *UnicityCertificate) Hash(hash crypto.Hash) []byte

func (*UnicityCertificate) IsDuplicate

func (x *UnicityCertificate) IsDuplicate(prevUC *UnicityCertificate) bool

func (*UnicityCertificate) IsRepeat

func (x *UnicityCertificate) IsRepeat(prevUC *UnicityCertificate) bool

func (*UnicityCertificate) IsSuccessor

func (x *UnicityCertificate) IsSuccessor(prevUC *UnicityCertificate) bool

func (*UnicityCertificate) IsValid

func (x *UnicityCertificate) IsValid(algorithm crypto.Hash, systemIdentifier SystemID, systemDescriptionHash []byte) error

func (*UnicityCertificate) Verify

func (x *UnicityCertificate) Verify(tb RootTrustBase, algorithm crypto.Hash, systemIdentifier SystemID, systemDescriptionHash []byte) error

type UnicityCertificateValidator

type UnicityCertificateValidator interface {
	Validate(uc *UnicityCertificate) error
}

type UnicitySeal

type UnicitySeal struct {
	RootChainRoundNumber uint64       `json:"root_chain_round_number,omitempty"`
	Timestamp            uint64       `json:"timestamp,omitempty"`
	PreviousHash         []byte       `json:"previous_hash,omitempty"`
	Hash                 []byte       `json:"hash,omitempty"`
	Signatures           SignatureMap `json:"signatures,omitempty"`
	// contains filtered or unexported fields
}

func (*UnicitySeal) AddToHasher

func (x *UnicitySeal) AddToHasher(hasher hash.Hash)

AddToHasher - add all UC data including signature bytes for hash calculation

func (*UnicitySeal) Bytes

func (x *UnicitySeal) Bytes() []byte

Bytes - serialize everything except signatures (used for sign and verify)

func (*UnicitySeal) IsValid

func (x *UnicitySeal) IsValid() error

func (*UnicitySeal) Sign

func (x *UnicitySeal) Sign(id string, signer crypto.Signer) error

func (*UnicitySeal) Verify

func (x *UnicitySeal) Verify(tb RootTrustBase) error

type UnicityTreeCertificate

type UnicityTreeCertificate struct {
	SystemIdentifier      SystemID        `json:"system_identifier,omitempty"`
	SiblingHashes         []*imt.PathItem `json:"sibling_hashes,omitempty"`
	SystemDescriptionHash []byte          `json:"system_description_hash,omitempty"`
	// contains filtered or unexported fields
}

func (*UnicityTreeCertificate) AddToHasher

func (x *UnicityTreeCertificate) AddToHasher(hasher hash.Hash)

func (*UnicityTreeCertificate) EvalAuthPath

func (x *UnicityTreeCertificate) EvalAuthPath(hashAlgorithm gocrypto.Hash) []byte

func (*UnicityTreeCertificate) IsValid

func (x *UnicityTreeCertificate) IsValid(ir *InputRecord, systemIdentifier SystemID, systemDescriptionHash []byte, hashAlgorithm gocrypto.Hash) error

type UnicityTreeData

type UnicityTreeData struct {
	SystemIdentifier            SystemID
	InputRecord                 *InputRecord
	SystemDescriptionRecordHash []byte
}

func (*UnicityTreeData) AddToHasher

func (t *UnicityTreeData) AddToHasher(hasher hash.Hash)

func (*UnicityTreeData) Key

func (t *UnicityTreeData) Key() []byte

type UnitData

type UnitData interface {
	Write(hasher hash.Hash) error
	SummaryValueInput() uint64
	Copy() UnitData
}

UnitData is a generic data type for the unit state.

type UnitDataAndProof

type UnitDataAndProof struct {
	UnitData *StateUnitData
	Proof    *UnitStateProof
	// contains filtered or unexported fields
}

func (*UnitDataAndProof) UnmarshalUnitData

func (up *UnitDataAndProof) UnmarshalUnitData(v any) error

type UnitID

type UnitID []byte

func NewUnitID

func NewUnitID(unitIDLength int, shardPart []byte, unitPart []byte, typePart []byte) UnitID

NewUnitID creates a new UnitID consisting of a shardPart, unitPart and typePart.

func (UnitID) Compare

func (uid UnitID) Compare(key UnitID) int

func (UnitID) Eq

func (uid UnitID) Eq(id UnitID) bool

func (UnitID) HasType

func (uid UnitID) HasType(typePart []byte) bool

func (UnitID) MarshalText

func (uid UnitID) MarshalText() ([]byte, error)

func (UnitID) String

func (uid UnitID) String() string

func (*UnitID) UnmarshalText

func (uid *UnitID) UnmarshalText(src []byte) error

type UnitStateProof

type UnitStateProof struct {
	UnitID             UnitID              `json:"unitId"`
	UnitValue          uint64              `json:"unitValue,string"`
	UnitLedgerHash     Bytes               `json:"unitLedgerHash"`
	UnitTreeCert       *UnitTreeCert       `json:"unitTreeCert"`
	StateTreeCert      *StateTreeCert      `json:"stateTreeCert"`
	UnicityCertificate *UnicityCertificate `json:"unicityCert"`
	// contains filtered or unexported fields
}

func (*UnitStateProof) CalculateSateTreeOutput

func (u *UnitStateProof) CalculateSateTreeOutput(algorithm crypto.Hash) ([]byte, uint64)

type UnitTreeCert

type UnitTreeCert struct {
	TransactionRecordHash Bytes          `json:"txrHash"`  // t
	UnitDataHash          Bytes          `json:"dataHash"` // s
	Path                  []*mt.PathItem `json:"path"`
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL