nai

github.com/m0t0k1ch1/naivechain

go get github.com/m0t0k1ch1/naivechain

Readme

naivechain

wercker status

a simple Blockchain inspired by https://github.com/lhartikk/naivechain written in Go

Install

$ go get -u github.com/m0t0k1ch1/naivechain

Run

$ naivechain [-api HTTP_SERVER_ADDRESS_FOR_API] [-p2p WEBSOCKET_SERVER_ADDRESS_FOR_P2P] [-origin P2P_ORIGIN]
Example
$ naivechain -api :3001 -p2p :6001

HTTP API

Get chain
$ curl http://127.0.0.1:3001/blocks
Mine block
$ curl http://127.0.0.1:3001/mineBlock -d '{"data":"some data to include in the block"}'
Add peer
$ curl http://127.0.0.1:3001/addPeer -d '{"peer":"ws://127.0.0.1:6002"}'
Get connected peers
$ curl http://127.0.0.1:3001/peers

Jump To