GithubHelp home page GithubHelp logo

chattg1 / sharding-p2p-poc Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ethresearch/sharding-p2p-poc

0.0 2.0 0.0 1.91 MB

Proof of Concept of Ethereum Serenity Peer-to-Peer Layer on libp2p PubSub System

Dockerfile 0.44% Makefile 1.10% Go 73.29% Shell 4.45% Python 18.35% HCL 2.32% Smarty 0.05%

sharding-p2p-poc's Introduction

sharding-p2p-poc

Build Status

This is a proof of concept of Ethereum sharding peer to peer layer with PubSub in libp2p, based on the idea from the slide.

For more information, please check out the document.

Getting Started

Prerequisites

  • go with 1.11.x or above is installed and properly configured on your machine.
    • $GOPATH variable has been specified.
    • $GOPATH/bin/ is part of your $PATH.
  • If you modify *.proto files, you will also need protoc to compile them to *.pb.go

Build

$ git clone https://github.com/ethresearch/sharding-p2p-poc.git
$ cd sharding-p2p-poc
$ make build

Testing

$ go test -v

Usage

$ ./sharding-p2p-poc --help
Usage of ./sharding-p2p-poc:
  -bootnodes string
    	multiaddresses of the bootnodes
  -bootstrap
    	whether to do bootstrapping or not
  -client
    	is RPC client or server
  -port int
    	port listened by the node for incoming connections (default 10000)
  -rpcport int
    	rpc port listened by the rpc server (default 13000)
  -seed int
    	set random seed for id generation
  -verbose
        set the log level to DEBUG, i.e., print all messages

Note: -bootstrap controls whether to spin up a bootstrap routine, which periodically queries its peers for new peers. There will be no effect if you feed -bootnodes without specifying the flag -bootstrap.

Example

Spin up a node with a running RPC server

$ ./sharding-p2p-poc -seed=1 -port=10001 -rpcport=13001 -bootstrap -bootnodes=/ip4/127.0.0.1/tcp/5566/ipfs/QmS5QmciTXXnCUCyxud5eWFenUMAmvAWSDa1c7dvdXRMZ7,/ip4/127.0.0.1/tcp/10001/ipfs/QmexAnfpHrhMmAC5UNQVS8iBuUUgDrMbMY17Cck2gKrqeX

This command spins up a node with seed 0, listening to new connections at port 10001, listening to RPC requests at port 13001, turning on bootstrapping mode with the flag-bootstrap, with the bootstrapping nodes /ip4/127.0.0.1/tcp/5566/ipfs/QmS5QmciTXXnCUCyxud5eWFenUMAmvAWSDa1c7dvdXRMZ7 and /ip4/127.0.0.1/tcp/10001/ipfs/QmexAnfpHrhMmAC5UNQVS8iBuUUgDrMbMY17Cck2gKrqeX.

Note: /ip4/127.0.0.1/tcp/10001/ipfs/QmexAnfpHrhMmAC5UNQVS8iBuUUgDrMbMY17Cck2gKrqeX is the format of ipfs address, which is in the form of /ip4/{ip}/tcp/{port}/{peerID}.

Command Line Interface

To give commands to the node you have spun up, you can run the command in this format:

$ ./sharding-p2p-poc -client -rpcport={rpcport} {method_name} {params}

The flag -rpcport is important since it is used to specify which node you are going to communicate with. If you don't specify it, the current default rpcport is 13000

Since they are still subject to changes, please check out the documentations for further reference to the RPC methods. You can also check out the examples here.

Using Docker

make docker-build

Setting up tracer

See tracer in the document.

Contributing

Issues, PRs, or any kind of help are definitely welcomed.

sharding-p2p-poc's People

Contributors

mhchia avatar nic619 avatar chihchengliang avatar hwwhww avatar jrhea avatar raulk avatar

Watchers

James Cloos avatar chattg1 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.