Skip to content

Mini Cryptocurrency - An Implementation of P2P Network, Public Cryptography, Blockchain, and Consensus Algorithms

Notifications You must be signed in to change notification settings

HiroIshikawa/mini-cryptocurrency

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mini Cryptocurrency

This project aims at building a mini cryptocurrency from the bottom up to understand underlying design and implementation of cryptocurrency. It implements some of the components we commonly see in major cryptocurrencies such as p2p network running gossip protocol for message propagations, public key cryptography for authentication, blockchain for achieving logical ordering and validations. and consensus algorithms for the network to reach an agreement on its global state.

Features

  • P2P network
    • Nodes
      • Miner
      • Full
      • SPV
    • Gossip protocol
      • Msg
        • Transaction
        • Blockchain
  • Cryptography
    • Public Cryptography
      • Private key
      • Public key
  • Consensus Algorithm
    • Proof-of-work
    • Blockchain
      • Merkle Tree
      • Validation

Getting Started ( Tested on Python 3.6.3 )

Prerequisites

Required modules are recorded in the requirements.txt file. As a shortcut, you can install requirements by running pip install -r requirements.txt.

Running the tests (currently backend only)

  1. Go to the backend folder
  2. Initiate the network with a miner node, which generates the genesis block and start its routine (make a transaction and do mining)
    • i.e. python app.py 4555 '' red miner
  3. Open your browser, go to the address running the flask app, and check the status of node
  4. Connect another node to the initial miner node
    • i.e. python app.py 4556 4555 blue full
  5. Now you can see two nodes start sending transaction to each other. Each node status is displayed on the localhost address with corresponding port number as displayed on your terminal.
  6. Try add in another SPV node
    • i.e. python app.py 4557 4556 green spv
  7. Now three nodes running playing different roles in the network.

Bulit With

  • jsonpickle: Python object serialization/deserialization
  • ecdsa: Implementation of ECDSA (Elliptic Curve Digital Signature Algorithm)
  • requests: HTTP library for Python
  • Flask: Microframework for Python

About

Mini Cryptocurrency - An Implementation of P2P Network, Public Cryptography, Blockchain, and Consensus Algorithms

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published