Sharing technical posts, make money online, ...

Sunday, November 5, 2017

How the Bitcoin Protocol Works?

Bitcoin runs on a technology called blockchain; blockchain was actually created to facilitate the cryptocurrency. Before getting into details about how the Bitcoin protocol works, this chapter will explain some about blockchain.

A ledger is a record of transactions that have occurred within an account. For example, your bank and credit card statements are both ledgers. Accountants use ledgers to keep track of a company’s finances. The blockchain is, at its core, a digital ledger. This means that it is basically a collection of transactions that are linked together in a continuous chain. Groups of transactions are collected into sections known as “blocks.” Those blocks are connected into a chain, hence the term “blockchain.”

Blockchain Transactions

Traditionally, computer programs are run through the server model. This means that whenever you get onto a website, you are actually connecting to that website’s main server, which stores all of its information. If there is a problem with the server, the website will not work. When a website is down for maintenance, the reason is usually because work needs to be done on that server. If anyone hacks into that server, all of the information on that website could be compromised. This is a huge problem when that website contains sensitive information; imagine someone hacking into your bank’s main server and stealing all of the information associated with your account.

Blockchain runs differently. Instead of the program being connected to one central server, it runs on a series of nodes. Nodes are individual computers, usually operated by private individuals that are a part of the network and contain all of the information on the blockchain. This means that instead of hacking into one computer, a hacker would have to be able to access every single node simultaneously. The only other way for a security breach to occur is for every single node operator to be in collusion. Considering that many blockchains, including Bitcoin, run on thousands of nodes, the odds of that scenario happening are extremely low. Therefore, blockchain is virtually impenetrable to hackers.

Because so many nodes are involved in executing the program, blockchain runs as open-source software. This means that the codes are publicly available and anyone has access to them. Furthermore, all of the transactions that occur on the digital ledger are made public for everyone to see; however, the identities of those involved in the transactions are anonymous. The open-source, public nature of blockchain means that no one can manipulate any of the information. While companies such as Enron failed because of secretive and illegal accounting practices that were not discovered until it was too late, blockchain makes that possibility impossible.

That explains some of the basic concepts behind blockchain. It is a decentralized, open-source software that is inaccessible to hackers or manipulators. This next section will explain some more technical details on how it actually works.

As previously mentioned, groups of transactions are collected together into blocks. Each block is time-stamped, similarly to the method proposed by Haber and Stornetta in 1991, to show that the information in that block was present at the time of its verification. The timestamp is used to generate something called a hash value, which is publicly broadcasted. A hash is basically a summary of large amounts of information in the blockchain, the hash is an alphanumeric value that converts the input message (the information in the block) into a cryptographic puzzle. This is also known as the digital fingerprint because, like fingerprints, no two hash values are the same. Miners, people who solve the cryptographic puzzles in exchange for rewards, compete against each other to solve the puzzle created by the hash. The solution becomes a part of the hash in the next block, thereby linking all the blocks into one continuous algorithm.

When a user wishes to make a transaction on a blockchain, say, Jack wants to send Jill two Bitcoins, he must do so using Jill’s public key and his own private key. This creates an input value and generates a digital signature. Once the digital signature is used to authorize the transaction, the data becomes embedded in a block. The input value is converted into an output value. This output is used to derive the user's public key from the private key; the public key then uses an algorithm to transform itself via a hash function into a unique value, thereby creating the sending user's public address that is visible on the blockchain's nodes.

The block is then sent to the nodes for verification via solving the cryptographic function created by the hash.  This process of verification ensures that the transactions in that block did take place. Once verified, the block becomes a part of the blockchain. Consequent, blocks that are verified are linked to it, making going back to change the information in the block that contains Jack and Jill’s transaction impossible. Jill then receives an email saying that Jack has sent her two Bitcoins, and the ownership of those two Bitcoins is conferred to her. The entire transaction process can take up to an hour or more, but the tradeoff is the high level of security inherent in the blockchain protocols.

Bitcoin Transactions

Here is a diagram of how the Bitcoin protocol works, laid out in Satoshi Nakamoto’s white paper.



As the diagram shows, when someone wants to initiate a Bitcoin transaction, that person's public key is applied to the solution from the previous block to generate a new hash that must be solved for that transaction to be verified. The digital signature, aka private key from the previous transaction — generated from the hash of the previous block — is applied as part of the verification process. When the next person wants to make a transaction, that person's public key is combined with the solution from the previous block to create a new hash. The previous person's private key is applied to create the new digital process, which again is used for the next transaction. Because all of the transactions are connected, none of the information can be changed without retroactively changing every other transaction that precedes it in the blockchain.

Bitcoin Mining Transactions

Mining is the process whereby virtual currency, such as Bitcoins, are generated and added to the existing pool. Nodes on the blockchain network are used to create the cryptographic hash puzzle that must be solved for a transaction to be verified; miners compete with each other to solve the puzzle. Whoever solves it first gets a reward, usually a predetermined amount of the virtual currency. Once solved, the hash is re-converted into the input message, which is publicly visible as part of the blockchain. This process allows the blocks to be verified. For more information on Bitcoin mining.

Mastering Bitcoin for Beginners - Neil Hoffman

No comments:

Post a Comment