Tiny Blockchain
This is a port of snakecoin to use Docker and Python 3. All credit to @aunyks and https://github.com/zacanger who wrote the originals.
The idea is a toy Python blockchain to be used as a playground for experimentation.
This version adds the following to the original:
- Python 3
- Falcon Web Framework
- docker-compose to more easily run multiple nodes
Usage
Start everything:
docker-compose up
Add some transactions:
curl "localhost:5001/transaction" \
-H "Content-Type: application/json" \
-d '{"from": "alice", "to":"bob", "amount": 3}'; \
curl "localhost:5002/transaction" \
-H "Content-Type: application/json" \
-d '{"from": "alice", "to":"pete", "amount": 5}'; \
curl "localhost:5003/transaction" \
-H "Content-Type: application/json" \
-d '{"from": "jeff", "to":"joe", "amount": 5}'; \
curl "localhost:5001/mine"; \
curl "localhost:5002/mine"; \
curl "localhost:5003/mine"
node1
has the longest chain.
Check the output, it should be the same on each node:
curl localhost:5001/blocks | jq
curl localhost:5002/blocks | jq
curl localhost:5003/blocks | jq