Coder Social home page Coder Social logo

geth-deploy's Introduction

背景

在测试p2p广播消息的时候,我需要创建至少16个节点,来验证消息的广播。创建多节点,需要经历如下几个步骤:

  • 配置genesis.json文件
  • 根据genesis.json创建创世块
  • 启动节点
  • 找到各个节点的enode,使用RPC命令admin_addPeer将节点互联起来 整个过程非常繁琐费力而且容易出错。为了简化此操作,我写了一套脚本,将上面所有的操作都自动化。无论搭建多少个节点(以我搭建32个为例,太多节点机器性能不够无法运转了),让你能在不到一分钟内完成上面所有的操作。

注意

注意:目前只支持windows/linux系统。如果需要其他系统的,需要做一下适配。

使用步骤

  • 安装Node.js,安装v14.x版本。
  • 在项目目录执行npm install安装依赖。
  • 将你编译好的geth重命名为geth.exe放到项目根目录。
  • config.default.json为蓝本,将内容复制一份到新建的文件config.json里面。你更新一下配置。genesis中extraData与alloc我会进行覆盖。配置文件字段见后续说明。
  • 执行 node init.js --start true --unlock true 初始化。
    • nohup 启动脚本是否是nohup,默认 true
    • console 启动脚本是否是console,默认 false
    • platform 当前平台(darwin,linux,win32),默认空,不传通过process.platform获取
    • start 初始化之后是否立即执行,默认 false
    • unlock 是否启动之后立即解锁所有账号,默认 false
  • 执行 npm run start 启动所有节点。
  • 执行 npm run stop 停止所有节点。

geth-deploy's People

Contributors

luchenqun avatar

Forkers

ecogit-stage

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.