zoukankan      html  css  js  c++  java
  • 以太坊:Go-Ethereum: 编译运行

    安装Golang

    go-ethereum 需要go版本不低于 1.7, 文章最后介绍了如何卸载低版本的go

    sudo add-apt-repository -y ppa:gophers/archive
    sudo apt-get update
    sudo apt-get install -y golang-1.10-go

    sudo ln -s /usr/lib/go-1.10/bin/go /usr/bin/go 通过软链的方式把go 放到全局环境变量中

    查看go版本 go version

    编译Ethereum

    git clone https://github.com/ethereum/go-ethereum
    cd go-ethereum
    git checkout v1.8.0
    make geth #编译

    生成 执行文件 ./build/bin/geth

    运行

    ./build/bin/geth
    
    INFO [03-12|21:50:36] Maximum peer count                       ETH=25 LES=0 total=25
    INFO [03-12|21:50:36] Starting peer-to-peer node               instance=Geth/v1.8.0-stable/linux-amd64/go1.10
    INFO [03-12|21:50:36] Allocated cache and file handles         database=~/.ethereum/geth/chaindata cache=768 handles=512
    INFO [03-12|21:50:36] Initialised chain configuration          config="{ChainID: 1 Homestead: 1150000 DAO: 1920000 DAOSupport: true EIP150: 2463000 EIP155: 2675000 EIP158: 2675000 Byzantium: 4370000 Engine: ethash}"
    INFO [03-12|21:50:36] Disk storage enabled for ethash caches   dir=~/.ethereum/geth/ethash count=3
    INFO [03-12|21:50:36] Disk storage enabled for ethash DAGs     dir=~/.ethash               count=2
    INFO [03-12|21:50:36] Initialising Ethereum protocol           versions="[63 62]" network=1
    INFO [03-12|21:50:36] Loaded most recent local header          number=0 hash=d4e567…cb8fa3 td=17179869184
    INFO [03-12|21:50:36] Loaded most recent local full block      number=0 hash=d4e567…cb8fa3 td=17179869184
    INFO [03-12|21:50:36] Loaded most recent local fast block      number=0 hash=d4e567…cb8fa3 td=17179869184
    INFO [03-12|21:50:36] Loaded local transaction journal         transactions=0 dropped=0
    INFO [03-12|21:50:36] Regenerated local transaction journal    transactions=0 accounts=0
    INFO [03-12|21:50:36] Starting P2P networking 
    INFO [03-12|21:50:36] Mapped network port                      proto=udp extport=30303 intport=30303 interface=NAT-PMP(192.168.1.1)
    INFO [03-12|21:50:36] UDP listener up                          self=enode://67d9b38f8a2f9874ef60d53a52492efecaaad5f662d08ef@192.168.1.1:30303
    INFO [03-12|21:50:36] RLPx listener up                         self=enode://67d9b38f8a2f9874ef60d53a52492efecaaad5f662d08ef@192.168.1.1:30303
    INFO [03-12|21:50:36] IPC endpoint opened                      url=~/.ethereum/geth.ipc
    INFO [03-12|21:50:36] Mapped network port                      proto=tcp extport=30303 intport=30303 interface=NAT-PMP(192.168.1.1)

    设定datadir 并后台运行

    nohup ./build/bin/geth --datadir /mnt/eth &

    ##移动 geth
    sudo mv ./build/bin/geth /usr/local/bin/

    同步方式

    eth有三种同步方式:

    --syncmode 'fast'   Blockchain sync mode ('fast' 'full or 'light')

    默认是 fast, 如果同步全部数据 geth --syncmode full

    ##守护进程

    geth Ethereum node to run automatically on Ubuntu

    #/etc/supervisor/conf.d/gethd.conf
    
    [program:gethd]
    command=/usr/local/bin/geth --datadir /mnt/eth/data --syncmode full --rpc
    user=deployer # deployer用户启动任务
    autostart=true
    autorestart=true
    stderr_logfile=/mnt/eth/data/geth_err.log
    stdout_logfile=/mnt/eth/data/geth.log

    sudo supervisorctl reload

    卸载Golang

    sudo apt-get remove golang-go
    sudo apt-get remove --auto-remove golang-go

    参考:

    https://github.com/golang/go/wiki/Ubuntu
    https://github.com/ethereum/go-ethereum/wiki/Installation-Instructions-for-Ubuntu

  • 相关阅读:
    随机森林算法
    读论文《BP改进算法在哮喘症状-证型分类预测中的应用》
    Spss22安装与破解步骤
    python安装pip、numpy、scipy、statsmodels、pandas、matplotlib等
    windows下Python三步安装pip
    LNMP环境下配置PHP错误信息提示
    SAE临时文件读写例子 SAE_TMP_PATH
    新浪sae 微信公众平台 输出 返回 打印对象
    PHP 易混 知识
    thinkphp tp5 模板文件 循环输出 bootstrap 模态框 弹窗 获取 微信媒体文件素材 media_id
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13312913.html
Copyright © 2011-2022 走看看