Python Blockchain

A blockchain is a time-stamped decentralized series of fixed records that contains data of any size is controlled by a large network of computers that are scattered around the globe and not owned by a single organization. Every block is secured and connected with each other using hashing technology which protects it from being tempered by an unauthorized person. 

Satoshi Nakamoto created the first virtual currency in the world called Bitcoin. Looking at the success of Bitcoin, many others created their own virtual currencies. To name a few − Litecoin, Zcash, and so on.

Now, you may also like to launch your own currency. Let us call this as TPCoin (TutorialsPoint Coin). You will write a blockchain to record all transactions that deal with TPCoin. The TPCoin can be used for buying Pizzas, Burgers, Salads, etc. There may be other service providers who would join your network and start accepting TPCoin as the currency for giving out their services. The possibilities are endless.

In this tutorial, let us understand how to construct such a system and launch your own digital currency in the market.

Components Involved in Blockchain Project Development

The entire blockchain project development consists of three major components.

  • Client
  • Miners
  • Blockchain

Client

The Client is the one who will buy goods from other vendors. The client himself may become a vendor and will accept money from others against the goods he supplies. We assume here that the client can both be a supplier and a recipient of TPCoins. Thus, we will create a client class in our code that has the ability to send and receive money.

Miner

The Miner is the one who picks up the transactions from a transaction pool and assembles them in a block. The miner has to provide a valid proof-of-work to get the mining reward. All the money that miner collects as a fee will be for him to keep. He may spend that money on buying goods or services from other registered vendors on the network, just the way a Client described above does.

Blockchain

Finally, a Blockchain is a data structure that chains all the mined blocks in a chronological order. This chain is immutable and thus temper-proof.

You may follow this tutorial by typing out the code presented in each step in a new Jupyter notebook. Alternatively, you may download the entire Jupyter notebook from www.anaconda.com.

Techappss