Etica full nodesHow to run fullnodes

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. Move to core-geth folder:

cd core-geth

2. Install dependencies with 4 following command lines:

sudo apt install make                                   
sudo apt-get update                                   
sudo apt install golang-go                                   
make geth                                   

Initialize Blockchain

1. Create a blockchain folder (this folder will contain the blockchain data). For this example we call it eticanode1 but you can replace "eticanode1" with a name of your choice:

mkdir eticanode1

2. Initialiaze blockchain (replace eticanode1 by your folder name if it is different):

./build/bin/geth --datadir=./eticanode1 init etica_genesis.json

3. Creates an account (replace eticanode1 by your folder name if it is different):

./build/bin/geth --datadir=./eticanode1 account new

The interface will ask you for a password, type your password & press enter to confirm (it won't display caracters as you type so just keep typing your password even if you don't see the interface updating). Make sure to note it somewhere to be able to provid it in Future

Launch Blockchain

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

./build/bin/geth --networkid 61803 --nat extip:127.0.0.1 --datadir "./eticanode1" --http --http.addr "localhost" --http.port "8545" --port "30303" --allow-insecure-unlock --http.corsdomain "*" --nat "any"  --rpc.allow-unprotected-txs  --http.api eth,web3,personal,net --rpcvhosts=* --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 --networkid 61803 --mine --miner.threads=2 --nat extip:127.0.0.1 --miner.gasprice "1000000000" --miner.gastarget "50000000" --miner.gaslimit "50000000" --datadir "./eticanode1" --http --http.addr "localhost" --http.port "8545" --port "30303" --allow-insecure-unlock --http.corsdomain "*" --nat "any"  --rpc.allow-unprotected-txs  --http.api eth,web3,personal,net --rpcvhosts=* --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 --networkid 61803 --mine --miner.threads=2 --nat extip:127.0.0.1 --miner.gasprice "1000000000" --miner.gastarget "50000000" --miner.gaslimit "50000000" --datadir "./eticanode1" --http --http.addr "localhost" --http.port "8545" --port "30303" --allow-insecure-unlock --http.corsdomain "*" --nat "any"  --rpc.allow-unprotected-txs  --http.api eth,web3,personal,net --rpcvhosts=* --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 --networkid 61803 --nat extip:127.0.0.1 --datadir "./eticanode1" --http --http.addr "localhost" --http.port "8545" --port "30303" --allow-insecure-unlock --http.corsdomain "*" --nat "any"  --rpc.allow-unprotected-txs  --http.api eth,web3,personal,net --rpcvhosts=* --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 --networkid 61803 --nat extip:127.0.0.1 --datadir "./eticanode1" --http --http.addr "localhost" --http.port "8545" --port "30303" --http.corsdomain "*" --nat "any"   --http.api eth,web3,net --rpcvhosts=* --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 --networkid 61803 --nat extip:127.0.0.1 --datadir "./eticanode1" --http --http.addr "localhost" --http.port "8545" --port "30303" --allow-insecure-unlock --http.corsdomain "*" --nat "any"  --rpc.allow-unprotected-txs  --http.api eth,web3,personal,net --rpcvhosts=* --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 --networkid 61803 --mine --miner.threads=2 --nat extip:127.0.0.1 --miner.gasprice "1000000000" --miner.gastarget "50000000" --miner.gaslimit "50000000" --datadir "./eticanode1" --http --http.addr "localhost" --http.port "8545" --port "30303" --allow-insecure-unlock --http.corsdomain "*" --nat "any"  --rpc.allow-unprotected-txs  --http.api eth,web3,personal,net --rpcvhosts=* --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. Then init blockchain on eticanode2 folder with following command:

./build/bin/geth --datadir=./eticanode2 init etica_genesis.json

iii. Then create a new acocunt on eticanode2 folder with following command:

./build/bin/geth --datadir=./eticanode2 account new

iv. Enter your password and make sure to note it somewhere because it might be necessary in Future.

v. 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"

vi. 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

i.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 --networkid 61803 --nat extip:127.0.0.1 --datadir "./eticanode1" --http --http.addr "localhost" --http.port "8545" --port "30303" --allow-insecure-unlock --http.corsdomain "*" --nat "any"  --rpc.allow-unprotected-txs  --http.api eth,web3,personal,net --rpcvhosts=* --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.

i.b Launch your node in mining mode:

If you have a startnode.sh file run:

./startnode.sh

Otherwise run:

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

Your node is back, synched with mainnet and mining EGAZ