Skip to content

I have made these steps for people who are struggling connecting their Geth nodes to Beacon Proof of Stake chain Ethereum using Consensus Client. By following these steps you can able to have your personal blockchain node and you don't need any third party provider like Infura.

License

Notifications You must be signed in to change notification settings

farhanx/ethereums-geth-and-beacon-client-POS

Repository files navigation

Run and Connect Blockchain Geth node for Ethereum Blockchain - Post merge (Proof of Stake)

I have made these steps for people who are struggling connecting their Geth nodes to Beacon Proof of Stake chain Ethereum using Consensus Client. By following these steps you can able to have your personal blockchain node and you don't need any third party provider like Infura.

You can watch the entire tutorial on my youtube: https://www.youtube.com/watch?v=anyBoghKp3I

Geth Pre-Requisites

  1. Go to the url and download latest GETH client https://geth.ethereum.org/downloads
  2. Make sure you have 2TB space in your SSD or hardisk.
  3. Make sure you have 16GB RAM (this recommended but you can still use 8 GB )
  4. Install the Geth client make sure to select "Development Tools" option while installing Geth.
  5. Open CMD in windows and write

geth --version

Note:- make sure you see the latest version otherwise your installation is not working properly.

Geth Experiments using DataDir DEV

  1. Account creation : This will create a new ethereum EOA account under a new directory dedicated for geth client in development node. A development node is an in memory node that is used for testing purpose only. Make sure to enter a new password for this client. You can do this process multiple times to create new accounts.

    geth --datadir C:\mynewnode\dev --dev account new

  2. Create Secret File: Create password secret file and put inside C:\mynewnode\dev\secret . Afteward open this file and enter the password of the account that you want to use as an owner of the geth client.

  3. Run Geth Client: Run the geth client by specifying data directory and secret file representing first EOA account password

    geth --datadir C:\mynewnode\dev --dev --password C:\mynewnode\dev\secret

  4. Connect JS Console to Geth: While you will see logs on the console screen of the geth, you will find there is a file generated by geth with the name .ipc. This is an inter process communication file and it should be used with your java script console to interact with the geth. Open a new command line windows and write below command

    geth attach \.\pipe\geth.ipc

  5. Commands for JS Console: Write following commands

    eth.syncing eth.blockNumber

  6. List accounts : List account will display existing EOA accounts you have created or generated throught "account new" command. Every new user will be stored under a keystore directory created inside the \mynode\dev\keystore.

eth.accounts

  1. Check Ether Balance: to how much ethers they have

    eth.getBalance(eth.accounts[0])

  2. Send transactions between coinbase and account

    eth.sendTransaction({from: eth.accounts[0],to:'0xA8CF550eC622c16b08ae50880c01B466C7E31Bc5' ,value: web3.toWei(0.5,'ether')});

How to use CLEF (User Account Management Client)

  1. Check Clef Version: write following commands

    clef --version

  2. Create User : You can also create a user using CLEF which is an external tool to manage users. In future geth might not allow user creation through geth commands. In that case, admin needs to start using CLEF commandline tool.

    clef newaccount --keystore "C:\mynewnode\dev\keystore"

  3. Check on JS Console: Open the JS window which is attach to geth, and write again eth.accounts. You will see new accounts the same way.

  4. List accounts: To see number of accounts you have using CLEF you can use following commands (if you dont give keystore directory then it will detect accounts from a default keystore directory in the APPdata\romaing\ethereum

    clef list-wallets --keystore "C:\mynewnode\dev\keystore"

Geth Experiments using DataDir Sepolia

To use a live network it is better first try SEPOLIA network which is a proof of stake conesnsus Ethereum test network.

  1. Create Sepolia Accounts:

    geth --datadir C:\mynewnode\sepolia --sepolia account new

  2. Connect Geth Sepolia Network with HTTP: Now we will run geth account with exposed api and endpoints in http for other clients

    geth --datadir C:\mynewnode\sepolia --sepolia --http --http.api eth,net,engine,admin

Note:- if you want to use your own JWT security token for third party or external tools then you can provide its path like adding this as a parameter --authrpc.jwtsecret E:\mynewnode\myjwtsecret (optional)

  1. Logs Troubleshooting:

    to read log : https://geth.ethereum.org/docs/fundamentals/logs

  2. Attach the console :

    geth attach \.\pipe\geth.ipc

  3. Sepolia Balance:

If you are using sepolia account which shows zero as a balance then rememmber your geth is not sync. In order to sync, you have to run Prysm Consensus Node.

Download Prysm and Configure with GETH

  1. Download Prysm using CURL: Assuming you are running a windows otherwise check official prysm link: https://docs.prylabs.network/docs/install/install-with-script make sure to create a prysm directory where you will download this. Below command will also add a registry key in the windows so you can have verbose loggings.

    curl https://raw.githubusercontent.com/prysmaticlabs/prysm/master/prysm.bat -o prysm.bat && reg add HKCU\Console /v VirtualTerminalLevel /t REG_DWORD /d 1

  2. Download Genesis File: To run Consensus client you have to download the genesis block file from the link in the prysm directory.

    https://github.com/eth-clients/merge-testnets/blob/main/sepolia/genesis.ssz

  3. Run Consensus Node (prysm): To run this beacon chain node you must make sure to add the ethereum address suggested-fee-recepient from existing accounts you created or imported inside geth. Secondly you have to provide the JWT token for the communication which you can find inside your directory\geth\jwsecret . This token is an auto generated token by geth for any external communication. Additionally you have to provide the endpoint location with the port. The endpoint url which has auth false try to use that url.

    prysm.bat beacon-chain --execution-endpoint=http://localhost:8551 --sepolia --suggested-fee-recipient=0x278e31b7c9214e1332c5f1d418693bf8af0bcd88 --jwt-secret=C:\mynewnode\sepolia\geth\jwtsecret --genesis-state=genesis.ssz

  4. Syncrhonization process and trouble shooting : To become a full node you have to allow this process to be completed in few days without downloading entire blocks you will not find Sepolia new state. To test the synchronization status you can follow below commands

    curl http://localhost:3500/eth/v1/node/syncing curl http://localhost:3500/eth/v1alpha1/node/eth1/connections

Log review between geth and prysm

You will find alot of logs on the command line console you can translate those logs just to make sure your own the right direction.

https://docs.prylabs.network/docs/troubleshooting/issues-errors https://geth.ethereum.org/docs/fundamentals/logs

Configure Metamask with the GETH Client

  1. Go in metamask settings
  2. Create network manually
  3. Add http://localhost:8545 which is called ENDPOINT (you can find this endpoint on the geth console screen) and give chainid sepolia 11155111 with symbol as ETH
  4. Add the network
  5. If it connects congrats
  6. Now you dont need any infura (but make sure you have downloaded proper blocks)

Configure Truffle with the Geth Client

  1. Create a truffle project

  2. Add the below configuration inside truffle-config

    gethsepolia: { host:"127.0.0.1", port:8545, network_id: '11155111' }

  3. make sure your migration script from account represent the account you will use (to deploy your contract)

  4. Test on the geth supported sepolia network

    truffle test --network gethsepolia

  5. Open development console

    truffle console --network gethsepolia accounts migrate

    Congratulations: Now you are a fully decentralized who doesnt need any third party to connect with the blockchain. But rememmber you will always need better security so make sure you always remain up to date with the following two main links.

    https://docs.prylabs.network/docs/getting-started https://geth.ethereum.org/docs/getting-started

About

I have made these steps for people who are struggling connecting their Geth nodes to Beacon Proof of Stake chain Ethereum using Consensus Client. By following these steps you can able to have your personal blockchain node and you don't need any third party provider like Infura.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published