README

Wavelet

GoDoc Discord MIT licensed Build Status Go Report Card Coverage Statusd

wavelet is an open ledger for scalable, mission-critical, decentralized WebAssembly applications.

Wavelet's very first protocol specification was written by Kenta Iwasaki and Heyang Zhou. This repository serves as Wavelet's initial Go implementation written by the Perlin team.

Refer to the docs located here to learn how to locally setup your own three-node cluster, to learn how to write and deploy your very first WebAssembly smart contract, or to learn how Wavelet actually works.

We're hiring!

Here at Perlin, we spend days and weeks debating, tinkering, and researching what is out there in academia to bring to industries truly resilient, open-source, secure, economic, and decentralized software to empower companies, startups, and users.

Our doors are open to academics that have a knack for distributed systems, engineers that want to explore unknown waters, frontend developers that want to make and evangelize the next generation of customer-facing applications, and graphics designers that yearn to instrument together greater user experiences for decentralized applications.

Contributions

First of all, thank you so much for taking part in our efforts for creating the ultimate decentralized ledger.

All code contributions to wavelet should comply with all idiomatic Go standards listed here.

All commit messages should be in the format:

module_name_1, module_name_2: description of the changes you made to the two
    modules here as a sentence

Be sure to use only imperative, present tense within your commit messages and optionally include motivation for your changes two lines breaks away from your commit message.

This allows other maintainers and contributors to know which modules you are modifying/creating within the code/docs repository.

Lastly, if you'd like to talk to us or any of the team in real-time, be sure to join our Discord server!

We are heavily active, ready to answer any questions/assist you with any code/doc contributions at almost any time.

License

wavelet, and all of its source code is released under the MIT License.

Documentation

Overview

    Package wavelet is a generated protocol buffer package.

    It is generated from these files:

    src/rpc.proto
    

    It has these top-level messages:

    QueryRequest
    QueryResponse
    OutOfSyncRequest
    OutOfSyncResponse
    SyncInfo
    SyncRequest
    SyncResponse
    DownloadTxRequest
    DownloadMissingTxRequest
    DownloadTxResponse
    Transactions
    Empty
    

    Index

    Constants

    View Source
    const (
    	SizeTransactionID   = blake2b.Size256
    	SizeTransactionSeed = blake2b.Size256
    	SizeRoundID         = blake2b.Size256
    	SizeMerkleNodeID    = md5.Size
    	SizeAccountID       = 32
    	SizeSignature       = 64
    )
    View Source
    const (
    	// PayloadParamNameRecipient defines a string representation of the recipient payload param.
    	PayloadParamNameRecipient = "recipient"
    
    	// PayloadParamNameAmount defines a string representation of the amount payload param.
    	PayloadParamNameAmount = "amount"
    
    	// PayloadParamNameGasLimit defines a string representation of the gas_limit payload param.
    	PayloadParamNameGasLimit = "gas_limit"
    
    	// PayloadParamNameGasDeposit defines a string representation of the gas_deposit payload param.
    	PayloadParamNameGasDeposit = "gas_deposit"
    
    	// PayloadParamNameFuncName defines a string representation of the fn_name payload param.
    	PayloadParamNameFuncName = "fn_name"
    
    	// PayloadParamNameFuncPayload defines a string representation of the fn_payload payload param.
    	PayloadParamNameFuncPayload = "fn_payload"
    
    	// PayloadParamNameOperation defines a string representation of the operation payload param.
    	PayloadParamNameOperation = "operation"
    
    	// PayloadParamNameContractCode defines a string representation of the contract_code payload param.
    	PayloadParamNameContractCode = "contract_code"
    )
    View Source
    const (
    	PageSize = 65536
    )

    Variables

    View Source
    var (
    	ZeroTransactionID TransactionID
    	ZeroRoundID       RoundID
    	ZeroMerkleNodeID  MerkleNodeID
    	ZeroAccountID     AccountID
    	ZeroSignature     Signature
    
    	ZeroRoundPtr = &Round{}
    
    	ZeroPage = make([]byte, PageSize)
    )
    View Source
    var (
    	ErrMissingParents           = errors.New("parents for transaction are not in graph")
    	ErrAlreadyExists            = errors.New("transaction already exists in the graph")
    	ErrDepthTooLow              = errors.New("transaction depth is too low")
    	ErrParentDepthLimitExceeded = errors.New("transactions parents exceed depth limit")
    )
    View Source
    var (
    	ErrInvalidLengthRpc = fmt.Errorf("proto: negative length found during unmarshaling")
    	ErrIntOverflowRpc   = fmt.Errorf("proto: integer overflow")
    )
    View Source
    var (
    	// ErrNoTag defines an error describing an empty Tag.
    	ErrNoTag = errors.New("no tag specified")
    
    	// ErrInvalidTag defines an error describing an invalid TransactionTag.
    	ErrInvalidTag = errors.New("tag is invalid")
    
    	// ErrCouldNotParse defines an error describing the inability to parse a given payload.
    	ErrCouldNotParse = errors.New("could not parse the given payload")
    
    	// ErrNilField defines an error describing a field value equal to nil.
    	ErrNilField = errors.New("field is nil")
    
    	// ErrInvalidOperation defines an error describing an invalid operation value.
    	ErrInvalidOperation = errors.New("operation is invalid")
    
    	// ErrInvalidAccountIDSize defines an error describing an invalid account ID size.
    	ErrInvalidAccountIDSize = errors.New("account ID is of an invalid size")
    )
    View Source
    var (
    	ErrContractFunctionNotFound = errors.New("contract: smart contract func not found")
    )
    View Source
    var (
    	ErrOutOfSync = errors.New("Node is currently ouf of sync. Please try again later.")
    )
    View Source
    var (
    	FaucetWallet = "" /* 128-byte string literal not displayed */
    )

    Functions

    func AcquireQueue

    func AcquireQueue() *queue.Queue

    func ApplyTransaction

    func ApplyTransaction(tree *avl.Tree, round *Round, tx *Transaction) error

      Apply the transaction and immediately write the states into the tree. If you have many transactions to apply, consider using CollapseContext.

      func CloneVM

      func CloneVM(vm *exec.VirtualMachine, gasPolicy compiler.GasPolicy, importResolver exec.ImportResolver) (*exec.VirtualMachine, error)

      func CollectVotesForFinalization

      func CollectVotesForFinalization(
      	accounts *Accounts,
      	snowball *Snowball,
      	voteChan <-chan finalizationVote,
      	wg *sync.WaitGroup,
      	snowballK int,
      )

      func CollectVotesForSync

      func CollectVotesForSync(
      	accounts *Accounts,
      	snowball *Snowball,
      	voteChan <-chan syncVote,
      	wg *sync.WaitGroup,
      	snowballK int,
      )

      func ExportGraphDOT

      func ExportGraphDOT(round *Round, graph *Graph)

      func LoadContractGlobals

      func LoadContractGlobals(snapshot *avl.Tree, id AccountID) ([]int64, bool)

      func LoadContractMemorySnapshot

      func LoadContractMemorySnapshot(snapshot *avl.Tree, id AccountID) []byte

      func ParseJSON

      func ParseJSON(data []byte, tag string) ([]byte, error)

        ParseJSON parses the given JSON payload input.

        func ReadAccountBalance

        func ReadAccountBalance(tree *avl.Tree, id AccountID) (uint64, bool)

        func ReadAccountContractCode

        func ReadAccountContractCode(tree *avl.Tree, id TransactionID) ([]byte, bool)

        func ReadAccountContractGasBalance

        func ReadAccountContractGasBalance(tree *avl.Tree, id TransactionID) (uint64, bool)

        func ReadAccountContractGlobals

        func ReadAccountContractGlobals(tree *avl.Tree, id TransactionID) ([]byte, bool)

        func ReadAccountContractNumPages

        func ReadAccountContractNumPages(tree *avl.Tree, id TransactionID) (uint64, bool)

        func ReadAccountContractPage

        func ReadAccountContractPage(tree *avl.Tree, id TransactionID, idx uint64) ([]byte, bool)

        func ReadAccountNonce

        func ReadAccountNonce(tree *avl.Tree, id AccountID) (uint64, bool)

        func ReadAccountReward

        func ReadAccountReward(tree *avl.Tree, id AccountID) (uint64, bool)

        func ReadAccountStake

        func ReadAccountStake(tree *avl.Tree, id AccountID) (uint64, bool)

        func ReadAccountsLen

        func ReadAccountsLen(tree *avl.Tree) uint64

        func RegisterWaveletServer

        func RegisterWaveletServer(s *grpc.Server, srv WaveletServer)

        func ReleaseQueue

        func ReleaseQueue(q *queue.Queue)

        func SaveContractGlobals

        func SaveContractGlobals(snapshot *avl.Tree, id AccountID, globals []int64)

        func SaveContractMemorySnapshot

        func SaveContractMemorySnapshot(snapshot *avl.Tree, id AccountID, mem []byte)

        func SelectPeers

        func SelectPeers(peers []*grpc.ClientConn, amount int) ([]*grpc.ClientConn, error)

        func SetGenesisByNetwork

        func SetGenesisByNetwork(name string) error

        func StoreRewardWithdrawalRequest

        func StoreRewardWithdrawalRequest(tree *avl.Tree, rw RewardWithdrawalRequest)

        func StoreRound

        func StoreRound(kv store.KV, round Round, currentIx, oldestIx uint32, storedCount uint8) error

        func WriteAccountBalance

        func WriteAccountBalance(tree *avl.Tree, id AccountID, balance uint64)

        func WriteAccountContractCode

        func WriteAccountContractCode(tree *avl.Tree, id TransactionID, code []byte)

        func WriteAccountContractGasBalance

        func WriteAccountContractGasBalance(tree *avl.Tree, id TransactionID, gasBalance uint64)

        func WriteAccountContractGlobals

        func WriteAccountContractGlobals(tree *avl.Tree, id TransactionID, globals []byte)

        func WriteAccountContractNumPages

        func WriteAccountContractNumPages(tree *avl.Tree, id TransactionID, numPages uint64)

        func WriteAccountContractPage

        func WriteAccountContractPage(tree *avl.Tree, id TransactionID, idx uint64, page []byte)

        func WriteAccountNonce

        func WriteAccountNonce(tree *avl.Tree, id AccountID, nonce uint64)

        func WriteAccountReward

        func WriteAccountReward(tree *avl.Tree, id AccountID, reward uint64)

        func WriteAccountStake

        func WriteAccountStake(tree *avl.Tree, id AccountID, stake uint64)

        func WriteAccountsLen

        func WriteAccountsLen(tree *avl.Tree, size uint64)

        Types

        type AccountID

        type AccountID = [SizeAccountID]byte

        type Accounts

        type Accounts struct {
        	sync.RWMutex
        	// contains filtered or unexported fields
        }

        func NewAccounts

        func NewAccounts(kv store.KV) *Accounts

        func (*Accounts) Commit

        func (a *Accounts) Commit(new *avl.Tree) error

        func (*Accounts) GC

        func (a *Accounts) GC(ctx context.Context, wg *sync.WaitGroup)

          GC periodically garbage collects every 5 seconds. Only one instance of GC worker can run at any time.

          func (*Accounts) Snapshot

          func (a *Accounts) Snapshot() *avl.Tree

          type Batch

          type Batch struct {
          	Size     uint8
          	Tags     []uint8
          	Payloads [][]byte
          }

          func ParseBatch

          func ParseBatch(payload []byte) (Batch, error)

            ParseBatch parses and performs sanity checks on the payload of a batch transaction.

            func (*Batch) AddContract

            func (b *Batch) AddContract(c Contract) error

              AddContract adds a Contract payload into a batch.

              func (*Batch) AddNop

              func (b *Batch) AddNop() error

                AddNop adds a Nop payload into a batch.

                func (*Batch) AddStake

                func (b *Batch) AddStake(s Stake) error

                  AddStake adds a Stake payload into a batch.

                  func (*Batch) AddTransfer

                  func (b *Batch) AddTransfer(t Transfer) error

                    AddTransfer adds a Transfer payload into a batch.

                    func (Batch) Marshal

                    func (b Batch) Marshal() []byte

                    type CollapseContext

                    type CollapseContext struct {
                    	VMCache *lru.LRU
                    	// contains filtered or unexported fields
                    }

                      WARNING: While using this, the tree must not be modified.

                      func NewCollapseContext

                      func NewCollapseContext(tree *avl.Tree) *CollapseContext

                      func (*CollapseContext) ApplyTransaction

                      func (c *CollapseContext) ApplyTransaction(round *Round, tx *Transaction) error

                        Apply a transaction by writing the states into memory. After you've finished, you MUST call CollapseContext.Flush() to actually write the states into the tree.

                        func (*CollapseContext) Flush

                        func (c *CollapseContext) Flush() error

                          Write the changes into the tree.

                          func (*CollapseContext) GetContractState

                          func (c *CollapseContext) GetContractState(id AccountID) (*VMState, bool)

                          func (*CollapseContext) ReadAccountBalance

                          func (c *CollapseContext) ReadAccountBalance(id AccountID) (uint64, bool)

                          func (*CollapseContext) ReadAccountContractCode

                          func (c *CollapseContext) ReadAccountContractCode(id TransactionID) ([]byte, bool)

                          func (*CollapseContext) ReadAccountContractGasBalance

                          func (c *CollapseContext) ReadAccountContractGasBalance(id TransactionID) (uint64, bool)

                          func (*CollapseContext) ReadAccountNonce

                          func (c *CollapseContext) ReadAccountNonce(id AccountID) (uint64, bool)

                          func (*CollapseContext) ReadAccountReward

                          func (c *CollapseContext) ReadAccountReward(id AccountID) (uint64, bool)

                          func (*CollapseContext) ReadAccountStake

                          func (c *CollapseContext) ReadAccountStake(id AccountID) (uint64, bool)

                          func (*CollapseContext) ReadAccountsLen

                          func (c *CollapseContext) ReadAccountsLen() uint64

                          func (*CollapseContext) SetContractState

                          func (c *CollapseContext) SetContractState(id AccountID, state *VMState)

                          func (*CollapseContext) StoreRewardWithdrawalRequest

                          func (c *CollapseContext) StoreRewardWithdrawalRequest(rw RewardWithdrawalRequest)

                          func (*CollapseContext) WriteAccountBalance

                          func (c *CollapseContext) WriteAccountBalance(id AccountID, balance uint64)

                          func (*CollapseContext) WriteAccountContractCode

                          func (c *CollapseContext) WriteAccountContractCode(id TransactionID, code []byte)

                          func (*CollapseContext) WriteAccountContractGasBalance

                          func (c *CollapseContext) WriteAccountContractGasBalance(id TransactionID, gasBalance uint64)

                          func (*CollapseContext) WriteAccountNonce

                          func (c *CollapseContext) WriteAccountNonce(id AccountID, nonce uint64)

                          func (*CollapseContext) WriteAccountReward

                          func (c *CollapseContext) WriteAccountReward(id AccountID, reward uint64)

                          func (*CollapseContext) WriteAccountStake

                          func (c *CollapseContext) WriteAccountStake(id AccountID, stake uint64)

                          func (*CollapseContext) WriteAccountsLen

                          func (c *CollapseContext) WriteAccountsLen(size uint64)

                          type CollapseState

                          type CollapseState struct {
                          	// contains filtered or unexported fields
                          }

                          type Contract

                          type Contract struct {
                          	GasLimit   uint64
                          	GasDeposit uint64
                          
                          	Params []byte
                          	Code   []byte
                          }

                          func ParseContract

                          func ParseContract(payload []byte) (Contract, error)

                            ParseContract parses and performs sanity checks on the payload of a contract transaction.

                            func (Contract) Marshal

                            func (c Contract) Marshal() []byte

                            type ContractExecutor

                            type ContractExecutor struct {
                            	ID AccountID
                            
                            	Gas              uint64
                            	GasLimitExceeded bool
                            
                            	Payload []byte
                            	Error   []byte
                            
                            	Queue []*Transaction
                            }

                            func (*ContractExecutor) Execute

                            func (e *ContractExecutor) Execute(id AccountID, round *Round, tx *Transaction, amount, gasLimit uint64, name string, params, code []byte, tree *avl.Tree, vmCache *lru.LRU, contractState *VMState) (*VMState, error)

                              contractState is an optional parameter that is used to pass the VMState of the contract. If you cache the VMState, you can pass it. If it's nil, we'll try to load the state from the tree.

                              This function MUST NOT write into the tree. The new or updated VM State must be returned.

                              func (*ContractExecutor) GetCost

                              func (e *ContractExecutor) GetCost(key string) int64

                              func (*ContractExecutor) ResolveFunc

                              func (e *ContractExecutor) ResolveFunc(module, field string) exec.FunctionImport

                              func (*ContractExecutor) ResolveGlobal

                              func (e *ContractExecutor) ResolveGlobal(module, field string) int64

                              type DownloadMissingTxRequest

                              type DownloadMissingTxRequest struct {
                              	Ids [][]byte `protobuf:"bytes,1,rep,name=ids" json:"ids,omitempty"`
                              }

                              func (*DownloadMissingTxRequest) Descriptor

                              func (*DownloadMissingTxRequest) Descriptor() ([]byte, []int)

                              func (*DownloadMissingTxRequest) GetIds

                              func (m *DownloadMissingTxRequest) GetIds() [][]byte

                              func (*DownloadMissingTxRequest) Marshal

                              func (m *DownloadMissingTxRequest) Marshal() (dAtA []byte, err error)

                              func (*DownloadMissingTxRequest) MarshalTo

                              func (m *DownloadMissingTxRequest) MarshalTo(dAtA []byte) (int, error)

                              func (*DownloadMissingTxRequest) ProtoMessage

                              func (*DownloadMissingTxRequest) ProtoMessage()

                              func (*DownloadMissingTxRequest) Reset

                              func (m *DownloadMissingTxRequest) Reset()

                              func (*DownloadMissingTxRequest) Size

                              func (m *DownloadMissingTxRequest) Size() (n int)

                              func (*DownloadMissingTxRequest) String

                              func (m *DownloadMissingTxRequest) String() string

                              func (*DownloadMissingTxRequest) Unmarshal

                              func (m *DownloadMissingTxRequest) Unmarshal(dAtA []byte) error

                              type DownloadTxRequest

                              type DownloadTxRequest struct {
                              	SkipIds [][]byte `protobuf:"bytes,1,rep,name=skip_ids,json=skipIds" json:"skip_ids,omitempty"`
                              	Depth   uint64   `protobuf:"varint,2,opt,name=depth,proto3" json:"depth,omitempty"`
                              }

                              func (*DownloadTxRequest) Descriptor

                              func (*DownloadTxRequest) Descriptor() ([]byte, []int)

                              func (*DownloadTxRequest) GetDepth

                              func (m *DownloadTxRequest) GetDepth() uint64

                              func (*DownloadTxRequest) GetSkipIds

                              func (m *DownloadTxRequest) GetSkipIds() [][]byte

                              func (*DownloadTxRequest) Marshal

                              func (m *DownloadTxRequest) Marshal() (dAtA []byte, err error)

                              func (*DownloadTxRequest) MarshalTo

                              func (m *DownloadTxRequest) MarshalTo(dAtA []byte) (int, error)

                              func (*DownloadTxRequest) ProtoMessage

                              func (*DownloadTxRequest) ProtoMessage()

                              func (*DownloadTxRequest) Reset

                              func (m *DownloadTxRequest) Reset()

                              func (*DownloadTxRequest) Size

                              func (m *DownloadTxRequest) Size() (n int)

                              func (*DownloadTxRequest) String

                              func (m *DownloadTxRequest) String() string

                              func (*DownloadTxRequest) Unmarshal

                              func (m *DownloadTxRequest) Unmarshal(dAtA []byte) error

                              type DownloadTxResponse

                              type DownloadTxResponse struct {
                              	Transactions [][]byte `protobuf:"bytes,1,rep,name=transactions" json:"transactions,omitempty"`
                              }

                              func (*DownloadTxResponse) Descriptor

                              func (*DownloadTxResponse) Descriptor() ([]byte, []int)

                              func (*DownloadTxResponse) GetTransactions

                              func (m *DownloadTxResponse) GetTransactions() [][]byte

                              func (*DownloadTxResponse) Marshal

                              func (m *DownloadTxResponse) Marshal() (dAtA []byte, err error)

                              func (*DownloadTxResponse) MarshalTo

                              func (m *DownloadTxResponse) MarshalTo(dAtA []byte) (int, error)

                              func (*DownloadTxResponse) ProtoMessage

                              func (*DownloadTxResponse) ProtoMessage()

                              func (*DownloadTxResponse) Reset

                              func (m *DownloadTxResponse) Reset()

                              func (*DownloadTxResponse) Size

                              func (m *DownloadTxResponse) Size() (n int)

                              func (*DownloadTxResponse) String

                              func (m *DownloadTxResponse) String() string

                              func (*DownloadTxResponse) Unmarshal

                              func (m *DownloadTxResponse) Unmarshal(dAtA []byte) error

                              type Empty

                              type Empty struct {
                              }

                              func (*Empty) Descriptor

                              func (*Empty) Descriptor() ([]byte, []int)

                              func (*Empty) Marshal

                              func (m *Empty) Marshal() (dAtA []byte, err error)

                              func (*Empty) MarshalTo

                              func (m *Empty) MarshalTo(dAtA []byte) (int, error)

                              func (*Empty) ProtoMessage

                              func (*Empty) ProtoMessage()

                              func (*Empty) Reset

                              func (m *Empty) Reset()

                              func (*Empty) Size

                              func (m *Empty) Size() (n int)

                              func (*Empty) String

                              func (m *Empty) String() string

                              func (*Empty) Unmarshal

                              func (m *Empty) Unmarshal(dAtA []byte) error

                              type Gossiper

                              type Gossiper struct {
                              	// contains filtered or unexported fields
                              }

                              func NewGossiper

                              func NewGossiper(ctx context.Context, client *skademlia.Client, metrics *Metrics) *Gossiper

                              func (*Gossiper) Gossip

                              func (g *Gossiper) Gossip(transactions [][]byte)

                              func (*Gossiper) Push

                              func (g *Gossiper) Push(tx Transaction)

                              type Graph

                              type Graph struct {
                              	sync.RWMutex
                              	// contains filtered or unexported fields
                              }

                              func NewGraph

                              func NewGraph(opts ...GraphOption) *Graph

                              func (*Graph) AddTransaction

                              func (g *Graph) AddTransaction(tx Transaction) error

                                AddTransaction adds sufficiently valid transactions with a strongly connected ancestry to the graph, and otherwise buffers incomplete transactions, or otherwise rejects invalid transactions.

                                func (*Graph) DepthLen

                                func (g *Graph) DepthLen(start *uint64, end *uint64) int

                                  GetTransactionsByDepth returns the number of transactions in graph whose depth is between [start, end].

                                  func (*Graph) FindEligibleCritical

                                  func (g *Graph) FindEligibleCritical(difficulty byte) *Transaction

                                    FindEligibleCritical looks through all transactions in the current round, and returns any one whose number of zero bits prefixed of its seed is >= difficulty.

                                    func (*Graph) FindEligibleParents

                                    func (g *Graph) FindEligibleParents() []*Transaction

                                      FindEligibleParents provides a set of transactions suited to be eligible parents. We consider eligible parents to be transactions closest to the graphs frontier by DEPTH_DIFF that have no children, such that they are leaf nodes of the graph.

                                      func (*Graph) FindTransaction

                                      func (g *Graph) FindTransaction(id TransactionID) *Transaction

                                        FindTransaction returns transaction with id from graph, and nil otherwise.

                                        func (*Graph) GetTransactionsByDepth

                                        func (g *Graph) GetTransactionsByDepth(start *uint64, end *uint64) []*Transaction

                                          GetTransactionsByDepth returns all transactions in graph whose depth is between [start, end].

                                          func (*Graph) Height

                                          func (g *Graph) Height() uint64

                                            Height returns the height of the graph.

                                            func (*Graph) IncompleteLen

                                            func (g *Graph) IncompleteLen() int

                                            func (*Graph) Len

                                            func (g *Graph) Len() int

                                              Len returns the number of transactions in the graph.

                                              func (*Graph) ListTransactions

                                              func (g *Graph) ListTransactions(offset, limit uint64, sender, creator AccountID) (transactions []*Transaction)

                                              func (*Graph) MarkTransactionAsMissing

                                              func (g *Graph) MarkTransactionAsMissing(id TransactionID, depth uint64)

                                                MarkTransactionAsMissing marks a transaction at some given depth to be missing.

                                                func (*Graph) Missing

                                                func (g *Graph) Missing() []TransactionID

                                                func (*Graph) MissingLen

                                                func (g *Graph) MissingLen() int

                                                  MissingLen returns the number of known missing transactions of the graph.

                                                  func (*Graph) PruneBelowDepth

                                                  func (g *Graph) PruneBelowDepth(targetDepth uint64) int

                                                    PruneBelowDepth prunes all transactions and their indices that has a depth equal to or less than targetDepth.

                                                    func (*Graph) RootDepth

                                                    func (g *Graph) RootDepth() uint64

                                                      RootDepth returns the current depth of the root transaction of the graph.

                                                      func (*Graph) UpdateRoot

                                                      func (g *Graph) UpdateRoot(root Transaction)

                                                        UpdateRoot forcefully adds a root transaction to the graph, and updates all relevant graph indices as a result of setting a new root with its new depth.

                                                        func (*Graph) UpdateRootDepth

                                                        func (g *Graph) UpdateRootDepth(rootDepth uint64)

                                                          UpdateRootDepth updates the root depth of the graph to disallow new transactions from being added to the graph whose depth is less than root depth by at most DEPTH_DIFF. It additionally clears away any missing transactions that are at a depth below the root depth by more than DEPTH_DIFF.

                                                          type GraphOption

                                                          type GraphOption func(*Graph)

                                                          func VerifySignatures

                                                          func VerifySignatures() GraphOption

                                                          func WithIndexer

                                                          func WithIndexer(indexer *Indexer) GraphOption

                                                          func WithMetrics

                                                          func WithMetrics(metrics *Metrics) GraphOption

                                                          func WithRoot

                                                          func WithRoot(root Transaction) GraphOption

                                                          type Identifiable

                                                          type Identifiable interface {
                                                          	GetID() string
                                                          }

                                                          type Indexer

                                                          type Indexer struct {
                                                          	*radix.Tree
                                                          }

                                                            Indexer indexes all transaction IDs into a single trie for the purposes of suiting the needs of implementing autocomplete related components.

                                                            func NewIndexer

                                                            func NewIndexer() *Indexer

                                                              NewIndexer instantiates trie indices for indexing complete transactions by their ID.

                                                              func (*Indexer) Find

                                                              func (m *Indexer) Find(query string, max int) (results []string)

                                                                Find searches through complete transaction indices for a specified query string. All indices that queried are in the form of tries.

                                                                func (*Indexer) Index

                                                                func (m *Indexer) Index(id string)

                                                                  Index indexes a single hex-encoded transaction ID. This method is safe to call concurrently.

                                                                  func (*Indexer) Remove

                                                                  func (m *Indexer) Remove(id string)

                                                                    Remove un-indexes a single hex-encoded transaction ID. This method is safe to call concurrently.

                                                                    type Ledger

                                                                    type Ledger struct {
                                                                    	// contains filtered or unexported fields
                                                                    }

                                                                    func NewLedger

                                                                    func NewLedger(kv store.KV, client *skademlia.Client, opts ...Option) *Ledger

                                                                    func (*Ledger) AddTransaction

                                                                    func (l *Ledger) AddTransaction(tx Transaction) error

                                                                      AddTransaction adds a transaction to the ledger. If the transaction has never been added in the ledgers graph before, it is pushed to the gossip mechanism to then be gossiped to this nodes peers. If the transaction is invalid or fails any validation checks, an error is returned. No error is returned if the transaction has already existed int he ledgers graph beforehand.

                                                                      func (*Ledger) BroadcastNop

                                                                      func (l *Ledger) BroadcastNop() *Transaction

                                                                        BroadcastNop has the node send a nop transaction should they have sufficient balance available. They are broadcasted if no other transaction that is not a nop transaction is not broadcasted by the node after 500 milliseconds. These conditions only apply so long as at least one transaction gets broadcasted by the node within the current round. Once a round is tentatively being finalized, a node will stop broadcasting nops.

                                                                        func (*Ledger) BroadcastingNop

                                                                        func (l *Ledger) BroadcastingNop() bool

                                                                          BroadcastingNop returns true if the node is supposed to broadcast nop transaction.

                                                                          func (*Ledger) Close

                                                                          func (l *Ledger) Close()

                                                                            Close stops all goroutines and waits for them to complete.

                                                                            func (*Ledger) FinalizeRounds

                                                                            func (l *Ledger) FinalizeRounds()

                                                                              FinalizeRounds periodically attempts to find an eligible critical transaction suited for the current round. If it finds one, it will then proceed to perform snowball sampling over its peers to decide on a single critical transaction that serves as an ending point for the current consensus round. The round is finalized, transactions of the finalized round are applied to the current ledger state, and the graph is updated to cleanup artifacts from the old round.

                                                                              func (*Ledger) Finalizer

                                                                              func (l *Ledger) Finalizer() *Snowball

                                                                                Finalizer returns the Snowball finalizer which finalizes the contents of individual consensus rounds.

                                                                                func (*Ledger) Find

                                                                                func (l *Ledger) Find(query string, max int) (results []string)

                                                                                  Find searches through complete transaction and account indices for a specified query string. All indices that queried are in the form of tries. It is safe to call this method concurrently.

                                                                                  func (*Ledger) Graph

                                                                                  func (l *Ledger) Graph() *Graph

                                                                                    Graph returns the directed-acyclic-graph of transactions accompanying the ledger.

                                                                                    func (*Ledger) LogChanges

                                                                                    func (l *Ledger) LogChanges(snapshot *avl.Tree, lastRound uint64)

                                                                                      LogChanges logs all changes made to an AVL tree state snapshot for the purposes of logging out changes to account state to Wavelet's HTTP API.

                                                                                      func (*Ledger) PerformConsensus

                                                                                      func (l *Ledger) PerformConsensus()

                                                                                        PerformConsensus spawns workers related to performing consensus, such as pulling missing transactions and incrementally finalizing intervals of transactions in the ledgers graph.

                                                                                        func (*Ledger) Protocol

                                                                                        func (l *Ledger) Protocol() *Protocol

                                                                                          Protocol returns an implementation of WaveletServer to handle incoming RPC and streams for the ledger. The protocol is agnostic to whatever choice of network stack is used with Wavelet, though by default it is intended to be used with gRPC and Noise.

                                                                                          func (*Ledger) PullMissingTransactions

                                                                                          func (l *Ledger) PullMissingTransactions()

                                                                                            PullMissingTransactions is an infinite loop continually sending RPC requests to pull any transactions identified to be missing by the ledger. It periodically samples a random peer from the network, and requests the peer for the contents of all missing transactions by their respective IDs. When the ledger is in amidst synchronizing/teleporting ahead to a new round, the infinite loop will be cleaned up. It is intended to call PullMissingTransactions() in a new goroutine.

                                                                                            func (*Ledger) PushSendQuota

                                                                                            func (l *Ledger) PushSendQuota()

                                                                                              PushSendQuota permits one token into this nodes send quota bucket every millisecond such that the node may add one single transaction into its graph.

                                                                                              func (*Ledger) Restart

                                                                                              func (l *Ledger) Restart() error

                                                                                                Restart restart wavelet process by means of stall detector (approach is platform dependent)

                                                                                                func (*Ledger) Rounds

                                                                                                func (l *Ledger) Rounds() *Rounds

                                                                                                  Rounds returns the round manager for the ledger.

                                                                                                  func (*Ledger) Snapshot

                                                                                                  func (l *Ledger) Snapshot() *avl.Tree

                                                                                                  func (*Ledger) SyncStatus

                                                                                                  func (l *Ledger) SyncStatus() string

                                                                                                  func (*Ledger) SyncToLatestRound

                                                                                                  func (l *Ledger) SyncToLatestRound()

                                                                                                  func (*Ledger) SyncTransactions

                                                                                                  func (l *Ledger) SyncTransactions()

                                                                                                  func (*Ledger) TakeSendQuota

                                                                                                  func (l *Ledger) TakeSendQuota() bool

                                                                                                    TakeSendQuota removes one token from this nodes send quota bucket to signal that the node has added one single transaction into its graph.

                                                                                                    type MerkleNodeID

                                                                                                    type MerkleNodeID = [SizeMerkleNodeID]byte

                                                                                                    type Metrics

                                                                                                    type Metrics struct {
                                                                                                    	// contains filtered or unexported fields
                                                                                                    }

                                                                                                    func NewMetrics

                                                                                                    func NewMetrics(ctx context.Context) *Metrics

                                                                                                    func (*Metrics) Stop

                                                                                                    func (m *Metrics) Stop()

                                                                                                    type Option

                                                                                                    type Option func(cfg *config)

                                                                                                    func WithGenesis

                                                                                                    func WithGenesis(genesis *string) Option

                                                                                                    func WithMaxMemoryMB

                                                                                                    func WithMaxMemoryMB(n uint64) Option

                                                                                                    func WithoutGC

                                                                                                    func WithoutGC() Option

                                                                                                      WithoutGC disables GC. Used for testing purposes.

                                                                                                      type OutOfSyncRequest

                                                                                                      type OutOfSyncRequest struct {
                                                                                                      	RoundIndex uint64 `protobuf:"varint,1,opt,name=round_index,json=roundIndex,proto3" json:"round_index,omitempty"`
                                                                                                      }

                                                                                                      func (*OutOfSyncRequest) Descriptor

                                                                                                      func (*OutOfSyncRequest) Descriptor() ([]byte, []int)

                                                                                                      func (*OutOfSyncRequest) GetRoundIndex

                                                                                                      func (m *OutOfSyncRequest) GetRoundIndex() uint64

                                                                                                      func (*OutOfSyncRequest) Marshal

                                                                                                      func (m *OutOfSyncRequest) Marshal() (dAtA []byte, err error)

                                                                                                      func (*OutOfSyncRequest) MarshalTo

                                                                                                      func (m *OutOfSyncRequest) MarshalTo(dAtA []byte) (int, error)

                                                                                                      func (*OutOfSyncRequest) ProtoMessage

                                                                                                      func (*OutOfSyncRequest) ProtoMessage()

                                                                                                      func (*OutOfSyncRequest) Reset

                                                                                                      func (m *OutOfSyncRequest) Reset()

                                                                                                      func (*OutOfSyncRequest) Size

                                                                                                      func (m *OutOfSyncRequest) Size() (n int)

                                                                                                      func (*OutOfSyncRequest) String

                                                                                                      func (m *OutOfSyncRequest) String() string

                                                                                                      func (*OutOfSyncRequest) Unmarshal

                                                                                                      func (m *OutOfSyncRequest) Unmarshal(dAtA []byte) error

                                                                                                      type OutOfSyncResponse

                                                                                                      type OutOfSyncResponse struct {
                                                                                                      	OutOfSync bool `protobuf:"varint,1,opt,name=out_of_sync,json=outOfSync,proto3" json:"out_of_sync,omitempty"`
                                                                                                      }

                                                                                                      func (*OutOfSyncResponse) Descriptor

                                                                                                      func (*OutOfSyncResponse) Descriptor() ([]byte, []int)

                                                                                                      func (*OutOfSyncResponse) GetOutOfSync

                                                                                                      func (m *OutOfSyncResponse) GetOutOfSync() bool

                                                                                                      func (*OutOfSyncResponse) Marshal

                                                                                                      func (m *OutOfSyncResponse) Marshal() (dAtA []byte, err error)

                                                                                                      func (*OutOfSyncResponse) MarshalTo

                                                                                                      func (m *OutOfSyncResponse) MarshalTo(dAtA []byte) (int, error)

                                                                                                      func (*OutOfSyncResponse) ProtoMessage

                                                                                                      func (*OutOfSyncResponse) ProtoMessage()

                                                                                                      func (*OutOfSyncResponse) Reset

                                                                                                      func (m *OutOfSyncResponse) Reset()

                                                                                                      func (*OutOfSyncResponse) Size

                                                                                                      func (m *OutOfSyncResponse) Size() (n int)

                                                                                                      func (*OutOfSyncResponse) String

                                                                                                      func (m *OutOfSyncResponse) String() string

                                                                                                      func (*OutOfSyncResponse) Unmarshal

                                                                                                      func (m *OutOfSyncResponse) Unmarshal(dAtA []byte) error

                                                                                                      type Protocol

                                                                                                      type Protocol struct {
                                                                                                      	// contains filtered or unexported fields
                                                                                                      }

                                                                                                      func (*Protocol) CheckOutOfSync

                                                                                                      func (p *Protocol) CheckOutOfSync(ctx context.Context, req *OutOfSyncRequest) (*OutOfSyncResponse, error)

                                                                                                      func (*Protocol) DownloadMissingTx

                                                                                                      func (p *Protocol) DownloadMissingTx(ctx context.Context, req *DownloadMissingTxRequest) (*DownloadTxResponse, error)

                                                                                                      func (*Protocol) DownloadTx

                                                                                                      func (p *Protocol) DownloadTx(ctx context.Context, req *DownloadTxRequest) (*DownloadTxResponse, error)

                                                                                                      func (*Protocol) Gossip

                                                                                                      func (p *Protocol) Gossip(stream Wavelet_GossipServer) error

                                                                                                      func (*Protocol) Query

                                                                                                      func (p *Protocol) Query(ctx context.Context, req *QueryRequest) (*QueryResponse, error)

                                                                                                      func (*Protocol) Sync

                                                                                                      func (p *Protocol) Sync(stream Wavelet_SyncServer) error

                                                                                                      type QueryRequest

                                                                                                      type QueryRequest struct {
                                                                                                      	RoundIndex uint64 `protobuf:"varint,1,opt,name=round_index,json=roundIndex,proto3" json:"round_index,omitempty"`
                                                                                                      }

                                                                                                      func (*QueryRequest) Descriptor

                                                                                                      func (*QueryRequest) Descriptor() ([]byte, []int)

                                                                                                      func (*QueryRequest) GetRoundIndex

                                                                                                      func (m *QueryRequest) GetRoundIndex() uint64

                                                                                                      func (*QueryRequest) Marshal

                                                                                                      func (m *QueryRequest) Marshal() (dAtA []byte, err error)

                                                                                                      func (*QueryRequest) MarshalTo

                                                                                                      func (m *QueryRequest) MarshalTo(dAtA []byte) (int, error)

                                                                                                      func (*QueryRequest) ProtoMessage

                                                                                                      func (*QueryRequest) ProtoMessage()

                                                                                                      func (*QueryRequest) Reset

                                                                                                      func (m *QueryRequest) Reset()

                                                                                                      func (*QueryRequest) Size

                                                                                                      func (m *QueryRequest) Size() (n int)

                                                                                                      func (*QueryRequest) String

                                                                                                      func (m *QueryRequest) String() string

                                                                                                      func (*QueryRequest) Unmarshal

                                                                                                      func (m *QueryRequest) Unmarshal(dAtA []byte) error

                                                                                                      type QueryResponse

                                                                                                      type QueryResponse struct {
                                                                                                      	Round []byte `protobuf:"bytes,1,opt,name=round,proto3" json:"round,omitempty"`
                                                                                                      }

                                                                                                      func (*QueryResponse) Descriptor

                                                                                                      func (*QueryResponse) Descriptor() ([]byte, []int)

                                                                                                      func (*QueryResponse) GetRound

                                                                                                      func (m *QueryResponse) GetRound() []byte

                                                                                                      func (*QueryResponse) Marshal

                                                                                                      func (m *QueryResponse) Marshal() (dAtA []byte, err error)

                                                                                                      func (*QueryResponse) MarshalTo

                                                                                                      func (m *QueryResponse) MarshalTo(dAtA []byte) (int, error)

                                                                                                      func (*QueryResponse) ProtoMessage

                                                                                                      func (*QueryResponse) ProtoMessage()

                                                                                                      func (*QueryResponse) Reset

                                                                                                      func (m *QueryResponse) Reset()

                                                                                                      func (*QueryResponse) Size

                                                                                                      func (m *QueryResponse) Size() (n int)

                                                                                                      func (*QueryResponse) String

                                                                                                      func (m *QueryResponse) String() string

                                                                                                      func (*QueryResponse) Unmarshal

                                                                                                      func (m *QueryResponse) Unmarshal(dAtA []byte) error

                                                                                                      type RewardWithdrawalRequest

                                                                                                      type RewardWithdrawalRequest struct {
                                                                                                      	// contains filtered or unexported fields
                                                                                                      }

                                                                                                      func GetRewardWithdrawalRequests

                                                                                                      func GetRewardWithdrawalRequests(tree *avl.Tree, roundLimit uint64) []RewardWithdrawalRequest

                                                                                                      func UnmarshalRewardWithdrawalRequest

                                                                                                      func UnmarshalRewardWithdrawalRequest(r io.Reader) (RewardWithdrawalRequest, error)

                                                                                                      func (RewardWithdrawalRequest) Key

                                                                                                      func (rw RewardWithdrawalRequest) Key() []byte

                                                                                                      func (RewardWithdrawalRequest) Marshal

                                                                                                      func (rw RewardWithdrawalRequest) Marshal() []byte

                                                                                                      type Round

                                                                                                      type Round struct {
                                                                                                      	ID     RoundID
                                                                                                      	Index  uint64
                                                                                                      	Merkle MerkleNodeID
                                                                                                      
                                                                                                      	Transactions uint32
                                                                                                      
                                                                                                      	Start Transaction
                                                                                                      	End   Transaction
                                                                                                      }

                                                                                                        Round represents a network-wide finalized non-overlapping graph depth interval that is denoted by both a critical starting point transaction, and a critical ending point transaction. They contain the expected Merkle root of the ledgers state. They are denoted by either their index or ID, which is the checksum of applying BLAKE2b over its contents.

                                                                                                        func LoadRounds

                                                                                                        func LoadRounds(kv store.KV) ([]*Round, uint32, uint32, error)

                                                                                                        func NewRound

                                                                                                        func NewRound(index uint64, merkle MerkleNodeID, transactions uint32, start, end Transaction) Round

                                                                                                        func UnmarshalRound

                                                                                                        func UnmarshalRound(r io.Reader) (round Round, err error)

                                                                                                        func (Round) ExpectedDifficulty

                                                                                                        func (r Round) ExpectedDifficulty(min byte, scale float64) byte

                                                                                                        func (*Round) GetID

                                                                                                        func (r *Round) GetID() string

                                                                                                        func (Round) Marshal

                                                                                                        func (r Round) Marshal() []byte

                                                                                                        type RoundID

                                                                                                        type RoundID = [SizeRoundID]byte

                                                                                                        type Rounds

                                                                                                        type Rounds struct {
                                                                                                        	sync.RWMutex
                                                                                                        	// contains filtered or unexported fields
                                                                                                        }

                                                                                                        func NewRounds

                                                                                                        func NewRounds(store store.KV, limit uint8) (*Rounds, error)

                                                                                                        func (*Rounds) Count

                                                                                                        func (r *Rounds) Count() uint64

                                                                                                        func (*Rounds) GetByIndex

                                                                                                        func (r *Rounds) GetByIndex(ix uint64) (*Round, error)

                                                                                                        func (*Rounds) Latest

                                                                                                        func (r *Rounds) Latest() *Round

                                                                                                        func (*Rounds) Oldest

                                                                                                        func (r *Rounds) Oldest() *Round

                                                                                                        func (*Rounds) Save

                                                                                                        func (r *Rounds) Save(round *Round) (*Round, error)

                                                                                                        type Signature

                                                                                                        type Signature = [SizeSignature]byte

                                                                                                        type Snowball

                                                                                                        type Snowball struct {
                                                                                                        	sync.RWMutex
                                                                                                        	// contains filtered or unexported fields
                                                                                                        }

                                                                                                        func NewSnowball

                                                                                                        func NewSnowball(opts ...SnowballOption) *Snowball

                                                                                                        func (*Snowball) Decided

                                                                                                        func (s *Snowball) Decided() bool

                                                                                                        func (*Snowball) Prefer

                                                                                                        func (s *Snowball) Prefer(v Identifiable)

                                                                                                        func (*Snowball) Preferred

                                                                                                        func (s *Snowball) Preferred() Identifiable

                                                                                                        func (*Snowball) Progress

                                                                                                        func (s *Snowball) Progress() int

                                                                                                        func (*Snowball) Reset

                                                                                                        func (s *Snowball) Reset()

                                                                                                        func (*Snowball) Tick

                                                                                                        func (s *Snowball) Tick(v Identifiable)

                                                                                                        type SnowballOption

                                                                                                        type SnowballOption func(*Snowball)

                                                                                                        func WithName

                                                                                                        func WithName(name string) SnowballOption

                                                                                                        type Stake

                                                                                                        type Stake struct {
                                                                                                        	Opcode byte
                                                                                                        	Amount uint64
                                                                                                        }

                                                                                                        func ParseStake

                                                                                                        func ParseStake(payload []byte) (Stake, error)

                                                                                                          ParseStake parses and performs sanity checks on the payload of a stake transaction.

                                                                                                          func (Stake) Marshal

                                                                                                          func (s Stake) Marshal() []byte

                                                                                                          type StallDetector

                                                                                                          type StallDetector struct {
                                                                                                          	// contains filtered or unexported fields
                                                                                                          }

                                                                                                          func NewStallDetector

                                                                                                          func NewStallDetector(stop <-chan struct{}, config StallDetectorConfig, delegate StallDetectorDelegate) *StallDetector

                                                                                                          func (*StallDetector) Run

                                                                                                          func (d *StallDetector) Run(wg *sync.WaitGroup)

                                                                                                          type StallDetectorConfig

                                                                                                          type StallDetectorConfig struct {
                                                                                                          	MaxMemoryMB uint64
                                                                                                          }

                                                                                                          type StallDetectorDelegate

                                                                                                          type StallDetectorDelegate struct {
                                                                                                          	PrepareShutdown func(error)
                                                                                                          }

                                                                                                          type SyncInfo

                                                                                                          type SyncInfo struct {
                                                                                                          	LatestRound []byte   `protobuf:"bytes,1,opt,name=latest_round,json=latestRound,proto3" json:"latest_round,omitempty"`
                                                                                                          	Checksums   [][]byte `protobuf:"bytes,2,rep,name=checksums" json:"checksums,omitempty"`
                                                                                                          }

                                                                                                          func (*SyncInfo) Descriptor

                                                                                                          func (*SyncInfo) Descriptor() ([]byte, []int)

                                                                                                          func (*SyncInfo) GetChecksums

                                                                                                          func (m *SyncInfo) GetChecksums() [][]byte

                                                                                                          func (*SyncInfo) GetLatestRound

                                                                                                          func (m *SyncInfo) GetLatestRound() []byte

                                                                                                          func (*SyncInfo) Marshal

                                                                                                          func (m *SyncInfo) Marshal() (dAtA []byte, err error)

                                                                                                          func (*SyncInfo) MarshalTo

                                                                                                          func (m *SyncInfo) MarshalTo(dAtA []byte) (int, error)

                                                                                                          func (*SyncInfo) ProtoMessage

                                                                                                          func (*SyncInfo) ProtoMessage()

                                                                                                          func (*SyncInfo) Reset

                                                                                                          func (m *SyncInfo) Reset()

                                                                                                          func (*SyncInfo) Size

                                                                                                          func (m *SyncInfo) Size() (n int)

                                                                                                          func (*SyncInfo) String

                                                                                                          func (m *SyncInfo) String() string

                                                                                                          func (*SyncInfo) Unmarshal

                                                                                                          func (m *SyncInfo) Unmarshal(dAtA []byte) error

                                                                                                          type SyncRequest

                                                                                                          type SyncRequest struct {
                                                                                                          	// Types that are valid to be assigned to Data:
                                                                                                          	//	*SyncRequest_RoundId
                                                                                                          	//	*SyncRequest_Checksum
                                                                                                          	Data isSyncRequest_Data `protobuf_oneof:"Data"`
                                                                                                          }

                                                                                                          func (*SyncRequest) Descriptor

                                                                                                          func (*SyncRequest) Descriptor() ([]byte, []int)

                                                                                                          func (*SyncRequest) GetChecksum

                                                                                                          func (m *SyncRequest) GetChecksum() []byte

                                                                                                          func (*SyncRequest) GetData

                                                                                                          func (m *SyncRequest) GetData() isSyncRequest_Data

                                                                                                          func (*SyncRequest) GetRoundId

                                                                                                          func (m *SyncRequest) GetRoundId() uint64

                                                                                                          func (*SyncRequest) Marshal

                                                                                                          func (m *SyncRequest) Marshal() (dAtA []byte, err error)

                                                                                                          func (*SyncRequest) MarshalTo

                                                                                                          func (m *SyncRequest) MarshalTo(dAtA []byte) (int, error)

                                                                                                          func (*SyncRequest) ProtoMessage

                                                                                                          func (*SyncRequest) ProtoMessage()

                                                                                                          func (*SyncRequest) Reset

                                                                                                          func (m *SyncRequest) Reset()

                                                                                                          func (*SyncRequest) Size

                                                                                                          func (m *SyncRequest) Size() (n int)

                                                                                                          func (*SyncRequest) String

                                                                                                          func (m *SyncRequest) String() string

                                                                                                          func (*SyncRequest) Unmarshal

                                                                                                          func (m *SyncRequest) Unmarshal(dAtA []byte) error

                                                                                                          func (*SyncRequest) XXX_OneofFuncs

                                                                                                          func (*SyncRequest) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{})

                                                                                                            XXX_OneofFuncs is for the internal use of the proto package.

                                                                                                            type SyncRequest_Checksum

                                                                                                            type SyncRequest_Checksum struct {
                                                                                                            	Checksum []byte `protobuf:"bytes,2,opt,name=checksum,proto3,oneof"`
                                                                                                            }

                                                                                                            func (*SyncRequest_Checksum) MarshalTo

                                                                                                            func (m *SyncRequest_Checksum) MarshalTo(dAtA []byte) (int, error)

                                                                                                            func (*SyncRequest_Checksum) Size

                                                                                                            func (m *SyncRequest_Checksum) Size() (n int)

                                                                                                            type SyncRequest_RoundId

                                                                                                            type SyncRequest_RoundId struct {
                                                                                                            	RoundId uint64 `protobuf:"varint,1,opt,name=round_id,json=roundId,proto3,oneof"`
                                                                                                            }

                                                                                                            func (*SyncRequest_RoundId) MarshalTo

                                                                                                            func (m *SyncRequest_RoundId) MarshalTo(dAtA []byte) (int, error)

                                                                                                            func (*SyncRequest_RoundId) Size

                                                                                                            func (m *SyncRequest_RoundId) Size() (n int)

                                                                                                            type SyncResponse

                                                                                                            type SyncResponse struct {
                                                                                                            	// Types that are valid to be assigned to Data:
                                                                                                            	//	*SyncResponse_Header
                                                                                                            	//	*SyncResponse_Chunk
                                                                                                            	Data isSyncResponse_Data `protobuf_oneof:"Data"`
                                                                                                            }

                                                                                                            func (*SyncResponse) Descriptor

                                                                                                            func (*SyncResponse) Descriptor() ([]byte, []int)

                                                                                                            func (*SyncResponse) GetChunk

                                                                                                            func (m *SyncResponse) GetChunk() []byte

                                                                                                            func (*SyncResponse) GetData

                                                                                                            func (m *SyncResponse) GetData() isSyncResponse_Data

                                                                                                            func (*SyncResponse) GetHeader

                                                                                                            func (m *SyncResponse) GetHeader() *SyncInfo

                                                                                                            func (*SyncResponse) Marshal

                                                                                                            func (m *SyncResponse) Marshal() (dAtA []byte, err error)

                                                                                                            func (*SyncResponse) MarshalTo

                                                                                                            func (m *SyncResponse) MarshalTo(dAtA []byte) (int, error)

                                                                                                            func (*SyncResponse) ProtoMessage

                                                                                                            func (*SyncResponse) ProtoMessage()

                                                                                                            func (*SyncResponse) Reset

                                                                                                            func (m *SyncResponse) Reset()

                                                                                                            func (*SyncResponse) Size

                                                                                                            func (m *SyncResponse) Size() (n int)

                                                                                                            func (*SyncResponse) String

                                                                                                            func (m *SyncResponse) String() string

                                                                                                            func (*SyncResponse) Unmarshal

                                                                                                            func (m *SyncResponse) Unmarshal(dAtA []byte) error

                                                                                                            func (*SyncResponse) XXX_OneofFuncs

                                                                                                            func (*SyncResponse) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{})

                                                                                                              XXX_OneofFuncs is for the internal use of the proto package.

                                                                                                              type SyncResponse_Chunk

                                                                                                              type SyncResponse_Chunk struct {
                                                                                                              	Chunk []byte `protobuf:"bytes,2,opt,name=chunk,proto3,oneof"`
                                                                                                              }

                                                                                                              func (*SyncResponse_Chunk) MarshalTo

                                                                                                              func (m *SyncResponse_Chunk) MarshalTo(dAtA []byte) (int, error)

                                                                                                              func (*SyncResponse_Chunk) Size

                                                                                                              func (m *SyncResponse_Chunk) Size() (n int)

                                                                                                              type SyncResponse_Header

                                                                                                              type SyncResponse_Header struct {
                                                                                                              	Header *SyncInfo `protobuf:"bytes,1,opt,name=header,oneof"`
                                                                                                              }

                                                                                                              func (*SyncResponse_Header) MarshalTo

                                                                                                              func (m *SyncResponse_Header) MarshalTo(dAtA []byte) (int, error)

                                                                                                              func (*SyncResponse_Header) Size

                                                                                                              func (m *SyncResponse_Header) Size() (n int)

                                                                                                              type TestLedger

                                                                                                              type TestLedger struct {
                                                                                                              	// contains filtered or unexported fields
                                                                                                              }

                                                                                                              func NewTestLedger

                                                                                                              func NewTestLedger(t testing.TB, cfg TestLedgerConfig) *TestLedger

                                                                                                              func (*TestLedger) Addr

                                                                                                              func (l *TestLedger) Addr() string

                                                                                                              func (*TestLedger) Applied

                                                                                                              func (l *TestLedger) Applied(tx Transaction) bool

                                                                                                              func (*TestLedger) Balance

                                                                                                              func (l *TestLedger) Balance() uint64

                                                                                                              func (*TestLedger) BalanceOfAccount

                                                                                                              func (l *TestLedger) BalanceOfAccount(node *TestLedger) uint64

                                                                                                              func (*TestLedger) BalanceWithPublicKey

                                                                                                              func (l *TestLedger) BalanceWithPublicKey(key AccountID) uint64

                                                                                                              func (*TestLedger) Benchmark

                                                                                                              func (l *TestLedger) Benchmark(batchSize int) (Transaction, error)

                                                                                                              func (*TestLedger) CallContract

                                                                                                              func (l *TestLedger) CallContract(id [32]byte, amount uint64, gasLimit uint64, funcName string, params []byte) (Transaction, error)

                                                                                                              func (*TestLedger) Cleanup

                                                                                                              func (l *TestLedger) Cleanup()

                                                                                                              func (*TestLedger) Client

                                                                                                              func (l *TestLedger) Client() *skademlia.Client

                                                                                                              func (*TestLedger) DBPath

                                                                                                              func (l *TestLedger) DBPath() string

                                                                                                              func (*TestLedger) DepositGas

                                                                                                              func (l *TestLedger) DepositGas(id [32]byte, gasDeposit uint64) (Transaction, error)

                                                                                                              func (*TestLedger) FindTransaction

                                                                                                              func (l *TestLedger) FindTransaction(t testing.TB, id TransactionID) *Transaction

                                                                                                              func (*TestLedger) GasBalanceOfAddress

                                                                                                              func (l *TestLedger) GasBalanceOfAddress(address [32]byte) uint64

                                                                                                              func (*TestLedger) Leave

                                                                                                              func (l *TestLedger) Leave()

                                                                                                              func (*TestLedger) Ledger

                                                                                                              func (l *TestLedger) Ledger() *Ledger

                                                                                                              func (*TestLedger) Nop

                                                                                                              func (l *TestLedger) Nop() (Transaction, error)

                                                                                                              func (*TestLedger) Pay

                                                                                                              func (l *TestLedger) Pay(to *TestLedger, amount uint64) (Transaction, error)

                                                                                                              func (*TestLedger) PlaceStake

                                                                                                              func (l *TestLedger) PlaceStake(amount uint64) (Transaction, error)

                                                                                                              func (*TestLedger) PrivateKey

                                                                                                              func (l *TestLedger) PrivateKey() edwards25519.PrivateKey

                                                                                                              func (*TestLedger) PublicKey

                                                                                                              func (l *TestLedger) PublicKey() AccountID

                                                                                                              func (*TestLedger) Reward

                                                                                                              func (l *TestLedger) Reward() uint64

                                                                                                              func (*TestLedger) RewardWithPublicKey

                                                                                                              func (l *TestLedger) RewardWithPublicKey(key AccountID) uint64

                                                                                                              func (*TestLedger) RoundIndex

                                                                                                              func (l *TestLedger) RoundIndex() uint64

                                                                                                              func (*TestLedger) SpawnContract

                                                                                                              func (l *TestLedger) SpawnContract(contractPath string, gasLimit uint64, params []byte) (Transaction, error)

                                                                                                              func (*TestLedger) Stake

                                                                                                              func (l *TestLedger) Stake() uint64

                                                                                                              func (*TestLedger) StakeOfAccount

                                                                                                              func (l *TestLedger) StakeOfAccount(node *TestLedger) uint64

                                                                                                              func (*TestLedger) StakeWithPublicKey

                                                                                                              func (l *TestLedger) StakeWithPublicKey(key AccountID) uint64

                                                                                                              func (*TestLedger) WaitForConsensus

                                                                                                              func (l *TestLedger) WaitForConsensus() <-chan bool

                                                                                                              func (*TestLedger) WaitForRound

                                                                                                              func (l *TestLedger) WaitForRound(index uint64) <-chan uint64

                                                                                                              func (*TestLedger) WaitForSync

                                                                                                              func (l *TestLedger) WaitForSync() <-chan bool

                                                                                                              func (*TestLedger) WaitUntilBalance

                                                                                                              func (l *TestLedger) WaitUntilBalance(t testing.TB, balance uint64)

                                                                                                                WaitUntilBalance should be used to ensure that the ledger's balance is of a specific value before continuing.

                                                                                                                func (*TestLedger) WaitUntilConsensus

                                                                                                                func (l *TestLedger) WaitUntilConsensus(t testing.TB)

                                                                                                                func (*TestLedger) WaitUntilRound

                                                                                                                func (l *TestLedger) WaitUntilRound(t testing.TB, round uint64)

                                                                                                                func (*TestLedger) WaitUntilStake

                                                                                                                func (l *TestLedger) WaitUntilStake(t testing.TB, stake uint64)

                                                                                                                func (*TestLedger) WithdrawReward

                                                                                                                func (l *TestLedger) WithdrawReward(amount uint64) (Transaction, error)

                                                                                                                func (*TestLedger) WithdrawStake

                                                                                                                func (l *TestLedger) WithdrawStake(amount uint64) (Transaction, error)

                                                                                                                type TestLedgerConfig

                                                                                                                type TestLedgerConfig struct {
                                                                                                                	Wallet           string
                                                                                                                	Peers            []string
                                                                                                                	N                int
                                                                                                                	RemoveExistingDB bool
                                                                                                                	DBPath           string
                                                                                                                }

                                                                                                                type TestLedgerOption

                                                                                                                type TestLedgerOption func(cfg *TestLedgerConfig)

                                                                                                                func WithDBPath

                                                                                                                func WithDBPath(path string) TestLedgerOption

                                                                                                                func WithKeepExistingDB

                                                                                                                func WithKeepExistingDB() TestLedgerOption

                                                                                                                func WithPeers

                                                                                                                func WithPeers(peers ...string) TestLedgerOption

                                                                                                                func WithWallet

                                                                                                                func WithWallet(wallet string) TestLedgerOption

                                                                                                                type TestNetwork

                                                                                                                type TestNetwork struct {
                                                                                                                	// contains filtered or unexported fields
                                                                                                                }

                                                                                                                func NewTestNetwork

                                                                                                                func NewTestNetwork(t testing.TB, opts ...TestNetworkOption) *TestNetwork

                                                                                                                func (*TestNetwork) AddNode

                                                                                                                func (n *TestNetwork) AddNode(t testing.TB, opts ...TestLedgerOption) *TestLedger

                                                                                                                func (*TestNetwork) Cleanup

                                                                                                                func (n *TestNetwork) Cleanup()

                                                                                                                func (*TestNetwork) Faucet

                                                                                                                func (n *TestNetwork) Faucet() *TestLedger

                                                                                                                func (*TestNetwork) Nodes

                                                                                                                func (n *TestNetwork) Nodes() []*TestLedger

                                                                                                                func (*TestNetwork) SetFaucet

                                                                                                                func (n *TestNetwork) SetFaucet(node *TestLedger)

                                                                                                                func (*TestNetwork) WaitForConsensus

                                                                                                                func (n *TestNetwork) WaitForConsensus(t testing.TB)

                                                                                                                func (*TestNetwork) WaitForRound

                                                                                                                func (n *TestNetwork) WaitForRound(t testing.TB, round uint64)

                                                                                                                  WaitForRound waits for all the nodes in the network to reach the specified round.

                                                                                                                  func (*TestNetwork) WaitForSync

                                                                                                                  func (n *TestNetwork) WaitForSync(t testing.TB)

                                                                                                                  type TestNetworkConfig

                                                                                                                  type TestNetworkConfig struct {
                                                                                                                  	AddFaucet bool
                                                                                                                  }

                                                                                                                  type TestNetworkOption

                                                                                                                  type TestNetworkOption func(cfg *TestNetworkConfig)

                                                                                                                  func WithoutFaucet

                                                                                                                  func WithoutFaucet() TestNetworkOption

                                                                                                                  type Transaction

                                                                                                                  type Transaction struct {
                                                                                                                  	Sender  AccountID // Transaction sender.
                                                                                                                  	Creator AccountID // Transaction creator.
                                                                                                                  
                                                                                                                  	Nonce uint64
                                                                                                                  
                                                                                                                  	ParentIDs   []TransactionID // Transactions parents.
                                                                                                                  	ParentSeeds []TransactionSeed
                                                                                                                  
                                                                                                                  	Depth uint64 // Graph depth.
                                                                                                                  
                                                                                                                  	Tag     sys.Tag
                                                                                                                  	Payload []byte
                                                                                                                  
                                                                                                                  	SenderSignature  Signature
                                                                                                                  	CreatorSignature Signature
                                                                                                                  
                                                                                                                  	ID TransactionID // BLAKE2b(*).
                                                                                                                  
                                                                                                                  	Seed    TransactionSeed // BLAKE2b(Sender || ParentIDs)
                                                                                                                  	SeedLen byte            // Number of prefixed zeroes of BLAKE2b(Sender || ParentIDs).
                                                                                                                  }

                                                                                                                  func AttachSenderToTransaction

                                                                                                                  func AttachSenderToTransaction(sender *skademlia.Keypair, tx Transaction, parents ...*Transaction) Transaction

                                                                                                                    AttachSenderToTransaction immutably attaches sender to a transaction without modifying it in-place.

                                                                                                                    func NewTransaction

                                                                                                                    func NewTransaction(creator *skademlia.Keypair, tag sys.Tag, payload []byte) Transaction

                                                                                                                    func UnmarshalTransaction

                                                                                                                    func UnmarshalTransaction(r io.Reader) (t Transaction, err error)

                                                                                                                    func (Transaction) ComputeSize

                                                                                                                    func (tx Transaction) ComputeSize() int

                                                                                                                    func (Transaction) Fee

                                                                                                                    func (tx Transaction) Fee() uint64

                                                                                                                    func (Transaction) IsCritical

                                                                                                                    func (tx Transaction) IsCritical(difficulty byte) bool

                                                                                                                    func (Transaction) LogicalUnits

                                                                                                                    func (tx Transaction) LogicalUnits() int

                                                                                                                      LogicalUnits counts the total number of atomic logical units of changes the specified tx comprises of.

                                                                                                                      func (Transaction) Marshal

                                                                                                                      func (tx Transaction) Marshal() []byte

                                                                                                                      func (Transaction) String

                                                                                                                      func (tx Transaction) String() string

                                                                                                                      type TransactionID

                                                                                                                      type TransactionID = [SizeTransactionID]byte

                                                                                                                      type TransactionSeed

                                                                                                                      type TransactionSeed = [SizeTransactionSeed]byte

                                                                                                                      type Transactions

                                                                                                                      type Transactions struct {
                                                                                                                      	Transactions [][]byte `protobuf:"bytes,1,rep,name=transactions" json:"transactions,omitempty"`
                                                                                                                      }

                                                                                                                      func (*Transactions) Descriptor

                                                                                                                      func (*Transactions) Descriptor() ([]byte, []int)

                                                                                                                      func (*Transactions) GetTransactions

                                                                                                                      func (m *Transactions) GetTransactions() [][]byte

                                                                                                                      func (*Transactions) Marshal

                                                                                                                      func (m *Transactions) Marshal() (dAtA []byte, err error)

                                                                                                                      func (*Transactions) MarshalTo

                                                                                                                      func (m *Transactions) MarshalTo(dAtA []byte) (int, error)

                                                                                                                      func (*Transactions) ProtoMessage

                                                                                                                      func (*Transactions) ProtoMessage()

                                                                                                                      func (*Transactions) Reset

                                                                                                                      func (m *Transactions) Reset()

                                                                                                                      func (*Transactions) Size

                                                                                                                      func (m *Transactions) Size() (n int)

                                                                                                                      func (*Transactions) String

                                                                                                                      func (m *Transactions) String() string

                                                                                                                      func (*Transactions) Unmarshal

                                                                                                                      func (m *Transactions) Unmarshal(dAtA []byte) error

                                                                                                                      type Transfer

                                                                                                                      type Transfer struct {
                                                                                                                      	Recipient AccountID
                                                                                                                      	Amount    uint64
                                                                                                                      
                                                                                                                      	GasLimit   uint64
                                                                                                                      	GasDeposit uint64
                                                                                                                      
                                                                                                                      	FuncName   []byte
                                                                                                                      	FuncParams []byte
                                                                                                                      }

                                                                                                                      func ParseTransfer

                                                                                                                      func ParseTransfer(payload []byte) (Transfer, error)

                                                                                                                        ParseTransfer parses and performs sanity checks on the payload of a transfer transaction.

                                                                                                                        func (Transfer) Marshal

                                                                                                                        func (t Transfer) Marshal() []byte

                                                                                                                        type VMState

                                                                                                                        type VMState struct {
                                                                                                                        	Globals []int64
                                                                                                                        	Memory  []byte
                                                                                                                        }

                                                                                                                        func SnapshotVMState

                                                                                                                        func SnapshotVMState(vm *exec.VirtualMachine) VMState

                                                                                                                        func (VMState) Apply

                                                                                                                        func (state VMState) Apply(vm *exec.VirtualMachine, gasPolicy compiler.GasPolicy, importResolver exec.ImportResolver, move bool) (*exec.VirtualMachine, error)

                                                                                                                        type WaveletClient

                                                                                                                        type WaveletClient interface {
                                                                                                                        	Gossip(ctx context.Context, opts ...grpc.CallOption) (Wavelet_GossipClient, error)
                                                                                                                        	Query(ctx context.Context, in *QueryRequest, opts ...grpc.CallOption) (*QueryResponse, error)
                                                                                                                        	CheckOutOfSync(ctx context.Context, in *OutOfSyncRequest, opts ...grpc.CallOption) (*OutOfSyncResponse, error)
                                                                                                                        	Sync(ctx context.Context, opts ...grpc.CallOption) (Wavelet_SyncClient, error)
                                                                                                                        	DownloadTx(ctx context.Context, in *DownloadTxRequest, opts ...grpc.CallOption) (*DownloadTxResponse, error)
                                                                                                                        	DownloadMissingTx(ctx context.Context, in *DownloadMissingTxRequest, opts ...grpc.CallOption) (*DownloadTxResponse, error)
                                                                                                                        }

                                                                                                                        func NewWaveletClient

                                                                                                                        func NewWaveletClient(cc *grpc.ClientConn) WaveletClient

                                                                                                                        type Wavelet_GossipClient

                                                                                                                        type Wavelet_GossipClient interface {
                                                                                                                        	Send(*Transactions) error
                                                                                                                        	CloseAndRecv() (*Empty, error)
                                                                                                                        	grpc.ClientStream
                                                                                                                        }

                                                                                                                        type Wavelet_GossipServer

                                                                                                                        type Wavelet_GossipServer interface {
                                                                                                                        	SendAndClose(*Empty) error
                                                                                                                        	Recv() (*Transactions, error)
                                                                                                                        	grpc.ServerStream
                                                                                                                        }

                                                                                                                        type Wavelet_SyncClient

                                                                                                                        type Wavelet_SyncClient interface {
                                                                                                                        	Send(*SyncRequest) error
                                                                                                                        	Recv() (*SyncResponse, error)
                                                                                                                        	grpc.ClientStream
                                                                                                                        }

                                                                                                                        type Wavelet_SyncServer

                                                                                                                        type Wavelet_SyncServer interface {
                                                                                                                        	Send(*SyncResponse) error
                                                                                                                        	Recv() (*SyncRequest, error)
                                                                                                                        	grpc.ServerStream
                                                                                                                        }

                                                                                                                        Directories

                                                                                                                        Path Synopsis
                                                                                                                        cmd
                                                                                                                        internal