The post on Building a Blockchain has inspired me to work on building a more realistic and secure blockchain on Python based on @dvf/blockchain Github (this repo is also forked from @dvf/blockchain).
Future goals will be to implement anonymous transactions - refer to Zcash shielded transactions.
- Add Miner Node to periodically mine for blocks
- Implement broadcasting mechanism to peer nodes when new transactions added
- Add Wallet API for users to add new transaction to node (currently use Postman to add transaction)
- Add Wallet API to calculate total amount associated per address (track address that belong to user)
- Fix MAX_TRANSACTIONS per block
- Implement Secure Transactions
- Implement a persistent database to store blockchain for node
- Decreasing reward function for miners
The repo work primarily on the Python folder (C# and Js files are forked from @dsf/blockchain)
- Make sure Python 3.6+ is installed.
- Install pipenv.
$ pip install pipenv
- Install requirements
$ pipenv install
- Run the server:
$ pipenv run python python/src/node.py
$ pipenv run python python/src/node.py -p 5001
$ pipenv run python python/src/node.py --port 5002
Another option for running this blockchain program is to use Docker. Follow the instructions below to create a local Docker container:
- Clone this repository
- Build the docker container
$ docker build -t blockchain .
- Run the container
$ docker run --rm -p 80:5000 blockchain
- To add more instances, vary the public port number before the colon:
$ docker run --rm -p 81:5000 blockchain
$ docker run --rm -p 82:5000 blockchain
$ docker run --rm -p 83:5000 blockchain
- Make sure nose is installed.
$ pip install nose
- Run tests
$ cd python
$ nosetests
You should see something like the following:
..................................
----------------------------------------------------------------------
Ran 8 tests in 0.440s
OK
Contributions are welcome! Please feel free to submit a Pull Request/Issue.