Git Product home page Git Product logo

powblockchain's Introduction

Blockchain Construction

Implemented a class framework to create a simple but functional blockchain that combines the ideas of proof-of-work, transactions, blocks, and blockchains.

This blockchain has the following consensus rules (it is a little different from Bitcoin to make testing easier)

Blockchain

  1. There are no consensus rules pertaining to the minimum proof-of-work of any blocks. That is it has no "difficulty adjustment algorithm". Instead, the code is expected to properly place blocks of different difficulty into the correct place in the blockchain and discover the most-work tip.

  2. A block with no transactions (no coinbase) is valid.

  3. If a block as > 0 transactions, the first transaction MUST be the coinbase transaction.

Merkle Tree of Transactions

  1. Use of sha256 hash.
  2. Used 0 if additional items are needed to pad odd merkle levels (more specific information is included below)

Transactions

  1. A transaction with inputs==None is a valid mint (coinbase) transaction. For these transactions, the coins created does not exceed the per-block "minting" maximum.

  2. If the transaction is not a coinbase transaction, coins cannot be created. In other words, coins spent (inputs) must be >= coins sent (outputs).

  3. Constraint scripts (permission to spend) are implemented via python lambda expressions (anonymous functions). These constraint scripts accept a list of parameters, and return True if permission to spend is granted. If execution of the constraint script throws an exception or returns anything except True, spending is not allowed!

More Information

Verified transactions, their constraint and satisfier scripts, and tracked the UTXO set.

Hashlib

Used hashlib.sha256() to do sha256 hashing in python.

Byte to integer conversion

Converted the sha256 array of bytes to a big endian integer via: int.from_bytes(bunchOfBytes,"big")

powblockchain's People

Contributors

yashk1900 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.