Code Monkey home page Code Monkey logo

visualizing-proof-of-work's Introduction

OVERVIEW

Proof-of-work is a consensus algorithm underpinning blockchain platforms such as Bitcoin and Ethereum.

For a through explanation of how it works and a wider dive into the nuts and bolts of a blockchain, please check out this link.

In the meantime, this is a simple interface to visualize how it works. Follow the steps below to simulate how it works:

  • Enter transactions - i.e. John sends 1 to Mary - and submit. Any transactions entered will be mined in the next block.
  • Click on "Mine".

At this point, the algorithm takes an object representing the block to be mined - consisting of:

  • A block ID that increments from the previous block
  • The cryptographic hash of the previous block.
  • The transactions that are pending.

It will then start the process of finding a proof (often referred to as a nonce) to add to this object, such that the hash of this object starts with four zeros. Once this proof is found, the new block is added to the chain. The validity of the proof (once it is available) is easily verifiable.

Having a reference to the previous block ensures that each block is "chained" to the previous one. Imposing a requirement for the cryptographic hash means that it would require considerable computing power to alter a transaction, as one would then need to find a valid hash for all subsequent blocks in order to keep the integrity of the chain.

SETUP

Install dependencies

cd client
yarn install

Run a build:

yarn build

Start the server:

cd ..
flask run

The interface should now be visible on localhost:5000.

ARCHITECTURE

On the server side, the proof-of-work algorithm is written in Python and the server is set up using Flask.

Architecture Architecture

The front end is developed with Vue and Vuetify.

Architecture Architecture

This project was undertaken in my time as a student at Code Chrysalis.

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.