Help us shape the future of Go! Take the 2026 Go Developer Survey

node

package
v0.2.7 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2019 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package node implements the ockam.Node interface

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Commit

type Commit struct {
	SignedHeader struct {
		Header struct {
			ChainID     string    `json:"chain_id"`
			Height      string    `json:"height"`
			Time        time.Time `json:"time"`
			NumTxs      string    `json:"num_txs"`
			TotalTxs    string    `json:"total_txs"`
			LastBlockID struct {
				Hash  string `json:"hash"`
				Parts struct {
					Total string `json:"total"`
					Hash  string `json:"hash"`
				} `json:"parts"`
			} `json:"last_block_id"`
			LastCommitHash     string `json:"last_commit_hash"`
			DataHash           string `json:"data_hash"`
			ValidatorsHash     string `json:"validators_hash"`
			NextValidatorsHash string `json:"next_validators_hash"`
			ConsensusHash      string `json:"consensus_hash"`
			AppHash            string `json:"app_hash"`
			LastResultsHash    string `json:"last_results_hash"`
			EvidenceHash       string `json:"evidence_hash"`
			ProposerAddress    string `json:"proposer_address"`
		} `json:"header"`
		Commit struct {
			BlockID struct {
				Hash  string `json:"hash"`
				Parts struct {
					Total string `json:"total"`
					Hash  string `json:"hash"`
				} `json:"parts"`
			} `json:"block_id"`
			Precommits []Precommit `json:"precommits"`
		} `json:"commit"`
	} `json:"signed_header"`
	Canonical bool `json:"canonical"`
}

Commit is

type Node

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

Node is

func New

func New(options ...Option) (*Node, error)

New returns a new Node

func (*Node) Chain

func (n *Node) Chain() ockam.Chain

Chain is

func (*Node) ID

func (n *Node) ID() string

ID returns the identifier of the chain

func (*Node) LatestBlock

func (n *Node) LatestBlock() ockam.Block

LatestBlock returns

func (*Node) Peers

func (n *Node) Peers() []ockam.Node

Peers returns the list of peer nodes that this node is aware of

func (*Node) Register

func (n *Node) Register(e ockam.Entity) (ockam.Claim, error)

Register is

func (*Node) Submit

func (n *Node) Submit(c ockam.Claim) error

Submit is

func (*Node) Sync

func (n *Node) Sync() error

Sync returns

type Option

type Option func(*Node)

Option is

func PeerDiscoverer

func PeerDiscoverer(d ockam.NodeDiscoverer) Option

PeerDiscoverer is

type Peer

type Peer interface {
	ockam.Node
	LatestCommit() *Commit
}

Peer is the interface that this local node implementation expects other peers to implement

type Precommit

type Precommit struct {
	Type      int       `json:"type"`
	Height    string    `json:"height"`
	Round     string    `json:"round"`
	Timestamp time.Time `json:"timestamp"`
	BlockID   struct {
		Hash  string `json:"hash"`
		Parts struct {
			Total string `json:"total"`
			Hash  string `json:"hash"`
		} `json:"parts"`
	} `json:"block_id"`
	ValidatorAddress string `json:"validator_address"`
	ValidatorIndex   string `json:"validator_index"`
	Signature        string `json:"signature"`
}

Precommit is

type Tx

type Tx struct {
	Proof struct {
		Proof struct {
			Aunts []interface{} `json:"aunts"`
		} `json:"Proof"`
		Data     string `json:"Data"`
		RootHash string `json:"RootHash"`
		Total    string `json:"Total"`
		Index    string `json:"Index"`
	} `json:"proof"`
	Tx       string `json:"tx"`
	TxResult struct {
		Log  string `json:"log"`
		Data string `json:"data"`
		Code string `json:"code"`
	} `json:"tx_result"`
	Height string `json:"height"`
	Hash   string `json:"hash"`
}

Tx is

Directories

Path Synopsis
remote
http
Package http implements ockam.Node interface to enable interaction with a remote node that can be commiunicated with over http.
Package http implements ockam.Node interface to enable interaction with a remote node that can be commiunicated with over http.

Jump to

Keyboard shortcuts

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