Giter VIP home page Giter VIP logo

legochain's Introduction

legochain

What is this?

This simple program implements a working blockchain class (based on block mining with a difficulty level) plus a very simple "peer to peer" protocol that enables two or more servers to talk to each other and send/receive their blockchains, based on TCP sockets.

This is a simple project with the following goals, either:

Goal A

To show newcomers to Common Lisp, an example of how to implement something not so simple but not too complex, like a blockchain, that would involve the use of:

The code is written with as many comments as possible, and is as clear as I can manage to. The aim was not performance, nor production-quality, but educational value.

You can start by taking a look at legochain.lisp and then to peertopeer.lisp

Goal B

  • To show seasoned CL developers who still haven't yet found out what is a blockchain, block mining, and the "nonce" values, a simple answer by looking at the code.

Supported features

  • Add any kind of data to the block's payload. You only need to define the encoding for the payload using conspack:defencoding (see the code)
  • Verification of one blockchain against other, rejecting invalid blockchains
  • Verification of the continuity (soundness) of each blocks' hash value and sequence value

Peer to peer supported operations:

  • Send blockchain to peer
  • Request blockchain from peer
  • Say "hi" to peer.

You can start many peers from your same machine so you can experiment adding more features to the code.

How to install (for newcomers to CL)

  • Install Portacle, the portable Common Lisp environent.
  • Clone this project into the projects subdirectory under the portacle root directory, so you have it into /portacle/projects/legochain.
  • Start portacle
  • Write (ql:quickload "legochain") to load the program.
  • All the functions are in package "legochain".
  • Try (legochain::servers-test 9000 9001) to make two blockchain servers talk to each other (a simple demo.)

Author

Flavio Egoavil aka D e f u n k y d r u m m e r

License MIT

Hacking

I'm always open to pull requests that can make the code more readable or more educational!

legochain's People

Contributors

defunkydrummer avatar

Watchers

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