GithubHelp home page GithubHelp logo

itskarad / blockchain Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 0.0 68 KB

Bite-size implementation of a blockchain storing transactions.

Python 99.37% Dockerfile 0.63%
blockchain proof-of-work python python3 pycryptodome pycrypto digital-signatures

blockchain's Introduction

Simple Blockchain

This is a simple blockchain storing transactions between different wallets.

Wallets are created with new public-private key pairs using PyCryptodome module.

Transactions contain digital signatures, so that tampered transactions can be detected. Transactions are signed using the private key and verified using the public key of a wallet.

New blocks are mined or added to the blockchain when a connected node solves a hard computational problem in a brute-force manner. I have used proof of work as a consensus algorithm. When a node solves this PoW problem, it receives an incentive reward of 200 units.

This computational problem is difficult to solve, but very easy to verify. Hence, it's really to verify authenticity of the chain at each time.

Basic Features

  1. Add transaction: Adds the transaction to open_transactions.
  2. Mining pending blocks: Mines transactions in open_transactions and solves PoW problem.
  3. Printing existing blocks in the blockchain.
  4. Getting balance of a particular wallet: Gets balance of a wallet from all legitimate transactions.
  5. Creating a new wallet with a new public-private key pair
  6. Loading existing public-private key pair from wallet.txt
  7. Saving public-private key pair to wallet.txt

How to use?

  1. Download/clone this repo.
  2. Run docker build .
  3. Note the image ID from the terminal after running the last command.
  4. Run docker run -ti <Image ID>

blockchain's People

Contributors

itskarad avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.