discovery

package
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2018 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ContractHash

type ContractHash struct {
	ABI  HashURL `json:"abi"`
	Code HashURL `json:"code"`
}

type Discovery

type Discovery struct {
	// Testnet is true if this discovery file represents a testing
	// network.
	Testnet bool `json:"testnet"`
	// Mainnet is true if this discovery file represents the main net
	// (or a production network). One of Testnet and Mainnet must be
	// `true`, and are mutually exclusive.
	Mainnet bool `json:"mainnet"`

	EOSIOAccountName      string        `json:"eosio_account_name"`
	EOSIOABPSigningKey    ecc.PublicKey `json:"eosio_appointed_block_producer_signing_key"`
	EOSIOInitialAuthority struct {
		Owner    eos.Authority `json:"owner"`
		Active   eos.Authority `json:"active"`
		Recovery eos.Authority `json:"recovery"`
	} `json:"eosio_initial_authority"`

	Website             string `json:"website"`
	IntroductionPostURL string `json:"introduction_post_url"`
	SocialFacebook      string `json:"social_facebook"`
	SocialTwitter       string `json:"social_twitter"`
	SocialYouTube       string `json:"social_youtube"`
	SocialTelegram      string `json:"social_telegram"`
	SocialWeChat        string `json:"social_wechat"`
	SocialSlack         string `json:"social_slack"`
	SocialSteemIt       string `json:"social_steemit"`
	SocialSteem         string `json:"social_steem"`
	SocialGitHub        string `json:"social_github"`
	SocialKeybase       string `json:"social_keybase"`

	OrganizationName    string `json:"organization_name"`
	OrganizationTagline string `json:"organization_tagline"`

	LaunchData LaunchData `json:"launch_data"`

	ClonedFrom string `json:"-"`
}

Discovery is data published autonomously by Block Producer candidates. LaunchData will contain the topology and build up the graph. Otherwise, this data is simply metadata about a BP.

type HashURL

type HashURL struct {
	// Hash is the important bit, used to weight in votes from
	// different BPs.
	Hash string `json:"hash"`
	// URL is the downloadable location of the resource, which should
	// hash to `Hash`.
	URL string `json:"url"`
	// Comment has any relevant details, how the resource was built,
	// produced, who did it, when, based on what revision of which
	// source code, and whatnot.
	Comment string `json:"comment"`
}

type LaunchData

type LaunchData struct {
	Wingmen              []Wingman               `json:"wingmen"`
	BootSequence         HashURL                 `json:"boot_sequence"`
	Snapshot             HashURL                 `json:"snapshot"`
	SnapshotUnregistered HashURL                 `json:"snapshot_unregistered"`
	Contracts            map[string]ContractHash `json:"contracts"`
}

type Network

type Network struct {
	ForceFetch bool
	// contains filtered or unexported fields
}

func NewNetwork

func NewNetwork(cachePath string, seedDiscoveryURL string) *Network

func (*Network) CalculateWeights

func (c *Network) CalculateWeights() error

func (*Network) ChainID

func (c *Network) ChainID() []byte

func (*Network) ConsensusLaunchData

func (c *Network) ConsensusLaunchData() (*LaunchData, error)

func (*Network) DownloadDiscoveryURL

func (c *Network) DownloadDiscoveryURL(discoveryURL string) (out *Discovery, rawDiscovery []byte, err error)

func (*Network) DownloadHashURL

func (c *Network) DownloadHashURL(discoveryURL string, hu HashURL) error

func (*Network) FetchAll

func (c *Network) FetchAll() error

func (*Network) FetchOne

func (c *Network) FetchOne(discoveryURL string) error

func (*Network) FileNameFromCache

func (c *Network) FileNameFromCache(fileName string) string

func (*Network) LoadCache

func (c *Network) LoadCache(initialDiscoveryURL string) error

func (*Network) OrderedPeers

func (c *Network) OrderedPeers() []*Peer

func (*Network) PrintOrderedPeers

func (c *Network) PrintOrderedPeers()

func (*Network) ReachedConsensus

func (c *Network) ReachedConsensus() bool

ReachedConsensus reads all the hashes of the top-level peers and returns true if we have reached an agreement on the content to inject in the chain.

func (*Network) ReadFromCache

func (c *Network) ReadFromCache(fileName string) ([]byte, error)

func (*Network) ReaderFromCache

func (c *Network) ReaderFromCache(fileName string) (io.ReadCloser, error)

func (*Network) ValidateLocalFile

func (c *Network) ValidateLocalFile(filename string) error

func (*Network) VerifyGraph

func (c *Network) VerifyGraph() error

type Peer

type Peer struct {
	DiscoveryURL string
	Discovery    *Discovery

	TotalWeight float64

	ClonedAccountName string
}

func (*Peer) AccountName

func (p *Peer) AccountName() string

func (*Peer) String

func (p *Peer) String() string

type Wingman

type Wingman struct {
	DiscoveryURL string  `json:"discovery_url"`
	Comment      string  `json:"comment"`
	Weight       float64 `json:"weight"` // From 0.0 to 1.0
}

Jump to

Keyboard shortcuts

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