Categories
1. Introduction

Beyond Bitcoin: Ethereum Blockchain

Originally created as the ultra-transparent ledger system for Bitcoin to operate on, blockchain has long been associated with cryptocurrency, but the technology’s transparency and security has seen growing adoption in a number of areas, much of which can be traced back to the development of the Ethereum blockchain. 

In late 2013, Russian-Canadian developer Vitalik Buterin published a white paper that proposed a platform combining traditional blockchain functionality with one key difference: the execution of computer code. Thus, the Ethereum Project was born. 

Ethereum blockchain lets developers create sophisticated programs that can communicate with one another on the blockchain.

Tokens

Ethereum programmers can create tokens to represent any kind of digital asset, track its ownership and execute its functionality according to a set of programming instructions.

Tokens can be music files, contracts, concert tickets or even a patient’s medical records. Most recently, Non-Fungible Tokens (NFTs) have become all the rage. NFTs are unique blockchain-based tokens that store digital media (like a video, music or art). Each NFT has the ability to verify authenticity, past history and sole ownership of the piece of digital media. NFTs have become wildly popular because they offer a new wave of digital creators the ability to buy and sell their creations, while getting proper credit and a fair share of profits.

Newfound uses for blockchain have broadened the potential of the ledger technology to permeate other sectors like media, government and identity security. Thousands of companies are currently researching and developing products and ecosystems that run entirely on the burgeoning technology.

Blockchain is challenging the current status quo of innovation by letting companies experiment with groundbreaking technology like peer-to-peer energy distribution or decentralized forms for news media. Much like the definition of blockchain, the uses for the ledger system will only evolve as technology evolves.

Categories
1. Introduction

Cryptocurrencies: The Beginning of Blockchain’s Technological Rise

Blockchain’s most well-known use (and maybe most controversial) is in cryptocurrencies. Cryptocurrencies are digital currencies (or tokens), like Bitcoin, Ethereum or Litecoin, that can be used to buy goods and services. Just like a digital form of cash, crypto can be used to buy everything from your lunch to your next home. Unlike cash, crypto uses blockchain to act as both a public ledger and an enhanced cryptographic security system, so online transactions are always recorded and secured.

To date, there are roughly 6,700 cryptocurrencies in the world that have a total market cap around $1.6 trillion, with Bitcoin holding a majority of the value. These tokens have become incredibly popular over the last few years, with one Bitcoin equaling $60,000. Here are some of the main reasons why everyone is suddenly taking notice of cryptocurrencies:

  • Blockchain’s security makes theft much harder since each cryptocurrency has its own irrefutable identifiable number that is attached to one owner.
  • Crypto reduces the need for individualized currencies and central banks- With blockchain, crypto can be sent to anywhere and anyone in the world without the need for currency exchanging or without interference from central banks.
  • Cryptocurrencies can make some people rich- Speculators have been driving up the price of crypto, especially Bitcoin, helping some early adopters to become billionaires. Whether this is actually a positive has yet to be seen, as some retractors believe that speculators do not have the long-term benefits of crypto in mind.
  • More and more large corporations are coming around to the idea of a blockchain-based digital currency for payments. In February 2021, Tesla famously announced that it would invest $1.5 billion into Bitcoin and accept it as payment for their cars.

Of course, there are many legitimate arguments against blockchain-based digital currencies. First, crypto isn’t a very regulated market. Many governments were quick to jump into crypto, but few have a staunch set of codified laws regarding it. Additionally, crypto is incredibly volatile due to those aforementioned speculators. In 2016, Bitcoin was priced around $450 per token. It then jumped to about $16,000 a token in 2018, dipped to around $3,100, then has since increased to more than $60,000. Lack of stability has caused some people to get very rich, while a majority have still lost thousands. 

Whether or not digital currencies are the future remains to be seen. For now, it seems as if blockchain’s meteoric rise is more starting to take root in reality than pure hype. Though it’s still making headway in this entirely-new, highly-exploratory field, blockchain is also showing promise beyond Bitcoin.

Categories
1. Introduction

Is Blockchain Secure?

Blockchain technology achieves decentralized security and trust in several ways. To begin with, new blocks are always stored linearly and chronologically. That is, they are always added to the “end” of the blockchain. After a block has been added to the end of the blockchain, it is extremely difficult to go back and alter the contents of the block unless a majority of the network has reached a consensus to do so. That’s because each block contains its own hash, along with the hash of the block before it, as well as the previously mentioned time stamp. Hash codes are created by a mathematical function that turns digital information into a string of numbers and letters. If that information is edited in any way, then the hash code changes as well.

Let’s say that a hacker, who also runs a node on a blockchain network, wants to alter a blockchain and steal cryptocurrency from everyone else. If they were to alter their own single copy, it would no longer align with everyone else’s copy. When everyone else cross-references their copies against each other, they would see this one copy stand out, and that hacker’s version of the chain would be cast away as illegitimate. 

Succeeding with such a hack would require that the hacker simultaneously control and alter 51% or more of the copies of the blockchain so that their new copy becomes the majority copy and, thus, the agreed-upon chain. Such an attack would also require an immense amount of money and resources, as they would need to redo all of the blocks because they would now have different time stamps and hash codes. 

Due to the size of many cryptocurrency networks and how fast they are growing, the cost to pull off such a feat probably would be insurmountable. This would be not only extremely expensive but also likely fruitless. Doing such a thing would not go unnoticed, as network members would see such drastic alterations to the blockchain. The network members would then hard fork off to a new version of the chain that has not been affected. This would cause the attacked version of the token to plummet in value, making the attack ultimately pointless, as the bad actor has control of a worthless asset. The same would occur if the bad actor were to attack the new fork of Bitcoin. It is built this way so that taking part in the network is far more economically incentivized than attacking it.

Categories
1. Introduction

Blockchain Decentralization

Imagine that a company owns a server farm with 10,000 computers used to maintain a database holding all of its client’s account information. This company owns a warehouse building that contains all of these computers under one roof and has full control of each of these computers and all of the information contained within them. This, however, provides a single point of failure. What happens if the electricity at that location goes out? What if its Internet connection is severed? What if it burns to the ground? What if a bad actor erases everything with a single keystroke? In any case, the data is lost or corrupted.

What a blockchain does is to allow the data held in that database to be spread out among several network nodes at various locations. This not only creates redundancy but also maintains the fidelity of the data stored therein—if somebody tries to alter a record at one instance of the database, the other nodes would not be altered and thus would prevent a bad actor from doing so. If one user tampers with Bitcoin’s record of transactions, all other nodes would cross-reference each other and easily pinpoint the node with the incorrect information. This system helps to establish an exact and transparent order of events. This way, no single node within the network can alter information held within it.

Because of this, the information and history (such as of transactions of a cryptocurrency) are irreversible. Such a record could be a list of transactions (such as with a cryptocurrency), but it also is possible for a blockchain to hold a variety of other information like legal contracts, state identifications, or a company’s product inventory.

To validate new entries or records to a block, a majority of the decentralized network’s computing power would need to agree to it. To prevent bad actors from validating bad transactions or double spends, blockchains are secured by a consensus mechanism such as proof of work (PoW) or proof of stake (PoS). These mechanisms allow for agreement even when no single node is in charge.

Categories
1. Introduction

How Does a Blockchain Work?

The goal of blockchain is to allow digital information to be recorded and distributed, but not edited. In this way, a blockchain is the foundation for immutable ledgers, or records of transactions that cannot be altered, deleted, or destroyed. This is why blockchains are also known as a distributed ledger technology (DLT).

First proposed as a research project in 1991,1

 the blockchain concept predated its first widespread application in use: Bitcoin, in 2009. In the years since, the use of blockchains has exploded via the creation of various cryptocurrencies, decentralized finance (DeFi) applications, non-fungible tokens (NFTs), and smart contracts.

Transaction Process

Blockchain
Categories
1. Introduction

Blockchain Programming Code Example

From the above picture of Blockchain, it is clear that we can code it in pretty much any programming language. For instance, the above concept can be implemented in C++, Python, Java and even JavaScript. Let us take a look at a sample Python code:

	# A block is stored as a tuple of
	# (parent_hash, transactions, hash_itself)
	
	def get_parent_hash(block):
	return block[0]
	
	
	def get_transactions(block):
	return block[1]
	
	
	def get_hash_itself(block):
	return block[2]
	
	# function to create a block in a blockchain
	def create_block(transactions, parent_hash):
	hash_itself = hash((transactions, parent_hash))
	return (parent_hash, transactions, hash_itself)
	
	
	# function to create the genesis block
	def create_genesis_block(transactions):
	return create_block(transactions, 0)
	
	
	# we create our genesis block
	genesis_block = create_genesis_block("X paid $100 to Y")
	
	# print the hash of the genesis_block
	genesis_block_hash = get_hash_itself(genesis_block)
	print "genesis_block_hash:", genesis_block_hash
	
	# create another block
	block1 = create_block("Y paid $20 to Z, X paid $10 to P", genesis_block_hash)
	
	# print the hash of block1
	block1_hash = get_hash_itself(block1)
	print "block1_hash:", block1_hash

Now suppose, if we were to mutilate the genesis_block

	genesis_block[1] = "Y paid $100 to X"
	genesis_block_hash = get_hash_itself(genesis_block)
	
	print "genesis_block_hash:", genesis_block_hash
	print "block1_parent_hash:", get_parent_hash(block1)

The output will be as follows:

	genesis_block_hash: 3495953456182427352
	block1_hash: -554281952046316805
	genesis_block_hash: 3220110016770526666
	block1_parent_hash: 3495953456182427352

Here, the value of genesis_block_hash and block1_parent_hash are clearly different while they should actually be the same in the correct Blockchain. As a result, the Blockchain is now corrupted.

Summary

Think of Blockchain as a distributed and secured data structure that can be used in places where no middlemen are involved. The decentralized nature of Blockchain is what helps in removing the middlemen and it comes from the above immutability of Blockchain. It is an interesting data structure and as we all have seen cryptocurrency is a real-life implementation of it.

Categories
1. Introduction

Blockchain Programming Fundamentals

In order to understand Blockchain deeply, let us first talk about the concept of a Digital Signature or a Hash.

Digital Signature is basically a function that takes a string as input and returns a fixed-size alphanumeric string. The output string is known as the Digital Signature or the Hash of the input message. The important point to note here is that the function via which we obtain the Digital Signature is “irreversible” in that given an input string, it can compute the Hash. However, given the Hash, it is virtually impossible to compute the input string. Further, it is also virtually impossible to find 2 values that have the same Hash.

hash1 = Hash(input1)
hash2 = Hash(input2)

Here, what we are essentially trying to say is the following:

  • It is easy to compute hash1 from input1 and hash2 from input2.
  • It is virtually impossible to compute input1 given the value of hash1. Similarly for input2 and hash2.
  • It is virtually impossible to find distinct input1 and input2 such that hash1 = hash2.

Such Hashing functions are carefully designed by cryptographers after years of research. Most programming languages have a built-in library function to compute the Hash of a particular input string.

Why are we talking about the Hash function?

Well, Blockchain as a concept relies heavily on Hashing. The idea is that in a Blockchain, we have an ordered chain of blocks such that each block contains the following information:

  • Hash of the previous block.
  • List of transactions.
  • Hash of itself.

Let us take an example. Consider the following simple block: [0, “X paid $100 to Y”, 91b452].

Here, since this is the first block of the Blockchain, the Hash of the previous block is 0. The list of transactions contains just 1 transaction – X paid $100 to Y. The Hash of itself is computed by the following way:

hash_itself = Hash(List of transactions, Hash of the previous block)

Basically, we combine the List of transactions and the Hash of the previous block as a single input string and feed it to the Hash function to get the hash_itself value.

Such blocks where the Hash of the previous block is 0 are termed as Generis Blocks. A Genesis block is basically the very first block in a Blockchain.

Now, suppose we want to add some more blocks to this Blockchain. Let us have block1 = [91b452, “Y paid $20 to Z, X paid $10 to P”, 8ab32k].

Here, 91b452 is nothing but the Hash of the previous block (the Genesis block). There are 2 transactions:

  • Y paid $20 to Z
  • X paid $10 to P

Finally, we have the hash_itself value which is basically Hash(“Y paid $20 to Z, X paid $10 to P”, 91b452). This turns out to be 8ab32k.

Representing pictographically, our Blockchain looks like the following:

What’s so special about this “data structure”?

Well, the idea is that if suppose someone were to mutilate the Blockchain by say altering the transaction in the Genesis Block – changing “X paid $100 to Y” to “Y paid $100 to X”, this will change the hash value of 91b452. As a result, there will be a mismatch in the value of this hash in block1 (remember, the first value of each block is the hash value of its parent block). As a result, the chain becomes invalid. This effectively holds for each block in the Blockchain because as soon as we modify a block, the hashes of all subsequent blocks become invalid and so, the chain collapses. Therefore Blockchain provides a high level of data security.

Categories
1. Introduction

What is Blockchain Technology?

Traditionally, there have been middlemen who have been controlling the data. For instance, Facebook is the middleman between users and advertisers. Banks are middlemen between borrowers and lenders.

The issue here is that the data is controlled by a central authority – Facebook and banks. They, therefore, control the prices and also technically own the data. In this scenario, all the power lies with a middleman and users have to trust them to remain ethical and continue to think about user interest. Blockchain was invented to make the data decentralized and trust minimized with any centralized party.

In order to understand it better, let us talk about torrents. In torrents, no file is owned by a single person. It is a kind of “peer-to-peer” architecture where multiple copies of the file are present at multiple workstations/users. Therefore, no single person controls that file. This kind of architecture is highly scalable and fault-tolerant since there is no single point of failure.

Blockchain essentially borrows the same idea: what if databases could be decentralized. This solves a lot of issues:

  • You can directly connect to a borrower without a middleman like a bank. You will get more profits.
  • You can connect directly to advertisers to tell them the kind of ads that you like, without going through Facebook.

One of the well-known use cases of Blockchain is that of cryptocurrency which is a digital currency that isn’t controlled by any central authority. Similarly, we can use Blockchain for smart digital contracts where no middleman is verifying the contract.