TIL

TIL) 이더리움 엔진 Geth 활용하여 private network 구축

Whatisblockchain 2022. 7. 1. 17:12

Geth란 무엇인가?

- full ethereum node를 구성하기 위한 tool

- Go 언어 기반으로 작성

 

Getting Started with Geth | Go Ethereum

Getting Started with Geth This page explains how to set up Geth and execute some basic tasks using the command line tools. In order to use Geth, the software must first be installed. There are several ways Geth can be installed depending on the operating s

geth.ethereum.org

 

Solidty는 많이 들어봤는데 Geth는 뭐지? 

- ethereum하면 흔히 solidity를 떠올리게 된다. 하지만 solidity는 이더리움의 주요 기능인 smart contract를 작성할 때만 사용되고, 이더리움 노드 운영과 관련된건 Go 언어 기반의 Geth 모듈을 활용하여 작성된다.

 

 

기본 명령어

 

Command-line Options | Go Ethereum

Install Downloads Documentation

geth.ethereum.org

 

 

local 테스트넷에서 Private 네트워크 구축

- 목표: docker ubuntu 환경에서 2개의 node 구성하고 연결하여 동작확인 

- 흐름

  • docker로 ubuntu 이미지 받아와서 container 만든 후 실행
  • git으로 go-ethereum repository clonning하고 go & geth 설치
  • 로컬 테스트넷에서 geth 실행하기 위해 디렉토리 및 genesis.json 파일 생성
  • 제네시스 블록 생성 및 초기화
  • 네트워크 연결
  • 피어 추가하여 연결
  • 블록 숫자 동기화되는지 확인

- 결과

- 배운내용

  • private network 구축할 때는 consensus algorithm으로 PoW가 아닌 PoA(Proof-of-Authority)가 권장됨
  • 0x20000는 사이즈를 헥사단위로 표기할 때 사용
    ex) 128KB*1024 = 131072byte = 0x20000 (in hexadecimal)
  • 터미널 명령어
    • # cd ~ : 사용자 홈 디렉토리로 이동

 

- 추가 학습내용

 

#geth 설치과정에서 ppa란?

  • PPA(Personal Package Archive): 개인 패키지 저장소로, 우분투의 공식 패키지 저장소에 없는 프로그램을 등록해놓고 업데이트 시킬 수 있다.
#sudo add-apt-repository -y ppa:ethereum/ethereum 
// add-apt-repository adds a PPA to your list of sources, 
// (importing the GPG public key of the PPA automatically), 
// so that Ubuntu knows to look for updates from that PPA 
// as well as from the official Ubuntu sources. 
// -y 플래그는 설치시 나타나는 모든 물음에 yes
 

Installing Geth | Go Ethereum

Installing Geth There are several ways to install Geth, including via a package manager, downloading a pre-built bundle, running as a docker container or building from downloaded source code. On this page the various installation options are explained for

geth.ethereum.org

 

#퍼블릭 네트워크에 연결하여 실제 채굴 환경을 구성하려면?

 

Mining | Go Ethereum

Mining This document explains how to set up geth for mining. The Ethereum wiki also has a page about mining, be sure to check that one as well. Mining is the process through which new blocks are created. Geth actually creates new blocks all the time, but t

geth.ethereum.org

 

#실제 이더리움 프라이빗 네트워크를 사용하여 네트워크를 구성하는 사례들이 있나?

  • 프라이빗 네트워크는 하이퍼레져 기반으로 많이 사용됨

 

 

- 추가로 학습할 내용

  • 하이퍼레져로 private network 구축

https://www.edx.org/course/introduction-to-hyperledger-blockchain-technologie

 

Introduction to Hyperledger Blockchain Technologies

A primer to blockchain, distributed ledgers and Hyperledger technologies.

www.edx.org

https://www.edx.org/course/identity-in-hyperledger-aries-indy-and-ursa

https://training.linuxfoundation.org/training/becoming-a-hyperledger-aries-developer-lfs173/

https://www.edx.org/course/hyperledger-besu-essentials-creating-a-private-blockchain-network