package
0.0.0-20220620005849-a315113d9162
Repository: https://github.com/mycodeku/transtionhelper.git
Documentation: pkg.go.dev

# README


order: false

simapp

simapp is an application built using the Cosmos SDK for testing and educational purposes.

Running testnets with simd

If you want to spin up a quick testnet with your friends, you can follow these steps. Unless otherwise noted, every step must be done by everyone who wants to participate in this testnet.

  1. From the root directory of the Cosmos SDK repository, run $ make build. This will build the simd binary inside a new build directory. The following instructions are run from inside the build directory.

  2. If you've run simd before, you may need to reset your database before starting a new testnet. You can reset your database with the following command: $ ./simd unsafe-reset-all.

  3. $ ./simd init [moniker] --chain-id [chain-id]. This will initialize a new working directory at the default location ~/.simapp. You need to provide a "moniker" and a "chain id". These two names can be anything, but you will need to use the same "chain id" in the following steps.

  4. $ ./simd keys add [key_name]. This will create a new key, with a name of your choosing. Save the output of this command somewhere; you'll need the address generated here later.

  5. $ ./simd add-genesis-account [key_name] [amount], where key_name is the same key name as before; and amount is something like 10000000000000000000000000stake.

  6. $ ./simd gentx [key_name] [amount] --chain-id [chain-id]. This will create the genesis transaction for your new chain. Here amount should be at least 1000000000stake. If you provide too much or too little, you will encounter an error when starting your node.

  7. Now, one person needs to create the genesis file genesis.json using the genesis transactions from every participant, by gathering all the genesis transactions under config/gentx and then calling $ ./simd collect-gentxs. This will create a new genesis.json file that includes data from all the validators (we sometimes call it the "super genesis file" to distinguish it from single-validator genesis files).

  8. Once you've received the super genesis file, overwrite your original genesis.json file with the new super genesis.json.

  9. Modify your config/config.toml (in the simapp working directory) to include the other participants as persistent peers:

    # Comma separated list of nodes to keep persistent connections to
    persistent_peers = "[validator_address]@[ip_address]:[port],[validator_address]@[ip_address]:[port]"
    

    You can find validator_address by running $ ./simd tendermint show-node-id. The output will be the hex-encoded validator_address. The default port is 26656.

  10. Now you can start your nodes: $ ./simd start.

Now you have a small testnet that you can use to try out changes to the Cosmos SDK or Tendermint!

NOTE: Sometimes creating the network through the collect-gentxs will fail, and validators will start in a funny state (and then panic). If this happens, you can try to create and start the network first with a single validator and then add additional validators using a create-validator transaction.

# Packages

No description provided by the author
Package params defines the simulation parameters in the simapp.
No description provided by the author

# Functions

AddTestAddrs constructs and returns accNum amount of accounts with an initial balance of accAmt in random order.
AddTestAddrsFromPubKeys adds the addresses into the SimApp providing only the public keys.
AddTestAddrs constructs and returns accNum amount of accounts with an initial balance of accAmt in random order.
AppStateFn returns the initial application state using a genesis or the simulation parameters.
AppStateFromGenesisFileFn util function to generate the genesis AppState from a genesis.json file.
AppStateRandomizedFn creates calls each module's GenesisState generator function and creates the simulation params.
CheckBalance checks the balance of an account.
CheckExportSimulation exports the app state and simulation parameters to JSON if the export paths are defined.
ConvertAddrsToValAddrs converts the provided addresses to ValAddress.
CreateTestPubKeys returns a total of numPubKeys public keys in ascending order.
SetupWithGenesisValSet initializes GenesisState with a single validator and genesis accounts that also act as delegators.
GenSequenceOfTxs generates a set of signed transactions of messages, such that they differ only by having the sequence numbers incremented between every transaction.
GetMaccPerms returns a copy of the module account permissions.
GetSimulationLog unmarshals the KVPair's Value to the corresponding type based on the each's module store key and the prefix bytes of the KVPair's key.
GetSimulatorFlags gets the values of all the available simulation flags.
MakeTestEncodingConfig creates an EncodingConfig for testing.
NewConfigFromFlags creates a simulation from the retrieved values of the flags.
NewDefaultGenesisState generates the default state for the application.
NewPubKeyFromHex returns a PubKey from a hex string.
NewSimApp returns a reference to an initialized SimApp.
NewSimappWithCustomOptions initializes a new SimApp with custom options.
PrintStats prints the corresponding statistics from the app DB.
RegisterSwaggerAPI registers swagger route with API Server.
Setup initializes a new SimApp.
SetupSimulation creates the config, db (levelDB), temporary directory and logger for the simulation tests.
SetupWithGenesisAccounts initializes a new SimApp with the provided genesis accounts and possible balances.
SetupWithGenesisValSet initializes a new SimApp with a validator set and genesis accounts that also act as delegators.
SignCheckDeliver checks a generated signed transaction and simulates a block commitment with the given transaction.
SimulationOperations retrieves the simulation params from the provided file path and returns all the modules weighted operations.
No description provided by the author

# Variables

DefaultConsensusParams defines the default Tendermint consensus params used in SimApp testing.
DefaultNodeHome default home directories for the application daemon.
List of available flags for the simulator.
List of available flags for the simulator.
List of available flags for the simulator.
List of available flags for the simulator.
List of available flags for the simulator.
List of available flags for the simulator.
List of available flags for the simulator.
List of available flags for the simulator.
List of available flags for the simulator.
List of available flags for the simulator.
List of available flags for the simulator.
List of available flags for the simulator.
List of available flags for the simulator.
List of available flags for the simulator.
TODO: Remove in favor of binary search for invariant violation.
List of available flags for the simulator.
List of available flags for the simulator.
List of available flags for the simulator.
List of available flags for the simulator.
ModuleBasics defines the module BasicManager is in charge of setting up basic, non-dependant module elements, such as codec registration and genesis verification.

# Structs

EmptyAppOptions is a stub implementing AppOptions.
SetupOptions defines arguments that are passed into `Simapp` constructor.
SimApp extends an ABCI application, but with most of its parameters exported.
SimGenesisAccount defines a type that implements the GenesisAccount interface to be used for simulation accounts in the genesis state.

# Interfaces

App implements the common methods for a Cosmos SDK-based application specific blockchain.

# Type aliases

No description provided by the author
GenesisState of the blockchain is represented here as a map of raw json messages key'd by a identifier string.