LoginSignup
8
5

More than 5 years have passed since last update.

go-ethereumを読む(1) 準備編

Posted at

ブロックチェーンの勉強のためにEthereumのデファクトとなっているgo-ethereumのソースコードを読んだのでそれを記録としてまとめます。
v1.8.15ベースに解説します。

debug

pritty printがあると便利

go-ethereumはgovendorを使っているので下記のコマンドでインストールしておくのをおすすめ

$ govendor fetch github.com/k0kubun/pp@=v2.3.0

使い方

geth

urfave/cli

gethでつかっているcliライブラリ

主要なディレクトリ構成

名前 説明
accounts Ethereumはアカウントベースなので、アドレスや鍵のプログラムがここにある 
cmd gethコマンド,puppethコマンドなどコマンドのmain.goなどがある
common Addressなどの汎用的に使う型やそれ用の関数がある
consensus ethash(PoW), clique(PoA)などのロジックがある
core Ethereumのコア機能の実装がある
eth EthServiceの機能がある
ethclient rpcリクエスト用のクライアントがある
ethdb LevelDBのwrapper
event FeedやSubscriptionといったものがある
miner マイニング用の汎用的なロジックがある(ethash, cliqueなどの特化したロジック以外)
node nodeをセットアップ、起動するためのロジックがある
p2p p2pのロジックがある
rlp Recursive Length PrefixというEthereumで独自定義されているバイナリフォーマット用のロジックがある
rpc http,ws,ipcなど具体的なrpcサーバのロジックがある
trie データ保存形式の作成ロジックがある
8
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
5