Documentation
¶
Index ¶
- Variables
- func FromProtobuf(chain []*MerklePathItem) []*mt.PathItem
- func FromProtobufHashChain(chain []*ChainItem) []*omt.Data
- func WriteBillsFile(path string, res *Bills) error
- type Bill
- func (*Bill) Descriptor() ([]byte, []int)deprecated
- func (x *Bill) GetId() []byte
- func (x *Bill) GetIsDcBill() bool
- func (x *Bill) GetTxHash() []byte
- func (x *Bill) GetTxProof() *TxProof
- func (x *Bill) GetValue() uint64
- func (*Bill) ProtoMessage()
- func (x *Bill) ProtoReflect() protoreflect.Message
- func (x *Bill) Reset()
- func (x *Bill) String() string
- func (x *Bill) Verify(unitID []byte, txConverter TxConverter, verifiers map[string]abcrypto.Verifier) error
- type Bills
- func (*Bills) Descriptor() ([]byte, []int)deprecated
- func (x *Bills) GetBills() []*Bill
- func (*Bills) ProtoMessage()
- func (x *Bills) ProtoReflect() protoreflect.Message
- func (x *Bills) Reset()
- func (x *Bills) String() string
- func (x *Bills) Verify(txConverter TxConverter, verifiers map[string]abcrypto.Verifier) error
- type Block
- func (x *Block) AddHeaderToHasher(hasher hash.Hash)
- func (*Block) Descriptor() ([]byte, []int)deprecated
- func (x *Block) GetBlockNumber() uint64
- func (x *Block) GetPreviousBlockHash() []byte
- func (x *Block) GetSystemIdentifier() []byte
- func (x *Block) GetTransactions() []*txsystem.Transaction
- func (x *Block) GetUnicityCertificate() *certificates.UnicityCertificate
- func (x *Block) Hash(txConverter TxConverter, hashAlgorithm crypto.Hash) ([]byte, error)
- func (x *Block) HashHeader(hashAlgorithm crypto.Hash) []byte
- func (*Block) ProtoMessage()
- func (x *Block) ProtoReflect() protoreflect.Message
- func (x *Block) Reset()
- func (x *Block) String() string
- func (x *Block) ToGenericBlock(txConverter TxConverter) (*GenericBlock, error)
- type BlockProof
- func (x *BlockProof) AddToHasher(hasher gohash.Hash)
- func (x *BlockProof) Bytes() []byte
- func (*BlockProof) Descriptor() ([]byte, []int)deprecated
- func (x *BlockProof) GetBlockHeaderHash() []byte
- func (x *BlockProof) GetBlockTreeHashChain() *BlockTreeHashChain
- func (x *BlockProof) GetHashValue() []byte
- func (x *BlockProof) GetProofType() ProofType
- func (x *BlockProof) GetSecTreeHashChain() *SecTreeHashChain
- func (x *BlockProof) GetTransactionsHash() []byte
- func (x *BlockProof) GetUnicityCertificate() *certificates.UnicityCertificate
- func (*BlockProof) ProtoMessage()
- func (x *BlockProof) ProtoReflect() protoreflect.Message
- func (x *BlockProof) Reset()
- func (x *BlockProof) String() string
- func (x *BlockProof) Verify(unitID []byte, tx txsystem.GenericTransaction, ...) error
- type BlockTreeHashChain
- func (*BlockTreeHashChain) Descriptor() ([]byte, []int)deprecated
- func (x *BlockTreeHashChain) GetItems() []*ChainItem
- func (*BlockTreeHashChain) ProtoMessage()
- func (x *BlockTreeHashChain) ProtoReflect() protoreflect.Message
- func (x *BlockTreeHashChain) Reset()
- func (x *BlockTreeHashChain) String() string
- type ChainItem
- type GenericBlock
- type MerklePathItem
- func (*MerklePathItem) Descriptor() ([]byte, []int)deprecated
- func (x *MerklePathItem) GetDirectionLeft() bool
- func (x *MerklePathItem) GetPathItem() []byte
- func (*MerklePathItem) ProtoMessage()
- func (x *MerklePathItem) ProtoReflect() protoreflect.Message
- func (x *MerklePathItem) Reset()
- func (x *MerklePathItem) String() string
- type PendingBlockProposal
- type ProofType
- type SecTreeHashChain
- func (*SecTreeHashChain) Descriptor() ([]byte, []int)deprecated
- func (x *SecTreeHashChain) GetItems() []*MerklePathItem
- func (*SecTreeHashChain) ProtoMessage()
- func (x *SecTreeHashChain) ProtoReflect() protoreflect.Message
- func (x *SecTreeHashChain) Reset()
- func (x *SecTreeHashChain) String() string
- type TxConverter
- type TxProof
- func (*TxProof) Descriptor() ([]byte, []int)deprecated
- func (x *TxProof) GetBlockNumber() uint64
- func (x *TxProof) GetProof() *BlockProof
- func (x *TxProof) GetTx() *txsystem.Transaction
- func (*TxProof) ProtoMessage()
- func (x *TxProof) ProtoReflect() protoreflect.Message
- func (x *TxProof) Reset()
- func (x *TxProof) String() string
- func (x *TxProof) Verify(unitID []byte, gtx txsystem.GenericTransaction, ...) error
Constants ¶
This section is empty.
Variables ¶
var ( ErrProofVerificationFailed = errors.New("proof verification failed") ErrTxIsNil = errors.New("tx is nil") ErrVerifierIsNil = errors.New("verifier is nil") ErrBlockIsNil = errors.New("block is nil") ErrInvalidUnitID = errors.New("unit id is invalid") ErrUCIsNil = errors.New("unicity certificate is nil") )
var ( ProofType_name = map[int32]string{ 0: "PRIM", 1: "SEC", 2: "ONLYSEC", 3: "NOTRANS", 4: "EMPTYBLOCK", } ProofType_value = map[string]int32{ "PRIM": 0, "SEC": 1, "ONLYSEC": 2, "NOTRANS": 3, "EMPTYBLOCK": 4, } )
Enum value maps for ProofType.
var File_bills_proto protoreflect.FileDescriptor
var File_block_proof_proto protoreflect.FileDescriptor
var File_block_proto protoreflect.FileDescriptor
Functions ¶
func FromProtobuf ¶ added in v0.1.1
func FromProtobuf(chain []*MerklePathItem) []*mt.PathItem
FromProtobuf utility function that converts []*MerklePathItem to []*mt.PathItem
func FromProtobufHashChain ¶ added in v0.1.1
FromProtobufHashChain utility function that converts []ChainItem []omt.Data
func WriteBillsFile ¶ added in v0.1.1
Types ¶
type Bill ¶ added in v0.1.1
type Bill struct { Id []byte `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` Value uint64 `protobuf:"varint,2,opt,name=value,proto3" json:"value,omitempty"` TxHash []byte `protobuf:"bytes,3,opt,name=tx_hash,json=txHash,proto3" json:"tx_hash,omitempty"` IsDcBill bool `protobuf:"varint,4,opt,name=is_dc_bill,json=isDcBill,proto3" json:"is_dc_bill,omitempty"` TxProof *TxProof `protobuf:"bytes,5,opt,name=tx_proof,json=txProof,proto3" json:"tx_proof,omitempty"` // contains filtered or unexported fields }
bill with tx proof
func (*Bill) Descriptor
deprecated
added in
v0.1.1
func (*Bill) GetIsDcBill ¶ added in v0.1.1
func (*Bill) GetTxProof ¶ added in v0.1.1
func (*Bill) ProtoMessage ¶ added in v0.1.1
func (*Bill) ProtoMessage()
func (*Bill) ProtoReflect ¶ added in v0.1.1
func (x *Bill) ProtoReflect() protoreflect.Message
type Bills ¶ added in v0.1.1
type Bills struct { Bills []*Bill `protobuf:"bytes,1,rep,name=bills,proto3" json:"bills,omitempty"` // contains filtered or unexported fields }
bills with tx proofs
func (*Bills) Descriptor
deprecated
added in
v0.1.1
func (*Bills) ProtoMessage ¶ added in v0.1.1
func (*Bills) ProtoMessage()
func (*Bills) ProtoReflect ¶ added in v0.1.1
func (x *Bills) ProtoReflect() protoreflect.Message
type Block ¶
type Block struct { SystemIdentifier []byte `protobuf:"bytes,1,opt,name=system_identifier,json=systemIdentifier,proto3" json:"system_identifier,omitempty"` BlockNumber uint64 `protobuf:"varint,2,opt,name=block_number,json=blockNumber,proto3" json:"block_number,omitempty"` PreviousBlockHash []byte `protobuf:"bytes,3,opt,name=previous_block_hash,json=previousBlockHash,proto3" json:"previous_block_hash,omitempty"` Transactions []*txsystem.Transaction `protobuf:"bytes,4,rep,name=transactions,proto3" json:"transactions,omitempty"` UnicityCertificate *certificates.UnicityCertificate `protobuf:"bytes,5,opt,name=unicity_certificate,json=unicityCertificate,proto3" json:"unicity_certificate,omitempty"` // contains filtered or unexported fields }
func (*Block) AddHeaderToHasher ¶
func (*Block) Descriptor
deprecated
func (*Block) GetBlockNumber ¶
func (*Block) GetPreviousBlockHash ¶
func (*Block) GetSystemIdentifier ¶
func (*Block) GetTransactions ¶
func (x *Block) GetTransactions() []*txsystem.Transaction
func (*Block) GetUnicityCertificate ¶
func (x *Block) GetUnicityCertificate() *certificates.UnicityCertificate
func (*Block) ProtoMessage ¶
func (*Block) ProtoMessage()
func (*Block) ProtoReflect ¶
func (x *Block) ProtoReflect() protoreflect.Message
func (*Block) ToGenericBlock ¶ added in v0.1.1
func (x *Block) ToGenericBlock(txConverter TxConverter) (*GenericBlock, error)
type BlockProof ¶ added in v0.1.1
type BlockProof struct { ProofType ProofType `protobuf:"varint,1,opt,name=proof_type,json=proofType,proto3,enum=ProofType" json:"proof_type,omitempty"` BlockHeaderHash []byte `protobuf:"bytes,2,opt,name=block_header_hash,json=blockHeaderHash,proto3" json:"block_header_hash,omitempty"` TransactionsHash []byte `protobuf:"bytes,3,opt,name=transactions_hash,json=transactionsHash,proto3" json:"transactions_hash,omitempty"` // hash value of either primary tx or secondary txs or zero hash, depending on proof type HashValue []byte `protobuf:"bytes,4,opt,name=hash_value,json=hashValue,proto3" json:"hash_value,omitempty"` BlockTreeHashChain *BlockTreeHashChain `protobuf:"bytes,5,opt,name=block_tree_hash_chain,json=blockTreeHashChain,proto3" json:"block_tree_hash_chain,omitempty"` SecTreeHashChain *SecTreeHashChain `protobuf:"bytes,6,opt,name=sec_tree_hash_chain,json=secTreeHashChain,proto3" json:"sec_tree_hash_chain,omitempty"` UnicityCertificate *certificates.UnicityCertificate `protobuf:"bytes,7,opt,name=unicity_certificate,json=unicityCertificate,proto3" json:"unicity_certificate,omitempty"` // contains filtered or unexported fields }
func NewPrimaryProof ¶ added in v0.1.1
func NewPrimaryProof(b *GenericBlock, unitID []byte, hashAlgorithm crypto.Hash) (*BlockProof, error)
NewPrimaryProof creates primary proof for given unit and block.
func NewSecondaryProof ¶ added in v0.1.1
func NewSecondaryProof(b *GenericBlock, unitID []byte, secTxIdx int, hashAlgorithm crypto.Hash) (*BlockProof, error)
NewSecondaryProof creates secondary proof for given unit and block.
func (*BlockProof) AddToHasher ¶ added in v0.1.1
func (x *BlockProof) AddToHasher(hasher gohash.Hash)
func (*BlockProof) Bytes ¶ added in v0.1.1
func (x *BlockProof) Bytes() []byte
func (*BlockProof) Descriptor
deprecated
added in
v0.1.1
func (*BlockProof) Descriptor() ([]byte, []int)
Deprecated: Use BlockProof.ProtoReflect.Descriptor instead.
func (*BlockProof) GetBlockHeaderHash ¶ added in v0.1.1
func (x *BlockProof) GetBlockHeaderHash() []byte
func (*BlockProof) GetBlockTreeHashChain ¶ added in v0.1.1
func (x *BlockProof) GetBlockTreeHashChain() *BlockTreeHashChain
func (*BlockProof) GetHashValue ¶ added in v0.1.1
func (x *BlockProof) GetHashValue() []byte
func (*BlockProof) GetProofType ¶ added in v0.1.1
func (x *BlockProof) GetProofType() ProofType
func (*BlockProof) GetSecTreeHashChain ¶ added in v0.1.1
func (x *BlockProof) GetSecTreeHashChain() *SecTreeHashChain
func (*BlockProof) GetTransactionsHash ¶ added in v0.1.1
func (x *BlockProof) GetTransactionsHash() []byte
func (*BlockProof) GetUnicityCertificate ¶ added in v0.1.1
func (x *BlockProof) GetUnicityCertificate() *certificates.UnicityCertificate
func (*BlockProof) ProtoMessage ¶ added in v0.1.1
func (*BlockProof) ProtoMessage()
func (*BlockProof) ProtoReflect ¶ added in v0.1.1
func (x *BlockProof) ProtoReflect() protoreflect.Message
func (*BlockProof) Reset ¶ added in v0.1.1
func (x *BlockProof) Reset()
func (*BlockProof) String ¶ added in v0.1.1
func (x *BlockProof) String() string
func (*BlockProof) Verify ¶ added in v0.1.1
func (x *BlockProof) Verify(unitID []byte, tx txsystem.GenericTransaction, verifiers map[string]abcrypto.Verifier, hashAlgorithm crypto.Hash) error
Verify verifies the proof against given transaction, returns error if verification failed, or nil if verification succeeded.
type BlockTreeHashChain ¶ added in v0.1.1
type BlockTreeHashChain struct { Items []*ChainItem `protobuf:"bytes,1,rep,name=items,proto3" json:"items,omitempty"` // contains filtered or unexported fields }
func (*BlockTreeHashChain) Descriptor
deprecated
added in
v0.1.1
func (*BlockTreeHashChain) Descriptor() ([]byte, []int)
Deprecated: Use BlockTreeHashChain.ProtoReflect.Descriptor instead.
func (*BlockTreeHashChain) GetItems ¶ added in v0.1.1
func (x *BlockTreeHashChain) GetItems() []*ChainItem
func (*BlockTreeHashChain) ProtoMessage ¶ added in v0.1.1
func (*BlockTreeHashChain) ProtoMessage()
func (*BlockTreeHashChain) ProtoReflect ¶ added in v0.1.1
func (x *BlockTreeHashChain) ProtoReflect() protoreflect.Message
func (*BlockTreeHashChain) Reset ¶ added in v0.1.1
func (x *BlockTreeHashChain) Reset()
func (*BlockTreeHashChain) String ¶ added in v0.1.1
func (x *BlockTreeHashChain) String() string
type ChainItem ¶ added in v0.1.1
type ChainItem struct { Val []byte `protobuf:"bytes,1,opt,name=val,proto3" json:"val,omitempty"` Hash []byte `protobuf:"bytes,2,opt,name=hash,proto3" json:"hash,omitempty"` // contains filtered or unexported fields }
func ToProtobufHashChain ¶ added in v0.1.1
ToProtobufHashChain utility function that converts []omt.Data to []ChainItem
func (*ChainItem) Descriptor
deprecated
added in
v0.1.1
func (*ChainItem) ProtoMessage ¶ added in v0.1.1
func (*ChainItem) ProtoMessage()
func (*ChainItem) ProtoReflect ¶ added in v0.1.1
func (x *ChainItem) ProtoReflect() protoreflect.Message
type GenericBlock ¶ added in v0.1.1
type GenericBlock struct { SystemIdentifier []byte BlockNumber uint64 PreviousBlockHash []byte Transactions []txsystem.GenericTransaction UnicityCertificate *certificates.UnicityCertificate }
GenericBlock same as Block but transactions are of type txsystem.GenericTransaction
func (*GenericBlock) AddHeaderToHasher ¶ added in v0.1.1
func (x *GenericBlock) AddHeaderToHasher(hasher hash.Hash)
func (*GenericBlock) Hash ¶ added in v0.1.1
func (x *GenericBlock) Hash(hashAlgorithm crypto.Hash) ([]byte, error)
Hash returns the hash of the block. Hash is computed from hash of block header fields || hash of raw block payload || tree hash of transactions
func (*GenericBlock) HashHeader ¶ added in v0.1.1
func (x *GenericBlock) HashHeader(hashAlgorithm crypto.Hash) []byte
func (*GenericBlock) ToProtobuf ¶ added in v0.1.1
func (x *GenericBlock) ToProtobuf() *Block
ToProtobuf converts GenericBlock to protobuf Block
type MerklePathItem ¶ added in v0.1.1
type MerklePathItem struct { // DirectionLeft direction from parent node; left=true right=false DirectionLeft bool `protobuf:"varint,1,opt,name=direction_left,json=directionLeft,proto3" json:"direction_left,omitempty"` // PathItem Hash of Merkle Tree node PathItem []byte `protobuf:"bytes,2,opt,name=path_item,json=pathItem,proto3" json:"path_item,omitempty"` // contains filtered or unexported fields }
func ToProtobuf ¶ added in v0.1.1
func ToProtobuf(srcPathItmes []*mt.PathItem) []*MerklePathItem
ToProtobuf utility function that converts []*mt.PathItem to []*MerklePathItem
func (*MerklePathItem) Descriptor
deprecated
added in
v0.1.1
func (*MerklePathItem) Descriptor() ([]byte, []int)
Deprecated: Use MerklePathItem.ProtoReflect.Descriptor instead.
func (*MerklePathItem) GetDirectionLeft ¶ added in v0.1.1
func (x *MerklePathItem) GetDirectionLeft() bool
func (*MerklePathItem) GetPathItem ¶ added in v0.1.1
func (x *MerklePathItem) GetPathItem() []byte
func (*MerklePathItem) ProtoMessage ¶ added in v0.1.1
func (*MerklePathItem) ProtoMessage()
func (*MerklePathItem) ProtoReflect ¶ added in v0.1.1
func (x *MerklePathItem) ProtoReflect() protoreflect.Message
func (*MerklePathItem) Reset ¶ added in v0.1.1
func (x *MerklePathItem) Reset()
func (*MerklePathItem) String ¶ added in v0.1.1
func (x *MerklePathItem) String() string
type PendingBlockProposal ¶
type PendingBlockProposal struct { RoundNumber uint64 PrevHash []byte StateHash []byte Transactions []txsystem.GenericTransaction }
type ProofType ¶ added in v0.1.1
type ProofType int32
func (ProofType) Descriptor ¶ added in v0.1.1
func (ProofType) Descriptor() protoreflect.EnumDescriptor
func (ProofType) EnumDescriptor
deprecated
added in
v0.1.1
func (ProofType) Number ¶ added in v0.1.1
func (x ProofType) Number() protoreflect.EnumNumber
func (ProofType) Type ¶ added in v0.1.1
func (ProofType) Type() protoreflect.EnumType
type SecTreeHashChain ¶ added in v0.1.1
type SecTreeHashChain struct { Items []*MerklePathItem `protobuf:"bytes,1,rep,name=items,proto3" json:"items,omitempty"` // contains filtered or unexported fields }
func (*SecTreeHashChain) Descriptor
deprecated
added in
v0.1.1
func (*SecTreeHashChain) Descriptor() ([]byte, []int)
Deprecated: Use SecTreeHashChain.ProtoReflect.Descriptor instead.
func (*SecTreeHashChain) GetItems ¶ added in v0.1.1
func (x *SecTreeHashChain) GetItems() []*MerklePathItem
func (*SecTreeHashChain) ProtoMessage ¶ added in v0.1.1
func (*SecTreeHashChain) ProtoMessage()
func (*SecTreeHashChain) ProtoReflect ¶ added in v0.1.1
func (x *SecTreeHashChain) ProtoReflect() protoreflect.Message
func (*SecTreeHashChain) Reset ¶ added in v0.1.1
func (x *SecTreeHashChain) Reset()
func (*SecTreeHashChain) String ¶ added in v0.1.1
func (x *SecTreeHashChain) String() string
type TxConverter ¶ added in v0.1.1
type TxConverter interface {
ConvertTx(tx *txsystem.Transaction) (txsystem.GenericTransaction, error)
}
type TxProof ¶ added in v0.1.1
type TxProof struct { BlockNumber uint64 `protobuf:"varint,1,opt,name=block_number,json=blockNumber,proto3" json:"block_number,omitempty"` Tx *txsystem.Transaction `protobuf:"bytes,2,opt,name=tx,proto3" json:"tx,omitempty"` Proof *BlockProof `protobuf:"bytes,3,opt,name=proof,proto3" json:"proof,omitempty"` // contains filtered or unexported fields }
tx proof context
func (*TxProof) Descriptor
deprecated
added in
v0.1.1
func (*TxProof) GetBlockNumber ¶ added in v0.1.1
func (*TxProof) GetProof ¶ added in v0.1.1
func (x *TxProof) GetProof() *BlockProof
func (*TxProof) GetTx ¶ added in v0.1.1
func (x *TxProof) GetTx() *txsystem.Transaction
func (*TxProof) ProtoMessage ¶ added in v0.1.1
func (*TxProof) ProtoMessage()
func (*TxProof) ProtoReflect ¶ added in v0.1.1
func (x *TxProof) ProtoReflect() protoreflect.Message