The source code started as a copy of the basic example from mycoralhealth's blockchain-tutorial and the explanations on the corresponding blog.
The code was then hacked and adapted for specific learning and practical needs.
A blockchain is a peer-to-peer network involving many servers discussing with each other. You can emulate this behaviour on your localhost using docker containers.
For every peer we have a mongoDb instance acting as a database to store the blockchain.
To emulate this we create two docker containers for every node:
- a container running a mongoDb daemon
- a container running the golang code inside this project
So we have two docker images:
- an image we build using the Dockerfile inside this project
- the latest version of mongoDb:
mongo:latest
.
See scripts.md below to get example scripts allowing you run as many containers as you want from these images.
There is a docker-compose file that you can run with:
docker-compose up
This project uses dep to manage golang packages. You need to download them before you run the project for the first time.
You can do it on your host from your $GOPATH/src/github.com/mpsido/golang-blockchain
repertory or inside a docker container
Whichever way you choose the command is:
dep ensure