Blockchain and its applications
Blockchain is a way of storing digital data. The data can literally be anything. For Bitcoin, it’s the transactions (logs of transfers of Bitcoin from one account to another), but it can even file; it doesn’t matter. The data is stored in the form of blocks, which are linked (or chained) together using cryptographic hashes — hence the name “blockchain.”
All of the magic lies in the way this data is stored and added to the blockchain. A blockchain is essentially a linked list that contains ordered data, with a few constraints such as:
- Blocks can’t be modified once added; in other words, it is append-only.
- There are specific rules for appending data to it.
- Its architecture is distributed.
What exactly is Blockchain?
A blockchain carries no transaction cost.
(An infrastructure cost yes, but no transaction cost.) The blockchain is a simple yet ingenious way of passing information from A to B in a fully automated and safe manner. One party to a transaction initiates the process by creating a block. This block is verified by thousands, perhaps millions of computers distributed around the net. The verified block is added to a chain, which is stored across the net, creating not just a unique record, but a unique record with a unique history. Falsifying a single record would mean falsifying the entire chain in millions of instances. That is virtually impossible. Bitcoin uses this model for monetary transactions, but it can be deployed in many other ways.
Cryptographic Hash Function
In simple terms, hashing means taking an input string of any length and giving out an output of a fixed length. In the context of cryptocurrencies like bitcoin, the transactions are taken as input and run through a hashing algorithm (Bitcoin uses SHA-256) which gives an output of a fixed length.
Let’s see how the hashing process works. We are going to put in certain inputs. For this exercise, we are going to use the SHA-256 (Secure Hashing Algorithm 256).
As you can see, in the case of SHA-256, no matter how big or small your input is, the output will always have a fixed 256-bits length. This becomes critical when you are dealing with a huge amount of data and transactions. So basically, instead of remembering the input data which could be huge, you can just remember the hash and keep track.
A cryptographic hash function is a special class of hash functions that has various properties making it ideal for cryptography. There are certain properties that a cryptographic hash function needs to have in order to be considered secure. You can read about those in detail in our guide on hashing.
There is just one property that we want you to focus on today. It is called the “Avalanche Effect.”
What does that mean?
Even if you make a small change in your input, the changes that will be reflected in the hash will be huge. Let’s test it out using SHA-256:
About the application
Think of a railway company. We buy tickets on an app or the web. The credit card company takes a cut for processing the transaction. Blockchains, not only can the railway operator save on credit card processing fees, it can move the entire ticketing process to the blockchain. The two parties in the transaction are the railway company and the passenger. The ticket is a block, which will be added to a ticket blockchain. Just as a monetary transaction on the blockchain is a unique, independently verifiable, and unfalsifiable record (like Bitcoin), so can your ticket be. Incidentally, the final ticket blockchain is also a record of all transactions for, say, a certain train route, or even the entire train network, comprising every ticket ever sold, every journey ever taken.
But the key here is this: it’s free. Not only can the blockchain transfer and store money, but it can also replace all processes and business models that rely on charging a small fee for a transaction. Or any other transaction between two parties.
Let’s briefly define the scope of our mini-application. Our goal is to build an application that allows users to share information by posting. Since the content will be stored on the blockchain, it will be immutable and permanent. Users will interact with the application through a simple web interface.
Steps
- Store transactions into blocks
- Add digital fingerprints to the blocks
- Chain the blocks
- Implement a proof of work algorithm
- Add blocks to the chain
- Create interfaces
- Establish consensus and decentralization
- Build the application
- Run the application
We’ll implement things using a bottom-up approach. Let’s begin by defining the structure of the data that we’ll store in the blockchain. A post is a message that’s posted by any user on our application. Each post will consist of three essential elements:
- Content
- Author
- Timestamp
Comments
Post a Comment