Geth - Lighthouse

A leading open-source Ethereum consensus client, written in Rust.

Lighthouse is an Ethereum consensus client that connects to other Ethereum consensus clients to form a resilient and decentralized proof-of-stake blockchain.

Implement the specification as defined in the ethereum/consensus-specs repository.

Setup Repository

Visit this Repository Testnet & Fork / Clone

A. Run these commands to enter this Cartenz Chain directory

cd gitshock-chain/cartenz 

B. Create a JWT Secret to create a new secret key by running this command

openssl rand -hex 32 | tr -d "\n" > "jwt.hex" 

C. Run this command to create a new execution layer account

geth account new --datadir "data" << data is folder PATH for your keystore

Your new account is locked with a password. Please give a password. Do not forget this password.
Password: (.............)
Create a password and remember it (as you wish)

a public address of the key will be generated (public address of the key will look like 0x.. something). Then a path of the secret key file will also be generated, save it .You’ll need to save them in a safe place directly and you can share the PUBLIC KEY, and don’t EVEN Share your path to the secret key

D. Run this command to write custom genesis block

geth --datadir /yourfolder/yourfolderwallet init /folder/to/genesis.json

# Example: 
geth --datadir /geth/geth-data init /execution/genesis.json

Before running the Node, we use the POSIX Nohup (No Hang UP) command which means (Do Not Close) a command in Linux systems that keeps the process running even after exiting the shell or terminal. Nohup prevents the process or job from receiving the SIGHUP (Signal Hang UP) signal. This is the signal sent to the process after closing or exiting the terminal.

Running Execution Layer

# Create Folder
mkdir logs 
cd logs 
touch geth_1.log 
cd ..

nohup geth \
--datadir "/PATH/YOUR/ACCOUNT" \
--http --http.api="engine,eth,web3,net,admin" \
--ws \
--ws.api="engine,eth,web3,net,debug" \
--http.corsdomain="*" \
--networkid=1881 \
--syncmode=full \
--authrpc.jwtsecret="/your/path/folder/jwt.hex" \
> /your/path/folder/log/geth_1.log &

# If You Need RPC Api, You Can Add This
--http.addr 0.0.0.0 
--http.port 8545 

Add Peer Node

geth attach http://localhost:8545

After entering the Geth Interactive Console Javascript, you must add a Manual Peer & Trusted Peer of at least 1 to connect to the blockchain, please take it in the  folder: consensus/bootnodes_enr.txt

Example: admin.addPeer("enode://03fc89e2035b52a609715a15dacad4179f57c0b1e51b3464a931f0fa913b9169d06df1b23515f41e4ed6d9be0e50f33175cbf836e7b6738c62eee00ad45250b0@212.47.241.173:30303")

Output: 
> True

Get Bootnodes

Get the Bootnode Inside the Geth Interactive Console, for You to Save Using Command

admin.nodeInfo.enode

Example Output: 
"enode://03fc89e2035b52a609715a15dacad4179f57c0b1e51b3464a931f0fa913b9169d06df1b23515f41e4ed6d9be0e50f33175cbf836e7b6738c62eee00ad45250b0@212.47.241.173:30303"

Running Consensus Layer

nohup lighthouse beacon \
--eth1 \
--http \
--testnet-dir /your/path/folder/consensus \
--datadir "/your/path/folder/datadir" \
--http-allow-sync-stalled \
--execution-endpoints http://127.0.0.1:8551 \
--http-port=5052 \
--enr-udp-port=9000 \
--enr-tcp-port=9000 \
--discovery-port=9000 \
--graffiti "CHANGE ME WITH YOUR UNIQUE NAME" \
--execution-jwt "/your/path/folder/jwt.hex" \
--suggested-fee-recipient=0xB0F9575AC688Ed5C37f50B3aF0d125664c2EA123 \
> /home/ubuntu/logs/beacon_1.log &

Getting ENR Key

curl http://localhost:5052/eth/v1/node/identity | jq 

Example Output: 
{
  "data": {
    "peer_id": "16Uiu2HAmGLNCWcsWgVR6Q2YvmGvGyyaEM3y5Tcq2rjmpv4dqo8JJ",
    "enr": "enr:-L24QCeN4AtWKWQfWMl9ubWXj_rWzxmVLG54qJtNQuXfEd9xPjPHrafoC3iyt_NUf4RNyiGaA-5yumvmSitnsd_Cx4SBiodhdHRuZXRziP__________hGV0aDKQWOqKlwJndzn__________4JpZIJ2NIJpcITUL_GtiXNlY3AyNTZrMaEDNqlqq2_MsiLqswykyIsqFIX10A-1COt29ZTpmlxf9teIc3luY25ldHMPg3RjcIIjKIN1ZHCCIyg",
    "p2p_addresses": [
      "/ip4/212.47.241.173/tcp/9000/p2p/16Uiu2HAmGLNCWcsWgVR6Q2YvmGvGyyaEM3y5Tcq2rjmpv4dqo8JJ"
    ],
    "discovery_addresses": [
      "/ip4/212.47.241.173/udp/9000/p2p/16Uiu2HAmGLNCWcsWgVR6Q2YvmGvGyyaEM3y5Tcq2rjmpv4dqo8JJ"
    ],
    "metadata": {
      "seq_number": "205",
      "attnets": "0xffffffffffffffff",
      "syncnets": "0x0f"
    }
  }
}

# SAVE YOUR ENR KEY! 

Running Other Consensus Layer

nohup lighthouse \
--testnet-dir /your/path/folder/consensus \
bn \
--datadir "/your/path/folder/beacons1" \
--eth1 \
--http \
--http-allow-sync-stalled \
--execution-endpoints "http://127.0.0.1:8551" \
--eth1-endpoints "http://127.0.0.1:8545" \
--http-address 0.0.0.0 \
--http-port 5053 \
--http-allow-origin="*" \
--listen-address 0.0.0.0 \
--enr-udp-port 9001 \
--enr-tcp-port 9001 \
--port 9001 \
--enr-address 54.82.42.159 \
--execution-jwt "/your/path/folder/jwt.hex" \
--suggested-fee-recipient="YOUR ADDRESS VALIDATOR HERE" \
--boot-nodes="FILL IN THE ENR YOU GOT FROM THE FIRST CONSENSUS LAYER AND ADD IT FROM THE CARTENZ CHAIN ENR." \
> /home/ubuntu/logs/beacon_2.log &

Building a Staker To Be Good Validator

Visit the Staking Website and Select Deposit and Make a Deposit with Command:

// Example From Deposit 

deposit new-mnemonic --num_validators 200 --eth1_withdrawal_address 0x9adddA86C9479C45bD145BBa9FC28146FdF46C83

# Example Output Mnemonic: 
"vibrant refuse observe flag shy depth disagree proud race angle vote picnic fancy renew museum bonus arena people thumb there atom tuna abstract negative"

Import Validator Keystore

# Before Import The Key you need create file password.txt and input

lighthouse account validator import \
--testnet-dir /your/path/folder/logs/consensus \
--datadir "/your/path/folder/logs/validator" \
--directory /your/path/folder/logs/validator_keys \
--password-file /your/path/folder/logs/password.txt \
--reuse-password

Running Validator Node

nohup lighthouse vc \
--suggested-fee-recipient CHANGE WITH YOUR ADDRESS FROM DEPOSIT \
--metrics-address 0.0.0.0 \
--metrics-allow-origin "*" \
--metrics-port 8801 \
--http-allow-origin "*" \
--http-address 0.0.0.0 \
--http \
--unencrypted-http-transport \
--graffiti "YOUR GRAFFITI UNIQUE NAME HERE" \
--testnet-dir "/your/path/folder/consensus" \
--datadir "/your/path/folder/validator" \
--beacon-nodes "http://127.0.0.1:5052" \
> /your/path/folder/logs/validator_run.log &
Output : 

Mar 29 16:06:09.001 INFO Connected to beacon node(s)             synced: 1, available: 1, total: 1, service: notifier
Mar 29 16:06:09.001 INFO Awaiting activation                     slot: 9748, epoch: 304, validators: 8, service: notifier
Mar 29 16:06:21.001 INFO Connected to beacon node(s)             synced: 1, available: 1, total: 1, service: notifier

How long does it take to sync a node?

48-72 hours this cannot be an actual reference time. The sync process is very long and can take up to 48-72 hours. Sync speed depends on your internet speed and storage device write speed. Because data is stored in blocks and linked together, corruption in a single block can corrupt the entire data chain

Last updated