Skip to content

ArturSkowronski/naivechain

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

REPO BASED ON ORIGINAL NAIVECHAIN - Best Simple JS Blockchain implementation

[NAIVECHAIN README][https://github.com/lhartikk/naivechain/blob/master/README.md]

This version uses class heavily and add Proof of Work for the usage in presentation: Blockchain: Developer Perspective presented 29.09.2017 in Krakow on [KrakowJS Conference][conf.krakowjs.pl]

Original Quick start

(set up two connected nodes and mine 1 block)

npm install
HTTP_PORT=3001 P2P_PORT=6001 npm start
HTTP_PORT=3002 P2P_PORT=6002 PEERS=ws://localhost:6001 npm start
curl -H "Content-type:application/json" --data '{"data" : "Some data to the first block"}' http://localhost:3001/mineBlock

Quick start with Docker

(set up three connected nodes and mine a block)

docker-compose up
curl -H "Content-type:application/json" --data '{"data" : "Some data to the first block"}' http://localhost:3001/mineBlock

HTTP API

Get blockchain
curl http://localhost:3001/blocks
Create block
curl -H "Content-type:application/json" --data '{"data" : "Some data to the first block"}' http://localhost:3001/mineBlock
Add peer
curl -H "Content-type:application/json" --data '{"peer" : "ws://localhost:6001"}' http://localhost:3001/addPeer

Query connected peers

curl http://localhost:3001/peers

About

Code created for educational purposes for presentation "Blockchain: Developers Perspective"

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published