Documentation
¶
Index ¶
- func NewFlagHasher(flagger Flagger, baseHasher hash.Hash) hash.Hash
- type AddPetitionMessage
- func (*AddPetitionMessage) Descriptor() ([]byte, []int)
- func (m *AddPetitionMessage) GetText() string
- func (*AddPetitionMessage) ProtoMessage()
- func (m *AddPetitionMessage) Reset()
- func (m *AddPetitionMessage) String() string
- func (m *AddPetitionMessage) XXX_DiscardUnknown()
- func (m *AddPetitionMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *AddPetitionMessage) XXX_Merge(src proto.Message)
- func (m *AddPetitionMessage) XXX_Size() int
- func (m *AddPetitionMessage) XXX_Unmarshal(b []byte) error
- type Application
- type Block
- func ImportProbabilisticBlock(prevHash []byte, messages []Message, messageSize int, validated bool) Block
- func ImportProbabilisticBlockHeader(prevHash []byte, rowRoots [][]byte, columnRoots [][]byte, squareWidth int, ...) Block
- func ImportSimpleBlock(prevHash []byte, messages []Message) Block
- func ImportSimpleBlockHeader(prevHash []byte, messagesRoot []byte) Block
- func NewProbabilisticBlock(prevHash []byte, messageSize int) Block
- func NewSimpleBlock(prevHash []byte) Block
- type BlockStore
- type Blockchain
- type BytesLeafHasher
- type CodedAxisSubtreeHasher
- type Currency
- func (c *Currency) AddTransferCallback(fn TransferCallback)
- func (c *Currency) Balance(pubKey crypto.PubKey) uint64
- func (c *Currency) BlockHead() []byte
- func (c *Currency) GenerateTransaction(fromPrivKey crypto.PrivKey, toPubKey crypto.PubKey, amount uint64, ...) Message
- func (c *Currency) Namespace() [namespaceSize]byte
- func (c *Currency) ProcessMessage(message Message)
- func (c *Currency) SetBlockHead(hash []byte)
- func (c *Currency) StorageSize() int
- type CurrencyTransaction
- func (*CurrencyTransaction) Descriptor() ([]byte, []int)
- func (m *CurrencyTransaction) GetAmount() uint64
- func (m *CurrencyTransaction) GetDependency() []byte
- func (m *CurrencyTransaction) GetFrom() []byte
- func (m *CurrencyTransaction) GetSignature() []byte
- func (m *CurrencyTransaction) GetTo() []byte
- func (*CurrencyTransaction) ProtoMessage()
- func (m *CurrencyTransaction) Reset()
- func (m *CurrencyTransaction) String() string
- func (m *CurrencyTransaction) XXX_DiscardUnknown()
- func (m *CurrencyTransaction) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *CurrencyTransaction) XXX_Merge(src proto.Message)
- func (m *CurrencyTransaction) XXX_Size() int
- func (m *CurrencyTransaction) XXX_Unmarshal(b []byte) error
- type CurrencyTransactionMessage
- func (*CurrencyTransactionMessage) Descriptor() ([]byte, []int)
- func (m *CurrencyTransactionMessage) GetAmount() uint64
- func (m *CurrencyTransactionMessage) GetDependency() []byte
- func (m *CurrencyTransactionMessage) GetTo() []byte
- func (*CurrencyTransactionMessage) ProtoMessage()
- func (m *CurrencyTransactionMessage) Reset()
- func (m *CurrencyTransactionMessage) String() string
- func (m *CurrencyTransactionMessage) XXX_DiscardUnknown()
- func (m *CurrencyTransactionMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *CurrencyTransactionMessage) XXX_Merge(src proto.Message)
- func (m *CurrencyTransactionMessage) XXX_Size() int
- func (m *CurrencyTransactionMessage) XXX_Unmarshal(b []byte) error
- type DummyApp
- func (app *DummyApp) BlockHead() []byte
- func (app *DummyApp) GenerateTransaction(puts map[string]string) Message
- func (app *DummyApp) Get(key string) string
- func (app *DummyApp) Namespace() [namespaceSize]byte
- func (app *DummyApp) ProcessMessage(message Message)
- func (app *DummyApp) SetBlockHead(hash []byte)
- func (app *DummyApp) StorageSize() int
- type DummyAppTransaction
- func (*DummyAppTransaction) Descriptor() ([]byte, []int)
- func (m *DummyAppTransaction) GetPuts() map[string]string
- func (*DummyAppTransaction) ProtoMessage()
- func (m *DummyAppTransaction) Reset()
- func (m *DummyAppTransaction) String() string
- func (m *DummyAppTransaction) XXX_DiscardUnknown()
- func (m *DummyAppTransaction) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *DummyAppTransaction) XXX_Merge(src proto.Message)
- func (m *DummyAppTransaction) XXX_Size() int
- func (m *DummyAppTransaction) XXX_Unmarshal(b []byte) error
- type Flagger
- type HashLeafHasher
- type InvalidKeyError
- type MapStore
- type Message
- type MessageLeafHasher
- type MessageSubtreeHasher
- type PetitionApp
- func (app *PetitionApp) BlockHead() []byte
- func (app *PetitionApp) GenerateAddPetitionTransaction(text string) Message
- func (app *PetitionApp) GenerateSignPetitionTransaction(key crypto.PrivKey, petition uint64) Message
- func (app *PetitionApp) Namespace() [namespaceSize]byte
- func (app *PetitionApp) Petition(petition uint64) uint64
- func (app *PetitionApp) ProcessAddPetitionMessage(apm *AddPetitionMessage)
- func (app *PetitionApp) ProcessMessage(message Message)
- func (app *PetitionApp) ProcessSignPetitionMessage(spm *SignPetitionMessage)
- func (app *PetitionApp) SetBlockHead(hash []byte)
- type PetitionAppTransaction
- func (*PetitionAppTransaction) Descriptor() ([]byte, []int)
- func (m *PetitionAppTransaction) GetApm() *AddPetitionMessage
- func (m *PetitionAppTransaction) GetMessage() isPetitionAppTransaction_Message
- func (m *PetitionAppTransaction) GetSpm() *SignPetitionMessage
- func (*PetitionAppTransaction) ProtoMessage()
- func (m *PetitionAppTransaction) Reset()
- func (m *PetitionAppTransaction) String() string
- func (m *PetitionAppTransaction) XXX_DiscardUnknown()
- func (m *PetitionAppTransaction) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *PetitionAppTransaction) XXX_Merge(src proto.Message)
- func (*PetitionAppTransaction) XXX_OneofWrappers() []interface{}
- func (m *PetitionAppTransaction) XXX_Size() int
- func (m *PetitionAppTransaction) XXX_Unmarshal(b []byte) error
- type PetitionAppTransaction_Apm
- type PetitionAppTransaction_Spm
- type ProbabilisticBlock
- func (pb *ProbabilisticBlock) AddMessage(message Message)
- func (pb *ProbabilisticBlock) ApplicationProof(namespace [namespaceSize]byte) (int, int, [][][]byte, *[]Message, [][]byte)
- func (pb *ProbabilisticBlock) ColumnRoots() [][]byte
- func (pb *ProbabilisticBlock) DependencyProven(hash []byte) bool
- func (pb *ProbabilisticBlock) Digest() []byte
- func (pb *ProbabilisticBlock) Messages() []Message
- func (pb *ProbabilisticBlock) PrevHash() []byte
- func (pb *ProbabilisticBlock) ProcessSamplesResponse(response *SampleResponse) bool
- func (pb *ProbabilisticBlock) ProveDependency(index int) ([]byte, [][]byte, error)
- func (pb *ProbabilisticBlock) RequestSamples(n int) (*SampleRequest, error)
- func (pb *ProbabilisticBlock) RespondSamples(request *SampleRequest) *SampleResponse
- func (pb *ProbabilisticBlock) RowRoots() [][]byte
- func (pb *ProbabilisticBlock) SquareWidth() int
- func (pb *ProbabilisticBlock) Valid() bool
- func (pb *ProbabilisticBlock) VerifyApplicationProof(namespace [namespaceSize]byte, proofStart int, proofEnd int, proofs [][][]byte, ...) bool
- func (pb *ProbabilisticBlock) VerifyDependency(index int, hash []byte, proof [][]byte) bool
- type RegisterTransaction
- func (*RegisterTransaction) Descriptor() ([]byte, []int)
- func (m *RegisterTransaction) GetName() []byte
- func (m *RegisterTransaction) GetOwner() []byte
- func (m *RegisterTransaction) GetSignature() []byte
- func (*RegisterTransaction) ProtoMessage()
- func (m *RegisterTransaction) Reset()
- func (m *RegisterTransaction) String() string
- func (m *RegisterTransaction) XXX_DiscardUnknown()
- func (m *RegisterTransaction) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *RegisterTransaction) XXX_Merge(src proto.Message)
- func (m *RegisterTransaction) XXX_Size() int
- func (m *RegisterTransaction) XXX_Unmarshal(b []byte) error
- type RegisterTransactionMessage
- func (*RegisterTransactionMessage) Descriptor() ([]byte, []int)
- func (m *RegisterTransactionMessage) GetName() []byte
- func (*RegisterTransactionMessage) ProtoMessage()
- func (m *RegisterTransactionMessage) Reset()
- func (m *RegisterTransactionMessage) String() string
- func (m *RegisterTransactionMessage) XXX_DiscardUnknown()
- func (m *RegisterTransactionMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *RegisterTransactionMessage) XXX_Merge(src proto.Message)
- func (m *RegisterTransactionMessage) XXX_Size() int
- func (m *RegisterTransactionMessage) XXX_Unmarshal(b []byte) error
- type Registrar
- func (app *Registrar) Balance(key []byte) uint64
- func (app *Registrar) BlockHead() []byte
- func (app *Registrar) GenerateTransaction(owner crypto.PrivKey, name []byte) Message
- func (app *Registrar) Name(name []byte) []byte
- func (app *Registrar) Namespace() [namespaceSize]byte
- func (app *Registrar) ProcessMessage(message Message)
- func (app *Registrar) SetBlockHead(hash []byte)
- func (app *Registrar) SetNamespace(namespace [namespaceSize]byte)
- type SampleRequest
- type SampleResponse
- type SignPetitionMessage
- func (*SignPetitionMessage) Descriptor() ([]byte, []int)
- func (m *SignPetitionMessage) GetId() uint64
- func (m *SignPetitionMessage) GetSignature() []byte
- func (m *SignPetitionMessage) GetSigner() []byte
- func (*SignPetitionMessage) ProtoMessage()
- func (m *SignPetitionMessage) Reset()
- func (m *SignPetitionMessage) String() string
- func (m *SignPetitionMessage) XXX_DiscardUnknown()
- func (m *SignPetitionMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *SignPetitionMessage) XXX_Merge(src proto.Message)
- func (m *SignPetitionMessage) XXX_Size() int
- func (m *SignPetitionMessage) XXX_Unmarshal(b []byte) error
- type SimpleBlock
- func (sb *SimpleBlock) AddMessage(message Message)
- func (sb *SimpleBlock) ApplicationProof(namespace [namespaceSize]byte) (int, int, [][]byte, *[]Message, [][]byte)
- func (sb *SimpleBlock) DependencyProven(hash []byte) bool
- func (sb *SimpleBlock) Digest() []byte
- func (sb *SimpleBlock) Messages() []Message
- func (sb *SimpleBlock) MessagesRoot() []byte
- func (sb *SimpleBlock) PrevHash() []byte
- func (sb *SimpleBlock) ProveDependency(index int) ([]byte, [][]byte, error)
- func (sb *SimpleBlock) Valid() bool
- func (sb *SimpleBlock) VerifyApplicationProof(namespace [namespaceSize]byte, proofStart int, proofEnd int, proof [][]byte, ...) bool
- func (sb *SimpleBlock) VerifyDependency(index int, hash []byte, proof [][]byte) bool
- type SimpleBlockStore
- type SimpleMap
- type TransferCallback
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AddPetitionMessage ¶
type AddPetitionMessage struct { Text *string `protobuf:"bytes,1,req,name=text" json:"text,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*AddPetitionMessage) Descriptor ¶
func (*AddPetitionMessage) Descriptor() ([]byte, []int)
func (*AddPetitionMessage) GetText ¶
func (m *AddPetitionMessage) GetText() string
func (*AddPetitionMessage) ProtoMessage ¶
func (*AddPetitionMessage) ProtoMessage()
func (*AddPetitionMessage) Reset ¶
func (m *AddPetitionMessage) Reset()
func (*AddPetitionMessage) String ¶
func (m *AddPetitionMessage) String() string
func (*AddPetitionMessage) XXX_DiscardUnknown ¶
func (m *AddPetitionMessage) XXX_DiscardUnknown()
func (*AddPetitionMessage) XXX_Marshal ¶
func (m *AddPetitionMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*AddPetitionMessage) XXX_Merge ¶
func (m *AddPetitionMessage) XXX_Merge(src proto.Message)
func (*AddPetitionMessage) XXX_Size ¶
func (m *AddPetitionMessage) XXX_Size() int
func (*AddPetitionMessage) XXX_Unmarshal ¶
func (m *AddPetitionMessage) XXX_Unmarshal(b []byte) error
type Application ¶
type Application interface { // ProcessMessage processes a message according to the application's state machine. ProcessMessage(message Message) // Namespace returns the namespace ID of the application. Namespace() [namespaceSize]byte // BlockHead returns the hash of the latest block that has been processed. BlockHead() []byte // SetBlockHead sets the hash of the latest block that has been processed. SetBlockHead(hash []byte) }
Application is an interface for a lazyledger application.
func NewCurrency ¶
func NewCurrency(state MapStore, b *Blockchain) Application
NewCurrency creates a new currency instance.
func NewDummyApp ¶
func NewDummyApp(state MapStore) Application
func NewPetitionApp ¶
func NewPetitionApp(state MapStore) Application
func NewRegistrar ¶
func NewRegistrar(state MapStore, currency *Currency, owner []byte) Application
type Block ¶
type Block interface { // AddMessage adds a message to the block. AddMessage(Message) // Digest computes the hash of the block. Digest() []byte // Valid returns true if the block is valid. Valid() bool // PrevHash returns the hash of the previous block. PrevHash() []byte // Messages returns the block's messages. Messages() []Message ProveDependency(int) ([]byte, [][]byte, error) VerifyDependency(int, []byte, [][]byte) bool DependencyProven([]byte) bool }
Block represents a block in the chain.
func ImportProbabilisticBlock ¶
func ImportProbabilisticBlock(prevHash []byte, messages []Message, messageSize int, validated bool) Block
ImportProbabilisticBlock imports a received probabilistic block.
func ImportProbabilisticBlockHeader ¶
func ImportProbabilisticBlockHeader(prevHash []byte, rowRoots [][]byte, columnRoots [][]byte, squareWidth int, messageSize int, validated bool) Block
ImportProbabilisticBlockBlockHeader imports a received probabilistic block without the messages.
func ImportSimpleBlock ¶
ImportSimpleBlock imports a received simple block.
func ImportSimpleBlockHeader ¶
ImportSimpleBlockHeader imports a received simple block without the messages.
func NewProbabilisticBlock ¶
NewProbabilisticBlock returns a new probabilistic block.
func NewSimpleBlock ¶
NewSimpleBlock returns a new simple block.
type BlockStore ¶
type BlockStore interface { Get(key []byte) (Block, error) // Get gets the value for a key. Put(key []byte, value Block) error // Put updates the value for a key. Del(key []byte) error // Del deletes a key. }
BlockStore is a key-value store for blocks.
type Blockchain ¶
type Blockchain struct {
// contains filtered or unexported fields
}
Blockchain is a chain of blocks. This is a prototype for testing purposes and thus does not support re-orgs, and there is no network stack.
func NewBlockchain ¶
func NewBlockchain(blockStore BlockStore) *Blockchain
NewBlockchain returns a new blockchain.
func (*Blockchain) ProcessBlock ¶
func (b *Blockchain) ProcessBlock(block Block)
ProcessBlock processes a new block.
func (*Blockchain) RegisterApplication ¶
func (b *Blockchain) RegisterApplication(application *Application)
RegisterApplication registers an application instance to call when new relevant messages arrive.
type BytesLeafHasher ¶
type BytesLeafHasher struct {
// contains filtered or unexported fields
}
BytesLeafHasher implements the merkletree.LeafHasher interface by reading a slice.
func NewBytesLeafHasher ¶
func NewBytesLeafHasher(data [][]byte, h hash.Hash) *BytesLeafHasher
NewBytesLeafHasher returns a new BytesLeafHasher for a slice.
func (*BytesLeafHasher) NextLeafHash ¶
func (blh *BytesLeafHasher) NextLeafHash() (leafHash []byte, err error)
NextLeafHash implements LeafHasher
type CodedAxisSubtreeHasher ¶
type CodedAxisSubtreeHasher struct {
// contains filtered or unexported fields
}
CodedAxisSubtreeHasher implements merkletree.SubtreeHasher by reading leaf data from an underlying slice representing a coded axis.
func NewCodedAxisSubtreeHasher ¶
func NewCodedAxisSubtreeHasher(data [][]byte, h hash.Hash) *CodedAxisSubtreeHasher
NewCodedAxisSubtreeHasher returns a new CodedAxisSubtreeHasher for a pointer to a slice representing a coded axis.
func (*CodedAxisSubtreeHasher) NextSubtreeRoot ¶
func (cash *CodedAxisSubtreeHasher) NextSubtreeRoot(subtreeSize int) ([]byte, error)
NextSubtreeRoot implements SubtreeHasher.
func (*CodedAxisSubtreeHasher) Skip ¶
func (cash *CodedAxisSubtreeHasher) Skip(n int) error
Skip implements SubtreeHasher.
type Currency ¶
type Currency struct {
// contains filtered or unexported fields
}
Currency is a demo cryptocurrency application.
func (*Currency) AddTransferCallback ¶
func (c *Currency) AddTransferCallback(fn TransferCallback)
func (*Currency) BlockHead ¶
BlockHead returns the hash of the latest block that has been processed.
func (*Currency) GenerateTransaction ¶
func (c *Currency) GenerateTransaction(fromPrivKey crypto.PrivKey, toPubKey crypto.PubKey, amount uint64, dependency []byte) Message
GenerateTransaction generates a transaction message.
func (*Currency) ProcessMessage ¶
ProcessMessage processes a message.
func (*Currency) SetBlockHead ¶
SetBlockHead sets the hash of the latest block that has been processed.
func (*Currency) StorageSize ¶
type CurrencyTransaction ¶
type CurrencyTransaction struct { To []byte `protobuf:"bytes,1,req,name=to" json:"to,omitempty"` From []byte `protobuf:"bytes,2,req,name=from" json:"from,omitempty"` Amount *uint64 `protobuf:"varint,3,req,name=amount" json:"amount,omitempty"` Signature []byte `protobuf:"bytes,4,req,name=signature" json:"signature,omitempty"` Dependency []byte `protobuf:"bytes,5,opt,name=dependency" json:"dependency,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*CurrencyTransaction) Descriptor ¶
func (*CurrencyTransaction) Descriptor() ([]byte, []int)
func (*CurrencyTransaction) GetAmount ¶
func (m *CurrencyTransaction) GetAmount() uint64
func (*CurrencyTransaction) GetDependency ¶
func (m *CurrencyTransaction) GetDependency() []byte
func (*CurrencyTransaction) GetFrom ¶
func (m *CurrencyTransaction) GetFrom() []byte
func (*CurrencyTransaction) GetSignature ¶
func (m *CurrencyTransaction) GetSignature() []byte
func (*CurrencyTransaction) GetTo ¶
func (m *CurrencyTransaction) GetTo() []byte
func (*CurrencyTransaction) ProtoMessage ¶
func (*CurrencyTransaction) ProtoMessage()
func (*CurrencyTransaction) Reset ¶
func (m *CurrencyTransaction) Reset()
func (*CurrencyTransaction) String ¶
func (m *CurrencyTransaction) String() string
func (*CurrencyTransaction) XXX_DiscardUnknown ¶
func (m *CurrencyTransaction) XXX_DiscardUnknown()
func (*CurrencyTransaction) XXX_Marshal ¶
func (m *CurrencyTransaction) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*CurrencyTransaction) XXX_Merge ¶
func (m *CurrencyTransaction) XXX_Merge(src proto.Message)
func (*CurrencyTransaction) XXX_Size ¶
func (m *CurrencyTransaction) XXX_Size() int
func (*CurrencyTransaction) XXX_Unmarshal ¶
func (m *CurrencyTransaction) XXX_Unmarshal(b []byte) error
type CurrencyTransactionMessage ¶
type CurrencyTransactionMessage struct { To []byte `protobuf:"bytes,1,req,name=to" json:"to,omitempty"` Amount *uint64 `protobuf:"varint,2,req,name=amount" json:"amount,omitempty"` Dependency []byte `protobuf:"bytes,3,opt,name=dependency" json:"dependency,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*CurrencyTransactionMessage) Descriptor ¶
func (*CurrencyTransactionMessage) Descriptor() ([]byte, []int)
func (*CurrencyTransactionMessage) GetAmount ¶
func (m *CurrencyTransactionMessage) GetAmount() uint64
func (*CurrencyTransactionMessage) GetDependency ¶
func (m *CurrencyTransactionMessage) GetDependency() []byte
func (*CurrencyTransactionMessage) GetTo ¶
func (m *CurrencyTransactionMessage) GetTo() []byte
func (*CurrencyTransactionMessage) ProtoMessage ¶
func (*CurrencyTransactionMessage) ProtoMessage()
func (*CurrencyTransactionMessage) Reset ¶
func (m *CurrencyTransactionMessage) Reset()
func (*CurrencyTransactionMessage) String ¶
func (m *CurrencyTransactionMessage) String() string
func (*CurrencyTransactionMessage) XXX_DiscardUnknown ¶
func (m *CurrencyTransactionMessage) XXX_DiscardUnknown()
func (*CurrencyTransactionMessage) XXX_Marshal ¶
func (m *CurrencyTransactionMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*CurrencyTransactionMessage) XXX_Merge ¶
func (m *CurrencyTransactionMessage) XXX_Merge(src proto.Message)
func (*CurrencyTransactionMessage) XXX_Size ¶
func (m *CurrencyTransactionMessage) XXX_Size() int
func (*CurrencyTransactionMessage) XXX_Unmarshal ¶
func (m *CurrencyTransactionMessage) XXX_Unmarshal(b []byte) error
type DummyApp ¶
type DummyApp struct {
// contains filtered or unexported fields
}
func (*DummyApp) GenerateTransaction ¶
func (*DummyApp) ProcessMessage ¶
func (*DummyApp) SetBlockHead ¶
func (*DummyApp) StorageSize ¶
type DummyAppTransaction ¶
type DummyAppTransaction struct { Puts map[string]string `` /* 128-byte string literal not displayed */ XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*DummyAppTransaction) Descriptor ¶
func (*DummyAppTransaction) Descriptor() ([]byte, []int)
func (*DummyAppTransaction) GetPuts ¶
func (m *DummyAppTransaction) GetPuts() map[string]string
func (*DummyAppTransaction) ProtoMessage ¶
func (*DummyAppTransaction) ProtoMessage()
func (*DummyAppTransaction) Reset ¶
func (m *DummyAppTransaction) Reset()
func (*DummyAppTransaction) String ¶
func (m *DummyAppTransaction) String() string
func (*DummyAppTransaction) XXX_DiscardUnknown ¶
func (m *DummyAppTransaction) XXX_DiscardUnknown()
func (*DummyAppTransaction) XXX_Marshal ¶
func (m *DummyAppTransaction) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*DummyAppTransaction) XXX_Merge ¶
func (m *DummyAppTransaction) XXX_Merge(src proto.Message)
func (*DummyAppTransaction) XXX_Size ¶
func (m *DummyAppTransaction) XXX_Size() int
func (*DummyAppTransaction) XXX_Unmarshal ¶
func (m *DummyAppTransaction) XXX_Unmarshal(b []byte) error
type Flagger ¶
type Flagger interface { // LeafFlag returns the flag of a raw unhashed leaf. LeafFlag([]byte) []byte // NodeFlag returns the flag of an intermediate node. NodeFlag([]byte) []byte // Union returns the union of two flags. Union([]byte, []byte) []byte // FlagSize returns the number of bytes that LeafFlag or Union will return. FlagSize() int }
Flagger is an interface for computing the flags of bytes of data.
func NewNamespaceDummyFlagger ¶
func NewNamespaceDummyFlagger() Flagger
NewNamespaceDummyFlagger returns a new dummy flagger for namespaced Merkle trees.
type HashLeafHasher ¶
type HashLeafHasher struct {
// contains filtered or unexported fields
}
HashLeafHasher implements the merkletree.LeafHasher interface from a slice of hashes.
func NewHashLeafHasher ¶
func NewHashLeafHasher(hashes [][]byte) *HashLeafHasher
NewHashLeafHasher returns a new MessageLeafHasher for a slice of hashes.
func (*HashLeafHasher) NextLeafHash ¶
func (hlh *HashLeafHasher) NextLeafHash() (leafHash []byte, err error)
NextLeafHash implements LeafHasher
type InvalidKeyError ¶
type InvalidKeyError struct {
Key []byte
}
InvalidKeyError is thrown when a key that does not exist is being accessed.
func (*InvalidKeyError) Error ¶
func (e *InvalidKeyError) Error() string
type MapStore ¶
type MapStore interface { Get(key []byte) ([]byte, error) // Get gets the value for a key. Put(key []byte, value []byte) error // Put updates the value for a key. Del(key []byte) error // Del deletes a key. // contains filtered or unexported methods }
MapStore is a key-value store.
type Message ¶
type Message struct {
// contains filtered or unexported fields
}
Message represents a namespaced message.
func NewMessage ¶
NewMessage returns a new message from its namespace and data.
func UnmarshalMessage ¶
UnmarshalMessage returns a message from its marshalled raw data.
func UnmarshalPaddedMessage ¶
UnmarshalPaddedMessage returns a message from its marshalled padded raw data.
func (*Message) MarshalPadded ¶
Marshal converts a message to padded raw data.
type MessageLeafHasher ¶
type MessageLeafHasher struct {
// contains filtered or unexported fields
}
MessageLeafHasher implements the merkletree.LeafHasher interface by reading leaf data from an underlying slice of messages.
func NewMessageLeafHasher ¶
func NewMessageLeafHasher(messages *[]Message, h hash.Hash) *MessageLeafHasher
NewMessageLeafHasher returns a new MessageLeafHasher for a pointer to a slice of messages.
func NewPaddedMessageLeafHasher ¶
func NewPaddedMessageLeafHasher(messages *[]Message, h hash.Hash, messageSize int) *MessageLeafHasher
NewPaddedMessageLeafHasher returns a new MessageLeafHasher for a pointer to a slice of messages, where messages should be padded.
func (*MessageLeafHasher) NextLeafHash ¶
func (mlh *MessageLeafHasher) NextLeafHash() (leafHash []byte, err error)
NextLeafHash implements LeafHasher
type MessageSubtreeHasher ¶
type MessageSubtreeHasher struct {
// contains filtered or unexported fields
}
MessageSubtreeHasher implements merkletree.SubtreeHasher by reading leaf data from an underlying slice of messages.
func NewMessageSubtreeHasher ¶
func NewMessageSubtreeHasher(messages *[]Message, h hash.Hash) *MessageSubtreeHasher
NewMessageSubtreeHasher returns a new MessageSubtreeHasher for a pointer to a slice of messages.
func (*MessageSubtreeHasher) NextSubtreeRoot ¶
func (msh *MessageSubtreeHasher) NextSubtreeRoot(subtreeSize int) ([]byte, error)
NextSubtreeRoot implements SubtreeHasher.
func (*MessageSubtreeHasher) Skip ¶
func (msh *MessageSubtreeHasher) Skip(n int) error
Skip implements SubtreeHasher.
type PetitionApp ¶
type PetitionApp struct {
// contains filtered or unexported fields
}
func (*PetitionApp) BlockHead ¶
func (app *PetitionApp) BlockHead() []byte
func (*PetitionApp) GenerateAddPetitionTransaction ¶
func (app *PetitionApp) GenerateAddPetitionTransaction(text string) Message
func (*PetitionApp) GenerateSignPetitionTransaction ¶
func (app *PetitionApp) GenerateSignPetitionTransaction(key crypto.PrivKey, petition uint64) Message
func (*PetitionApp) Namespace ¶
func (app *PetitionApp) Namespace() [namespaceSize]byte
func (*PetitionApp) Petition ¶
func (app *PetitionApp) Petition(petition uint64) uint64
func (*PetitionApp) ProcessAddPetitionMessage ¶
func (app *PetitionApp) ProcessAddPetitionMessage(apm *AddPetitionMessage)
func (*PetitionApp) ProcessMessage ¶
func (app *PetitionApp) ProcessMessage(message Message)
func (*PetitionApp) ProcessSignPetitionMessage ¶
func (app *PetitionApp) ProcessSignPetitionMessage(spm *SignPetitionMessage)
func (*PetitionApp) SetBlockHead ¶
func (app *PetitionApp) SetBlockHead(hash []byte)
type PetitionAppTransaction ¶
type PetitionAppTransaction struct { // Types that are valid to be assigned to Message: // *PetitionAppTransaction_Apm // *PetitionAppTransaction_Spm Message isPetitionAppTransaction_Message `protobuf_oneof:"message"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*PetitionAppTransaction) Descriptor ¶
func (*PetitionAppTransaction) Descriptor() ([]byte, []int)
func (*PetitionAppTransaction) GetApm ¶
func (m *PetitionAppTransaction) GetApm() *AddPetitionMessage
func (*PetitionAppTransaction) GetMessage ¶
func (m *PetitionAppTransaction) GetMessage() isPetitionAppTransaction_Message
func (*PetitionAppTransaction) GetSpm ¶
func (m *PetitionAppTransaction) GetSpm() *SignPetitionMessage
func (*PetitionAppTransaction) ProtoMessage ¶
func (*PetitionAppTransaction) ProtoMessage()
func (*PetitionAppTransaction) Reset ¶
func (m *PetitionAppTransaction) Reset()
func (*PetitionAppTransaction) String ¶
func (m *PetitionAppTransaction) String() string
func (*PetitionAppTransaction) XXX_DiscardUnknown ¶
func (m *PetitionAppTransaction) XXX_DiscardUnknown()
func (*PetitionAppTransaction) XXX_Marshal ¶
func (m *PetitionAppTransaction) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*PetitionAppTransaction) XXX_Merge ¶
func (m *PetitionAppTransaction) XXX_Merge(src proto.Message)
func (*PetitionAppTransaction) XXX_OneofWrappers ¶
func (*PetitionAppTransaction) XXX_OneofWrappers() []interface{}
XXX_OneofWrappers is for the internal use of the proto package.
func (*PetitionAppTransaction) XXX_Size ¶
func (m *PetitionAppTransaction) XXX_Size() int
func (*PetitionAppTransaction) XXX_Unmarshal ¶
func (m *PetitionAppTransaction) XXX_Unmarshal(b []byte) error
type PetitionAppTransaction_Apm ¶
type PetitionAppTransaction_Apm struct {
Apm *AddPetitionMessage `protobuf:"bytes,1,opt,name=apm,oneof"`
}
type PetitionAppTransaction_Spm ¶
type PetitionAppTransaction_Spm struct {
Spm *SignPetitionMessage `protobuf:"bytes,2,opt,name=spm,oneof"`
}
type ProbabilisticBlock ¶
type ProbabilisticBlock struct {
// contains filtered or unexported fields
}
ProbabilisticBlock represents a block designed for the Probabilistic Validity Rule.
func (*ProbabilisticBlock) AddMessage ¶
func (pb *ProbabilisticBlock) AddMessage(message Message)
AddMessage adds a message to the block.
func (*ProbabilisticBlock) ApplicationProof ¶
func (pb *ProbabilisticBlock) ApplicationProof(namespace [namespaceSize]byte) (int, int, [][][]byte, *[]Message, [][]byte)
ApplicationProof creates a Merkle proof for all of the messages in a block for an application namespace. All proofs are created from row roots only.
func (*ProbabilisticBlock) ColumnRoots ¶
func (pb *ProbabilisticBlock) ColumnRoots() [][]byte
ColumnRoots returns the Merkle roots of the columns of the block.
func (*ProbabilisticBlock) DependencyProven ¶
func (pb *ProbabilisticBlock) DependencyProven(hash []byte) bool
func (*ProbabilisticBlock) Digest ¶
func (pb *ProbabilisticBlock) Digest() []byte
Digest computes the hash of the block.
func (*ProbabilisticBlock) Messages ¶
func (pb *ProbabilisticBlock) Messages() []Message
Messages returns the block's messages.
func (*ProbabilisticBlock) PrevHash ¶
func (pb *ProbabilisticBlock) PrevHash() []byte
PrevHash returns the hash of the previous block.
func (*ProbabilisticBlock) ProcessSamplesResponse ¶
func (pb *ProbabilisticBlock) ProcessSamplesResponse(response *SampleResponse) bool
func (*ProbabilisticBlock) ProveDependency ¶
func (pb *ProbabilisticBlock) ProveDependency(index int) ([]byte, [][]byte, error)
func (*ProbabilisticBlock) RequestSamples ¶
func (pb *ProbabilisticBlock) RequestSamples(n int) (*SampleRequest, error)
func (*ProbabilisticBlock) RespondSamples ¶
func (pb *ProbabilisticBlock) RespondSamples(request *SampleRequest) *SampleResponse
func (*ProbabilisticBlock) RowRoots ¶
func (pb *ProbabilisticBlock) RowRoots() [][]byte
RowRoots returns the Merkle roots of the rows of the block.
func (*ProbabilisticBlock) SquareWidth ¶
func (pb *ProbabilisticBlock) SquareWidth() int
SquareWidth returns the width of coded data square of the block.
func (*ProbabilisticBlock) Valid ¶
func (pb *ProbabilisticBlock) Valid() bool
Valid returns true if the block is valid.
func (*ProbabilisticBlock) VerifyApplicationProof ¶
func (pb *ProbabilisticBlock) VerifyApplicationProof(namespace [namespaceSize]byte, proofStart int, proofEnd int, proofs [][][]byte, messages *[]Message, hashes [][]byte) bool
VerifyApplicationProof verifies a Merkle proof for all of the messages in a block for an application namespace.
func (*ProbabilisticBlock) VerifyDependency ¶
func (pb *ProbabilisticBlock) VerifyDependency(index int, hash []byte, proof [][]byte) bool
type RegisterTransaction ¶
type RegisterTransaction struct { Owner []byte `protobuf:"bytes,1,req,name=owner" json:"owner,omitempty"` Name []byte `protobuf:"bytes,2,req,name=name" json:"name,omitempty"` Signature []byte `protobuf:"bytes,3,req,name=signature" json:"signature,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*RegisterTransaction) Descriptor ¶
func (*RegisterTransaction) Descriptor() ([]byte, []int)
func (*RegisterTransaction) GetName ¶
func (m *RegisterTransaction) GetName() []byte
func (*RegisterTransaction) GetOwner ¶
func (m *RegisterTransaction) GetOwner() []byte
func (*RegisterTransaction) GetSignature ¶
func (m *RegisterTransaction) GetSignature() []byte
func (*RegisterTransaction) ProtoMessage ¶
func (*RegisterTransaction) ProtoMessage()
func (*RegisterTransaction) Reset ¶
func (m *RegisterTransaction) Reset()
func (*RegisterTransaction) String ¶
func (m *RegisterTransaction) String() string
func (*RegisterTransaction) XXX_DiscardUnknown ¶
func (m *RegisterTransaction) XXX_DiscardUnknown()
func (*RegisterTransaction) XXX_Marshal ¶
func (m *RegisterTransaction) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*RegisterTransaction) XXX_Merge ¶
func (m *RegisterTransaction) XXX_Merge(src proto.Message)
func (*RegisterTransaction) XXX_Size ¶
func (m *RegisterTransaction) XXX_Size() int
func (*RegisterTransaction) XXX_Unmarshal ¶
func (m *RegisterTransaction) XXX_Unmarshal(b []byte) error
type RegisterTransactionMessage ¶
type RegisterTransactionMessage struct { Name []byte `protobuf:"bytes,1,req,name=name" json:"name,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*RegisterTransactionMessage) Descriptor ¶
func (*RegisterTransactionMessage) Descriptor() ([]byte, []int)
func (*RegisterTransactionMessage) GetName ¶
func (m *RegisterTransactionMessage) GetName() []byte
func (*RegisterTransactionMessage) ProtoMessage ¶
func (*RegisterTransactionMessage) ProtoMessage()
func (*RegisterTransactionMessage) Reset ¶
func (m *RegisterTransactionMessage) Reset()
func (*RegisterTransactionMessage) String ¶
func (m *RegisterTransactionMessage) String() string
func (*RegisterTransactionMessage) XXX_DiscardUnknown ¶
func (m *RegisterTransactionMessage) XXX_DiscardUnknown()
func (*RegisterTransactionMessage) XXX_Marshal ¶
func (m *RegisterTransactionMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*RegisterTransactionMessage) XXX_Merge ¶
func (m *RegisterTransactionMessage) XXX_Merge(src proto.Message)
func (*RegisterTransactionMessage) XXX_Size ¶
func (m *RegisterTransactionMessage) XXX_Size() int
func (*RegisterTransactionMessage) XXX_Unmarshal ¶
func (m *RegisterTransactionMessage) XXX_Unmarshal(b []byte) error
type Registrar ¶
type Registrar struct {
// contains filtered or unexported fields
}
func (*Registrar) GenerateTransaction ¶
func (*Registrar) ProcessMessage ¶
func (*Registrar) SetBlockHead ¶
func (*Registrar) SetNamespace ¶
type SampleRequest ¶
type SampleResponse ¶
type SampleResponse struct {
Proofs [][][]byte
}
type SignPetitionMessage ¶
type SignPetitionMessage struct { Id *uint64 `protobuf:"varint,1,req,name=id" json:"id,omitempty"` Signature []byte `protobuf:"bytes,2,req,name=signature" json:"signature,omitempty"` Signer []byte `protobuf:"bytes,3,req,name=signer" json:"signer,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*SignPetitionMessage) Descriptor ¶
func (*SignPetitionMessage) Descriptor() ([]byte, []int)
func (*SignPetitionMessage) GetId ¶
func (m *SignPetitionMessage) GetId() uint64
func (*SignPetitionMessage) GetSignature ¶
func (m *SignPetitionMessage) GetSignature() []byte
func (*SignPetitionMessage) GetSigner ¶
func (m *SignPetitionMessage) GetSigner() []byte
func (*SignPetitionMessage) ProtoMessage ¶
func (*SignPetitionMessage) ProtoMessage()
func (*SignPetitionMessage) Reset ¶
func (m *SignPetitionMessage) Reset()
func (*SignPetitionMessage) String ¶
func (m *SignPetitionMessage) String() string
func (*SignPetitionMessage) XXX_DiscardUnknown ¶
func (m *SignPetitionMessage) XXX_DiscardUnknown()
func (*SignPetitionMessage) XXX_Marshal ¶
func (m *SignPetitionMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*SignPetitionMessage) XXX_Merge ¶
func (m *SignPetitionMessage) XXX_Merge(src proto.Message)
func (*SignPetitionMessage) XXX_Size ¶
func (m *SignPetitionMessage) XXX_Size() int
func (*SignPetitionMessage) XXX_Unmarshal ¶
func (m *SignPetitionMessage) XXX_Unmarshal(b []byte) error
type SimpleBlock ¶
type SimpleBlock struct {
// contains filtered or unexported fields
}
SimpleBlock represents a block designed for the Simple Validity Rule.
func (*SimpleBlock) AddMessage ¶
func (sb *SimpleBlock) AddMessage(message Message)
AddMessage adds a message to the block.
func (*SimpleBlock) ApplicationProof ¶
func (sb *SimpleBlock) ApplicationProof(namespace [namespaceSize]byte) (int, int, [][]byte, *[]Message, [][]byte)
ApplicationProof creates a Merkle proof for all of the messages in a block for an application namespace.
func (*SimpleBlock) DependencyProven ¶
func (sb *SimpleBlock) DependencyProven(hash []byte) bool
func (*SimpleBlock) Digest ¶
func (sb *SimpleBlock) Digest() []byte
Digest computes the hash of the block.
func (*SimpleBlock) Messages ¶
func (sb *SimpleBlock) Messages() []Message
Messages returns the block's messages.
func (*SimpleBlock) MessagesRoot ¶
func (sb *SimpleBlock) MessagesRoot() []byte
MessagesRoot returns the Merkle root of the messages in the block.
func (*SimpleBlock) PrevHash ¶
func (sb *SimpleBlock) PrevHash() []byte
PrevHash returns the hash of the previous block.
func (*SimpleBlock) ProveDependency ¶
func (sb *SimpleBlock) ProveDependency(index int) ([]byte, [][]byte, error)
func (*SimpleBlock) Valid ¶
func (sb *SimpleBlock) Valid() bool
Valid returns true if the block is valid.
func (*SimpleBlock) VerifyApplicationProof ¶
func (sb *SimpleBlock) VerifyApplicationProof(namespace [namespaceSize]byte, proofStart int, proofEnd int, proof [][]byte, messages *[]Message, hashes [][]byte) bool
VerifyApplicationProof verifies a Merkle proof for all of the messages in a block for an application namespace.
func (*SimpleBlock) VerifyDependency ¶
func (sb *SimpleBlock) VerifyDependency(index int, hash []byte, proof [][]byte) bool
type SimpleBlockStore ¶
type SimpleBlockStore struct {
// contains filtered or unexported fields
}
SimpleBlockStore is a simple in-memory block store.
func NewSimpleBlockStore ¶
func NewSimpleBlockStore() *SimpleBlockStore
NewSimpleBlockStore creates a new empty simple block store.
func (*SimpleBlockStore) Del ¶
func (sbs *SimpleBlockStore) Del(key []byte) error
Del deletes a key.
type SimpleMap ¶
type SimpleMap struct {
// contains filtered or unexported fields
}
SimpleMap is a simple in-memory map.
type TransferCallback ¶
Source Files
¶
- app_currency.go
- app_currency.pb.go
- app_dummy.go
- app_dummy.pb.go
- app_petition.go
- app_petition.pb.go
- app_registrar.go
- app_registrar.pb.go
- application.go
- block.go
- blockchain.go
- blockstore.go
- constants.go
- flagger.go
- flaghasher.go
- mapstore.go
- merkletree_exports.go
- message.go
- namespacedummyflagger.go
- probabilisticblock.go
- simpleblock.go
- treehashers.go