Skip to content

Commit

Permalink
docs: getting started improvements (#594)
Browse files Browse the repository at this point in the history
* docs: getting started improvements

* Update README.md

Co-authored-by: Anil Kumar Kammari <anil@vitwit.com>

Co-authored-by: Anil Kumar Kammari <anil@vitwit.com>
  • Loading branch information
ryanchristo and anilcse committed Oct 27, 2021
1 parent 81972ee commit 53b6f00
Show file tree
Hide file tree
Showing 7 changed files with 215 additions and 101 deletions.
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Regen Ledger
![banner](docs/regen-network-image.jpg)

![banner](docs/regen_ledger.png)

[![Build status](https://github.com/regen-network/regen-ledger/workflows/Build/badge.svg)](https://github.com/regen-network/regen-ledger/commits/master)
[![Tests status](https://github.com/regen-network/regen-ledger/workflows/Tests/badge.svg)](https://github.com/regen-network/regen-ledger/commits/master)
Expand All @@ -11,14 +12,12 @@
[![Go Report Card](https://goreportcard.com/badge/github.com/regen-network/regen-ledger)](https://goreportcard.com/report/github.com/regen-network/regen-ledger)
[![Gitter chat](https://badges.gitter.im/regen-network/regen-ledger.png)](https://gitter.im/regen-network/regen-ledger "Gitter chat")


A distributed ledger for ecology built on top of the
[cosmos-sdk](http://github.com/cosmos/cosmos-sdk).

## Getting Started


See [Getting Started](docs/getting-started/README.md) for instructions how to install and run the blockchain.
See [Get Started](https://docs.regen.network/getting-started) for instructions on how to run a single node network on your local machine. For instructions on how to run a full node or validator node on a live network, see [Running a Full Node](https://docs.regen.network/getting-started/running-a-full-node) or [Running a Validator](https://docs.regen.network/getting-started/running-a-validator).

## Core Features

Expand Down
92 changes: 63 additions & 29 deletions docs/getting-started/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
# Quick Start
# Get Started

This document provides instructions for running a single node network on your local machine and then submitting your first few transactions to that network using the command line. Running a single node network is a great way to get familiar with Regen Ledger and its functionality.

<!-- TODO: update example to use ecocredit module once updated to v1.1 -->

## Prerequisites

In order to install the `regen` binary, you'll need the following:
Expand All @@ -19,45 +17,68 @@ For more information, see [Prerequisites](prerequisites.md).
The `regen` binary serves as the node client and the application client. In other words, the `regen` binary can be used to both run a node and interact with it.

Clone the `regen-ledger` repository:
```

```bash
git clone https://github.com/regen-network/regen-ledger
```

Change to the `regen-ledger` directory:
```

```bash
cd regen-ledger
```

Check out the latest stable version:
```

```bash
git checkout v1.0.0
```

Install the `regen` binary:
```

```bash
make install
```

Note: the `regen` binary is installed into `$(go env GOPATH)/bin`, so please make sure `$(go env GOPATH)/bin` is in your PATH (e.g. `export PATH=$(go env GOPATH)/bin:$PATH` if not already there)

Check to make sure the install was successful:
```

```bash
regen version
```

You should see `v1.0.0` printed to the console. Now that you have successfully installed the `regen` binary, the next step will be to add a couple test accounts.

## Quickstart

If you would like to learn about the setup process and manually set up a single node network, skip to the [next section](#create-accounts). Alternatively, you can run the following quickstart script:

```bash
./scripts/start_testnode.sh
```

The script provides two command-line options for specifying a keyring-backend (`-k`), and the name of the blockchain (`-c`). For example, to use the `os` keyring-backend with the name `demo`:

```bash
./scripts/start_testnode.sh -k os -c demo
```

After running the quickstart script, you can skip to [Start Node](#start-node).

## Create Accounts

In this section, you will create two test accounts. You will name the first account `validator` and the second account `delegator`. You will create both accounts using the `test` backend, meaning both accounts will not be securely stored and should not be used in a production environment. When using the `test` backend, accounts are stored in the home directory (more on this in the next section).

Create `validator` account:
```

```bash
regen keys add validator --keyring-backend test
```

Create `delegator` account:
```

```bash
regen keys add delegator --keyring-backend test
```

Expand All @@ -68,7 +89,8 @@ After running each command, information about each account will be printed to th
Initializing the node will create the `config` and `data` directories within the home directory. The `config` directory is where configuration files for the node are stored and the `data` directory is where the data for the blockchain is stored. The default home directory is `~/.regen`.

Initialize the node:
```

```bash
regen init node --chain-id test
```

Expand All @@ -80,35 +102,39 @@ When the node was initialized, a `genesis.json` file was created within the `con

Update native staking token to `uregen`:

If you're on a Linux variant:
*For Mac OS:*

```
sed -i "s/stake/uregen/g" ~/.regen/config/genesis.json
```bash
sed -i "" "s/stake/uregen/g" ~/.regen/config/genesis.json
```

Note: Mac OS does `sed` slightly differently:
*For Linux variants:*

```
sed -i "" "s/stake/uregen/g" ~/.regen/config/genesis.json
```bash
sed -i "s/stake/uregen/g" ~/.regen/config/genesis.json
```

Add `validator` account to `genesis.json`:
```

```bash
regen add-genesis-account validator 5000000000uregen --keyring-backend test
```

Add `delegator` account to `genesis.json`:
```

```bash
regen add-genesis-account delegator 2000000000uregen --keyring-backend test
```

Create genesis transaction:
```

```bash
regen gentx validator 1000000uregen --chain-id test --keyring-backend test
```

Add genesis transaction to `genesis.json`:
```

```bash
regen collect-gentxs
```

Expand All @@ -119,7 +145,8 @@ Now that you have updated the `genesis.json` file, you are ready to start the no
Well, what are you waiting for?

Start the node:
```

```bash
regen start
```

Expand All @@ -130,37 +157,44 @@ You should see logs printed in your terminal with information about services sta
Now that you have a single node network running, you can open a new terminal window and interact with the node using the same `regen` binary. Let's delegate some `uregen` tokens to the validator and then collect the rewards.

Get the validator address for the `validator` account:
```

```bash
regen keys show validator --bech val --keyring-backend test
```

Using the validator address, delegate some `uregen` tokens:
```

```bash
regen tx staking delegate [validator_address] 10000000uregen --from delegator --keyring-backend test --chain-id test
```

In order to query all delegations, you'll need the address for the `delegator` account:
```

```bash
regen keys show delegator --keyring-backend test
```

Using the address, query all delegations for the `delegator` account:
```

```bash
regen q staking delegations [delegator_address]
```

Query the rewards using the delegator address and the validator address:
```

```bash
regen q distribution rewards [delegator_address] [validator_address]
```

Withdraw the rewards:
```

```bash
regen tx distribution withdraw-all-rewards --from delegator --keyring-backend test --chain-id test
```

Check the account balance:
```

```bash
regen q bank balances [delegator_address]
```

Expand Down
9 changes: 6 additions & 3 deletions docs/getting-started/live-networks.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,20 @@ First, you'll need to install the `regen` binary. For installation instructions,
In order to interact with a node from a live network, you'll need to provide a `--node` flag with a valid node address to your commands. Before submitting any queries or transactions, you should first check the status of the node using the `status` command.

To check the status of the Regen Mainnet node provided above, run the following command:
```

```bash
regen status --node http://104.131.169.70:26657
```

To check the status of the Redwood Testnet node provided above, run the following command:
```

```bash
regen status --node http://redwood.regen.network:26657
```

To check the status of the Hambach Testnet node provided above, run the following command:
```

```bash
regen status --node http://hambach.regen.network:26657
```

Expand Down
35 changes: 23 additions & 12 deletions docs/getting-started/prerequisites.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,35 +28,45 @@ We recommend the following hardware specifications:

We recommend using Ubuntu 18.04 or 20.04.

The prerequisites listed above for developers are also required for node operators. The following instructions provide a quick start for installing prerequisites on a Linux machine.
The prerequisites listed above for developers are also required for node operators. The following instructions will install the necessary prerequisites on a Linux machine.

:::tip NOTE
These commands are included in the [quickstart script](./running-a-validator.md#quickstart).
:::

Install tools:
```

```bash
sudo apt install git build-essential wget jq -y
```

Download Go:
```
wget https://dl.google.com/go/go1.15.14.linux-amd64.tar.gz

```bash
wget https://dl.google.com/go/go1.17.2.linux-amd64.tar.gz
```

Verify data integrity:
```
sha256sum go1.15.14.linux-amd64.tar.gz

```bash
sha256sum go1.17.2.linux-amd64.tar.gz
```

Verify SHA-256 hash:
```
6f5410c113b803f437d7a1ee6f8f124100e536cc7361920f7e640fedf7add72d

```bash
f242a9db6a0ad1846de7b6d94d507915d14062660616a61ef7c808a76e4f1676
```

Unpack Go download:
```
sudo tar -C /usr/local -xzf go1.15.14.linux-amd64.tar.gz

```bash
sudo tar -C /usr/local -xzf go1.17.2.linux-amd64.tar.gz
```

Set up environment:
```

```bash
echo '
export GOPATH=$HOME/go
export GOROOT=/usr/local/go
Expand All @@ -65,7 +75,8 @@ export PATH=$PATH:/usr/local/go/bin:$GOBIN' >> ~/.profile
```

Source profile file:
```

```bash
. ~/.profile
```

Expand Down

0 comments on commit 53b6f00

Please sign in to comment.