cosmos-sdk: github.com/cosmos/cosmos-sdk/x/genutil Index | Files | Directories

package genutil

import "github.com/cosmos/cosmos-sdk/x/genutil"

Package genutil contains a variety of genesis utility functionality for usage within a blockchain application. Namely:

 - Genesis transactions related (gentx)
    - commands for collection and creation of gentxs
	- initchain processing of gentxs
 - Genesis file validation
 - Tendermint related initialization

Index

Package Files

collect.go doc.go genesis.go gentx.go module.go utils.go

func CollectTxs Uses

func CollectTxs(cdc codec.JSONMarshaler, txJSONDecoder sdk.TxDecoder, moniker, genTxsDir string,
    genDoc tmtypes.GenesisDoc, genBalIterator types.GenesisBalancesIterator,
) (appGenTxs []sdk.Tx, persistentPeers string, err error)

CollectTxs processes and validates application's genesis Txs and returns the list of appGenTxs, and persistent peers required to generate genesis.json.

func DeliverGenTxs Uses

func DeliverGenTxs(
    ctx sdk.Context, genTxs []json.RawMessage,
    stakingKeeper types.StakingKeeper, deliverTx deliverTxfn,
    txEncodingConfig client.TxEncodingConfig,
) []abci.ValidatorUpdate

DeliverGenTxs iterates over all genesis txs, decodes each into a Tx and invokes the provided deliverTxfn with the decoded Tx. It returns the result of the staking module's ApplyAndReturnValidatorSetUpdates.

func ExportGenesisFile Uses

func ExportGenesisFile(genDoc *tmtypes.GenesisDoc, genFile string) error

ExportGenesisFile creates and writes the genesis configuration to disk. An error is returned if building or writing the configuration to file fails.

func ExportGenesisFileWithTime Uses

func ExportGenesisFileWithTime(
    genFile, chainID string, validators []tmtypes.GenesisValidator,
    appState json.RawMessage, genTime time.Time,
) error

ExportGenesisFileWithTime creates and writes the genesis configuration to disk. An error is returned if building or writing the configuration to file fails.

func GenAppStateFromConfig Uses

func GenAppStateFromConfig(cdc codec.JSONMarshaler, txEncodingConfig client.TxEncodingConfig,
    config *cfg.Config, initCfg types.InitConfig, genDoc tmtypes.GenesisDoc, genBalIterator types.GenesisBalancesIterator,
) (appState json.RawMessage, err error)

GenAppStateFromConfig gets the genesis app state from the config

func InitGenesis Uses

func InitGenesis(
    ctx sdk.Context, stakingKeeper types.StakingKeeper,
    deliverTx deliverTxfn, genesisState types.GenesisState,
    txEncodingConfig client.TxEncodingConfig,
) []abci.ValidatorUpdate

InitGenesis - initialize accounts and deliver genesis transactions

func InitializeNodeValidatorFiles Uses

func InitializeNodeValidatorFiles(config *cfg.Config) (nodeID string, valPubKey crypto.PubKey, err error)

InitializeNodeValidatorFiles creates private validator and p2p configuration files.

func NewAppModule Uses

func NewAppModule(accountKeeper types.AccountKeeper,
    stakingKeeper types.StakingKeeper, deliverTx deliverTxfn,
    txEncodingConfig client.TxEncodingConfig,
) module.AppModule

NewAppModule creates a new AppModule object

func SetGenTxsInAppGenesisState Uses

func SetGenTxsInAppGenesisState(
    cdc codec.JSONMarshaler, txJSONEncoder sdk.TxEncoder, appGenesisState map[string]json.RawMessage, genTxs []sdk.Tx,
) (map[string]json.RawMessage, error)

SetGenTxsInAppGenesisState - sets the genesis transactions in the app genesis state

func ValidateAccountInGenesis Uses

func ValidateAccountInGenesis(
    appGenesisState map[string]json.RawMessage, genBalIterator types.GenesisBalancesIterator,
    addr sdk.Address, coins sdk.Coins, cdc codec.JSONMarshaler,
) error

ValidateAccountInGenesis checks that the provided account has a sufficient balance in the set of genesis accounts.

type AppModule Uses

type AppModule struct {
    AppModuleBasic
    // contains filtered or unexported fields
}

AppModule implements an application module for the genutil module.

func (AppModule) ExportGenesis Uses

func (am AppModule) ExportGenesis(_ sdk.Context, cdc codec.JSONMarshaler) json.RawMessage

ExportGenesis returns the exported genesis state as raw bytes for the genutil module.

func (AppModule) InitGenesis Uses

func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONMarshaler, data json.RawMessage) []abci.ValidatorUpdate

InitGenesis performs genesis initialization for the genutil module. It returns no validator updates.

type AppModuleBasic Uses

type AppModuleBasic struct{}

AppModuleBasic defines the basic application module used by the genutil module.

func (AppModuleBasic) DefaultGenesis Uses

func (AppModuleBasic) DefaultGenesis(cdc codec.JSONMarshaler) json.RawMessage

DefaultGenesis returns default genesis state as raw bytes for the genutil module.

func (AppModuleBasic) GetQueryCmd Uses

func (AppModuleBasic) GetQueryCmd() *cobra.Command

GetQueryCmd returns no root query command for the genutil module.

func (AppModuleBasic) GetTxCmd Uses

func (AppModuleBasic) GetTxCmd() *cobra.Command

GetTxCmd returns no root tx command for the genutil module.

func (AppModuleBasic) Name Uses

func (AppModuleBasic) Name() string

Name returns the genutil module's name.

func (AppModuleBasic) RegisterCodec Uses

func (AppModuleBasic) RegisterCodec(cdc *codec.LegacyAmino)

RegisterCodec registers the genutil module's types for the given codec.

func (AppModuleBasic) RegisterInterfaces Uses

func (b AppModuleBasic) RegisterInterfaces(_ cdctypes.InterfaceRegistry)

RegisterInterfaces registers the module's interface types

func (AppModuleBasic) RegisterRESTRoutes Uses

func (AppModuleBasic) RegisterRESTRoutes(_ client.Context, _ *mux.Router)

RegisterRESTRoutes registers the REST routes for the genutil module.

func (AppModuleBasic) ValidateGenesis Uses

func (b AppModuleBasic) ValidateGenesis(cdc codec.JSONMarshaler, txEncodingConfig client.TxEncodingConfig, bz json.RawMessage) error

ValidateGenesis performs genesis state validation for the genutil module.

Directories

PathSynopsis
client/cli
client/rest
legacy/v0_36
legacy/v0_38
legacy/v0_39
legacy/v0_40
types

Package genutil imports 26 packages (graph) and is imported by 40 packages. Updated 2020-08-13. Refresh now. Tools for package owners.