"Geth (go-ethereum) is a Go implementation of Ethereum - a gateway into the decentralized web.
Geth is an Ethereum execution client meaning it handles transactions, deployment and execution of smart contracts and contains an embedded computer known as the Ethereum Virtual Machine."
Geth란 Go-Ethereum의 준말로, 프로그래밍 언어인 고(Go)에서 구현된 전체 이더넷 노드를 실행하기 위한 다목적 명령 줄 도구이다.
Geth를 처음 시작하면 네트워크 내의 다른 이더리움 클라이언트(node)에 연결하는 작업을 진행하고, 블록체인의 전체 사본을 내려받음.
Geth는 블록체인의 복사본을 최신 상태로 유지하기 위해 끊임없이 다른 노드와 통신한다. Geth는 블록을 채굴하거나, 블록체인에 트랜잭션을 추가하고 블록의 트랜잭션을 검증하며 트랜잭션을 실행할 수도 있다.
또한, RPC를 통해 상호작용할 수 있는 API를 노출하여 서버 역할을 하기도 한다.
Hostname | eth0 | eth1 |
---|---|---|
Port | 30303 | 30303 |
Maxpeers | 2 | 2 |
Datadir | ~/dev/eth_localdata | ~/dev/eth_localdata |
RPC Port | 8545 | 8545 |
RPC Addr | 0.0.0.0 | localhost |
RPC API | 사용 | N/A (not available) |
Mining | True | True |
--datadir
: 데이터 디렉터리 지정--networkid
: 네트워크 식별자http.port
: Port 지정. (``의 경우 전체 허용)*http.corsdomain
: Cors 지정. (``의 경우 전체 허용)*http.api
: Geth API 지정. (``의 경우 전체 허용)*--nodiscover
: 생성자의 노드를 다른 노드에서 검색할 수 없게 함. 즉 같은 제네시스 블록과 네트워크 ID에 있는 블록들이 연결되는 것을 방지allow-insecure-unlock
: 보안상의 이유로 외부에서 계정을 unlock하는 것을 금지하지만, 이를 허용하도록 함--miner.threads
: mining을 할 때 사용할 threads 수를 지정console
: 콘솔 구동vagrant ssh eth0
입력 후 노드 접속geth \
--networkid 921 \
--datadir ~/dev/eth_localdata \
--maxpeers 2 \
--port 30303 \
--http \
--http.port "8545" \
--http.addr "0.0.0.0" \
--http.corsdomain "*" \
--http.api "eth, net, web3, miner, debug, personal, rpc" \
--allow-insecure-unlock \
--nodiscover \
console
vagrant ssh eth1
를 입력하여 eth1 노드에 접속geth --networkid 921 --maxpeers 2 --datadir ~/dev/eth_localdata --allow-insecure-unlock --port 30303 --http --http.port 8545 --http.addr localhost --http.corsdomain "*" --miner.threads 1
geth attach <url>
명령을 통해 접근
geth attach http://0.0.0.0:8545
geth attach http://localhost:8545