All Projects → satwikkansal → Python_blockchain_app

satwikkansal / Python_blockchain_app

A fully functional blockchain application implemented in Python from scratch (with tutorial).

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Python blockchain app

Loopchain
Blockchain engine for icon foundation.
Stars: ✭ 69 (-86.47%)
Mutual labels:  blockchain, consensus-algorithm
Blockchain Tutorial
🌾 A step-by-step blockchain tutorial in simplified Chinese
Stars: ✭ 2,081 (+308.04%)
Mutual labels:  blockchain, tutorial
Blockchaintechnology
Blockchain Frontier Technology Tracking
Stars: ✭ 88 (-82.75%)
Mutual labels:  blockchain, consensus-algorithm
Blockchaindemo
A simple demo for Blockchain in Swift
Stars: ✭ 44 (-91.37%)
Mutual labels:  blockchain, tutorial
Basic Blockchain Programming
Sample code from my blog series "Basic blockchain programming".
Stars: ✭ 282 (-44.71%)
Mutual labels:  blockchain, tutorial
Learn Solidity
Code base for "Learn Solidity: Programming Language for Ethereum Smart Contracts" course in Tosh Academy & Blockchain Council
Stars: ✭ 44 (-91.37%)
Mutual labels:  blockchain, tutorial
Ton
Telegram Open Network research group. Telegram: https://t.me/ton_research
Stars: ✭ 146 (-71.37%)
Mutual labels:  blockchain, tutorial
Your first decentralized application python
An up to date and bare minimum tutorial on deploying smart contracts with python
Stars: ✭ 132 (-74.12%)
Mutual labels:  blockchain, tutorial
Zerotoblockchain
Tutorial for Zero to Blockchain series
Stars: ✭ 272 (-46.67%)
Mutual labels:  blockchain, tutorial
Heroes Service
Short tutorial to build a blockchain application in Go with Hyperledger Fabric
Stars: ✭ 248 (-51.37%)
Mutual labels:  blockchain, tutorial
Voting Blockchain
A simple blockchain-based voting system application built from scratch by Python. It's available for running with multipeer.
Stars: ✭ 26 (-94.9%)
Mutual labels:  blockchain, tutorial
Eth Crypto
Cryptographic javascript-functions for ethereum and tutorials to use them with web3js and solidity
Stars: ✭ 420 (-17.65%)
Mutual labels:  blockchain, tutorial
Ethereum Development With Go Book
📖 A little book on Ethereum Development with Go (golang)
Stars: ✭ 754 (+47.84%)
Mutual labels:  blockchain, tutorial
Exonum
An extensible open-source framework for creating private/permissioned blockchain applications
Stars: ✭ 1,037 (+103.33%)
Mutual labels:  blockchain, consensus-algorithm
Unetwork
U Network Public Blockchain
Stars: ✭ 189 (-62.94%)
Mutual labels:  blockchain, consensus-algorithm
Cryptozombies Lesson Code
cryptozomebie lesson code
Stars: ✭ 301 (-40.98%)
Mutual labels:  blockchain, tutorial
Eattheblocks
Source code for Eat The Blocks, a screencast for Ethereum Dapp Developers
Stars: ✭ 431 (-15.49%)
Mutual labels:  blockchain, tutorial
Flutter For Android Developers
Compilation of Flutter materials for Android developers
Stars: ✭ 488 (-4.31%)
Mutual labels:  tutorial
Tutoshowcase
A simple and Elegant Showcase view for Android
Stars: ✭ 499 (-2.16%)
Mutual labels:  tutorial
Awesome Framer
A curated list of awesome things related to Framer prototyping tool
Stars: ✭ 487 (-4.51%)
Mutual labels:  tutorial

python_blockchain_app

A simple tutorial for developing a blockchain application from scratch in Python.

What is blockchain? How it is implemented? And how it works?

Please read the step-by-step implementation tutorial to get your answers :)

Instructions to run

Clone the project,

$ git clone https://github.com/satwikkansal/python_blockchain_app.git

Install the dependencies,

$ cd python_blockchain_app
$ pip install -r requirements.txt

Start a blockchain node server,

# Windows users can follow this: https://flask.palletsprojects.com/en/1.1.x/cli/#application-discovery
$ export FLASK_APP=node_server.py
$ flask run --port 8000

One instance of our blockchain node is now up and running at port 8000.

Run the application on a different terminal session,

$ python run_app.py

The application should be up and running at http://localhost:5000.

Here are a few screenshots

  1. Posting some content

image.png

  1. Requesting the node to mine

image.png

  1. Resyncing with the chain for updated data

image.png

To play around by spinning off multiple custom nodes, use the register_with/ endpoint to register a new node.

Here's a sample scenario that you might wanna try,

# Make sure you set the FLASK_APP environment variable to node_server.py before running these nodes
# already running
$ flask run --port 8000 &
# spinning up new nodes
$ flask run --port 8001 &
$ flask run --port 8002 &

You can use the following cURL requests to register the nodes at port 8001 and 8002 with the already running 8000.

curl -X POST \
  http://127.0.0.1:8001/register_with \
  -H 'Content-Type: application/json' \
  -d '{"node_address": "http://127.0.0.1:8000"}'
curl -X POST \
  http://127.0.0.1:8002/register_with \
  -H 'Content-Type: application/json' \
  -d '{"node_address": "http://127.0.0.1:8000"}'

This will make the node at port 8000 aware of the nodes at port 8001 and 8002, and make the newer nodes sync the chain with the node 8000, so that they are able to actively participate in the mining process post registration.

To update the node with which the frontend application syncs (default is localhost port 8000), change CONNECTED_NODE_ADDRESS field in the views.py file.

Once you do all this, you can run the application, create transactions (post messages via the web inteface), and once you mine the transactions, all the nodes in the network will update the chain. The chain of the nodes can also be inspected by inovking /chain endpoint using cURL.

$ curl -X GET http://localhost:8001/chain
$ curl -X GET http://localhost:8002/chain

PS: For consulting, you can reach out to me via Codementor (use this link for free 10$ credits).

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].