Skip to content

Commit

Permalink
docs: stargate updates (#136)
Browse files Browse the repository at this point in the history
  • Loading branch information
daeMOn63 authored Jul 9, 2021
1 parent 0458863 commit 8889402
Show file tree
Hide file tree
Showing 13 changed files with 168 additions and 236 deletions.
84 changes: 37 additions & 47 deletions docs/docs/building.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,73 +2,63 @@

## Prerequisites

- Go 1.14+ (installation instructions available [here](https://golang.org/dl/))
- Go 1.16+ (installation instructions available [here](https://golang.org/dl/))
- Packages: `make`, `gcc` (on ubunty, install them with `sudo apt-get update && sudo apt-get install -y make gcc`)

### Ubuntu 20.04 / Debian 10
## Building the code

```bash
# Run the following command if using Ubuntu
sudo apt-get install libgmp-dev swig

# Download and install the MCL libraries
cd ~
wget https://github.com/herumi/mcl/archive/v1.05.tar.gz
tar xvf v1.05.tar.gz
cd mcl-1.05
sudo make install
sudo ldconfig
Download the latest released version from github and build the project using the following commands:

```
git clone https://github.com/fetchai/fetchd.git && cd fetchd
```

### MacOS
Then select the particular tag version you want to build, ie:

```bash
# Run the following command if using OS X
brew install swig gmp

# Download and install the MCL libraries
cd ~
wget https://github.com/herumi/mcl/archive/v1.05.tar.gz
tar xvf v1.05.tar.gz
cd mcl-1.05
sudo make install
sudo ldconfig
git checkout v0.8.1
```

## Building the code

Download the latest released version from github and build the project using the following commands:

git clone https://github.com/fetchai/fetchd.git && cd fetchd

Then build the code with the command:

make build

This will generate the following binaries:
```bash
make build
```

- `./build/fetchcli` - This is the command line client that is useful for interacting with the network
- `./build/fetchd` - This is the block chain node daemon and can be configured to join the network
This will generate the `./build/fetchd` binary.

For non-developer users we recommend that the user installs the binaries into their system. This can be done with the following command:

sudo make install

This will install the binaries in the directory specified by your `$GOBIN` environment variable.

### Boost Dependencies (Only for beaconworld versions `v0.5x` and `v0.6.x`)

Currently the code requires that the user compiles the code with at least version 1.67 of Boost Serialisation library. Failure to do so will mean that users will not be able to sync with the blockchain. This limitation will be resolved in the near future (with the Boost dependency being removed completely).
```bash
make install
```

To verify which libraries you have linked against use the following commands
This will install the binaries in the directory specified by your `$GOBIN` environment variable (default to `~/go/bin`).

**Ubuntu 20.04 / Debian 10**

```bash
ldd ./build/fetchd
which fetchd
```

**MacOS**
This should return a path such as `~/go/bin/fetchd` (might be different depending on your actual go installation).

> If you get no output, or an error such as `which: no fetchd in ...`, possible cause can either be that `make install` failed with some errors or that your go binary folder (default: ~/go/bin) is not in your `PATH`.
>
> To add the ~/go/bin folder to your PATH, add this line at the end of your ~/.bashrc:
>```
>export PATH=$PATH:~/go/bin
>```
>
>and reload it with:
>
>```
>source ~/.bashrc
>```
You can also verify that you are running the correct version

```bash
otool -L ./build/fetchd
fetchd version
```

This should print a version number that must be compatible with the network you're connecting to (see the [network page](../networks/) for the list of supported versions per network).
9 changes: 9 additions & 0 deletions docs/docs/cli-introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@ fetchcli config trust-node false
fetchcli config node https://rpc-fetchhub.fetch-ai.com:443
```

### Connecting to stargateworld network

On Stargate networks, the `fetchcli` binary **does not exists anymore**. Instead, every commands are now provided by `fetchd`. Beside this, the syntax is generaly the same. To connect to the stargateworld network run the following configuration steps:

```bash
fetchd config chain-id stargateworld-1
fetchd config node https://rpc-stargateworld.fetch-ai.com:443
```

### Connecting to Agent Land network

To connect to the agent land network run the following configuration steps:
Expand Down
29 changes: 20 additions & 9 deletions docs/docs/cli-keys.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ Managing your keys is an essential part of working with the Ledger, since all in
To create a new local key you need run the following command:

```bash
fetchcli keys add <your_key_name>
fetchd keys add <your_key_name>
```

<div class="admonition note">
<p class="admonition-title">Note</p>
<p>These keys are stored locally on your system. By default, these keys will be stored in the OS level keychain, however, in general these keys are considered less secure than using a hardware device</p>
</div>

After running the command `fetchcli` will print out a summary of the new key. An example of this output is shown below:
After running the command `fetchd` will print out a summary of the new key. An example of this output is shown below:

```text
- name: test
Expand All @@ -34,7 +34,7 @@ This will be followed by a 24-word mnemonic that can be used to re-generate the
A common operation that you will want to do is to lookup the address for a specified key. This can be done quickly using the following command:

```bash
fetchcli keys show -a <name of key>
fetchd keys show -a <name of key>
```

An example of the expected output is shown below:
Expand All @@ -46,7 +46,7 @@ fetch142tawq2rj397mctc3jtw9dfzf03ns0ze4swat0
A less common operation, but still useful, would be to lookup the public key for a specified key. The can be achieved with the following command:

```bash
fetchcli keys show -p <name of the key>
fetchd keys show -p <name of the key>
```

An example of the expected output is shown below:
Expand All @@ -60,7 +60,7 @@ fetchpub1addwnpepqvtmze0ekffynnjx9n85g6sexzl49ze2vpgc2f52fteyyghjtvvqw682nkx
To lookup more detailed information for all keys on your system use the following command:

```bash
fetchcli keys list
fetchd keys list
```

This will output all of your keys information in a yaml format that is similar to the one generated when you first created the key.
Expand All @@ -75,6 +75,17 @@ This will output all of your keys information in a yaml format that is similar t
pubkeys: []
```

## Recovering a key

You can import a key from a 24-word mnemonic by running:

```bash
fetchd keys add <name> --recover
> Enter your bip39 mnemonic
<type or paste your mnemonic>
```
You'll be prompted to enter the mnemonic phrase, and it will then print the matching address and key details as when creating a new key.

## Hardware Wallets

### Setup
Expand All @@ -87,14 +98,14 @@ We recommend hardware wallets as a solution for managing private keys. The Fetch

### Adding a new key

In order to use the hardware wallet address with the cli, the user must first add it via `fetchcli`. This process only records the public information about the key.
In order to use the hardware wallet address with the cli, the user must first add it via `fetchd`. This process only records the public information about the key.

To import the key first plug in the device and enter the device pin. Once you have unlocked the device navigate to the Cosmos app on the device and open it.

To add the key use the following command:

```bash
fetchcli keys add <name for the key> --ledger --index 0
fetchd keys add <name for the key> --ledger --index 0
```

<div class="admonition note">
Expand All @@ -121,13 +132,13 @@ It is also possible to import private keys from the agent framework. For example
To import this key into the local keychain simply run the following command:

```bash
fetchcli keys import --agent-raw-key <name of the new key> <path to the key file>
fetchd keys import --agent-raw-key <name of the new key> <path to the key file>
```

For example:

```bash
fetchcli keys import --agent-raw-key agent /home/user/fetchai_private_key.txt
fetchd keys import --agent-raw-key agent /home/user/fetchai_private_key.txt
```

<div class="admonition note">
Expand Down
57 changes: 37 additions & 20 deletions docs/docs/cli-tokens.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,21 @@

## Querying your balance

Once the wasm is configured for the desired [network](../cli-introduction/). The user can query there balance using the following command:
Once `fetchd` is configured for the desired [network](../cli-introduction/). The user can query there balance using the following command:

```bash
fetchcli query account fetch1akvyhle79nts4rwn075t85xrwmp5ysuqynxcn4
fetchd query bank balances fetch1akvyhle79nts4rwn075t85xrwmp5ysuqynxcn4
```

If the address exists on the network then the user will expect to see an output in the following form:

```text
address: fetch1akvyhle79nts4rwn075t85xrwmp5ysuqynxcn4
coins:
- denom: atestfet
amount: "1000000000000000000"
public_key: ""
account_number: 20472
sequence: 0
balances:
- amount: "8000000000000000000"
denom: atestfet
pagination:
next_key: null
total: "0"
```


Expand All @@ -26,36 +25,54 @@ If the address exists on the network then the user will expect to see an output
To send funds from one address to another address then you would use the `tx send` subcommand. As shown below:

```bash
./build/fetchcli tx send <from address or key name> <target address> <amount>
fetchd tx bank send <from address or key name> <target address> <amount>
```

In a more concrete example if the user wanted to send `100atestfet` from `main` key/address to `fetch106vm9q6ezu9va7v7e0cvq0nedc54egjm692fcp` then the following command would be used.

```bash
./build/fetchcli tx send main fetch106vm9q6ezu9va7v7e0cvq0nedc54egjm692fcp 100atestfet
fetchd tx bank send main fetch106vm9q6ezu9va7v7e0cvq0nedc54egjm692fcp 100atestfet
```

When you run the command you will get a similar output and prompt. The user can check the details of the transfer and then press 'y' to confirm the transfer.

```text
{"chain_id":"agent-land","account_number":"20472","sequence":"0","fee":{"amount":[],"gas":"200000"},"msgs":[{"type":"cosmos-sdk/MsgSend","value":{"from_address":"fetch1akvyhle79nts4rwn075t85xrwmp5ysuqynxcn4","to_address":"fetch106vm9q6ezu9va7v7e0cvq0nedc54egjm692fcp","amount":[{"denom":"atestfet","amount":"100"}]}}],"memo":""}
{"body":{"messages":[{"@type":"/cosmos.bank.v1beta1.MsgSend","from_address":"fetch12cjntwl32dry7fxck8qlgxq6na3fk5juwjdyy3","to_address":"fetch1hph8kd54gl6qk0hy5rl08qw9gcr4vltmk3w02v","amount":[{"denom":"atestfet","amount":"100"}]}],"memo":"","timeout_height":"0","extension_options":[],"non_critical_extension_options":[]},"auth_info":{"signer_infos":[],"fee":{"amount":[],"gas_limit":"200000","payer":"","granter":""}},"signatures":[]}
confirm transaction before signing and broadcasting [y/N]: y
```

Once the transfer has been made a summary is presented to the user. An example is shown below:

```text
height: 0
txhash: CA7C2C842F8F577E9621C2B23A016D93B979AC1A45015807799C5AD959503FA4
codespace: ""
code: 0
codespace: ""
data: ""
rawlog: '[]'
logs: []
gas_used: "0"
gas_wanted: "0"
height: "0"
info: ""
gaswanted: 0
gasused: 0
logs: []
raw_log: '[]'
timestamp: ""
tx: null
txhash: 77C7382A0B1B9FE39257A6C16C7E3169A875CB3A87F2CE9D947D7C1335B53E76
```

On failure, the response will have a non zero code, as well as some logs under the `raw_log` key:

```text
code: 4
codespace: sdk
data: ""
gas_used: "0"
gas_wanted: "0"
height: "0"
info: ""
logs: []
raw_log: 'signature verification failed; please verify account number (5815) and chain-id
(stargateworld-1): unauthorized'
timestamp: ""
```
tx: null
txhash: 23701B052B423D63EB4AC94773B5B8227B03A576692A57999E92F2554F2372D4
```
Loading

0 comments on commit 8889402

Please sign in to comment.