From 0335838949d5808cc2010ddc31bfe15874976a80 Mon Sep 17 00:00:00 2001 From: Ethan Buchman Date: Fri, 19 Jul 2024 09:18:34 -0400 Subject: [PATCH] Update README.md with wasmd setup for local testnet (#99) --- apps/transfers/README.md | 53 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 50 insertions(+), 3 deletions(-) diff --git a/apps/transfers/README.md b/apps/transfers/README.md index f3f7c97..af15da9 100644 --- a/apps/transfers/README.md +++ b/apps/transfers/README.md @@ -86,7 +86,7 @@ Tada! ### Setup Wasmd Accounts -Run `wasmd init ` to initialize the local wasmd folder. +Run `wasmd init --chain-id testing` to initialize the local wasmd folder. Now open the file `~/.wasmd/config/client.toml` and change the field `keyring-backend` from `os` to `test`: @@ -100,13 +100,60 @@ Now, finally, we can create a local admin key for your wasmd. You'll use this to wasmd keys add admin ``` -This should output a wasm address. Now you need to fund this account. -Send this address to someone who has access to the admin account for your testnet. If you have access yourself you can send funds yourself: +This should output a wasm address. + +Now either you will setup a local testnet or use an existing testnet. If its an existing testnet, you need to fund this account. Send this address to someone who has access to the admin account for your testnet. If you have access yourself you can send funds yourself: ``` wasmd tx bank send --chain-id testing -y ``` +If you're setting up your own local testnet, continue with the following: + +``` +# generate a second key for the validator +wasmd keys add validator + +# fund both accounts in genesis +wasmd genesis add-genesis-account admin 100000000000stake,100000000000ucosm +wasmd genesis add-genesis-account validator 100000000000stake,100000000000ucosm + +# sign genesis tx from validator and compose genesis +wasmd genesis gentx validator 100000000stake --chain-id testing +wasmd genesis collect-gentxs +``` + +Before finally starting the node, for it to work with the front end, you need to configure CORS. + +In `~/.wasmd/config/config.toml`, you'll need to make sure the listen address binds to the public IP (0.0.0.0) and the CORS allows all origins: + +``` +[rpc] +laddr = "tcp://0.0.0.0:26657" +cors_allowed_origins = ["*"] +``` + +And in `~/.wasmd/config/app.toml`: + +``` +[api] +enable = true +address = "tcp://0.0.0.0:1317" +enabled-unsafe-cors = true +``` + +Now, finally: + +``` +wasmd start +``` + +And you should have a chain making blocks! + +You can also reduce the block time by lowering `timeout_commit` in `~/.wasmd/config/config.toml`. + +Now that you have the chain running, you can start running the enclave and proxy in other windows. + ## Run First set the `NODE_URL` variable to the address of the blockchain node. If it's a local node, set it to `localhost:26657`. If it's a remote node, set it to that node's address (eg. `export NODE_URL=143.244.186.205:26657`).