Giter Site home page Giter Site logo

learn-blockchain's Introduction

What is this?

This is a simple blockchain application to demonstrate how blockchain works. The code has been borrowed from Ecomunsing but there has been some changes to make it simpler to understand. Also some code has been added to it to make it possible to run it in interactive mode from terminal.

What does this do?

This is a blockchain application that will keep the data of transactions (like bitcoin). Although it is only for learning. All the transactions are between two people: Alice and Bob whom play the role of sender and receiver in each transaction. The amount of transactions are generated randomly.

What is this good for?

By running the script you will get an understandig of what a blockchain is, and by diving into to code you can see the parts that come together to make a blockchain.

How to Start?

To understand How blockchain works:

Copy the blockchain.py file to your local machine, open terminal and run the following command:

  • python blockchain.py

Keep in mind that:

  • you should include the path to your file if terminal is not open in the same location.
  • make sure to use the python 3 interpreter. if python 3 is not your default interpreter, use the following command: python3 blockchain.py

when the program is already running, you are given some choices: a: show chain b: make new transactions c: show the new transactions d: add the new transactions to the blockchain

what do these do:

  • a: shows the current chain: the resualt will be some blocks linked to each other by hashes. if you run this command the moment you run the blockchain.py file, you will see a chain with only one block: the genesis block. it will be explained later.

  • b: make new transactions: it will generate some random transactions. all the transactions are between two users: alice and bob, that each time one of them (randomly) would be the sender and the other one the receiver.

  • c: show the new transations: it will show the random transactions created in previous step. these are not yet added to the block chain.

  • d: add the new transactions to the blockchain: this will add the previous transactions to the blockchain. make sure to run part b before you want to add to the blockchain.

The code, Explained

The doc will be completed soon. But at the moment you can read the tutorial on Ecomunsing .

learn-blockchain's People

Contributors

reza-keshavarz avatar

Stargazers

 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.