Code Monkey home page Code Monkey logo

blockchain's Introduction

Simple Blockchain

A basic implementation of a blockchain data structure for personal education, designed to illustrate the fundamentals of related concepts including decentralization, cryptographic hashing, transaction linking, digital signatures, and block mining.

University of Michigan Demonstration

Implementation Overview (Simplified)

Alpha, Bravo, Charlie, and Delta all buy in with 100 units worth of cryptocurrency, and transact six times between themselves.

New transactions are executed by gathering a user's unspent transaction outputs, which all point back to the respective transactions they originated from. After the user digitally signs the transaction, and the recipient verifies the signature, the new transaction is added to a pool of un-mined transactions.

Miners compete in a proof-of-work competition to package transactions into blocks and collect the associated reward. The winning miner broadcasts the newly-created block across the network; each user maintains a local copy of all blocks, which link together and form a blockchain.

Key Takeaway

Users in a network can securely transact (or share information) between each other without having to trust a central authority for verification, control, and distribution. All users maintain a copy of all past transactions (or shared information) through the blockchain, but can only transact (or access information) if they (and the counterparty) can verify their identity.

Departures from Reality (Or, Room for Improvement)

Normally, a merkle root is included in the block, for purposes of saving memory space and verifying the validity of block transactions (Satoshi's White Paper)

A merkle tree would be created recursively using the hashes of all the transactions in the block. Not included in this implementation given the small size of the transaction set

Only one miner, so there's no real need for a proof-of-work competition here

Sample Output

Genesis Block Creation Transaction Pool Block Mining Final Blockchain

Resources:

Satoshi Nakamoto's OG White Paper:

https://bitcoin.org/bitcoin.pdf

Blockchain Fundamentals:

https://www.youtube.com/watch?v=bBC-nXj3Ng4

Asymmetric Encryption & Digital Signatures:

https://www.youtube.com/watch?v=Us_Og3JeXiI

Transaction Structure:

http://chimera.labs.oreilly.com/books/1234000001802/ch05.html

Blockchain Structure:

http://chimera.labs.oreilly.com/books/1234000001802/ch07.html

Mining & Decentralized Consensus:

http://chimera.labs.oreilly.com/books/1234000001802/ch08.html

Coding Tips:

https://bigishdata.com/2017/10/17/write-your-own-blockchain-part-1-creating-storing-syncing-displaying-mining-and-proving-work/

blockchain's People

Contributors

namangupta9 avatar naman-g avatar

Watchers

James Cloos 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.