This is the simplest blockchain example possible. it implements only a chain of blocks with data. And does not include any of high order concepts like mining of chain verification.
1) First, download the repository
git clone https://github.com/Rufaim/Simple-golang-blockchain-example.git
OR
go get github.com/Rufaim/Simple-golang-blockchain-example
2) Second, run a server
go run . config.json
Message Server is on http://localhost:8080
should appear is console for default config.
3) Then open visualization interface at http://localhost:8080
.
Direct API requests are also supported.
To add block use
curl -X POST http://localhost:8080/bc -d '{"data":"some_data"}'
To get all blocks use
curl -X GET http://localhost:8080/bc
Please note that a block added via API request is visible on visualization interface after page update.