Skip to content

Commit

Permalink
Merge pull request #4 from InjectiveLabs/f/readme-updates
Browse files Browse the repository at this point in the history
NOISSUE - Adds sync from scratch guide
  • Loading branch information
albertchon authored Oct 20, 2021
2 parents 6de682f + b480b2b commit 953600f
Show file tree
Hide file tree
Showing 2 changed files with 130 additions and 6 deletions.
15 changes: 9 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@ It also contains hassle-free guides and scripts for getting started and managing

* [Create a new node and join the network](guides/new-node.md)
* [Sync node from the snapshot](guides/sync-node.md) (quickest way to sync blocks).
* [Sync node from scratch via public sentries](guides/sync-node.md) (better decentralization factor).
* [Upgrade Node to the latest version](guides/upgrade-node.md)


## Requirments

The following requirements are required to run the node natively.

### Hardware:
### Hardware

The following table shows the recommended hardware requirements for the running node on the mainnet.

| Validator Node | Sentry Node |
Expand All @@ -23,15 +25,14 @@ The following table shows the recommended hardware requirements for the running
| Storage: 1Tb | Storage: 1Tb |
| Network: 5Gbps+ | Network: 5Gbps+|


### Software:
### Software

* [Go Installed][go-install-link]
* [Git Installed][git-link]
* [AWS CLI][aws-cli-install-link] (only for snapshot sync, aws account not required)


## Sentry Seed Nodes

For the **testnet**, find a list of seed nodes in seed.txt in the matching release folder [here][injective-netconf-test]

*Example, for testnet release [0.4.14](https://github.com/InjectiveLabs/injective-chain-releases/releases/tag/v0.4.14-1632990203)
Expand All @@ -40,17 +41,19 @@ you will find the seed node list in `40014/seed.txt`*
For the **mainnet**, find a list of seed nodes matching your release [here][injective-netconf-main]

## Helpful links

* [Official Documentation][injective-docs]
* [Injective REST API Spec][injective-rest-api-link]

# Get Involved

Injective Protocol is a community driven project; we welcome all contribution.

* Discuss with [Discord community][discord-community-link]
* Join Injective on [Telegram][telegram-community-link]
* [Github repositories][injective-github-repo]
* Follows us on [Twitter][injective-twitter-link]


[sync-node-link]:
[create-node-link]:
[upgrade-node-link]: https://docs.injective.network/docs/staking/mainnet/validate-on-mainnet/upgrading-your-node
Expand Down
121 changes: 121 additions & 0 deletions guides/sync-node.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,126 @@ Follow manual process [here.][sync-guide-link]

Or use automation [sync script](../scripts/README.md)

**NOTE:** You always have the option to sync your sentry from scratch via public sentries, which is a more decentralized approach.

# Sync From Scratch


Because of breaking changes we made with release 10001 rc7, the node should be synced with `injectived`
version 10001 rc6, until halt height block 2045750. Then the `injectived` binary should be updated to version 10001 rc7 to the latest block.

Here is a simple 6-step guide on how to sync from scratch.


### Step 1

Backup your configuration

```
mkdir $HOME/injectived-backup/
cp -rf $HOME/.injectived/config $HOME/.injectived/keyring-file $HOME/injectived-backup/
```

### Step 2
Get the previous release version `10001 rc6`
```
# Make sure that no running injectived processes
killall injectived &>/dev/null || true
# Remove current binary that you use
rm -rf /usr/bin/injectived
wget https://github.com/InjectiveLabs/injective-chain-releases/releases/download/v1.0.1-1629427973/linux-amd64.zip
unzip linux-amd64.zip
mv -f injectived /usr/bin
#check version
injectived version
# Should output
#Version dev (48356b9)
```

### Step 3
Init chain
```
# The argument <moniker> is the custom username of your node. It should be human-readable.
export MONIKER=<moniker>
# the Injective Chain has a chain-id of "injective-1"
injectived init $MONIKER --chain-id injective-1
```

### Step 4
Sync to halt height block
```
injectived start --halt-height 2045750
```

The node will automatically exit upon reaching block height reachs 2045750.

**NOTE:** The sync process takes approximately two days until it reaches halt height. If you want to run sync as a background process, follow the official guide [using systemd service][using-systemd-guide-link].
**Make sure you update ExecStart commannd** bypassing `--halt-height 2045750` param.
Otherwise, you will overshoot the halt height and will have to resync from scratch again.

`ExecStart=/bin/bash -c '/usr/bin/injectived --halt-height 2045750 --log-level=error start'`


### Step 5
From this step, given that you've now reached the halt height, you can now switch binary to the latest version.

```
# Make sure that no running injectived processes
killall injectived &>/dev/null || true
# If you use systemd service, stop it, otherwise skip this step
sudo systemctl stop injectived && sudo systemctl disable injectived
# Remove old binary, you don't need it anymore
rm -rf /usr/bin/injectived
# Get the latest one
wget https://github.com/InjectiveLabs/injective-chain-releases/releases/download/v1.0.1-1630308393/linux-amd64.zip
unzip linux-amd64.zip
sudo mv injectived peggo injective-exchange /usr/bin
#check version
injectived version
# Should output
#Version dev (b174465)
```

### Step 6
Continue syncing to the latest block.

```
injectived start
```

**NOTE:** If you want to continue sync as a background process, follow the official guide [using systemd service][using-systemd-guide-link].
**Make sure you update back ExecStart commannd** by removing `--halt-height 2045750` param.


`ExecStart=/bin/bash -c '/usr/bin/injectived --log-level=error start'`


Start systemd service

`sudo systemctl start injectived && sudo systemctl enable injectived`


Wait until the sync finishes, and the block height should reach the latest chain block. Follow via API

```
curl localhost:26657/status | grep height
```

When it reaches network block height, your node is fully synced, and you are running the latest version of the injective chain.


[sync-guide-link]: https://docs.injective.network/docs/staking/mainnet/validate-on-mainnet/sync-from-snapshot/
[using-systemd-guide-link]: https://chain.injective.network/guides/mainnet/join-network.html

0 comments on commit 953600f

Please sign in to comment.