Giter Site home page Giter Site logo

legion's Introduction

Legion - a simple blockchain implementation

An as-simple-as-possible blockchain server inspired by naivechain, but written in Haskell. Spinning up several Legion nodes creates a peer to peer network that syncronizes the block chain across the network.

Prereqs: To compile from source, you'll need stack.

Alternatively, you can get a precompiled pre-release binary. Note: if you download the binary from github, you'll need to mark it executable by running:

$ chmod +x legion-exe

Usage:

$ stack exec legion-exe [http port] [p2p port] [optional: `seedhost:seedP2PPort`]

Examples:

$ stack exec legion-exe 8001 9001

By default, legion will log what it's doing to standard out. In another terminal window:

$ stack exec legion-exe 8002 9002 localhost:9001

Alternatively, you grab the binaries from the github releases, and run that directly rather than via stack exec

The 3rd argument tells the node where a seed node can be found to bootstrap the connection to the peer to peer network. The current state of the (valid) blockchain will be fetched from all servers, and it will automatically keep itself updated and post its own updated to others.

Now that 2 nodes are now synced, and you can view the current chain from either node at http://localhost:$httpPort/chain, eg http://localhost:8001/chain

Add a new block to the blockchain via a POST request to /block:

$ curl -H "Content-Type: application/json" -X POST -d '{"blockBody": "this is the data for the next block"}' http://localhost:8001/block

legion's People

Contributors

aviaviavi avatar nathanhleung avatar octaltree avatar

Watchers

 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.