* [10948]: Add changelog entry. * [10948]: Deprecate the types.DBBackend variable and the NewLevelDB function. Create a NewDB function to replace them. * [10948]: Add a DBBackend string to the simulation config and a flag for setting it. Update the simulation setup to use that instead of the compile-time DBBackend variable. * [10948]: Update the mock app creator to use the NewDB function. Not sure what to do about the db backend in that case though. * [10948]: Update changelog to reflect new db-backend field name. * [10948]: Use the tendermint db-backend type for the snapshot db. * [10948]: Update the last use of NewLevelDB by adding a parameter to openDB and uppdating calls to that to provide the db type to use. * [10948]: Upddate the NewDB function to also have a default db backend type if an empty string is provided there. * [10948]: Remove the new TODO in mock.NewApp. After looking through it's uses, there doesn't seem to be any desire to change it, and there's no easy way to communicate it. * [10948]: Enhance the NewDB defer function to also add info to any err that is being returned. * [10948]: Add some unit tests for NewDB. * [10948]: Lint fixes. * [10948]: Add a changelog entry to the deprecated section. * [10948]: Update the makefile to no longer set the types.DBBackend value. * [10948]: Use memdb for the mock app instead of goleveldb. I know it was a goleveldb before, but for a mock app, a memdb feels like a better choice (assuming 'mock' and 'mem' mean what I assume they mean). * [10948]: Fix the store benchmark tests (had some index-out-of-range issues). * [10948]: Fix cachekv store bench test calling iter.Key() before checking iter.Valid(). * [10948]: Remove the panic recovery from types.NewDB since dbm.NewDB returns an error now (it didn't originally, when NewLevelDB was first written). * [10948]: Add changlog entry indicationg an API breaking change due to the DBBackend change. * [10948]: Get rid of the types.NewDB function in favor of just using the tm-db version of it. * [10948]: Fix Update the codeql-analysis github action to use go v1.17. * [10948]: Add config file option for the app db backend type. * [10948]: Adjust the comment on the app-db-backend config entry to clarify fallback behavior. * [10948]: Add a default of GoLevelDBBackend to GetAppDBBackend. The old DBBackend variable defaulted to that, and some unit tests assume that behavior still exists. * [10948]: Add the missing quotes around the app-db-backend value. * [10948]: Small tweak to the changelog's deprecated entry. * Add the go version declaration back into the codeql-analysis github action. * [10948]: Update new use of openDB. * [10948]: Put a brief delay after closing the test network. Hopefully that helps with address-in-use and non-empty directory errors. Co-authored-by: Marko <marbar3778@yahoo.com> |
||
|---|---|---|
| .. | ||
| helpers | ||
| params | ||
| simd | ||
| app_test.go | ||
| app.go | ||
| config.go | ||
| encoding.go | ||
| export.go | ||
| genesis_account_test.go | ||
| genesis_account.go | ||
| genesis.go | ||
| README.md | ||
| sim_bench_test.go | ||
| sim_test.go | ||
| state.go | ||
| test_helpers.go | ||
| types.go | ||
| utils_test.go | ||
| utils.go | ||
| 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.
-
From the root directory of the Cosmos SDK repository, run
$ make build. This will build thesimdbinary inside a newbuilddirectory. The following instructions are run from inside thebuilddirectory. -
If you've run
simdbefore, 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. -
$ ./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. -
$ ./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. -
$ ./simd add-genesis-account [key_name] [amount], wherekey_nameis the same key name as before; andamountis something like10000000000000000000000000stake. -
$ ./simd gentx [key_name] [amount] --chain-id [chain-id]. This will create the genesis transaction for your new chain. Hereamountshould be at least1000000000stake. If you provide too much or too little, you will encounter an error when starting your node. -
Now, one person needs to create the genesis file
genesis.jsonusing the genesis transactions from every participant, by gathering all the genesis transactions underconfig/gentxand then calling$ ./simd collect-gentxs. This will create a newgenesis.jsonfile that includes data from all the validators (we sometimes call it the "super genesis file" to distinguish it from single-validator genesis files). -
Once you've received the super genesis file, overwrite your original
genesis.jsonfile with the new supergenesis.json. -
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_addressby running$ ./simd tendermint show-node-id. The output will be the hex-encodedvalidator_address. The defaultportis 26656. -
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.