Skip to content

Commit

Permalink
Added content for keys. Updated some commands references. (#542)
Browse files Browse the repository at this point in the history
  • Loading branch information
andynog committed Jan 28, 2021
1 parent a882df6 commit 42a78e2
Show file tree
Hide file tree
Showing 10 changed files with 259 additions and 26 deletions.
8 changes: 7 additions & 1 deletion ci/chains/gaia/v3.0.0/ibc-0/key_seed.json
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"
}
9 changes: 5 additions & 4 deletions guide/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,20 @@
- [Pre-requisites](./pre_requisites.md)
- [Setup](./setup.md)
- [Configuration](./config.md)
- [Commands](./commands.md)
- [Tutorials](./tutorials.md)
- [Two Chains](./two_chains.md)
- [Commands Reference](./commands.md)
- [Keys](./keys.md)
- [Light Clients](./light_clients.md)
- [Transactions](./transactions.md)
- [Client](./tx_client.md)
- [Connection](./tx_connection.md)
- [Channel](./tx_channel.md)
- [Packet](./tx_packet.md)
- [Channels](./channels.md)
- [Queries](./queries.md)
- [Events](./events.md)
- [Tutorials](./tutorials.md)
- [Local Testing](./local_chains.md)
- [Troubleshooting](./troubleshoot.md)
- [FAQ](./faq.md)
- [Glossary](./glossary.md)
---
---
1 change: 1 addition & 0 deletions guide/src/channels.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Channels
4 changes: 4 additions & 0 deletions guide/src/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ Commands to manage light client configuration. Allows adding and removing light

Command to submit transactions to configured chains

**[Channels](./channels.md)**

Commands to manage channels

**[Queries](./queries.md)**

Commands to execute queries on configured chains
Expand Down
9 changes: 5 additions & 4 deletions guide/src/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@

In order to run the relayer, you will need to have a configuration file.

Currently the relayer does not store the configuration information in the local disk. The relayer currently also does not support adding the sections below programmatically. You will need to use a text editor to create the file and add content to it.

The format supported for the configuration file is [TOML](https://toml.io/en/)

Every command executed through the relayer requires the configuration file localtion to be passed as a parameter.

> Currently the relayer does not store the configuration information in the local disk. The relayer currently also does not support adding the sections below programmatically. You will need to use a text editor to create the file and add content to it.

```bash
relayer -c config.toml [COMMAND]
```
Expand Down Expand Up @@ -100,7 +101,7 @@ For each chain configured you need to add a private key for that chain in order

### Example configuration file

Here is an full example of a configuration file with two [local chains](./local_chains.md) configured and light client peers added:
Here is an full example of a configuration file with two chains configured and light client peers added:

```toml
[global]
Expand Down Expand Up @@ -191,4 +192,4 @@ path = '/home/andy/development/github.com/informalsystems/ibc-rs/data/ibc-1/data

### Next Steps

Now that you learned how to build the relayer and how to create a configuration file, you can go to the [`Local Testing`](./local_chains.md) section to learn how to perform some local testing connecting the relayer to two local chains.
Now that you learned how to build the relayer and how to create a configuration file, you can go to the [`Two Chains`](./two_chains.md) tutorial to learn how to perform some local testing connecting the relayer to two local chains.
8 changes: 4 additions & 4 deletions guide/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ The introduction gives a brief overview about the IBC Relayer

The getting started section can help you setup, configure and run the IBC Relayer

**[Commands](./commands.md)**

The commands will let you interact with the IBC Relayer using its command-line interface.

**[Tutorials](./tutorials.md)**

This section provides some tutorials on how to operate and test the relayer

**[Commands Reference](./commands.md)**

The commands will let you interact with the IBC Relayer using its command-line interface.

**[Troubleshooting](./troubleshoot.md)**

This section has the most frequently asked questions related to the IBC Relayer.
Expand Down
112 changes: 111 additions & 1 deletion guide/src/keys.md
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])"]}
```
4 changes: 2 additions & 2 deletions guide/src/light_clients.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Light Clients

Using the light client commands you can add and remove light client peers configuration for the relayer
Using the `light` command you can add and remove light client peers information to the chain configuration.

#### Show usage

To see the available commands run:
To see the available subcommands for the `light` command run:

```shell
relayer help light
Expand Down
111 changes: 111 additions & 0 deletions guide/src/two_chains.md
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)
19 changes: 9 additions & 10 deletions guide/theme/css/variables.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@
/* Globals */

:root {
--sidebar-width: 220px;
--sidebar-width: 300px;
--page-padding: 15px;
--content-max-width: 1280px;
--content-max-width: 750px;
--menu-bar-height: 50px;
}

/* Themes */

.ayu {
Expand Down Expand Up @@ -91,29 +90,29 @@
}

.light {
--bg: hsl(0, 0%, 100%);
--fg: #333333;
--bg: hsl(0, 0%, 97%);
--fg: #181818;

--sidebar-bg: #335787;
--sidebar-fg: #fcfcff;
--sidebar-non-existant: #aaaaaa;
--sidebar-active: #ffffff;
--sidebar-spacer: #f4f4f4;
--sidebar-spacer: #e5e5e5;

--scrollbar: #cccccc;
--scrollbar: var(--sidebar-fg);

--icons: #797979;
--icons: #2f2f2f;
--icons-hover: #333333;

--links: #267CB9;

--inline-code-color: #393730;
--inline-code-color: #2d2b26;

--theme-popup-bg: #fafafa;
--theme-popup-border: #cccccc;
--theme-hover: #e6e6e6;

--quote-bg: hsl(214, 25%, 73%);
--quote-bg: hsl(212, 52%, 86%);
--quote-border: hsl(220, 83%, 67%);

--table-border-color: hsl(0, 0%, 95%);
Expand Down

0 comments on commit 42a78e2

Please sign in to comment.