...
Installation of the Geth Ethereum client on Ubuntu 22.04 LTS is described herein.
...
1. Install Geth
...
as the “Execution Client”
Tip |
---|
Minimum system suggested:
|
...
That command should generate a confirmation like so:
...
SCREEN
Screen is a Linux built-in windowing utility that enables you to operate several Linux programs at the same time. It’s useful when you have to switch back and forth between multiple programs within a single Terminal window. There are other ways of accomplishing this task - including using multiple Terminal windows - but Screen has the added benefit of persistence: the program does not terminate when you close a Screen window (or get disconnected).
Screen is used within this article. Complete instructions: https://linux.die.net/man/1/screen
Create a new screen window:
screen -S name_of_window
Detach from a window: Ctrl+A, then D
Attach to a window:
screen -r name_of_window
...
2. Startup Geth.
a) Create a new account/wallet using Geth.
Create the account:
Code Block |
---|
geth account new |
...
Tip |
---|
Save the wallet password somewhere secure! |
Verify the account:
Code Block |
---|
geth account list |
You may see a few errors (it’s ok), but “Account #0” should be listed at the end.
...
You should now backup the account.
You will need both the backup and the password to access your wallet in case of a disaster.
See official documentation for details.
...
b) Start the Geth node:
SCREEN is described above:
Geth will now start inside the new SCREEN window, and automatically begin searching for other nodes. It won’t begin downloading the blockchain until the next step (installing a consensus client) has completed.
Code Block |
---|
screen -S geth
geth --allow-insecure-unlock --http --http.api personal,eth,net,web3 |
Exit SCREEN using Ctrl+A, then “d” (for detach).
To later return (reattach) to this window, use
screen -r geth
.
...
3. Install Prysm as the “Consensus Client”.
You may choose any Consensus Client that suits you. You have a half-dozen choices, and the community encourages diversity.
Other consensus clients: https://geth.ethereum.org/docs/getting-started/consensus-clients
For this example I chose “Prysm” because it is also based on the Go software. It was mostly an arbitrary decision. The guide I provide below differs from the one at their website, as certain assumptions (Ubuntu + Geth + IPC + Mainnet) have already been calculated in.
Full Prysm installation instructions here: https://docs.prylabs.network/docs/install/install-with-script
Install Prysm:
Code Block |
---|
mkdir -p /root/.local/prysm
cd /root/.local/prysm
curl https://raw.githubusercontent.com/prysmaticlabs/prysm/master/prysm.sh --output prysm.sh && chmod +x prysm.sh |
Start Prysm:
Create a new SCREEN window, and start Prysm:
Code Block |
---|
screen -S prysm
/root/.local/prysm/prysm.sh beacon-chain --execution-endpoint=/root/.ethereum/geth.ipc --mainnet --checkpoint-sync-url=https://beaconstate.info --genesis-beacon-api-url=https://beaconstate.info |
The IPC endpoint specified is the Geth default.
Exit SCREEN using Ctrl+A, then “d” (for detach).
To later return (attach) to this window, use
screen -r prysm
.
4. Sync.
Now that an account has been created, we’re ready to startup the node to , and a consensus client is operating, Geth & Prysm will begin to automatically synchronize it with the rest of the Ethereum network. This will take quite some time, and is unavoidable. You must prepare to wait days before the process is complete. Once finished with the initial sync, your Node will keep itself synchronized - but the first time is a bear.
...
To view the sync process, reattach to the Geth
...
screen:
Code Block |
---|
gethscreen --allow-insecure-unlock --http --http.api personal,eth,net,web3 |
...
r geth |
You’ll see Geth fetching blocks from other nodes, confirming the blocks, and adding them to your locally stored blockchain. This is called a “full node implementation”, and they are important to the network. Full nodes are the backbone of Ethereum (and all other blockchain-based networks).
This is an example of the node output while “live”:
...
Notice the “age” reported in this log.
The synchronization may take a few days. This . The reported ETA is unreliable and virtually worthless. The actual ETA heavily depends upon several factors, including your CPU, GPU, RAM, storage technology, and Internet bandwidth. Once the entire blockchain has been downloaded and confirmed by your node, you’ll be ready to proceed with the next step of enabling remote access.
Tip |
---|
From this point forward, we’ll refer to this window asthe“GethNodeServer”. |
Use “screen” to permit Geth to run merrily in the background while you disconnect your client computer. Outside the scope of this article, please consult these external links for more information regarding proper usage:
Watch and wait:
...
|
Once you are satisfied that the synchronization is underway, exit the SCREEN using Ctrl+A, then “d”.
...
Control.
Watch and wait.
To monitor the sync progress, you may use the built-in Geth JavaScript client to check up on it. Once you’ve SSH’d in to your server and have an additional command prompt, start the Geth JavaScript console using:
...
You should see something similar to:
...
The SCREEN containing the Geth Server should still be running merrily in the background.
The Javascript console enables you to monitor & control your node; this is the front door.
More information here: https://geth.ethereum.org/docs/interface/javascript-console
...
This means that your node has stopped synchronizing. This may be is likely because it has finished successfully, or that possibly because your node has been shut down.
The node will attempt to use all available resources to finish as quickly as possible, and your server’s host may consider it to be abuse. They’ll respond by automatically “killing” your node. Here’s how to tell in the Geth Node Server:
...
If you see that, then your node was probably shut down for abusing your host’s “Terms of Service”. Yes, I did was guilty of that once. Sorry Google. Explore the use of “cpulimit” to prevent that abuse, or increase the server resources to comply with your hosts demands.
Assuming that the Geth Node Server isn’t shutdown, that it continues to process the network, and that “eth.syncing” generates a “false” reply in the Geth Console, then your blockchain should now be fully sync’d and your node ready for the next step.
...
You should now backup the account.
You will need both the backup and the password to access your wallet in case of a disaster.
See official documentation for details.
...
Setup an SSH tunnel to secure inter-server RPC communication.
...
Code Block |
---|
exit |
Tip |
---|
The Geth Node Server must always be running, and the wallet must remain unlocked.
|
...