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
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>
{{domain}}:{{http_port}}/addNode/{{node_port}}
This API is to add a node into the blockchain network.
Cases
- Status 200: init connection
- Status 200: ECONNREFUSED
P.S. Currently, the system will show any messages in the debug console instead of HTTP response.
{{domain}}:{{http_port}}/spawnLazy/{{message}}
This API is to create a block inside the blockchain with the message specified.
Cases
- Status 200
You can get the postman collection and environment files from docs.