This is a simplified in-memory blockchain implementation written in Go based on the first project from Udacity Blockchain Developer Nanodegree Program course. Udacity kindly provided instructions and boilerplate code - this implementation is based on those great learning resources.
Disclaimer: this is NOT perfect, idiomatic Go, I treat this project as an excuse to learn Go lang and experiment.
go build
- builds all packages, produces single executable in root dir: starchain
go test ./...
- test all packages
go test -v ./...
- test all packages and print verbose output
go test -v ./... -run GetBlocks
- test all packages and print verbose output, filter tests to be executed with run flag
Helpful screenshots can be found in screenshots/ directory, where you can find examples of how to query the API. The same example queries can be found in test.sh file. Remember to edit them appropriately - some of them will fail if not changed due to validations. If you change wallet address, change it in all places - otherwise, validations will fail. The timestamp has to be fresh as well (not older than 5 mins).
Sketch of an example scenario:
-
check if api works by calling
/hello
endpoint -
get genesis block:
/block/0
-
request message by calling
/requestValidation
endpoint -
submit new star to blockchain by calling
/submitStar
endpoint -
get blocks for a given address by calling
/blocks/:addr
endpoint
Again, you can find examples of queries above in test.sh file. You might find it helpful to edit them and execute interactively in shell, one by one.