zoukankan      html  css  js  c++  java
  • 以太坊私有节点搭建

    我们可以通过搭建以太坊的私有节点,模拟以太坊挖矿、交易、部署运行智能合约,从而达到测试开发的目的。下面具体说明搭建过程:

    1. 创建新帐号

        geth --datadir {eth_dir} account new    //其中 eth_dir 是私有节点的数据目录

          //该命令会在 {eth_dir}目录下生成keystore目录,目录下会有相应的帐号文件

    2. 创建 genesis.json 文件,保存创世纪块的配置信息

    {
    "config": {
            "chainId": 1,
            "homesteadBlock": 0,
            "eip155Block": 0,
            "eip158Block": 0
        },
      "alloc"      : {
        "f985f8578206c6d317785cf131682259bf84588f": {"balance": "100000001"}    //红色部分代表帐号,来自上个命令生成的帐号文件的address属性
        },
      "coinbase"   : "0x0000000000000000000000000000000000000000",
      "difficulty" : "0x20000",
      "extraData"  : "",
      "gasLimit"   : "0x4c4b40",
      "nonce"      : "0x0001000000000042",
      "mixhash"    : "0x0000000000000000000000000000000000000000000000000000000000000000",
      "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
      "timestamp"  : "0x00"
    }

    3.初始化创世纪块

    geth --datadir {eth_dir}  init  {./genesis.json}    

    4. 启动以太坊工作节点

    geth --verbosity 6 --datadir e:/eth_dir --networkid 13579 --etherbase f985f8578206c6d317785cf131682259bf84588f 
        --port 30303 --rpcport 8545 --rpcaddr localhost --rpc --rpccorsdomain http://localhost:3000
        --ws --wsorigins "http://localhost:3000" --wsport 8546 --unlock f985f8578206c6d317785cf131682259bf84588f
        --nodiscover --mine --minerthreads 1 --password e:/eth_dir/passwd console 2>>eth_output.log
  • 相关阅读:
    GLSL逐像素光照 【转】
    GLSL逐顶点光照[转]
    GLSL 基础量定义 【转】
    GLSL纹理贴图 【转】
    NormalMap 贴图 [转]
    glsl镜面水倒影的实现[转]
    C#调用C++Dll封装时遇到的一系列问题【转】
    在C#中使用C++编写的类——用托管C++进行封装[转]
    GEOS 使用的例子
    昌平区2015年义务教育阶段入学工作意见 (含非京籍)
  • 原文地址:https://www.cnblogs.com/hzhuxin/p/9962493.html
Copyright © 2011-2022 走看看