概要 EthereumがPoSに移行した後,gethを使ってプライベートチェーンの構築を試みましたが,geth minerやgeth personalコマンドが存在せず,古い情報に従っても送金すらできませんでした.
加えて,PoS移行後の情報が極めて少なく,様々な公式ドキュメントやヘルプを読みあさり なんとか送金するところまでたどり着いたので,自分流のやり方として公開します.
目次
前提条件
Ubuntu (docker使うからあんま変わらないかも)
WSLでsystemdを有効化済み
公式ドキュメントに従いdocker-ceインストール済
やりたいこと
アカウントAliceを作成
Aliceが100ETHを持った状態の初期ブロックを作成
Bobに送金
clef初期化 clefは従来のgeth personalに変わる秘密鍵の管理サーバのようなものです. 今回はアカウントごとにdockerコンテナを立ち上げてclefを動作させます. そのため,複数のアカウントを扱う場合,コマンド中のaliceという名前を読み替えてください.
以下のコマンドでclefの対話画面を立ち上げる
1 2 3 4 $ sudo docker run --rm -it --name alice_clef \ -v alice_clef_vl:/root/.clef \ ethereum/client-go:alltools-stable \ clef init --configdir /root/.clef
以下のようなメッセージが表示されたらokと入力しEnterキーを入力
1 2 3 4 5 6 7 8 9 10 11 12 13 14 WARNING! Clef is an account management tool. It may, like any software, contain bugs. Please take care to - backup your keystore files, - verify that the keystore(s) can be opened with your password. Clef is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULARPURPOSE. See the GNU General Public License for more details. Enter 'ok' to proceed: >
パスワードを設定 パスワードは10桁以上で2回繰り返して入力
1 2 3 4 The master seed of clef will be locked with a password . Please specify a password . Do not forget this password ! Password : ***Repeat password : ***
アドレス生成 以下のコマンドで秘密鍵とETHアドレスを生成 途中で初期化時と同じ確認やパスワードが求められるので適宜入力します
1 2 3 4 sudo docker run --rm -it --name alice_clef \-v alice_clef_vl:/root/.clef \ ethereum/client-go:alltools-stable \ clef newaccount --keystore /root/.clef/keystore
以下のような表示が出ればアドレスの生成は完了.
1 2 3 4 INFO [09-25 |06:21:31.481] Your new key was generated address=0x930620D7C29043423BaE931A4A88345a2ff725a6 WARN [09-25 |06:21:31.481] Please backup your key file! path=/root/.clef/keystore/UTC--2025 -09 -25 T06-21 -29 .776639348Z--930620 d7c29043423bae931a4a88345a2ff725a6 WARN [09-25 |06:21:31.481] Please remember your password! Generated account 0x930620D7C29043423BaE931A4A88345a2ff725a6
念のため以下のコマンドで鍵が保存されているか確認
1 2 3 4 sudo docker run --rm -it --name alice_clef \-v alice_clef_vl:/root/.clef \ ethereum/client-go:alltools-stable \ clef list-accounts --keystore /root/.clef/keystore
このように表示されればOK.
1 0x930620D7C29043423BaE931A4A88345a2ff725a6 (keystore:///root/.clef/keystore/UTC--2025 -09 -25 T06-21 -29 .776639348 Z--930620 d7c29043423bae931a4a88345a2ff725a6)
アドレスは後ほど使うため覚えておきます.
clefサーバーを起動 以下のコマンドでclefサーバを起動します. 今回はポート番号50000としていますが,複数アカウントを使用する場合は重複しないように変更してください.
1 2 3 4 5 sudo docker run --rm -it --name alice_clef \-v alice_clef_vl:/root/.clef \ -p 50000:50000 \ ethereum/client-go:alltools-stable \ clef --keystore /root/.clef/keystore --configdir /root/.clef --chainid 585858 --http --http.addr 0.0.0.0 --http.vhosts "*" --http.port 50000
その後,パスワードの入力などを行い,以下のようにアカウント情報が表示されたら起動成功.
1 2 ------- Available accounts ------- 0. 0x930620D7C29043423BaE931A4A88345a2ff725a6 at keystore:///root/.clef/keystore/UTC--2025 -09 -25 T06-21 -29 .776639348Z--930620 d7c29043423bae931a4a88345a2ff725a6
以降,このコンソールは立ち上げたままにして,新しいコンソールから作業を行います.
Kurotosisのインストール KurotosisはEthereumのプライベートチェーン構築を補助するツールです.network-params.ymlを定義することで必要なコンテナを一気に立ち上げてconfigを投入してくれます.
まずはじめに,公式のインストールガイドを参照し,Kurotosisをインストールしてください.https://docs.kurtosis.com/install
設定ファイルの作成 以下の設定ファイルの必要箇所を編集し,network-params.ymlというファイル名で保存.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 participants: #Alice - el_type: geth el_image: "ethereum/client-go:alltools-stable" el_extra_params: ['--signer=http://<ホストのIPアドレス>:50000/'] cl_type: lighthouse #Bob - el_type: geth el_image: "ethereum/client-go:alltools-stable" cl_type: lighthouse - el_type: geth cl_type: teku network_params: network_id: "585858" prefunded_accounts: '{"<Aliceのアドレス>":{"balance":"100ETH"}}' additional_services: - dora
Kurotosisの起動 以下のコマンドでKurotosisを起動
1 $ sudo kurtosis run github.com/ethpandaops/ethereum-package --args-file ./network-params.yml
以下のような画面が表示されたら,Enterキーを入力
1 2 3 4 5 The Kurtosis CLI collects user metrics by default. These metrics are anonymized, private & obfuscated. These metrics help us better understand what features are used, what features to invest in and what features might be buggy. In case you wish to not send metrics, you can do so by running - kurtosis analytics disable Read more at https://docs.kurtosis.com/advanced-concepts/metrics-philosophy ✔ (Optional) Share your email address for occasional updates & outreach for product feedback from Kurtosis: █
最後に以下のような画面が表示されたら起動完了. このときの情報は後々必要になるので控えておく.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 ========================================== User Services ========================================== UUID Name Ports Status 2fa0759d0f19 cl-1-lighthouse-geth http: 4000/tcp -> http://127.0.0.1:32784 RUNNING metrics: 5054/tcp -> http://127.0.0.1:32785 quic-discovery: 9001/udp -> 127.0.0.1:32772 tcp-discovery: 9000/tcp -> 127.0.0.1:32786 udp-discovery: 9000/udp -> 127.0.0.1:32771 57b30e388a1e cl-2-lighthouse-geth http: 4000/tcp -> http://127.0.0.1:32787 RUNNING metrics: 5054/tcp -> http://127.0.0.1:32788 quic-discovery: 9001/udp -> 127.0.0.1:32774 tcp-discovery: 9000/tcp -> 127.0.0.1:32789 udp-discovery: 9000/udp -> 127.0.0.1:32773 5a0d0ee91d86 cl-3-teku-geth http: 4000/tcp -> http://127.0.0.1:32790 RUNNING metrics: 8008/tcp -> http://127.0.0.1:32791 tcp-discovery: 9000/tcp -> 127.0.0.1:32792 udp-discovery: 9000/udp -> 127.0.0.1:32775 36676219c6c8 dora http: 8080/tcp -> http://127.0.0.1:32795 RUNNING 2f9bb3e40158 el-1-geth-lighthouse engine-rpc: 8551/tcp -> 127.0.0.1:32771 RUNNING metrics: 9001/tcp -> http://127.0.0.1:32772 rpc: 8545/tcp -> 127.0.0.1:32769 tcp-discovery: 30303/tcp -> 127.0.0.1:32773 udp-discovery: 30303/udp -> 127.0.0.1:32768 ws: 8546/tcp -> 127.0.0.1:32770 eeb653321f3a el-2-geth-lighthouse engine-rpc: 8551/tcp -> 127.0.0.1:32776 RUNNING metrics: 9001/tcp -> http://127.0.0.1:32777 rpc: 8545/tcp -> 127.0.0.1:32774 tcp-discovery: 30303/tcp -> 127.0.0.1:32778 udp-discovery: 30303/udp -> 127.0.0.1:32769 ws: 8546/tcp -> 127.0.0.1:32775 c31ebc8e8aaa el-3-geth-teku engine-rpc: 8551/tcp -> 127.0.0.1:32781 RUNNING metrics: 9001/tcp -> http://127.0.0.1:32782 rpc: 8545/tcp -> 127.0.0.1:32779 tcp-discovery: 30303/tcp -> 127.0.0.1:32783 udp-discovery: 30303/udp -> 127.0.0.1:32770 ws: 8546/tcp -> 127.0.0.1:32780 4cb590a2e6ca validator-key-generation-cl-validator-keystore <none> RUNNING e9e76f1af61a vc-1-geth-lighthouse metrics: 8080/tcp -> http://127.0.0.1:32794 RUNNING 1b7552662140 vc-2-geth-lighthouse metrics: 8080/tcp -> http://127.0.0.1:32793 RUNNING
gethとClefの接続確認 はじめに,AliceとなるコンテナのIDを取得.
1 $ sudo docker ps | grep el-1-geth
以下のような出力の54ba7f879b61という部分がAliceのコンテナIDです.
1 54ba7f879b61 ethereum/client-go:alltools-stable "sh -c 'geth init --…" 4 minutes ago Up 4 minutes 0.0.0.0:32769->8545/tcp, [::]:32769->8545/tcp, 0.0.0.0:32770->8546/tcp, [::]:32770->8546/tcp, 0.0.0.0:32771->8551/tcp, [::]:32771->8551/tcp, 0.0.0.0:32772->9001/tcp, [::]:32772->9001/tcp, 0.0.0.0:32768->30303/udp, 0.0.0.0:32773->30303/tcp, [::]:32768->30303/udp, [::]:32773->30303/tcp el-1-geth-lighthouse--2f9bb3e401584721b928ecd01eb3a99d
コンテナのシェルに接続
1 $ sudo docker exec -it <コンテナID> geth attach --datadir /data/geth/execution-data
gethが立ち上がると以下のような文章が表示される
1 2 3 4 5 6 7 8 Welcome to the Geth JavaScript console!instance : Geth/v1.16 .3 -stable-d818a9af/linux-amd64/go1.24 .6 at block: 21 (Thu Sep 25 2025 07 :25 :34 GMT+0000 (UTC)) datadir : /data/geth/execution-data modules : admin:1 .0 debug:1 .0 engine:1 .0 eth:1 .0 miner:1 .0 net:1 .0 rpc:1 .0 txpool:1 .0 web3:1 .0 To exit, press ctrl-d or type exit
以下のコマンドを入力して,clefに保存されたアカウントを呼び出す
clefのコンソールに以下のようなメッセージが表示されるのでyと入力
1 2 3 4 5 6 7 8 9 10 11 12 13 14 -------- List Account request--------------A request has been made to list all accounts. You can select which accounts the caller can see [x] 0x930620D7C29043423BaE931A4A88345a2ff725a6 URL: keystore:///root/.clef/keystore/UTC--2025-09-25T06-21-29.776639348Z--930620d7c29043423bae931a4a88345a2ff725a6 ------------------------------------------- Request context: 172.17.0.1:32892 -> http -> 172.25.82.171:50000 Additional HTTP header data, provided by the external caller: User-Agent: "Go-http-client/1.1" Origin: "" Approve? [y/N]: >
gethの方に戻り,以下のようにアドレスが表示されたらOK
1 "0x930620d7c29043423bae931a4a88345a2ff725a6"
残高を確認するために,gethで以下のコマンドを入力.
1 web3.fromWei(eth.getBalance(eth.accounts[0 ]))
clef側で鍵へのアクセスを許可すると以下のように表示されます.
network-params.ymlで100ETHを指定していた場合,100という応答が得られればOK
送金 適当なアドレス0xcA5EB5ce7A5e4808e2243c9336d3DC7221Fb9855に対して10ETH送金します. ※コマンドの実行毎にclefで許可しないといけないが,ここでは記述省略
まずは,両者の残高確認.
1 2 3 4 > web3.fromWei(eth.getBalance(eth.accounts[0 ])) 100 > web3.fromWei(eth.getBalance("0xcA5EB5ce7A5e4808e2243c9336d3DC7221Fb9855" )) 0
続いて送金トランザクションを生成し送金. ※ここではclefでパスワード入力が求められる
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 > eth.sendTransaction({from: eth.accounts[0 ], to: "0xcA5EB5ce7A5e4808e2243c9336d3DC7221Fb9855" , value: web3.toWei(10 , "ether" )}) "0x7f4c40a7905ab618b9985a64f09e7566255281588083bfc1253e1d8c0ef8926a" > eth.getTransaction("0x7f4c40a7905ab618b9985a64f09e7566255281588083bfc1253e1d8c0ef8926a" ) { accessList: [], blockHash: "0x20d55cad337260446b65d449b5deb471656740248a80434cbee697961430a79a" , blockNumber: 89 , chainId: "0x8f082" , from: "0x930620d7c29043423bae931a4a88345a2ff725a6" , gas: 21000 , gasPrice: 6903 , hash: "0x7f4c40a7905ab618b9985a64f09e7566255281588083bfc1253e1d8c0ef8926a" , input: "0x" , maxFeePerGas: 15775 , maxPriorityFeePerGas: 1 , nonce: 0 , r: "0x1d7eb51d3bccae59bb21e9b3a85d686dc085e26671f29dd3878f4b517efce41f" , s: "0x3982f96fed13fab88c9af46e430ccd7fcfb722f2da683803de4dc96fb532a3f2" , to: "0xca5eb5ce7a5e4808e2243c9336d3dc7221fb9855" , transactionIndex: 0 , type : "0x2" , v: "0x1" , value: 10000000000000000000 , yParity: "0x1" }
最後に両者の残高を確認. 送信元のアカウントからは10ETHと手数料が引き落とされ, 宛先のアカウントには10ETHが入金されていることがわかります.
1 2 3 4 5 > web3.fromWei(eth.getBalance(eth.accounts[0 ])) 89.999999999855037 > web3.fromWei(eth.getBalance("0xcA5EB5ce7A5e4808e2243c9336d3DC7221Fb9855" )) 10 >
最初からやり直したい場合 1 2 sudo docker ps -aq | xargs sudo docker rm -fsudo docker volume ls -q | xargs sudo docker volume rm
参考文献 Private Networks via Kurtosis | go-ethereum https://geth.ethereum.org/docs/fundamentals/kurtosis GitHub - ethpandaops/ethereum-package: A Kurtosis package that deploys a private, portable, and modular Ethereum devnet https://github.com/ethpandaops/ethereum-package