Files
Dena/docs/zagros/blockchain/set-up-eth-node.md
2026-08-13 19:50:53 +03:30

3.0 KiB

ether: set up node

Sprint: ?

###DOC

we setup our node with geth.Geth(Go Ethereum) is a command line interface for running Ethereum node implemented in Go Language. Using Geth you can join Ethereum network, transfer ether between accounts or even mine ethers.

###steup

You can start Geth in one of three different sync modes using the --syncmode "" argument that determines what sort of node it is in the network.

These are:

  1. Full: Downloads all blocks (including headers, transactions, and receipts) and generates the state of the blockchain incrementally by executing every block.
  2. Fast: Downloads all blocks (including headers, transactions and receipts), verifies all headers, and downloads the state and verifies it against the headers.
  3. Snap (Default): Same functionality as fast, but with a faster algorithm.
  4. Light: Downloads all block headers, block data, and verifies some randomly.

we used light mode to better speed in syncing and decrease needed storage.

Ethereum has many networks:

  1. mainnet
  2. testnet
    1. Görli(goerli)
      A proof-of-authority testnet that works across clients.

    2. Kovan:
      A proof-of-authority testnet for those running OpenEthereum clients.

    3. Rinkeby:
      A proof-of-authority testnet for those running Geth client.

    4. Ropsten:
      A proof-of-work testnet. This means it's the best like-for-like representation of Ethereum.

we wrote an script to setup eth node:

geth --goerli --http --http.vhosts="" --http.addr=0.0.0.0  --datadir /home/ubuntu/.ethereum --rpcaddr=0.0.0.0 --rpcport=8545 --port=30303 --rpcapi="admin,db,debug,personal,eth,net,web3" --rpccorsdomain="" --rpcvhosts="*" --syncmode="light" --cache=2048 --allow-insecure-unlock --nousb
  • in goerli testnet and light mode

you can see more detail in geth docs or use

geth --help

after installation

###some commands and tips

  1. install the geth on your machine
    commands for ubuntu
    • sudo add-apt-repository -y ppa:ethereum/ethereum
    • sudo apt-get update
    • sudo apt-get install ethereum
  2. connect to console of Eth server: geth attach http://ip:prot
  3. personal.newAccount()
    Generates a new private key and stores it in the key store directory. The key file is encrypted with the given passphrase. Returns the address of the new account.
    At the geth console, newAccount will prompt for a passphrase when it is not supplied as the argument.
> personal.newAccount()
Passphrase: 
Repeat passphrase: 
"0x5e97870f263700f46aa00d967821199b9bc5a120"
  1. for checking that geth is updated or not you can use:

    > eth
    

    for all informations

    > eth.blockNumber
    

    for getting only last received block
    and compare it with etherscan

  2. to connect to your node with js console you can use:

geth attach {$your_node_anddress}