Skip to content

minimal blockchain implemented in python. communicates over a REST API

License

Notifications You must be signed in to change notification settings

samarthkulshrestha/blockrypt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

blockrypt

samarth kulshrestha

release version code quality top language
license pre-release date repo size


blockrypt logo

Introduction

"The fastest way to learn how blockchains work is to build one", says Hackernoon. Blockrypt is a blockchain that I built to understand how blockchains function.

A blockchain is an immutable, sequential chain of records called Blocks. They can contain transactions, files or any data you like, really. But the important thing is that they’re chained together using hashes.

Requirements

  • Make sure that Python v3.6+ (along with pip) is installed.

  • Install the required pip packages by running:

pip install Flask==2.3.2 requests==2.29.0
  • An HTTP Client (for examplePostman or cURL) is also needed.

Running

  • Clone the repository.
git clone https://github.com/samarthkulshrestha/blockrypt.git
  • Enter the blockrypt directory.
cd blockrypt/
  • Run Blockrypt.
python src/blockrypt.py

You will be asked for a port number. Here, enter the port you want to run Blockrypt on. The port must be idle.

API

  • /chain: Returns the entire blockchain.

    • method: GET
  • /mine: Runs the proof of work algorithm and mines a new block on the chain.

    • method: GET
  • /transactions/new: Adds a transaction to a block.

    • method: POST
    • data:
    {
        "sender": "<sender's address>",
        "recipient": "<recipient's address>",
        "amount": 7
    }
  • /nodes/register: Registers new nodes on the blockchain.

    • method: POST
    • data:
    {
        "nodes": ["http://127.0.0.1:6969"]
    }
  • /nodes/resolve: Runs the consensus algorithm to determine the authoritative chain.

    • method: GET

Contribute

pull requests welcome python style guide

License

Blockrypt is licensed under the MIT License.

Copyright (c) 2023 Samarth Kulshrestha.

About

minimal blockchain implemented in python. communicates over a REST API

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages