Documentation ¶
Index ¶
- Constants
- func ConfigSave(c *Config) error
- type Account
- type Blockchain
- func (b *Blockchain) Cleanup() error
- func (b *Blockchain) Create(ctx context.Context) error
- func (b *Blockchain) CreateAccount(ctx context.Context, account chain.Account) (chain.Account, error)
- func (b *Blockchain) Info() (BlockchainInfo, error)
- func (b *Blockchain) IssueGentx(ctx context.Context, account chain.Account, proposal Proposal) (gentx jsondoc.Doc, err error)
- func (b *Blockchain) Join(ctx context.Context, accountAddress, publicAddress string, coins types.Coins, ...) error
- type BlockchainInfo
- type Builder
- func (b *Builder) AccountCreate(name, mnemonic string) (spn.Account, error)
- func (b *Builder) AccountExport(name, password string) (privateKey string, err error)
- func (b *Builder) AccountGet(name string) (spn.Account, error)
- func (b *Builder) AccountImport(name, privateKey, password string) error
- func (b *Builder) AccountInUse() (spn.Account, error)
- func (b *Builder) AccountList() ([]spn.Account, error)
- func (b *Builder) AccountUse(name string) error
- func (b *Builder) ChainList(ctx context.Context, options ...spn.ChainListOption) (chains []spn.Chain, nextPageKey []byte, err error)
- func (b *Builder) Init(ctx context.Context, chainID string, source SourceOption, ...) (*Blockchain, error)
- func (b *Builder) LaunchInformation(ctx context.Context, chainID string) (spn.LaunchInformation, error)
- func (b *Builder) ProposalGet(ctx context.Context, chainID string, id int) (spn.Proposal, error)
- func (b *Builder) ProposalList(ctx context.Context, chainID string, options ...spn.ProposalListOption) ([]spn.Proposal, error)
- func (b *Builder) Propose(ctx context.Context, chainID string, proposals ...spn.ProposalOption) error
- func (b *Builder) ShowChain(ctx context.Context, chainID string) (spn.Chain, error)
- func (b *Builder) SimulatedLaunchInformation(ctx context.Context, chainID string, proposalIDs []int) (spn.LaunchInformation, error)
- func (b *Builder) StartChain(ctx context.Context, chainID string, flags []string, options ...InitOption) error
- func (b *Builder) SubmitReviewals(ctx context.Context, chainID string, reviewals ...spn.Reviewal) (gas uint64, broadcast func() error, err error)
- func (b *Builder) VerifyProposals(ctx context.Context, chainID string, homeDir string, proposals []int, ...) (bool, error)
- type Config
- type DataDirExistsError
- type InitOption
- type Option
- type Proposal
- type ProposalMeta
- type SourceOption
Constants ¶
const ValidatorSetNilErrorMessage = "validator set is nil in genesis and still empty after InitChain"
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Blockchain ¶
type Blockchain struct {
// contains filtered or unexported fields
}
func (*Blockchain) Cleanup ¶
func (b *Blockchain) Cleanup() error
Cleanup closes the event bus and cleanups everything related to installed blockchain.
func (*Blockchain) Create ¶
func (b *Blockchain) Create(ctx context.Context) error
Create submits Genesis to SPN to announce a new network.
func (*Blockchain) CreateAccount ¶
func (*Blockchain) Info ¶
func (b *Blockchain) Info() (BlockchainInfo, error)
Info returns information about the blockchain.
func (*Blockchain) IssueGentx ¶
func (b *Blockchain) IssueGentx(ctx context.Context, account chain.Account, proposal Proposal) (gentx jsondoc.Doc, err error)
IssueGentx creates a Genesis transaction for account with proposal.
func (*Blockchain) Join ¶
func (b *Blockchain) Join(ctx context.Context, accountAddress, publicAddress string, coins types.Coins, gentx []byte, selfDelegation types.Coin) error
Join proposes a validator to a network.
address is the ip+port combination of a p2p address of a node (does not include id). https://docs.tendermint.com/master/spec/p2p/config.html.
type BlockchainInfo ¶
BlockchainInfo hold information about a Blokchain.
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
Builder is network builder.
func (*Builder) AccountCreate ¶
AccountCreate creates a new account in OS keyring.
func (*Builder) AccountExport ¶
AccountExport exports an account in OS keyring with name and password.
func (*Builder) AccountGet ¶
AccountGet gets an account by name in OS keyring.
func (*Builder) AccountImport ¶
AccountImport imports account to OS keyring with name, password and privateKey.
func (*Builder) AccountInUse ¶
AccountInUse gets the account in use while working with SPN.
func (*Builder) AccountList ¶
AccountList lists all accounts in OS keyring.
func (*Builder) AccountUse ¶
AccountUse sets the account to be used while working with SPN.
func (*Builder) ChainList ¶
func (b *Builder) ChainList(ctx context.Context, options ...spn.ChainListOption) (chains []spn.Chain, nextPageKey []byte, err error)
ChainList lists summaries of chains
func (*Builder) Init ¶
func (b *Builder) Init(ctx context.Context, chainID string, source SourceOption, options ...InitOption) (*Blockchain, error)
Init initializes blockchain from by source option and init options.
func (*Builder) LaunchInformation ¶
func (b *Builder) LaunchInformation(ctx context.Context, chainID string) (spn.LaunchInformation, error)
LaunchInformation retrieves chain's launch information.
func (*Builder) ProposalGet ¶
ProposalGet retrieves a proposal on a chain by id.
func (*Builder) ProposalList ¶
func (b *Builder) ProposalList(ctx context.Context, chainID string, options ...spn.ProposalListOption) ([]spn.Proposal, error)
ProposalList lists proposals on a chain by status.
func (*Builder) Propose ¶
func (b *Builder) Propose(ctx context.Context, chainID string, proposals ...spn.ProposalOption) error
Propose proposes given proposals in batch for chainID by using SPN accountName.
func (*Builder) SimulatedLaunchInformation ¶
func (b *Builder) SimulatedLaunchInformation(ctx context.Context, chainID string, proposalIDs []int) (spn.LaunchInformation, error)
SimulatedLaunchInformation retrieves chain's simulated launch information from proposals to verify.
func (*Builder) StartChain ¶
func (b *Builder) StartChain(ctx context.Context, chainID string, flags []string, options ...InitOption) error
StartChain downloads the final version version of Genesis on the first start or fails if Genesis has not finalized yet. After overwriting the downloaded Genesis on top of app's home dir, it starts blockchain by executing the start command on its appd binary with optionally provided flags.
func (*Builder) SubmitReviewals ¶
func (b *Builder) SubmitReviewals(ctx context.Context, chainID string, reviewals ...spn.Reviewal) (gas uint64, broadcast func() error, err error)
SubmitReviewals submits reviewals for proposals in batch for chainID by using SPN accountName.
func (*Builder) VerifyProposals ¶
func (b *Builder) VerifyProposals(ctx context.Context, chainID string, homeDir string, proposals []int, commandOut io.Writer) (bool, error)
VerifyProposals generates a genesis file from the current launch information and proposals to verify The function returns false if the generated genesis is invalid
type Config ¶
type Config struct { // SPNAccount is the default spn account in use. SPNAccount string // FinalizedChains can be started without any further preparation. FinalizedChains []string }
Config holds configuration about network builder's state.
func (*Config) IsChainMarkedFinalized ¶
IsChainMarkedFinalized checks if chain marked as finalized.
func (*Config) MarkFinalized ¶
MarkFinalized marks chain as finalized.
type DataDirExistsError ¶
func (DataDirExistsError) Error ¶
func (e DataDirExistsError) Error() string
type InitOption ¶
type InitOption func(*initOptions)
InitOption sets other initialization options.
func InitializationCLIHomePath ¶
func InitializationCLIHomePath(cliHomePath string) InitOption
InitializationCLIHomePath provides a specific cli home path for the blockchain for the initialization
func InitializationHomePath ¶
func InitializationHomePath(homePath string) InitOption
InitializationHomePath provides a specific home path for the blockchain for the initialization
func MustNotInitializedBefore ¶
func MustNotInitializedBefore() InitOption
MustNotInitializedBefore makes the initialization process fail if data dir for the blockchain already exists.
type Option ¶
type Option func(*Builder)
func CollectEvents ¶
CollectEvents collects events from Builder.
type Proposal ¶
type Proposal struct { Validator chain.Validator Meta ProposalMeta }
Proposal holds proposal info of validator candidate to join to a network.
type ProposalMeta ¶
type SourceOption ¶
type SourceOption func(*initOptions)
SourceOption sets the source for blockchain.
func SourceChainID ¶
func SourceChainID() SourceOption
SourceChainID makes source determined by the chain's id.
func SourceLocal ¶
func SourceLocal(path string) SourceOption
SourceLocal uses a local git repo as source for the blockchain.
func SourceRemote ¶
func SourceRemote(url string) SourceOption
SourceRemote sets the default branch on a remote as source for the blockchain.
func SourceRemoteBranch ¶
func SourceRemoteBranch(url, branch string) SourceOption
SourceRemoteBranch sets the branch on a remote as source for the blockchain.
func SourceRemoteHash ¶
func SourceRemoteHash(url, hash string) SourceOption
SourceRemoteHash uses a remote hash as source for the blockchain.
func SourceRemoteTag ¶
func SourceRemoteTag(url, tag string) SourceOption
SourceRemoteTag sets the tag on a remote as source for the blockchain.