Skip to content

lauramayol/my_blockchain

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

Create your Custom Blockchain in Django

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

Features

This release

  • 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.

Next release

  • Test Consensus algorithm by creating a conflicting blockchain on another node.

Endpoints

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

Running project locally

  1. Clone repo to your development environment
git clone https://github.com/lauramayol/my_blockchain.git
  1. Install virtualenv
pip install virtualenv
  1. Change directory to project folder
cd blockchain_project
  1. Start virtualenv
virtualenv --python=/usr/local/bin/python3 env
  1. Run virtualenv
source env/bin/activate
  1. Install dependencies using pip
pip3 install -r requirements.txt
  1. Run development server
python blockchain_project/manage.py runserver
  1. Check http://127.0.0.1:8000/chain on your browser.

Contribute

Support

If you are having issues, please let me know by posting on Issue Tracker.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published