Add README

Resolves #46

Signed-off-by: Doctor K <doctor_whoami@ghostchain.io>
This commit is contained in:
Doctor K 2024-12-04 17:08:59 +03:00
parent cd2d52df1c
commit 941da651a8
Signed by: doctor_whoami
SSH Key Fingerprint: SHA256:vE55a19CRoNAv7af7mpduptyLuK6qoP1ks8fsqorX0I
42 changed files with 553 additions and 1 deletions

554
README.md
View File

@ -1 +1,553 @@
TODO
# Notes
Arrows will mark the places where your input is needed
# Update system
Update Your System: Before installing any new software,
it's a good practice to update your system's package list and
upgrade the existing packages to their latest versions.
```bash
sudo apt update
sudo apt upgrade
```
# Firewall
Install Ubuntu firewall
```bash
sudo apt install ufw
```
If you want to connect to your node-machine, allow connection to the SSH port
```bash
sudo ufw allow ssh
```
![readme_images/img.png](readme_images/img.png)
Enable firewall, confirm the operation
```bash
sudo ufw enable
```
![readme_images/img_1.png](readme_images/img_1.png)
Check firewall status. You should see `Status: active`
```bash
sudo ufw numbered
```
![readme_images/img_2.png](readme_images/img_2.png)
# SSH
## Install SSH
Once you have installed the proper Operating System on you machine
we recommend that you enable SSH. Most people have a Daily Driver machine.
GHOST requires a separate machine. Adding an extra machine to your life could be cumbersome.
Chances are you had to use an external monitor to install Ubuntu on GHOST Node,
the same screen regularly used by the Daily Driver machine.
SSH enables you to manage your GHOST Nodes remotely from the comfort of your Daily Driver.
Install OpenSSH Server: With your system updated, the next step is to install
the OpenSSH server package. This package contains the necessary software to run
an SSH server.
```bash
sudo apt install openssh-server
```
Enable SSH Service to Start on Boot: To ensure that the SSH service automatically
starts after a reboot, you need to enable it using _systemctl_.
```bash
sudo systemctl enable ssh
```
To check the status of the SSH service, run the following command:
```bash
sudo systemctl status ssh
```
You should be seeing something like this:
![readme_images/img_3.png](readme_images/img_3.png)
## Connect by SSH
With SSH enabled and the firewall configured, you can now connect
to your node machine from another computer using SSH.
You have to know your username and your local network ip
```bash
ssh [username]@[your_server_ip_OR_hostname]
```
# Install GHOST Application
## Allow Ports
Allow `port 30333` on GHOST Node:
```bash
sudo ufw allow 30333
```
![readme_images/img_5.png](readme_images/img_5.png)
To ensure that the ports are allowed, run the following command:
```bash
sudo ufw numbered
```
![readme_images/img_6.png](readme_images/img_6.png)
## Install Substrate Libraries
Click [here](https://docs.substrate.io/install/linux/) for a detailed Rust guide if you want to dive deep into the documentation. Otherwise let's proceed.
### Install Dependencies
Check the documentation for your operating system for information about
the packages that are installed and how to download and install
any additional packages you might need. For example,
if you use Debian/Ubuntu, you can use the Advanced Packaging Tool (apt)
to install packages:
```bash
sudo apt install -y build-essential clang curl git make libssl-dev protobuf-compiler llvm libudev-dev
```
### Rust Install
Download the rustup installation program and use it to install Rust by running the following command:
```bash
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
```
Press Enter for using default options:
![readme_images/img_7.png](readme_images/img_7.png)
Update your current shell to include Cargo by running the following command:
```bash
source $HOME/.cargo/env
```
Verify your installation by running the following command:
```bash
rustc --version
```
You should see something like this:
![readme_images/img_8.png](readme_images/img_8.png)
Configure the Rust toolchain to default to the latest stable version by running the following commands:
```bash
rustup default stable
```
```bash
rustup update
```
Add the nightly release and the nightly WebAssembly (wasm) targets
to your development environment by running the following commands:
```bash
rustup update nightly
```
```bash
rustup target add wasm32-unknown-unknown --toolchain nightly
```
```bash
rustup target add wasm32-unknown-unknown --toolchain stable-x86_64-unknown-linux-gnu
```
**_IF error try_**
```bash
rustup target add wasm32-unknown-unknown --toolchain default
```
Verify the configuration of your development environment by running
the following command:
```bash
rustup show
```
```bash
rustup +nightly show
```
You should see something like this:
![readme_images/img_9.png](readme_images/img_9.png)
![readme_images/img_10.png](readme_images/img_10.png)
Now run:
```bash
rustup component add rust-src --toolchain stable
```
**_IF error try_**
```bash
rustup component add rust-src --toolchain default
```
## Install GHOST
Check if Git is already installed:
```bash
git --version
```
![readme_images/img_11.png](readme_images/img_11.png)
Make a GHOST Directory and go to it:
```bash
mkdir ghost && cd ghost
```
Clone GHOST Node Git:
```bash
git clone https://git.ghostchain.io/ghostchain/ghost-node.git
```
Go to ghost-node directory:
```bash
cd ghost-node
```
Compile the node template by running the following command:
```bash
cargo build --release
```
The build can take up to 20 minutes depending on the specifications of your machine.
![readme_images/img_12.png](readme_images/img_12.png)
# Boot Node Qualification
## Boot Node Qualification Test
Becoming a Boot Node on GHOST Chain is an absolute MUST if we want the network
to be sufficiently decentralized. However, due to certain ISP limitations
some countries make it being a Boot Node easier than others.
Hence, the GHOST Dev team came up with a Boot Node Qualification Test.
First we should install TRACEROUTE:
```bash
sudo apt install traceroute
```
Then we must determine the public IP for your GHOST Node Machine.
```bash
curl -4 icanhazip.com
```
![readme_images/img_13.png](readme_images/img_13.png)
Then type the following command replacing `<YOUR_IP_FROM_PREVIOUS_STEP>` with an actual IP address from previous step:
```bash
traceroute <YOUR_IP_FROM_PREVIOUS_STEP>
```
If your GHOST Node is **not behind a NAT** your terminal window should look something like this:
![readme_images/img_14.png](readme_images/img_14.png)
If your GHOST Node is **behind NAT** your terminal window should look something like this:
![readme_images/img_15.png](readme_images/img_15.png)
If your GHOST Node is NOT behind the NAT then your node can be a Boot Node.
If your GHOST Node is behind the NAT then your node CANNOT be a Boot Node
and you will have to use some kind of proxy to rectify the situation.
Afterwards, post the screenshot of your terminal window in the Whales group.
Feel free to blur out your IP.
## Setting Proper Firewall Rules
You must enable `port 30333` on your router
Based on prior instructions you may have configured your firewall in way that is
no longer needed. For the purpose of GHOST Chain you should only
open `port 30333` and close other ports.
### Checking Firewall
Check the ports that are opened on your firewall:
```bash
sudo ufw numbered
```
![readme_images/img_16.png](readme_images/img_16.png)
If `port 9945` is opened then close it:
```bash
sudo ufw deny 9945
```
### Configuring Router
Enable port forwarding for port 30333 on your router. Be mindful that different networks and routers have different ways of setting this up. It is best to search for portforwarding instruction for the specific router model.
![readme_images/img_17.png](readme_images/img_17.png)
### Checking Ports
Simulate a broadcasting node by running a dummy GHOST Node launch command:
```bash
./target/release/ghost --port=30333 --rpc-port=9945 --chain=dev --node-key=0000000000000000000000000000000000000000000000000000000000000001 --base-path=/tmp/alice --alice --validator --unsafe-rpc-external --no-telemetry --state-pruning=archive
```
To check ports go to [Port Checker Website](https://dnschecker.org/port-scanner.php) and check following ports:
```
30333, 9945
```
Only `port 30333` should be opened.
![readme_images/img_18.png](readme_images/img_18.png)
Press _CTRL+C_ to stop the node.
# Launching GHOST TestNet 2.0
Switch to main GIT branch:
```bash
git switch main
```
Make sure `ghost-node` is up to date:
```bash
git pull origin main
```
## Generating keys
Create ghost configuration directory:
```bash
sudo mkdir /etc/ghost
```
Give the user permission to the directory:
```bash
sudo chown $(whoami) /etc/ghost
```
To generate the node key use the following command:
```bash
./target/release/ghost key generate-node-key --bin --file=/etc/ghost/node-key
```
Generate Wallet Key file with the following command:
```bash
./target/release/ghost key generate | grep "Secret seed" | awk '{$1=$2=""; sub(/^[ \t]+/, ""); print}' > /etc/ghost/wallet-key
```
Display the wallet-key on the screen by using cat command:
```bash
./target/release/ghost key inspect $(cat /etc/ghost/wallet-key)
```
![readme_images/img_22.png](readme_images/img_22.png)
Feel free to back the file on a separate storage device.
Generate Stash Key file with the following command:
```bash
./target/release/ghost key generate | grep "Secret seed" | awk '{$1=$2=""; sub(/^[ \t]+/, ""); print}' > /etc/ghost/stash-key
```
Display the stash-key on the screen by using cat command:
```bash
./target/release/ghost key inspect $(cat /etc/ghost/stash-key)
```
![readme_images/img_23.png](readme_images/img_23.png)
Generate Session Key file with the following command:
```bash
./target/release/ghost key generate | grep "Secret seed" | awk '{$1=$2=""; sub(/^[ \t]+/, ""); print}' > /etc/ghost/session-key
```
You have generates 4 types of Session Keys:
1. Session Key AUDI
2. Session Key BABE
3. Session Key SLOW
4. Session Key GRAN
Now let's display them!
Display the session-key//audi on the screen by using cat command:
```bash
./target/release/ghost key inspect "$(cat /etc/ghost/session-key)//audi"
```
![readme_images/img_24.png](readme_images/img_24.png)
Display the session-key//babe on the screen by using cat command:
```bash
./target/release/ghost key inspect "$(cat /etc/ghost/session-key)//babe"
```
![readme_images/img_25.png](readme_images/img_25.png)
Display the session-key//slow on the screen by using cat command:
```bash
./target/release/ghost key inspect "$(cat /etc/ghost/session-key)//slow"
```
![readme_images/img_26.png](readme_images/img_26.png)
Display the session-key//gran on the screen by using cat command:
```bash
./target/release/ghost key inspect "$(cat /etc/ghost/session-key)//gran" --scheme=ed25519
```
![readme_images/img_27.png](readme_images/img_27.png)
## Build and start the ghost-node
Recompile `ghost-node` using `starter.sh` and `--release` flag.
Make `ghost-node` service being able to be started by default user
using `--make-global`:
```bash
./scripts/starter.sh --release --make-global
```
We need to recompile so type y and press Enter to proceed:
![readme_images/img_20.png](readme_images/img_20.png)
Recompiling will take some time!
The script needs higher permissions to write the ghost-node startup file, so it may ask for your user's password
![readme_images/img_21.png](readme_images/img_21.png)
![readme_images/img_28.png](readme_images/img_28.png)
Check the hash of the build:
```bash
sha256sum /etc/ghost/casper.json
```
You should see:
```
6c1bab2e9c04043814b5e5e72984b00ac60150bd48cb16068495f1b49fbc5008
```
![readme_images/img_29.png](readme_images/img_29.png)
Create running `ghost-node` service that starts on system boot using `--unit-file` flag.
And we must set up the `ghost-node` launch command by setting arguments using
`--set-arguments` flag:
```bash
./scripts/starter.sh --unit-file --set-arguments
```
Only change the defaults if you are advanced otherwise press _Enter_ for
the following prompts.
If this is your first node simply press _Enter_ to proceed with the default.
If this is your second node you should type a different port here,
for example `30334`, and then you should open this port on your firewall
and create a dedicated port forwarding rule on your router as specified
in the Testing Connectivity Part:
```
specify p2p protocol TCP port (default: 30333): 30334
```
To choose default options press Enter here:
![readme_images/img_30.png](readme_images/img_30.png)
Currently, you have to qualify to become a validator node through [GHOST Whales](https://ghostchain.io/whales-apply).
If you were NOT included in the [ghosties file](https://git.ghostchain.io/ghostchain/ghost-node/src/branch/main/service/ghosties) then you cannot be a validator node,
and you can only be a full node so for `disable validator mode? [y/N]` type `y`.
If you were included in the ghosties file you can press Enter:
```
disable validator mode? [y/N]: y
```
![readme_images/img_31.png](readme_images/img_31.png)
Press _Enter_ for reject enabling Prometheus:
![readme_images/img_32.png](readme_images/img_32.png)
For the following prompt:
```
list of bootnodes if any:
```
Paste one of the following **Boot Node** address:
```
/dns/bootnode69.chain.ghostchain.io/tcp/30334/p2p/12D3KooWF9SWxz9dmy6vfndQhoxqCa7PESaoFWEiF8Jkqh4xKDRf
```
![readme_images/img_33.png](readme_images/img_33.png)
Press _Enter_:
![readme_images/img_34.png](readme_images/img_34.png)
Changing `unit-file` name is optional, otherwise press _Enter_:
![readme_images/img_35.png](readme_images/img_35.png)
Type `y` and press _Enter_ for create dedicated user for running `ghost-node`:
![readme_images/img_36.png](readme_images/img_36.png)
**DO NOT start and enable** `ghost-node.service` press _Enter_:
![readme_images/img_37.png](readme_images/img_37.png)
Now you can check whether or not the keys on your GHOST Node match those
in the [ghosties file](https://git.ghostchain.io/ghostchain/ghost-node/src/branch/main/service/ghosties) on GHOST Git.
If you are running a **Validator Node** and if you have followed
the Generating Keys Part you will see all `[+]`.
If you are a running a **Full Node** you will see errors:
(Press _Enter_ for prompts)
```bash
./scripts/starter.sh --check-keys
```
Full Node:
![readme_images/img_38.png](readme_images/img_38.png)
Validator Node:
![readme_images/img_39.png](readme_images/img_39.png)
Start `ghost-node`:
```bash
sudo systemctl start ghost-node
```
Wait 60 seconds!
Check node is started:
```bash
sudo systemctl status ghost-node
```
![readme_images/img_40.png](readme_images/img_40.png)
For exit press _CTRL+C_
In order to insert keys run the following flags `--check-keys` `--insert-keys`:
```bash
./scripts/starter.sh --check-keys --insert-keys
```
Restart `ghost-node`:
```bash
sudo systemctl restart ghost-node
```
Enable `ghost-node`:
```bash
sudo systemctl enable ghost-node
```
![readme_images/img_41.png](readme_images/img_41.png)
To see the logs produced by your `ghost-node`:
```bash
journalctl -f -u ghost-node
```
To exit press _CTRL+C_.
Congratulations! You have an operational GHOST Node.

BIN
readme_images/img.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

BIN
readme_images/img_1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

BIN
readme_images/img_10.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

BIN
readme_images/img_11.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

BIN
readme_images/img_12.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
readme_images/img_13.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

BIN
readme_images/img_14.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

BIN
readme_images/img_15.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

BIN
readme_images/img_16.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
readme_images/img_17.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 95 KiB

BIN
readme_images/img_18.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

BIN
readme_images/img_19.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

BIN
readme_images/img_2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

BIN
readme_images/img_20.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

BIN
readme_images/img_21.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

BIN
readme_images/img_22.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

BIN
readme_images/img_23.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

BIN
readme_images/img_24.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

BIN
readme_images/img_25.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

BIN
readme_images/img_26.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

BIN
readme_images/img_27.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

BIN
readme_images/img_28.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

BIN
readme_images/img_29.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

BIN
readme_images/img_3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

BIN
readme_images/img_30.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

BIN
readme_images/img_31.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

BIN
readme_images/img_32.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

BIN
readme_images/img_33.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

BIN
readme_images/img_34.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

BIN
readme_images/img_35.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

BIN
readme_images/img_36.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

BIN
readme_images/img_37.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

BIN
readme_images/img_38.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

BIN
readme_images/img_39.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

BIN
readme_images/img_40.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 98 KiB

BIN
readme_images/img_41.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

BIN
readme_images/img_5.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

BIN
readme_images/img_6.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

BIN
readme_images/img_7.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
readme_images/img_8.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

BIN
readme_images/img_9.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB