-
Notifications
You must be signed in to change notification settings - Fork 359
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added content for keys. Updated some commands references. (#542)
- Loading branch information
Showing
10 changed files
with
259 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,7 @@ | ||
{"name":"user","type":"local","address":"cosmos1tc3vcuxyyac0dmayf887v95tdg7qpyql48w7gj","pubkey":"cosmospub1addwnpepqgg7ng4ycm50pdxfzdfh4hjvkwcr3da59mr8k883vsstx60ruv7kur4525u","mnemonic":"nephew pledge maximum fence boat dignity swing someone theory chef warm receive oppose prosper mule dynamic blouse staff essay inquiry tortoise unlock move hidden"} | ||
{ | ||
"name": "user", | ||
"type": "local", | ||
"address": "cosmos1tc3vcuxyyac0dmayf887v95tdg7qpyql48w7gj", | ||
"pubkey": "cosmospub1addwnpepqgg7ng4ycm50pdxfzdfh4hjvkwcr3da59mr8k883vsstx60ruv7kur4525u", | ||
"mnemonic": "nephew pledge maximum fence boat dignity swing someone theory chef warm receive oppose prosper mule dynamic blouse staff essay inquiry tortoise unlock move hidden" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# Channels |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,111 @@ | ||
# Keys | ||
# Adding Keys to the Relayer | ||
|
||
Using the `keys` command you can add and list keys. | ||
|
||
#### Show usage | ||
|
||
To see the available subcommands for the `keys` command run: | ||
|
||
```shell | ||
relayer help keys | ||
``` | ||
|
||
Currently there are two subcommands supported `add` and `list`: | ||
|
||
```shell | ||
USAGE: | ||
relayer-cli keys <SUBCOMMAND> | ||
|
||
DESCRIPTION: | ||
manage keys in the relayer for each chain | ||
|
||
SUBCOMMANDS: | ||
help get usage information | ||
add adds a key to a configured chain | ||
list list keys configured on a chain | ||
``` | ||
|
||
### Key Seed file (Private Key) | ||
|
||
In order to execute the command below you need a private key file (JSON). The private key file will be used to sign the transactions submitted by the relayer to the chain. | ||
|
||
The private key file can be obtained by using the `keys add` on a Cosmos chain, for example for a `gaia` chain the command is: | ||
|
||
```shell | ||
gaiad keys add ... | ||
``` | ||
|
||
The command outputs a JSON similar to the one below. You can save this file (e.g. key_seed.json) and use it to add to the relayer | ||
|
||
```json | ||
{ | ||
"name": "user", | ||
"type": "local", | ||
"address": "cosmos1tc3vcuxyyac0dmayf887t95tdg7qpyql48w7gj", | ||
"pubkey": "cosmospub1addwnpepqgg7ng4ycm60pdxfzdfh4hjvkwcr3da59mr8k883vsstx60ruv7kur4525u", | ||
"mnemonic": "[24 words mnemonic]" | ||
} | ||
``` | ||
|
||
> __WARNING__: Currently the relayer does NOT support a `keyring` store to securely store the private key file. The key file will be stored on the local file system in the user __$HOME__ folder under `$HOME/.rrly` | ||
|
||
### Adding Keys | ||
|
||
In order to add a key to a chain use the `keys add` command: | ||
|
||
```shell | ||
USAGE: | ||
relayer-cli keys add <OPTIONS> | ||
|
||
DESCRIPTION: | ||
adds a key to a configured chain | ||
|
||
POSITIONAL ARGUMENTS: | ||
chain_id identifier of the chain | ||
file the key path and filename | ||
|
||
``` | ||
|
||
#### Add a private key to a chain | ||
|
||
To add a private key file to a chain: | ||
|
||
```shell | ||
relayer -c config keys add [CHAIN_ID] [PRIVATE_KEY_FILE] | ||
``` | ||
|
||
If the command is successful a message similar to the one below will be displayed: | ||
|
||
```json | ||
{"status":"success","result":["Added key testkey ([ADDRESS]) on [CHAIN ID] chain"]} | ||
``` | ||
|
||
### List keys | ||
|
||
In order to list the private keys added to chains use the `keys list` command | ||
|
||
```shell | ||
USAGE: | ||
relayer-cli keys list <OPTIONS> | ||
|
||
DESCRIPTION: | ||
list keys configured on a chain | ||
|
||
POSITIONAL ARGUMENTS: | ||
chain_id identifier of the chain | ||
``` | ||
|
||
#### Listing the private key that was added to a chain | ||
|
||
To list the private key file that was added to a chain: | ||
|
||
```shell | ||
relayer -c config keys list [CHAIN_ID] | ||
``` | ||
|
||
If the command is successful a message similar to the one below will be displayed: | ||
|
||
```json | ||
{"status":"success","result":["chain: [CHAIN_ID] -> testkey ([ADDRESS])"]} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
# Testing the relayer with two local chains | ||
|
||
In order to test the relayer against two chains, we provide a script that can start two separate chains and configure them automatically. This is the easiest way to get started. | ||
|
||
The script below starts two [`gaia`](https://github.com/cosmos/gaia) chains that support the `IBC` protocol. | ||
|
||
### Running the script | ||
|
||
To run the script, open a terminal and navigate to the `ibc-rs` repository folder | ||
|
||
```bash | ||
cd ibc-rs | ||
``` | ||
|
||
#### Configuration | ||
|
||
In order to run the script, you will need a `TOML` configuration file to be passed as a parameter. Please check the [`Configuration`](./config.md) section for more information about the relayer configuration file. | ||
|
||
#### Start the chains | ||
|
||
Run the following script with the parameters below to start the chains: | ||
|
||
```bash | ||
./dev-env two_chains.toml ibc-0 ibc-1 | ||
``` | ||
|
||
The script will configure and start two `gaiad` instances, one named `ibc-0` and the other `ibc-1` | ||
|
||
```mermaid | ||
graph TD | ||
A[dev-env] -->|run| C(start chains) | ||
C -->|gaiad| D[ibc-0] | ||
C -->|gaiad| F[ibc-1] | ||
``` | ||
|
||
If the script runs successfully you should see a message similar to the one below in the terminal: | ||
|
||
```shell | ||
$ ./dev-env ./relayer-cli/tests/fixtures/two_chains.toml ibc-0 ibc-1 | ||
|
||
GAIA VERSION INFO: 3.0.0 | ||
Generating gaia configurations... | ||
Creating gaiad instance: home=./data | chain-id=ibc-0 | p2p=:26656 | rpc=:26657 | profiling=:6060 | grpc=:9090 | samoleans=:100000000000 | ||
Change settings in config.toml file... | ||
balances: | ||
- amount: "0" | ||
denom: stake | ||
pagination: | ||
next_key: null | ||
total: "0" | ||
balances: | ||
- amount: "100000000000" | ||
denom: samoleans | ||
- amount: "100000000000" | ||
denom: stake | ||
pagination: | ||
next_key: null | ||
total: "0" | ||
Creating gaiad instance: home=./data | chain-id=ibc-1 | p2p=:26556 | rpc=:26557 | profiling=:6061 | grpc=:9091 | samoleans=:100000000000 | ||
Change settings in config.toml file... | ||
balances: | ||
- amount: "0" | ||
denom: stake | ||
pagination: | ||
next_key: null | ||
total: "0" | ||
balances: | ||
- amount: "100000000000" | ||
denom: samoleans | ||
- amount: "100000000000" | ||
denom: stake | ||
pagination: | ||
next_key: null | ||
total: "0" | ||
ibc-0 initialized. Watch file /home/user/development/github.com/informalsystems/ibc-rs/data/ibc-0.log to see its execution. | ||
ibc-1 initialized. Watch file /home/user/development/github.com/informalsystems/ibc-rs/data/ibc-1.log to see its execution. | ||
Building the Rust relayer... | ||
Removing light client peers from configuration... | ||
Adding primary peers to light client configuration... | ||
Adding secondary peers to light client configuration... | ||
Importing keys... | ||
``` | ||
|
||
#### Data directory | ||
The script will also create a `data` directory in the current directory in order to install the chain store and configuration files for each chain. | ||
|
||
The `data` directory should have a tree structure similar to this | ||
|
||
```shell | ||
data | ||
├── ibc-0 | ||
│ ├── config | ||
│ ├── data | ||
│ ├── keyring-test | ||
│ ├── key_seed.json | ||
│ └── validator_seed.json | ||
├── ibc-0.log | ||
├── ibc-1 | ||
│ ├── config | ||
│ ├── data | ||
│ ├── keyring-test | ||
│ ├── key_seed.json | ||
│ └── validator_seed.json | ||
└── ibc-1.log | ||
|
||
``` | ||
|
||
#### Next steps | ||
|
||
Now that you have two chains running with IBC support, you can run some relayer [commands](./commands.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters