Coder Social home page Coder Social logo

alpha's Introduction

alpha

安装

npm install

启动

启动节点1

HTTP_PORT=3001 P2P_PORT=6001 npm start

启动节点2

HTTP_PORT=3002 P2P_PORT=6002 npm start

启动节点3

HTTP_PORT=3003 P2P_PORT=6003 npm start

配置节点

curl -H "Content-type:application/json" --data '{"peer" : "ws://localhost:6001"}' http://localhost:3001/addPeer
curl -H "Content-type:application/json" --data '{"peer" : "ws://localhost:6002"}' http://localhost:3001/addPeer
curl -H "Content-type:application/json" --data '{"peer" : "ws://localhost:6003"}' http://localhost:3001/addPeer

查看节点

curl http://localhost:3001/peers

创世

curl http://localhost:3001/g

查询区块

curl http://localhost:3001/blocks/all
curl http://localhost:3002/blocks/all
curl http://localhost:3003/blocks/all

用户操作

新建用户

node newuser.js
 你要把助忆词和地址抄在安全的地方,key文件里仅仅保存私钥。 

+--------------+---------------------------------------------------------------------------------------+
|  mnemonic    | analyst merit gown expect lake crouch either radio achieve provide half total         |
|  Privatekey  | 5JdGzR28pdh6c3vKrwLuQvWXbznJmrPwE81qurSVZzf8SwCtsDY                                   |
|  Publickey   | GPH6HqQmNUBb3AqTfW7MtBqVCPXDJuKnZVEeyxPNk64sE6QYQKyH5                                 |
|  Address     | GPH9Jw8v7vmqKTaMjJpac2xefehQ7d9nJkAm                                                  |
+------------  +---------------------------------------------------------------------------------------+

显示用户

node showuser.js
这是你的信息 

+--------------+---------------------------------------------------------------------------------------+
|  Privatekey  | 5JdGzR28pdh6c3vKrwLuQvWXbznJmrPwE81qurSVZzf8SwCtsDY                                   |
|  Publickey   | GPH6HqQmNUBb3AqTfW7MtBqVCPXDJuKnZVEeyxPNk64sE6QYQKyH5                                 |
|  Address     | GPH9Jw8v7vmqKTaMjJpac2xefehQ7d9nJkAm                                                  |
+------------  +---------------------------------------------------------------------------------------+

信息上链

node msg.js haha localhost 3001

交流

欢迎关注公众号 ForkChain

欢迎进入芥末圈

备注

区块链的部分是我自己写的,p2p 这部分主要来源于 https://github.com/zfzGit/P2PNodejs/blob/master/main.js 项目。

alpha's People

Contributors

cr4fun avatar

Watchers

 avatar  avatar

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.