Skip to content

esrefozturk/poa

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Proof of Authority Blockchain

In this project, I implemented a toy cryptocurrency blockchain from scratch. Here are some details:

  • IP addresses of miner nodes are defined in miners.txt file.
  • Public keys(Addresses) of miners are defined in genesis block payload.
  • Blocks and transactions are signed with RSA public key digital signature scheme.
  • Account based transaction format is used.
  • REST API is used to interact with the nodes.

Prerequisites

  • Python
    • RSA
    • Django
    • Django Rest Framework

How to Start a Miner None

  • Put */10 * * * * cd <project path> && /usr/bin/python manage.py mine
  • python manage.py init
  • python manage.py runserver 0.0.0.0:8000

API Endpoints

Get Block Count

  • Method : GET

  • Path : /block_count/

  • Response :

{
    "block_count": <block_count>
}

Get Single Block Data

  • Method : GET

  • Path : /blocks/<block_hash>/

  • Response :

{
  "index": 1,
  "timestamp": <timestamp>,
  "sign": <sign>,
  "hash": <hash>,
  "previous_hash": <previous_hash>,
  "transactions": [<transaction_data>, <transaction_data>, ...],
  "payload": <payload>,
  "miner": <miner>
}

Get Single Transaction Data

  • Method : GET

  • Path : /transactions/<transaction_hash>/

  • Response :

{
  "sender": <sender>,
  "receiver": <receiver>,
  "amount": <amount>,
  "hash": <hash>,
  "timestamp": <timestamp>,
  "sign": <sign>
}

Create New Transaction

  • Method : POST

  • Path : /new_transaction/

  • Request :

{
  "sender": <sender>,
  "receiver": <receiver>,
  "amount": <amount>,
  "hash": <hash>,
  "timestamp": <timestamp>,
  "sign": <sign>
}

How to Initialize Wallet

  • Create new public address and key pairs : python wallet.py create_new_wallet

How to Use Wallet

  • Send coin : python wallet.py <public_key_of_receiver> <amount>

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages