前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >ethereum-编译geth

ethereum-编译geth

作者头像
潇洒
发布2023-10-23 14:22:20
1790
发布2023-10-23 14:22:20
举报
文章被收录于专栏:石头岛石头岛

前言

geth 是将计算机变成一个以太坊节点,连接到以太坊网络的客户端。

对于geth的几个问题:

  • 有了 geth 之后能做什么?
  • 该怎么用?
  • 用了之后能了解到什么?

能做几件事:

  1. 成为一个以太坊节点,可以是:全节点、矿工节点、归档节点
  2. 可以当在一个gRPC 的查询工具来用
  3. 生成账户等操作

一句话总结:geth就代表运行在你电脑上的以太坊程序。

环境准备

这里说明只基于对开发环境的基础配置,官方要求的配置更高

最小硬件要求

  • CPU 2+ cores
  • 4GB RAM
  • 1TB
  • 8 MBit/sec

go安装

注意需要修改一下go代理:

代码语言:javascript
复制
go env -w GOPROXY=https://goproxy.cn

安装gcc

代码语言:javascript
复制
yum install gcc

编译

下载源码之后,看一下README.md,使用make geth就行编译,编译一下

代码语言:javascript
复制
git clone https://github.com/ethereum/go-ethereum.git
cd  go-ethereum
# 查看所有分支 git brarnch -a
git checkout release/1.9
make geth
make all

开始编译后输出:

代码语言:javascript
复制
github.com/ethereum/go-ethereum/eth/filters
github.com/ethereum/go-ethereum/light
github.com/ethereum/go-ethereum/eth/protocols/eth
github.com/ethereum/go-ethereum/accounts/abi/bind/backends
github.com/ethereum/go-ethereum/internal/ethapi
github.com/ethereum/go-ethereum/eth/fetcher
github.com/ethereum/go-ethereum/eth/protocols/snap
github.com/ethereum/go-ethereum/eth/tracers
github.com/ethereum/go-ethereum/graphql
github.com/ethereum/go-ethereum/les/downloader
github.com/ethereum/go-ethereum/eth/downloader
github.com/ethereum/go-ethereum/eth/tracers/js
github.com/ethereum/go-ethereum/eth/tracers/native
github.com/ethereum/go-ethereum/miner
github.com/ethereum/go-ethereum/eth/ethconfig
github.com/ethereum/go-ethereum/eth
github.com/ethereum/go-ethereum/les
github.com/ethereum/go-ethereum/eth/catalyst
github.com/ethereum/go-ethereum/les/catalyst
github.com/ethereum/go-ethereum/ethstats
github.com/ethereum/go-ethereum/cmd/utils
github.com/ethereum/go-ethereum/cmd/geth
Done building.
Run "./build/bin/geth" to launch geth.

可以看到geth被编译到了: ./build/bin/geth,这个路径。

执行下看看编译是否成功:

代码语言:javascript
复制
./build/bin/geth --help

成功

代码语言:javascript
复制
    --txpool.globalqueue value     (default: 1024)
          Maximum number of non-executable transaction slots for all accounts
   
    --txpool.globalslots value     (default: 5120)
          Maximum number of executable transaction slots for all accounts
   
    --txpool.journal value         (default: "transactions.rlp")
          Disk journal for local transaction to survive node restarts
   
    --txpool.lifetime value        (default: 3h0m0s)
          Maximum amount of time non-executable transaction are queued
   
    --txpool.locals value         
          Comma separated accounts to treat as locals (no flush, priority inclusion)
   
    --txpool.nolocals              (default: false)
          Disables price exemptions for locally submitted transactions
   
    --txpool.pricebump value       (default: 10)
          Price bump percentage to replace an already existing transaction
   
    --txpool.pricelimit value      (default: 1)
          Minimum gas price limit to enforce for acceptance into the pool
   
    --txpool.rejournal value       (default: 1h0m0s)
          Time interval to regenerate the local transaction journal
   
   VIRTUAL MACHINE
   
    --vmdebug                      (default: false)
          Record information useful for VM and contract debugging
   

COPYRIGHT:
   Copyright 2013-2022 The go-ethereum Authors

总结

如果是 windows 机器,建议装个虚拟机操作,在Linux环境下使用起来更顺手一些。

参考文档

https://github.com/ethereum/go-ethereum https://geth.ethereum.org/docs/getting-started

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2022-01-12,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 前言
  • 环境准备
    • 最小硬件要求
      • go安装
      • 编译
      • 总结
      • 参考文档
      领券
      问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档