Ethereum Node Setup
Recommended Server Requirements
- RAM : 8GB
- Disk: 160 GB
- OS: Ubuntu 20.04
To install ETH node run the following commands:
sudo add-apt-repository -y ppa:ethereum/ethereum
sudo apt-get update
sudo apt-get install ethereum -y
After installing the node run the following command to generate a configuration file. If you want to install test node then add any of the test node flag to the following command after geth
- --goerli
- --rinkeby
- --yolov2
- --ropsten
geth --syncmode light --cache=2048 --http --http.api "eth,net,web3,personal" --http.corsdomain '*' --http.addr 0.0.0.0 --http.port 8545 --ws --ws.api "eth,web3" --ws.origins '*' --ws.addr 0.0.0.0 --ws.port 8546 --nousb dumpconfig > config.toml
Now you have to create service file geth.service
. Run the following command:
vim geth.service
Copy and paste the following configurations:
[Unit]
Description=Geth
[Service]
Type=simple
User=root
Restart=always
WorkingDirectory=/root
ExecStart=/usr/bin/geth --config config.toml
[Install]
WantedBy=default.target
Note: If your server username is not root then don't forget to change the name from the above configurations
Run these following command to active the service that created.
cp geth.service /etc/systemd/system/geth.service
systemctl daemon-reload
systemctl enable geth.service
systemctl start geth
Note: Syncing Node will take times depends on sync mode
and network mode
. Wait until sync completed
Secure The Ethereum Node
Setting Up Firewall Using UFW
Install UFW
sudo apt-get install ufw
Set Up Default Policies
sudo ufw default deny incoming
sudo ufw default allow outgoing
Allow Ethereum Network Port
We would also enable ethereum network so that our nodes can be able to communicate and sync with the public blockchain network.
The Ethereum network port is 30303
sudo ufw allow 30303
Enable RPC port
sudo ufw allow from <SERVER IP> to any port 8545
sudo ufw allow from <SERVER IP> to any port 8546
Note: If you are using a different a different RPC port then it should be specified
Enable UFW
sudo ufw enable
Allow HTTP
sudo ufw allow http
Allow HTTP
sudo ufw allow ssh