1、安装geth:
(1)在Ubuntu上安装:
打开终端按顺序执行以下四条命令
sudo apt-get install software-properties-common
sudo add-apt-repository -y ppa:ethereum/ethereum
sudo apt-get update
sudo apt-get install ethereum
安装完毕后执行帮助命令即可看到geth的帮助信息
geth help
(2)在Mac上安装:
brew tap ethereum/ethereum
brew install ethereum
2、geth启动脚本
geth --datadir ./data --networkid 15 --port 30303 --rpc --rpcaddr 0.0.0.0 --rpcport 8545 --rpcvhosts "*" --rpcapi 'db,net,eth,web3,personal' --rpccorsdomain '*' --nat "any" --nodiscover --dev --dev.period 1 console 2> 1.log
//参数说明:
datadir --指定数据存放目录
port --节点之间的通信端口
rpc --允许远程指令访问
rpcaddr --提供远程访问链接的地址;0.0.0.0代表本地的任意有效IP都可以作为连接IP
rpcport --geth的服务端口
rpcapi --rpc远程调用的模块
rpccorsdomain --可以跨域访问
console -- 启动后启用命令行
最后的2> 1.log--终端输出的命令全部重定向到1.log文件中
3、eth创世块文件--genesis.json
{
"config": {

本文介绍了在Ubuntu和Mac上安装geth的步骤,并提供了geth启动脚本及其参数说明。同时,详细讲解了创世块文件genesis.json的配置,以及初始化创世节点、设置data目录的操作。此外,还列举了一些常用命令,如创建和解锁账号、查看余额、转账等。最后,补充了在Ubuntu中安装Chrome浏览器的方法。
最低0.47元/天 解锁文章
1145

被折叠的 条评论
为什么被折叠?



