zoukankan      html  css  js  c++  java
  • 以太坊(一)

    Centos 7 安装 以太坊环境

    安装系统依赖库   

    ##yum update -y && yum install git wget bzip2 vim gcc-c++ ntp epel-release nodejs cmake -y  

    # 安装编译工具和库
    yum -y groupinstall 'Development Tools'
    
    # 安装和设置 ntp 时间校准服务
    yum -y install ntp
    systemctl enable ntpd.service
    systemctl start ntpd.service

    安装Go

    wget https://dl.google.com/go/go1.10.linux-amd64.tar.gz
    tar -C /usr/local -xzf go1.10.linux-amd64.tar.gz
    echo 'export GOROOT=/usr/local/go' >> /etc/profile
    echo 'export PATH=$PATH:$GOROOT/bin' >> /etc/profile
    echo 'export GOPATH=/root/go' >> /etc/profile
    echo 'export PATH=$PATH:$GOPATH/bin' >> /etc/profile
    source /etc/profile

    验证

    $ go version

    go version go1.10 linux/amd64

    克隆编译项目go-ethereum

    git clone https://github.com/ethereum/go-ethereum.git

    cd go-ethereum

    make all

    在path中加入geth路径

    echo 'export PATH=$PATH:/usr/local/go-ethereum/build/bin' >> /etc/profile

    source /etc/profile

    验证

    geth version
    Geth
    Version: 1.8.2-unstable
    Git Commit: bd6879ac518431174a490ba42f7e6e822dcb3ee1
    Architecture: amd64
    Protocol Versions: [63 62]
    Network Id: 1
    Go Version: go1.10
    Operating System: linux
    GOPATH=/root/go
    GOROOT=/usr/local/go

    配置私有链初始状态,新建文件genesis.json

    { 
        "config": {
                "chainId": 22, 
                "homesteadBlock": 0, 
                "eip155Block": 0, 
                "eip158Block": 0 
        },
        "alloc" : {},
        "coinbase" : "0x0000000000000000000000000000000000000000", 
        "difficulty" : "0x400", 
        "extraData" : "", 
        "gasLimit" : "0x2fefd8", 
        "nonce" : "0x0000000000000038", 
        "mixhash" : "0x0000000000000000000000000000000000000000000000000000000000000000", 
        "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", 
        "timestamp" : "0x00" 
    }

    初始化区块链,生成创世区块和初始状态

    geth --datadir /opt/data init /opt/eth/genesis.json

    启动区块链

    geth --datadir ./data0 --networkid 11 console

  • 相关阅读:
    Linux系统挂载点与分区的关系(转载)
    读书笔记深入linux内核架构Chapter 2 part2
    读书笔记深入linux内核架构Chapter 2 part1
    读书笔记深入linux内核架构Chapter9
    读书笔记深入linux内核架构Chapter8part2
    鞋匠的烦恼
    和最大的连续子数组
    wxLog 的使用
    suffix trie
    trie
  • 原文地址:https://www.cnblogs.com/liuq1991/p/9042658.html
Copyright © 2011-2022 走看看