Etica full nodesHow to run fullnodes (tutorial updated to eticav2)

Download Etica Blockchain

This part intends to clone Etica repository: https://github.com/etica/core-geth (skip details if you know how to do it)

1. Open a linux terminal
2. Move to the folder you want to import the blockchain into
For instance the following commands enable you to create and move to a folder eticanode:

cd /home/myuser   //(this command move to /home/myuser folder, replace /home/myuser by a folder of your computer)
mkdir eticanode   //(this command creates a folder eticanode within /home/myuser folder)
cd eticanode      //(this command move to folder eticanode)
    

3. Download Etica Blockchain codebase (once you moved to the folder you want to import Etica Blockchain into, type following command to download Etica Blockchain code (Etica repository: https://github.com/etica/etica):

git clone https://github.com/etica/core-geth.git

Installs

This part intends to install dependencies for Etica fullnodes: (skip details if you know how to do it)

1. Install Go version 1.19.1:

sudo apt-get update
wget https://go.dev/dl/go1.19.1.linux-amd64.tar.gz
sudo tar -xvf go1.19.1.linux-amd64.tar.gz
sudo mv go /usr/local
export GOROOT=/usr/local/go
export GOPATH=$HOME/go
export PATH=$GOPATH/bin:$GOROOT/bin:$PATH
source ~/.profile
go version

2. Move to core-geth folder:

cd core-geth

3. Build from source:

sudo apt install make                                   
make geth                                   

Launch Blockchain

1. Start node in none mining mode (replace --datadir "./eticanode1" by --datadir "./yourfoldername" if it is different):

./build/bin/geth --etica --nat extip:127.0.0.1 --datadir "./eticanode1" --http --http.addr "localhost" --http.port "8545" --port "30303" --allow-insecure-unlock --http.corsdomain "*" --rpc.allow-unprotected-txs  --http.api eth,web3,personal,net --http.vhosts=* --ipcpath "~/.ethereum/geth.ipc" --bootnodes "enode://b0e97d2f1a37b2035a34b97f32fb31ddd93ae822b603c56b7f17cfb189631ea2ef17bfbed904f8bc564765634f2d9db0a128835178c8af9f1dde68ee6b5e2bf7@167.172.47.195:30303"

2. Start node in mining mode (replace --datadir "./eticanode1" by --datadir "./yourfoldername" if it is different):

./build/bin/geth --etica --mine --miner.threads=2 --nat extip:127.0.0.1 --miner.gasprice "1000000000" --miner.gaslimit "50000000" --datadir "./eticanode1" --http --http.addr "localhost" --http.port "8545" --port "30303" --allow-insecure-unlock --http.corsdomain "*" --rpc.allow-unprotected-txs  --http.api eth,web3,personal,net --http.vhosts=* --ipcpath "~/.ethereum/geth.ipc" --bootnodes "enode://b0e97d2f1a37b2035a34b97f32fb31ddd93ae822b603c56b7f17cfb189631ea2ef17bfbed904f8bc564765634f2d9db0a128835178c8af9f1dde68ee6b5e2bf7@167.172.47.195:30303"

3. Stop blockchain:

Once blockchain is launched you can stop it by typing CTRL + c on your keyboard. (Be patient, if you type "CTRL + c" too much it can crash your node. It can take few seconds sometimes to actually stop but the node will stop)
CTRL + c

Launch Files

Launch files make it easier to relaunch blockchain as you don't have to remember all command line parameters

Create launch files (for mining mode)

1. Creates and opens a file for launching blockchain in none mining mode:

nano startnode.sh    //run this command from core-geth folder

2. copy and paste this command (same command used above and replace eticanode1 by your folder name):

./build/bin/geth --etica --mine --miner.threads=2 --nat extip:127.0.0.1 --miner.gasprice "1000000000" --miner.gaslimit "50000000" --datadir "./eticanode1" --http --http.addr "localhost" --http.port "8545" --port "30303" --allow-insecure-unlock --http.corsdomain "*" --rpc.allow-unprotected-txs  --http.api eth,web3,personal,net --http.vhosts=* --ipcpath "~/.ethereum/geth.ipc" --bootnodes "enode://b0e97d2f1a37b2035a34b97f32fb31ddd93ae822b603c56b7f17cfb189631ea2ef17bfbed904f8bc564765634f2d9db0a128835178c8af9f1dde68ee6b5e2bf7@167.172.47.195:30303"

Make sure it is just on one line and remove blanks at the bottom and the top. Use keyboard arrows to move accross the file

Wrong

There are still empty spaces at the top and bottom

screenshot
Right

There is only one line, empty spaces at top & bottom have been removed

screenshot

3. To save file, do as follow:

CTRL + o    // o like in oscar
Press Enter
CTRL + x

4. give right to startnode.sh file to start automatically

sudo chmod +x startnode.sh:

5. Now you can launch your blockchain simply with this command:

./startnode.sh

6. To stop it just type "Ctrl + c" on your keyboard
(click on the window before typing "Ctrl + c" if it's not reacting)

Done. Your Etica Blockchain node is operational!

Create launch files (for none mining mode)

1. Creates and opens a file for launching blockchain in none mining mode:

nano startnodenomining.sh

2. copy and paste this command (same command used above):

./build/bin/geth --etica --nat extip:127.0.0.1 --datadir "./eticanode1" --http --http.addr "localhost" --http.port "8545" --port "30303" --allow-insecure-unlock --http.corsdomain "*" --rpc.allow-unprotected-txs  --http.api eth,web3,personal,net --http.vhosts=* --ipcpath "~/.ethereum/geth.ipc" --bootnodes "enode://b0e97d2f1a37b2035a34b97f32fb31ddd93ae822b603c56b7f17cfb189631ea2ef17bfbed904f8bc564765634f2d9db0a128835178c8af9f1dde68ee6b5e2bf7@167.172.47.195:30303"

Make sure it is just on one line and remove blanks at the bottom and the top. Use keyboard arrows to move accross the file

Wrong

There are still empty spaces at the top and bottom

screenshot
Right

There is only one line, empty spaces at top & bottom have been removed

screenshot

3. To save file, do as follow:

CTRL + o    // o like in oscar
Press Enter
CTRL + x

4. give right to startnode.sh file to start automatically

sudo chmod +x startnodenomining.sh:

5. Now you can launch your blockchain simply with this command:

./startnodenomining.sh

6. To stop it just type "Ctrl + c" on your keyboard
(click on the window before typing "Ctrl + c" if it's not reacting)

Create launch files (for secure online server)

1. Close your server ports with ufw:

2. Open 8545 port with ufw:

3. Creates and opens a file for launching blockchain in none mining mode:

nano startnodeonserver.sh

2. copy and paste this command (same command used above):

./build/bin/geth --etica --nat extip:127.0.0.1 --datadir "./eticanode1" --http --http.addr "localhost" --http.port "8545" --port "30303" --http.corsdomain "*" --http.api eth,web3,net --http.vhosts=* --ipcpath "~/.ethereum/geth.ipc" --bootnodes "enode://b0e97d2f1a37b2035a34b97f32fb31ddd93ae822b603c56b7f17cfb189631ea2ef17bfbed904f8bc564765634f2d9db0a128835178c8af9f1dde68ee6b5e2bf7@167.172.47.195:30303"

Make sure it is just on one line and remove blanks at the bottom and the top. Use keyboard arrows to move accross the file

Wrong

There are still empty spaces at the top and bottom

screenshot
Right

There is only one line, empty spaces at top & bottom have been removed

screenshot

3. To save file, do as follow:

CTRL + o
Press Enter
CTRL + x

4. give right to startnodeonserver.sh file to start automatically

sudo chmod +x startnodeonserver.sh:

5. Now you can launch your blockchain simply with this command:

./startnodeonserver.sh

What to do if your node desynchronize from mainnet?

Sometimes your node can desynchronise from mainnet. You can see it when it doesn't import blocks for a while and it only commits your own local new blocks. Also you have the peers field equal to 0 like this: peers=0.
To solve this issue:

Step 1: Relaunch in none mining mode

1. First stop the node by typing "Ctrl + c" on your keyboard.

2. launch your node in none mining mode to catch up with mainnet.
If you have created a none mining launch file (startnodenomining.sh) simply run following command:

./startnodenomining.sh

If you have not created a none mining launch file you can:
a) create one as described in previous step, and then run this command:

./startnodenomining.sh
or b) run following command:

./build/bin/geth --etica --nat extip:127.0.0.1 --datadir "./eticanode1" --http --http.addr "localhost" --http.port "8545" --port "30303" --allow-insecure-unlock --http.corsdomain "*" --rpc.allow-unprotected-txs  --http.api eth,web3,personal,net --http.vhosts=* --ipcpath "~/.ethereum/geth.ipc" --bootnodes "enode://b0e97d2f1a37b2035a34b97f32fb31ddd93ae822b603c56b7f17cfb189631ea2ef17bfbed904f8bc564765634f2d9db0a128835178c8af9f1dde68ee6b5e2bf7@167.172.47.195:30303"

After running a) or b) command you should see your node Importing blocks.

Once you see the blocks importation is done and your node only imports new blocks, stop your node by typing "Ctrl + c".

Step 2 (optional): Relaunch in mining mode

If your node was a mining node and you want to get back as mining node, launch your node in mining mode as follow

If you have made a startnode.sh file simply run:

./startnode.sh

If you don't have a startnode.sh file run this command:

./build/bin/geth --etica --mine --miner.threads=2 --nat extip:127.0.0.1 --miner.gasprice "1000000000" --miner.gaslimit "50000000" --datadir "./eticanode1" --http --http.addr "localhost" --http.port "8545" --port "30303" --allow-insecure-unlock --http.corsdomain "*" --rpc.allow-unprotected-txs  --http.api eth,web3,personal,net --http.vhosts=* --ipcpath "~/.ethereum/geth.ipc" --bootnodes "enode://b0e97d2f1a37b2035a34b97f32fb31ddd93ae822b603c56b7f17cfb189631ea2ef17bfbed904f8bc564765634f2d9db0a128835178c8af9f1dde68ee6b5e2bf7@167.172.47.195:30303"

If you arrived up to here without issues, then your node is back and connected to mainnet.


If encontered issues while running the commands to resynchronize your node, then try again several times.
If it still doesn't work then run the following commands to restart a new node:

Restart a new node

i. create a new folder eticanode2 (or name it as you want):

mkdir eticanode2

ii. Actualize your startnode.sh and startnodenomining.sh files:

nano startnode.sh

use right keyboard arrow to move to "--datadir=./eticanode1" and replace "eticanode1" by "eticanode2"

iii. To save file, do as follow:

CTRL + o
Press Enter
CTRL + x

Do it for all your startnode.sh files (startnodenomining ...)

Now you should be ready to relaunch your node

iv.a Launch your node in no mining mode to resynch:

If you have a startnodenomining.sh file run:

./startnodenomining.sh

Otherwise run:

./build/bin/geth --etica --nat extip:127.0.0.1 --datadir "./eticanode1" --http --http.addr "localhost" --http.port "8545" --port "30303" --allow-insecure-unlock --http.corsdomain "*" --rpc.allow-unprotected-txs  --http.api eth,web3,personal,net --http.vhosts=* --ipcpath "~/.ethereum/geth.ipc" --bootnodes "enode://b0e97d2f1a37b2035a34b97f32fb31ddd93ae822b603c56b7f17cfb189631ea2ef17bfbed904f8bc564765634f2d9db0a128835178c8af9f1dde68ee6b5e2bf7@167.172.47.195:30303"

Once your node is synched and only imports new blocks your back and synched with mainnet

stop your node by typing "Ctrl + c" on your keyboard.

iv.b Launch your node in mining mode:

If you have a startnode.sh file run:

./startnode.sh

Otherwise run:

./build/bin/geth --etica --mine --miner.threads=2 --nat extip:127.0.0.1 --miner.gasprice "1000000000" --miner.gaslimit "50000000" --datadir "./eticanode1" --http --http.addr "localhost" --http.port "8545" --port "30303" --allow-insecure-unlock --http.corsdomain "*" --rpc.allow-unprotected-txs  --http.api eth,web3,personal,net --http.vhosts=* --ipcpath "~/.ethereum/geth.ipc" --bootnodes "enode://b0e97d2f1a37b2035a34b97f32fb31ddd93ae822b603c56b7f17cfb189631ea2ef17bfbed904f8bc564765634f2d9db0a128835178c8af9f1dde68ee6b5e2bf7@167.172.47.195:30303"

Your node is back, synched with mainnet and mining EGAZ

Start a crucible node (Etica Testnet)

i. replace --etica by --crucible

ii. create a new folder for instance cruciblenode (or name it as you want):

iii. remove or replace bootnodes from etica mainnet at the end of your etica script command line

Then run:

./build/bin/geth --crucible --nat extip:127.0.0.1 --datadir "./cruciblenode" --http --http.addr "localhost" --http.port "8545" --port "30303" --allow-insecure-unlock --http.corsdomain "*" --rpc.allow-unprotected-txs  --http.api eth,web3,personal,net --http.vhosts=* --ipcpath "~/.ethereum/geth.ipc" --bootnodes="enode://0c0c00f5602de8c1a7f6537f243ab96b95792e3cc44274c035b89f0db25b0e7502c7e950cb0d8962ccc47f535fa83fe5375c76fbd004b2c3173ae6e7ee0a354d@72.137.255.180:40101"

Once your node is synched and only imports new blocks your back and synched with mainnet

stop your node by typing "Ctrl + c" on your keyboard.

iv.b Launch your node in mining mode to mine testnet TEGAZ to make testnet transactions:

If you have a startnode.sh file run:

./startnode.sh

Otherwise run:

./build/bin/geth --crucible --mine --miner.threads=2 --nat extip:127.0.0.1 --miner.gasprice "1000000000" --miner.gaslimit "50000000" --datadir "./cruciblenode1" --http --http.addr "localhost" --http.port "8545" --port "30303" --allow-insecure-unlock --http.corsdomain "*" --rpc.allow-unprotected-txs  --http.api eth,web3,personal,net --http.vhosts=* --ipcpath "~/.ethereum/geth.ipc" --bootnodes "enode://0c0c00f5602de8c1a7f6537f243ab96b95792e3cc44274c035b89f0db25b0e7502c7e950cb0d8962ccc47f535fa83fe5375c76fbd004b2c3173ae6e7ee0a354d@72.137.255.180:40101"

Your node is now, synched with crucible testnet and mining TEGAZ