Install Node 2023

Node basic steps

// Some code
cd /usr/local

sudo su
wget https://go.dev/dl/go1.19.linux-amd64.tar.gz
tar -zxvf go1.19.linux-amd64.tar.gz
cp go /usr/local/go -R #Only if not in the path
apt-get update
apt-get install git make gcc
apt install –reinstall build-essential
IF ERROR
step 1) pico /etc/apt/sources.list
step 2) apt-get update

git clone https://github.com/treschain/TRESCLI
cd TRESCLI
export GOROOT=/usr/local/go
export GOPATH=$HOME/go
export PATH=$GOPATH/bin:$GOROOT/bin:$PATH
source ~/.bashrc
go version
make geth
cd /usr/local/TRESCLI/build/bin cp -r geth /usr/local/bin/
cd /usr/local
mkdir node

git clone https://github.com/treschain/Blockchain
cd Blockchain/Configuration/Genesis/Mainet
cp -r treslechesmainnet.json /usr/local/node

cd /usr/local/node

geth init treslechesmainnet.json
geth --networkid 6066 --datadir data --identity "External Miner" --bootnodes enode://333de758402827269778b4a96f675b3d207ddb4b7fdb2a60d505d7d10d5eac564a0aa2b6cded48bbbaf7328092b81eef293c182a04e302b4b0dd01285a324b60@147.182.143.50:0?discport=30301  --port 30306 --miner.threads 1 --miner.etherbase=0x000000000000000000000000000000000000dEaD --syncmode full --http --http.vhosts "*" --http.corsdomain "*" --http.port 8548 --cache 8192  --ws.port 8549 --http.api debug,net,eth,web3,txpool --ws.api "eth,net,web3,network,debug,txpool" --gcmode "archive" --authrpc.port 8550  console

type node.AdminInfo copy enode and send to node group
CTRL + D and exit the console.

sudo nano  /etc/init.d/geth
copy the following into the geth.

You need to edit the ipaddress from here to match your node.

#!/bin/bash
#
### BEGIN INIT INFO
# Provides:          geth
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Should-Start:      $network $named $time
# Should-Stop:       $network $named $time
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start and stop the geth daemon
# Description:       Controls the geth server daemon
### END INIT INFO
#
. /lib/lsb/init-functions
start() {
   PCOUNT=`pgrep -c geth`
   if ((PCOUNT==1)); then
      /usr/local/bin/geth --networkid 6066 --datadir /usr/local/node/data --identity "Main Node" --bootnodes "enode://333de758402827269778b4a96f675b3d207ddb4b7fdb2a60d505d7d10d5eac564a0aa2b6cded48bbbaf7328092b81eef293c182a04e302b4b0dd01285a324b60@147.182.143.50:0?discport=30301" --port 30303 --miner.threads 1 --miner.etherbase=0x000000000000000000000000000000000000dEaD --ipcdisable --syncmode full --http --http.vhosts "*" --http.corsdomain "*" --http.port 8545 --nodiscover --nat extip:147.182.143.50 --http.api admin,eth,net,miner,engine,txpool,web3,debug --http.addr 127.0.0.1 --ws --ws.addr 147.182.143.50 --ws.port 8549 --ws.api eth,net,web3,network,debug,txpool  --ws.origins "*" --authrpc.port 8551 --authrpc.addr 147.182.143.50 --rpc.gascap 80000000 --rpc.txfeecap 2 --graphql --graphql.corsdomain "*" --graphql.vhosts "*" --gpo.blocks 10 --cache 8192 --verbosity "0" --gcmode "archive" &
   fi
   echo $"Geth Started"
}
stop() {
   PCOUNT=`pgrep -c geth`
   if ((PCOUNT>1)); then
      /usr/bin/killall -9 geth &
   fi
   echo "Geth Stopped"
}
case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  status)
        status geth
        ;;
  restart|reload|condrestart)
        stop
        start
        ;;
  *)
  echo $"Usage: $0 {start|stop|restart|reload|status}"
  exit 1
esac
exit 0
 

Set Permissions

sudo chmod 755 /etc/init.d/geth
sudo chown root:root /etc/init.d/geth

sudo update-rc.d geth defaults

sudo systemctl enable geth

sudo systemctl start geth

sudo systemctl daemon-reload
sudo systemctl status geth
sudo journalctl -u geth -f
# if netstat is not installed
sudo apt install net-tools
sudo netstat -tulpn
geth attach http://127.0.0.1:8545

follow the steps to secure your node.

Last updated