前言:由于上一篇基于geth1.8版本,发现geth1.8版本掘金速度有点慢。故更新到geth1.11版本。该版本命令有些许不同。
本文将从一个区块链入门小白的视角,来一步步的讲解如何实现区块链数据上链,链上数据查询,geth1.11多节点同步。以及讲解在上链过程中,我踩过的坑及其解决方案。如果有不对的地方,还请大佬指教!🙇🙇🙇
声明:本文为作者Huathy原创文章,未经许可,禁止转载。否则依法追究责任!
文章目录
环境搭建
GoLang环境安装
- 版本安装 :https://studygolang.com/dl
基于go1.22.0.windows-amd64.msi (60MB)稳定版本 - gopath配置
Windows版本安装自动配置,或类似JavaHome配置
Geth环境安装
下载geth1.8.20版本:geth-windows-amd64-1.8.20-24d727b6.exe
配置环境变量:
geth初始化
- 编写创世区块配置文件genesis.json
{ "config": { "chainId": 1, "homesteadBlock": 0, "eip150Block": 0, "eip150Hash": "0x0000000000000000000000000000000000000000000000000000000000000000", "eip155Block": 0, "eip158Block": 0, "byzantiumBlock": 0, "constantinopleBlock": 0, "petersburgBlock": 0, "istanbulBlock": 0, "ethash": { } }, "nonce": "0x0", "timestamp": "0x5ddf8f3e", "extraData": "0x0000000000000000000000000000000000000000000000000000000000000000", "gasLimit": "0xffffffff", "difficulty": "0x00002", "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000", "coinbase": "0x0000000000000000000000000000000000000000", "alloc": { }, "number": "0x0", "gasUsed": "0x0", "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000" }
- 执行初始化命令
geth init --datadir eth_node1 C:\env\Geth\genesis.json geth init --datadir eth_node2 C:\env\Geth\genesis.json
启动节点
geth --datadir "eth_node1" --port 30303 --ipcdisable --networkid 23 --