Geth (1) - 설치 및 실행

박근원·2023년 1월 12일
0

based on Window

1. Geth 설치

Installing Geth | go-ethereum

  • 해당 링크를 통해 접속하면 운영체제에 따라 설치하고 빌드할 수 있는 방법이 있다.

설치

Downloads | go-ethereum

  • 해당 링크에서 윈도우에 맞는 geth를 설치한다.
  • PATH는 자동으로 설정되며 안에서 developer tools를 설치할지 여부를 물어본다.
  • cmd에서 geth —version을 쳤을때 동작하면 완료

빌드

  • 빌드를 위해서는 3가지를 미리 설치해야한다.
    • git
    • golang (Go)
    • mingw (GNU)
  • 이미 설치가 되어있다면
    C:\Users\xxx> mkdir src\github.com\ethereum
    C:\Users\xxx> git clone https://github.com/ethereum/go-ethereum src\github.com\ethereum\go-ethereum
    C:\Users\xxx> cd src\github.com\ethereum\go-ethereum
    C:\Users\xxx\src\github.com\ethereum\go-ethereum> go get -u -v golang.org/x/net/context
    C:\Users\xxx\src\github.com\ethereum\go-ethereum> go install -v ./cmd/...
    • 해당 cmd 명령을 통해 설치하면 된다.

2. Consensus 설치

  • 이더리움이 PoS방식으로 변경된 이후 consensus 설치가 필요해졌다. Quickstart: Run a node and (optionally) stake ETH using Prysm | Prysm
  • 해당 링크를 따라 설치하면 된다.
    1. ethereum 폴더 생성 후 하위폴더로 consensus, execution을 생성한다.

      📂ethereum
      ┣ 📂consensus
      ┣ 📂execution
    2. consensus로 이동해서 prysm 파일 생성 후 prysm안으로 진입.

      mkdir prysm && cd prysm
    3. 해당 명령어 입력

      curl https://raw.githubusercontent.com/prysmaticlabs/prysm/master/prysm.bat --output prysm.bat
      reg add HKCU\Console /v VirtualTerminalLevel /t REG_DWORD /d 1
  • JWT Secret 생성
    • prysm과 geth의 http 통신은 JWT Token을 통해 이루어진다. 따라서 JWT Token을 생성해야한다.
    • prysm폴더에 들어가서 해당 명령어를 입력하면 JWT Token을 생성한다.
      prysm.bat beacon-chain generate-auth-secret
  • Geth 실행
    • cmd를 하나 더 켜서 해당 명령어를 입력하면 geth가 실행된다. (full node의 경우.)

      geth --http --http.api eth,net,engine,admin --authrpc.jwtsecret ../consensus/prysm/jwt.hex
    • light mode로 실행하고 싶다면 geth --syncmode light로 시작한다.

  • prysm 실행
    • prysm폴더에 해당 명령어를 입력하면 prysm이 실행된다.

      prysm.bat beacon-chain --execution-endpoint=http://localhost:8551 --jwt-secret=jwt.hex --suggested-fee-recipient=0xABE8D3E1f609Fb2f9029203c41589b8B6e2814fB

0개의 댓글