naivechain

command module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 22, 2022 License: MIT Imports: 18 Imported by: 0

README

naivechain

Test

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

Install

$ go install github.com/m0t0k1ch1/naivechain@latest

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

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL