Skip to content

A lightweight NodeJS blockchain implementation.

Notifications You must be signed in to change notification settings

manuasir/LazyChain

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Code-Style

LazyChain

NodeJS Blockchain implementation - Protecting the tea making ledger from unscrupulous colleagues

This is a rough working example, contains a LazyNode, a LazyChain and an HTTP server

How to get start

Docker

To install Docker, visit Docker Official Sites.

To build the container

docker build -t lazychain:latest .

To run the container

docker run -t -p <LOCAL_PORT>:3000 -p <LOCAL_PORT>:17080 lazychain:latest

# e.g.
docker run -t -p 3001:3000 -p 17080:17080 lazychain:latest
# you can access the http server via 127.0.0.1:3001 and blockchain node via 127.0.0.1:17080

To list running container

docker ps

To stop a container

docker stop <CONTAINER_ID>

APIs

HTTP Server

Add Node

{{domain}}:{{http_port}}/addNode/{{node_port}}

This API is to add a node into the blockchain network.

Cases

  1. Status 200: init connection
  2. Status 200: ECONNREFUSED

P.S. Currently, the system will show any messages in the debug console instead of HTTP response.

Create Block

{{domain}}:{{http_port}}/spawnLazy/{{message}}

This API is to create a block inside the blockchain with the message specified.

Cases

  1. Status 200

Postman

You can get the postman collection and environment files from docs.