Release 1.0
The goal of this project is to set up a simple blockchain stored in sqlitedb. Inspired by https://github.com/dvf/blockchain
- Mine transactions that haven't been assigned to a block yet and be rewarded with a coin. Simple Proof of Work Algorithm used: - Find a number p' such that hash(pp') contains leading 4 zeroes, where p is the previous p' - p is the previous proof, and p' is the new proof
- Create new transactions to be mined.
- Query full chain and transaction list.
- Register and resolve conflicts with other nodes in the network that hold a copy of same blockchain.
- Test Consensus algorithm by creating a conflicting blockchain on another node.
Method | Description | Endpoint | Query Sample |
---|---|---|---|
GET |
Chain | /chain |
n/a |
POST |
Mine | /mine |
n/a |
POST |
Register transaction | /transactions/new |
?sender=1&recipient=some-other-address&amount=1 |
POST |
Register Node | /nodes/register |
?node=http://192.168.0.5:5000 |
PATCH |
Resolve Conflict between Nodes | /nodes/resolve |
n/a |
POST |
Creates genesis block (new chain only) | /blocks/genesis |
n/a |
- Clone repo to your development environment
git clone https://github.com/lauramayol/my_blockchain.git
- Install virtualenv
pip install virtualenv
- Change directory to project folder
cd blockchain_project
- Start virtualenv
virtualenv --python=/usr/local/bin/python3 env
- Run virtualenv
source env/bin/activate
- Install dependencies using pip
pip3 install -r requirements.txt
- Run development server
python blockchain_project/manage.py runserver
- Check http://127.0.0.1:8000/chain on your browser.
- Issue Tracker: https://github.com/lauramayol/my_blockchain/issues
- Source Code: https://github.com/lauramayol/my_blockchain
If you are having issues, please let me know by posting on Issue Tracker.