Update README.md with wasmd setup for local testnet (#99)

This commit is contained in:
Ethan Buchman 2024-07-19 09:18:34 -04:00 committed by GitHub
parent 4b3630adf3
commit 0335838949
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -86,7 +86,7 @@ Tada!
### Setup Wasmd Accounts ### Setup Wasmd Accounts
Run `wasmd init <your name>` to initialize the local wasmd folder. Run `wasmd init <your name> --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`: 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 wasmd keys add admin
``` ```
This should output a wasm address. Now you need to fund this account. This should output a wasm address.
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:
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 <sender key name> <recipient address> <amount ucosm> --chain-id testing -y wasmd tx bank send <sender key name> <recipient address> <amount ucosm> --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 ## 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`). 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`).