mplementation of a simple block chain for learning.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
app
.gitignore
README.md
main.go

README.md

naivechain

a simple Blockchain inspired by https://github.com/kofj/naivechain

Implementation of a simple block chain for learning.

Run First Node

go run main.go 

Run Second Node

go run main.go -api :3002 -p2p :6002 -peers ws://localhost:6001

Show blocks

$ curl http://localhost:3001/blocks

Mine block

$ curl -H "Content-type:application/json" --data '{"data" : "Some data to the first block"}' http://localhost:3001/mine_block

Add peer

$ curl -H "Content-type:application/json" --data '{"peer" : "ws://localhost:6002"}' http://localhost:3001/add_peer

Query peers

$ curl http://localhost:3001/peers