Category Archives: Layman Guide

Dummies guide to Bitcoin Energy Use

For past couple of months, there has been an increased focus on bitcoin energy usage. Recent examples are –  Vice article  and IEEE.

This post attempts to explain bitcoin’s energy usage. It also tries to add some perspective on the energy problem.

Warning: This article gets a bit technical.

Flow of Money

“It is digital money” is simplest explanation for bitcoin.

Digital currencies have an inherent problem. Let’s take an example. A digital currency called “MyDitigalCoin”:

mydoc_coin

If I need more MyDigitalCoin I can create a copy.

mydoc_coinmydoc_coin

Tada! I have 2 coins now. It is called double spending.

The solution is to record ownership information.

Owner How Many MyDigitalCoins?
Me 1

 

Ownership and amount can be verified using this record. You can now reject every “copy” coin. This record is called a ledger.

Banks use ledgers to store your ownership and spending. Banks secure and maintain the private ledgers. Government authorities act as monitoring authority for the banks.

A cryptocurrency’s ledger is open to everyone. Anyone can check and edit the ledger. Hence the name – “public ledger”.

Public ledgers have two issues:

  1. Editing the ledger requires a trusted party.
  2. The identity verification of the trusted party should be fast.

Enter….

Proof of Work

We discussed “proof of work” earlier on this blog here.

Proof of Work asks a miner to generate a token (nonce). The nonce verification happens in less than a second.

After verification, the miner can edit the ledger and earn reward coins.

But, there is a problem.

Latency and “Blockchains”

On the internet there is always a delay between action and reaction. This time delay is called latency.

In Bitcoin, it is the time difference between block creation(action) and acceptance by all peers(reaction). This process of a block being accepted by other peers is known as block propagation.

Because of this delay there are always multiple versions of a blockchain. Wikipedia entry on blockchain has a diagram:

blockchain

Green box is our genesis block. Black boxes are blocks accepted by the whole network. This chain of black blocks is called main chain.

Purple and black blocks are mined at the same time. Purple boxes are valid blocks but not accepted by the whole network. These are called orphan blocks.

This latency causes two problems.

First, we don’t know if an accepted transaction is in an orphan or main chain block. This can cause double spending.

Visually, think a transaction included in purple block #1 but not black block # 1. This can be due to latency or someone maliciously changing the structure. Whatever the case, coins from purple # 1 can be re-spent and included in black block #2.

Second, orphan and main blocks both require same mining effort. So, orphan block is essentially wasting computing resource. Additionally, the network needs to decide the valid block and build from there. This is called block reorganization. 

Think about the 2nd and 3rd purple block. That is a chain of two blocks. So, cryptocurrency network needs to work together and find if that chain is invalid.

As per this site, bitcoin’s:

  1. 95% transactions take 22 second
  2. 95% of blocks take ~13 seconds

There is a 13 seconds window where two different people can find a block. Combine it with the block generation time of 10 minutes, that is nearly 2% chance of an orphan block. This situation was even worse back in 2013. Block propagation was 125 seconds or 20% chance of an orphan block.

Confirmations and Maturity

The solution for transaction issue is to measure probability of double spending. All cryptocurrencies use the same metric – confirmations.

Once a transaction is included in a block, number of confirmation becomes 1. Probability of a block being an orphan grows smaller and smaller with each additional block added.

All crypotcurrencies have the “confirmations” section on the transaction page. Example bitcoin:

https://blockexplorer.com/tx/9491979b3e4fbab15f661a475b65d1c124cfa3495b60357eea8a66d5d763349c

transaction_confirmation

Here, the number of confirmations is 2. There is 1 additional blocks on top of the transaction block. So, the latest block number/lock time is 495750. Now, the block confirmations will be more than 1000 now.

Block rewards, the newly minted coins, need 100 confirmations. This is known as block maturity. New coins can only be spend after maturing.

Revisiting Block Generation and Difficulty

Bitcoin’s solves block latency problem using block generation time and difficulty adjustment.

First, selecting a block generation time is a balancing act. This needs to be:

  1. High to delay blocks and minimize probability of an orphan block.
  2. Low to allow faster transactions.
  3. Low to allow faster confirmations. Confirmation counting starts from transaction block.

Bitcoin block generation time is 10 minutes. The recommended number of confirmations is 6 blocks. So, after an hour a bitcoin transaction is nearly immune from double spending.

Second, difficulty retargeting keeps the network within generation time boundary. Difficulty increases, if block generation is too fast. Mining becomes harder. Reverse is also true. Difficulty reduces, if blocks are taking too much time.

There is a simple relation between difficulty and PoW or hashing – Higher difficulty requires more hashes.

In Bitcoin, difficulty changes every 2 weeks. Additionally, it cannot change by more than 4 times the current difficulty.

Short History of Bitcoin Difficulty

When bitcoin started, the difficulty was 1. The first difficulty jump to 1.125 happened 11 months later in December 2009. As more people found bitcoin, the difficulty increased slowly.

A watershed moment happened when Laszlo Hanecz was able to find a way to mine coins using his GPU. Here’s the passage from Digital Gold by Nathaniel Popper:

Laszlo’s CPU had been winning, at most, one block of 50 Bitcoins each day, of the approximately 140 blocks that were released daily. Once Laszlo got his GPU card hooked in he began winning one or two blocks an hour, and occasionally more. On May 17 he won twenty-eight blocks; these wins gave him fourteen hundred new coins that day.

Satoshi knew someone would eventually spot this opportunity as Bitcoin became more successful and was not surprised when Laszlo e-mailed him about his project. But in responding to Laszlo, Satoshi was clearly torn. If one person was taking all the coins, there would be less of an incentive for new people to join in.

“I don’t mean to sound like a socialist,” Satoshi wrote back. “I don’t care if wealth is concentrated, but for now, we get more growth by giving that money to 100% of the people than giving it to 20%.”

As a result, Satoshi asked Laszlo to go easy with the “high powered hashing,” the term coined to refer to the process of plugging an input into a hash function and seeing what it spit out.

But Satoshi also recognized that having more computing power on the network made the network stronger as long as the people with the power, like Laszlo, wanted to see Bitcoin succeed.”

With people racing to find more blocks, difficulty increased steadily. In next four years, it went from just 1 to 3 million.

Many people were not interested in investing money the R&D money required for ASICs. But, in 2013 bitcoin prices touched $100 and suddenly there was interest in specialized bitcoin miners.

The miners started shipping towards end of 2013. While ASICs promised more efficient mining they came at a cost. The difficulty of bitcoin doubled in 2 months. This was truly “Tragedy of Commons“.

By the time 2013 ended difficulty increased by 1000 times to 1 giga hashes. Today, difficulty has increased by 1,500 times to 1.5 Terra hashes.

Energy usage

Now, let’s see the relationship between hashing and energy usage.

One of the famous bitcoin miners is Bitmain Antminer S9 Bitcoin Miner.

This machine can do 13.5 Terra Hashes per second (TH/s) or 13,500 Giga Hashes per second (GH/s). Here’s a table of coins at different difficulty levels:

Hashing Power (GH/s) Difficulty Bitcoins in 1 day
14000 1 3379583358.7646
14000 1000000000 3.3796
14000 1590896927258.079

(Current)

0.0021
14000 3181793854516.158 (twice the current difficulty) 0.0011

Let’s look at how the economics work:

Assume machine cost is 0.

This machine requires 1323 watts of electricity. In US, average cost of electricity is $0.12 kilo watts per hour. So, each day power cost is $3.81.

1 bitcoin goes for $13000. At 0.0021 BTC per day, revenue is $27.3/day.

Profit per day, after power costs, is $22.82.

That is ~$600 revenue per month.

This calculation is simplistic, especially with machine costs assumed to be zero. If people want, I will get into the economics of this.

Since starting of the year, difficulty has increased by more than 5 times. So, people mining 1 BTC in January can now only mine 0.2 BTC. Price have skyrocketed. People want to mine more coins.

Hence, people are adding more hashing power to bitcoin network. This has caused bitcoin’s energy usage to explode.

Bitcoin and the Energy concerns

The articles are right to an extent. If prices keep rising then surely people will spend more and more hashing power to earn coins. But, most of these discussions miss an important metric – mining efficiency. The metric for mining efficiency is watts required for 1 giga-hash. (1 giga-hash =1000000000 hashes)

Mining efficiency chart for the flagship Bitmain S-series miners:

bitcoin energy efficiency

The mining efficiency is up by 10 times in last 4 years.

The variability of mining profit comes mainly from electricity costs. With prices increasing (and lot of criticism on electricity usage) there will be even more research dedicated to reducing electricity costs. Sure, people might counterbalance this by trying to earn more coins. But, in time we will reach a balance. So, predicting a failure so soon is unwarranted.

There has been work on another Proof-model too.

Proof of Stake

This mining algorithm was first proposed on bitcointalk in 2011. The description given was (emphasis mine):

What I mean by proof of stake is that instead of your “vote” on the accepted transaction history being weighted by the share of computing resources you bring to the network, it’s weighted by the number of bitcoins you can prove you own, using your private keys.

So, instead of hashing and spending energy, a miner verification happens using coins owned by her. This proves her stake in the coin’s ecosystem. The idea being, if she has a stake then she will be less inclined to harm the coin. The first implementation of PoS happened in Peercoin.

There are couple of problems in PoS. First, someone can acquire coin just for creating issues. So, there is a coin age criterion. For staking considerations, coins need to be older than specific number of days. Example, peercoin considers coins not used, bought or sold, for last 30 days.

The second problem is “nothing at stake” problem. As we discussed above, due to latency, we have multiple blockchains at once. In PoW, computing acts as a deterrent to stop people from changing history.

In PoS, someone can stake their coins for more than blockchain. This can create a situation where there are multiple histories. So, blockchain reorganizes quite frequently.

To avoid this, PoS coins use a checkpoint system. On reaching a checkpoint, the blockchain freezes. There can be no changes beyond this checkpoint.

To understand this, look at the diagram in latency section. Let’s say the rule is – checkpoint after 4 blocks. So, after 4 blocks the first purple block is no longer valid.

The third problem is staking mechanism. Only people allowed to mine are the ones already owning coins. This makes the cryptocurrency somewhat centralized.

Conclusion

A decentralized currency where everyone can get in and have a fair say without consuming too many resources is a super interesting problem. Bitcoin is doing moderately well in this area. Mining efficiency research will lead the way for better energy future for bitcoin.

Blockchain Usage Part 2

We looked at two major uses of blockchain in our part 1. Here we expand our understanding looking at two more changes (but not usage) in blockchain space. We will tie this information in an ICO evaluation piece later.

Hashing Algorithm Change

(We have covered hashing and mining earlier in the blog.)

Bitcoin started with normal or “CPU Mining”. As bitcoin became famous people started to find ways to mine faster. There were miners (mining software) written to use the computer graphics card or GPUs. This difference in mining speed between CPU and GPU mining was nearly 5-10 times. That means for the same amount of work, GPU owners were earning 5-10 times more coins compared to CPU miners.

With time there were specialized machines called ASIC and FPGA which tilted the bar even further, sometimes in tune of up to 100 times.

This is not a bitcoin problem per se but an algorithm problem. So, any coin, example like Peercoin, which uses SHA-256 also has a similar problem.

This lead to people trying to find alternative hashing algorithms. Something which made GPU mining difficult. One of the earlier attempt to this was using scrypt algorithm.

Litecoin

Litecoin was announced on October 9th, 2011 as a faster coin. Three major changes were:

  1. Faster block time – 2.5 minutes vs 10 minutes on bitcoin
  2. Increased number of coins – 84 million vs 21 million
  3. Hashing algorithm – Scrypt instead of SHA256

The general idea of Litecoin was to be silver to Bitcoin’s gold. Compared to Bitcoin’s gold colored “B” icon,  the coin has a silver colored “L”.  Additionally, this was one of first implementation of dual mining. People could mine bitcoin as well as Litecoin using the same software.

CPU mining was not the highlight feature of Litecoin. But, scrypt algorithm was used for the coin’s Proof of Work for precisely because it could be mined using CPU. With time people did find a way to mine Litecoin on GPUs too.

Nowadays, many coins which start with explicitly seeking to make it easier to CPU mine; but most of them are unable to hold that position for long. So, CPU mining is effectively dead.

Privacy

In bitcoin, addresses are a series of numbers and letter which provides some level of anonymity. But, the public ledger has a downside. As we saw in our post on blockchain explorers, once I know your bitcoin address checking your balances and transactions is very easy. Every trail and transaction exists in the public domain. So, it is not fully anonymous rather half or pseudo anonymous.

People have tried to find ways around it. Bitcoin allows anyone to create unlimited number of addresses. So, one of the ways to avoid the above issue is to create a new address for every transaction. This is not a long-term solution as blockchain explorer can show a predictable pattern of transactions.

This lead to creation of bitcoin mixer/ tumbler services. These services confuse the trail of transactions by shuffling the coins between multiple address. At the end of the cycle, original owner receives the coins to a new address. There is no direct link between original and ending accounts. So, there is a certain degree of anonymity.

There are couple of issues with these services –

One, these are third party services. So, you have to trust the people running these service with your bitcoins. This is not ideal.

Secondly, over time mixer might end up using some old addresses. This again creates a public trail of transactions.

So, people came up with ways to have anonymity on blockchain. Two major coins in this area are:

Zcash

Johns Hopkins University professor Matthew Green and his students Ian Miers and Christina Garman set out to resolve the issue of pseudo anonymity on bitcoin. Their proposal is called Zerocoin. The idea behind Zerocoin was to create a mixing service on the blockchain; thus, making every transaction untraceable. The actual technology enabling the untraceable accounts is referred as “zero knowledge proofs or zk-SNARKs

Zerocoin was first implemented into a fully functional cryptocurrency called Zcoin which was released Oct 2016.

There are two different type of accounts on Zerocoin. Account starting “z” are untraceable. Accounts starting with “t” are traceable.

Zcash has a block time of 2.5 minutes and total supply of 21 million.

Looking at the Zcash blockchain explorer:

Block information

https://explorer.zcha.in/blocks/000000000eb491deed9edabd6eab8a93786f930634aa8e06f7d7ff1c0caf3202

You can see most addresses start with “t” and hence show full amounts. Z-type accounts are hidden and no transaction information can be found.

There are transactions marked with heading – JoinSplits (example transaction – https://explorer.zcha.in/transactions/826453061a02dded44d6ef43633e927a47624d505e42be658c25f7964e4605ae).

These are the transactions which involve at least one “z” account – either on the receiver or sender side. Amounts show up only for “t” accounts.

Monero

Monero was announced in 2014.  Features announced were:

  1. Untraceable payments
  2. Un-linkable transactions
  3. Blockchain analysis resistance

Monero’s block time is 120 seconds.

Monero uses a technology called “ring signatures” to obfuscate transactions. So, if you look at:

Block info

https://moneroblocks.info/block/1413513

Transaction information

https://moneroblocks.info/tx/d58e4e7302cfd7f1b25ee4941c9927c62f2324529ad3cc4043f01a4e8372c836

Transaction amounts or “output total” are marked “confidential”.

Interestingly,  both Monero and Zcash started with CPU friendly algorithm. Over time people have written GPU miners to tilt the advantage in favor of GPU miners. So, as a rule of thumb – if you want to mine coins, it’s better to have GPUs.

Now let’s answer the perennial question:

Why do we need Altcoin?

There are good reasons for creating an new coins and not going the OMNI way.

(Note: I am going to use address and account interchangeably.)

First let’s deal with why can’t we build coins directly on top of bitcoin just like OMNI.

Bitcoin transactions have a fixed format.

So, the only way to store information on bitcoin blockchain is to use address. The process is rather cumbersome. (Steps can be found at – http://www.righto.com/2014/02/ascii-bernanke-wikileaks-photographs.html (Read – “How to put your own message in the blockchain”)

There are two caveats here:

  1. Storing anything on blockchain requires a fee. So, storing information on these special addresses is not free.
  2. Bitcoin doesn’t recognize these addresses. So, any coin sent to these “un-spendable” addresses are lost forever.

OMNI uses these un-spendable addresses to store information. Let’s take an example – Here’s the transfer of an asset named Tether on OMNI:

https://omniexplorer.info/lookuptx.aspx?txid=7f2faaef67d8ee942787240c604aa09197ab5f9c628e3cd2c9b7eb45e2f1a401

The amount transferred was 8495 Tethers.

While the same transaction on bitcoin blockchain has a different structure:

https://blockchain.info/tx/7f2faaef67d8ee942787240c604aa09197ab5f9c628e3cd2c9b7eb45e2f1a401

The un-spendable account which holds information about transfer shows up as “Unable to decode output address”.

While OMNI can read these un-spendable accounts, bitcoin cannot. As far as bitcoin is concerned these accounts are completely nonsense. This adds a layer of complexity on using bitcoin blockchain as the backbone.

We also need to consider other bitcoin features, like:

Block size

It defines the maximum possible size of a block in the chain. So, if we look at our blockchain example:

Complete Blockchain

Currently it has 3 transactions – 2 transfers and 1 reward. Total number of transactions – 4 transfer + 2 rewards (yellow). The length is 3 blocks.

Let’s say I reduce the block size to 2 transactions. Then every block will contain 1 transfer and 1 reward transaction (yellow). This means each transfer needs a reward.  This will cause a radical change. With 4 transfers each of them needing 1 reward, my number of blocks will swell to 5 – 4 transactions blocks and 1 Genesis

Similarly, if I increase the block size to 5 transactions. Every block will contain 4 transfers and 1 reward. With 4 transfers in total I can accommodate everything in one block. My number of blocks will be 2 – One Genesis and one Transfer.

In cryptocurrency, megabytes is the measure of block size.

Bitcoin’s block size is 1 MB. At this size 1 bitcoin block can store a maximum of 4200 transactions.  The OMNI transactions will also be a part of this limited 4200 “seats”.

Nowadays, increased fees is a serious concern on Bitcoin. It is exactly due to small block size. So, if all coins were use Bitcoin as the base we might see even more heavy fees.

Block Generation Time

Transaction times are tied directly to block generation time.  Bitcoin’s generation time is 10 minutes. So, a bitcoin transaction takes at least 10 minutes. The amount doesn’t matter. It is as true for 1 BTC as it is for 0.00001 BTC. In comparison, Litecoin’s block time is 2.5 minutes. So, transactions are 4 times faster.

Hashing Algorithm and Features

Some features require changing the hashing algorithm. Example being CPU mining friendly. Today, bitcoin’s SHA256 hashing algorithm cannot deliver that promise.

While features like full anonymity cannot be delivered on the existing bitcoin blockchain.

Limited Scripting

Bitcoin uses a scripting language to interact with the blockchain. The language is somewhat restrictive. It was exactly this issue that led to creation of a new coin and the “Rise of ICOs”.

 

Blockchain Usage Part 1

Disclaimer – Coins discussed in this post are for educational purpose. Please don’t take them as any form of endorsements.

In our previous post we discussed one of the important tools to evaluate ICOs. In this post, we will expand our understanding of the blockchain technology. This will help us to further evaluate ICOs by understanding their underlying technology proposal.

Trustless and decentralized transactions, consistency and privacy – are the major advantages of blockchain.

All these features are already provided by bitcoin. So, the question is what do ICOs or other blockchain offer at all? It all comes down to usage.

Blockchain Usage

Let’s go back to our earlier blockchain example:

Complete Blockchain

From this we understand that a blockchain contains:

  1. Balances
  2. Identity information

But what if things can go beyond this?

Blockchain as Database

The very first block of bitcoin or genesis did not contain only balances and identity information. It also contained a message –

“The Times 03/Jan/2009 Chancellor on brink of second bailout for banks”

If you actually want to see the actual message. Find the genesis block:

https://blockchain.info/block/000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f

Click on the text just below “Transactions”, it will take you here:

https://blockchain.info/tx/4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b

Click on “show scripts and coinbase”.

As bitcoin caught on, people started storing all sort of  data on the blockchain. With ingenuity and enough fees anything can be stored . Examples include:

  1. Bitcoin logo
  2. Catholic Prayers – Oh yes, it is embedded in the bitcoin blockchain forever
  3. Nelson Mandela complete pic
  4. Bitcoin pdf paper etc.

(credit to: http://www.righto.com/2014/02/ascii-bernanke-wikileaks-photographs.html. Check the page for detailed information. )

Combined with inherent characteristics like privacy, decentralized etc., blockchain could be used for a lot of things.

Now, armed with this information people came up with two ways to utilize it:

  1. Using the blockchain underlying principle to create a new blockchain (also known as altcoins) to solve a problem.
  2. Using bitcoin as a metadata store (Metadata is data about data. Check the Nelson Mandela pic example in the righto.com link above. Nelson Mandela pic is the data. While the pic name – 3Nelson-Mandela.jpg? is the metadata).

Let’s look at one example of both the ways:

New Blockchain or Altcoins

Any new coin with its own blockchain falls into this category. These tend to solve a particular problem.

Namecoin is the first example of leveraging blockchain concept for a different purpose other monetary transaction.

Namecoin

This was the first fork of bitcoin.

A fork, in layman terms, means copying a program code and then reusing it. The re-use can be:

  1. Simple renaming (ex. Use bitcoin code as it is to create Mycoin)
  2. Improving the code
  3. Re-purposing the code

Etc.

Namecoin used the bitcoin code to create a new coin which could be used, you guessed it, to store names. Domain names are the most stored information on namecoin.

Domain Name

Think of addresses –  the major component of a normal address is the House Number and Zip code. Similarly, every computer in this world has an IP address. A website which is a computer also has an IP address.

For example, www.google.com IP address is: 172.217.26.196

So, when you type www.google.com in chrome or Firefox, it checks the site address in a domain name registry which is hosted on a Domain Name Server or DNS. Your computer requires the correct IP to open a website.

The DNS database is a centralized server. So think of a controversial website like – wikileaks.org. In this case, blocking a site is simple. Just delete the IP address associated with wikileaks.org from the DNS database.

Namecoin and DNS

Namecoin blockchain allows people to store site name and IP address in exchange for well what else but namecoins. The extension for a namecoin site is .bit (extension examples are .com, .net, .org etc). So, WikiLeaks can create a site – wikileaks.bit and store a corresponding IP address on the namecoin blockchain after paying some coins.

Website IP information cannot be tampered as blockchains are secure (immutable in tech speak). So any website information stored on namecoin blockchain will remain forever within the blockchain.

Normal web browsers cannot find the .bit websites. It requires specialized namecoin software,chrome and firefox extension, to get the DNS information of .bit websites.

Using Bitcoin Blockchain as Metadata Store

Metadata is data that provides information about other data. So, using blockchain as a metadata means using it to store information about “other” data ie non-bitcoin information.

An example of these are coins which are layered on top of bitcoin. They utilize bitcoin’s blockchain to store their metadata information ie non-bitcoin information. They utilize the computing power behind bitcoin to secure their network. Examples include — Omni (earlier known as Mastercoin) and Counterparty.

Let’s look at Omni (I will be using Mastercoin and OMNI interchangeably)

Omni (MasterCoin)

OMNI architecture:

Omni and Bitcoin Layering

(Their paper https://github.com/OmniLayer/spec )

Mastercoin was one of the first coin sales or ICO. People were asked to send coins to an exodus address (1EXoDusjGwvnjZUyKkxZ4UHEf77z6A5S4P).  Mastercoin was credited in lieu of BTC to those accounts. The distribution was similar to ICO nowadays. Just like a classic IPO, late buyers paid a slight premium compared to the early adopters.

How does OMNI work?

Omni uses an elaborate scheme to manage transactions. All OMNI transactions have three parts:

  1. The sender and receiver -These are bitcoin addresses which own OMNI coins. Yes you read it right, because of layering all OMNI coin owners are also bitcoin owners
  2. Exodus address – Each OMNI transaction pays a small fee to the Exodus address. It makes filtering OMNI transactions from the complete bitcoin blockchain very easy. So all OMNI transactions can be found on the exodus account page: https://blockchain.info/address/1EXoDusjGwvnjZUyKkxZ4UHEf77z6A5S4P
  3. Data Address – This is a special bitcoin address which stores the OMNI coin transaction. So if I send you 1 OMNI from my bitcoin address to your address, a special data address will store that transaction.

Let’s take an example:

A transfer of 0.9 OMNI between two addresses as seen and stored by OMNI:

https://omniexplorer.info/lookuptx.aspx?txid=fa3dae8c2bcb9fbc4fabf01bb40d047b262203f3768d5980c3ca29c0464d8722

You can see the sender and receiver of the coins.

As, we know OMNI uses bitcoin blockchain so the information must exist there too:

https://blockchain.info/tx/fa3dae8c2bcb9fbc4fabf01bb40d047b262203f3768d5980c3ca29c0464d8722

If you match both the page, the information can be broken down to:

  1. Sender – 1BF6A2MU7iS5qLRe8tLTHkLZBmEUsKHV5m
  2. Receiver – 1KTpA9UJfCP5L3at3QwgHYYyRCUwNnRhWY (Both are actual bitcoin address)
  3. Exodus Address – 1EXoDusjGwvnjZUyKkxZ4UHEf77z6A5S4P (Omniexplorer uses this to filter transactions)
  4. Data Address – 1BF6A2MU7iS5qLRe8tLTHkLZBmEUsKHV5m → This stores the transaction and ownership information of OMNI coins. In this case it will store the transfer of 0.9 OMNI coins

 

ICO, Token, Genesis, PreMine and Instamine Explained

Please note: This is a supplement to the “Blockchain and Cryptocurrency Explained” series. If you want to start from the beginning, go here.

This information should help you during your next token or ICO sale.

What is ICO and pre-mine?

To understand this let’s go to our blockchain example in part 3:

Blockchain Example

The question here is – How do Red or Blue transfer any coins at all? There is no mining information at all.

So, we expand our example to include mining:

Complete Blockchain

With Red and Blue getting some coins in block#0 they can now transact in block#1. The noticeable thing for Block#0 is:

  1. Red and Blue are not rewarded for mining.
  2. Both Red and Blue get some coins. Ideally, this should not happen. Block reward belongs to “a person” mining the block (check part 4)

Genesis Block

Genesis block is a special case in cryptocurrency. This block can have rules which are separate from other blocks. For example, Bitcoin’s genesis block:

https://blockchain.info/block/000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f

Using what we learn in our last article :

  1. The section called “previous block” is all 0.
  2. Transaction section shows only one transaction. The “Newly Generated Coins” or the block reward.

So, the only transaction in the block was rewarding 50 BTC to the person mining the genesis block of bitcoin. You can click on the bitcoin address and you can see all the transactions. (If it is not clickable, you can check the address here). It says “Genesis of Bitcoin”.  The special rule for bitcoin genesis is that these 50 BTC cannot be used. That means no one can use this 50 BTC to exchange for USD, buy ethereum etc. So, the actual block rewards in bitcoin start from block#1.

ICO

When Satoshi came out with the idea of Bitcoin it was a passion project. As time went by there were a glut of coins – 817 coins. Now coin developers are facing an issue of getting people interested in their platforms. Additionally, with more money invested into cryptocurrencies expectations started change. Developers are expected to:

  1. Hire more developers to keep improving the coin
  2. Promote the coins
  3. Develop necessary features like blockchain explorer. Private explorers like Blockchain.info tend to get controversial.
  4. List the coins on exchange. This can cost up to 25 BTC per listing.

Etc.

So, the idea of Initial Coin Offerings or ICO was born.  

In an ICO, developers ask people to send BTC or ETH to a particular address. In exchange, people get coins on the newly developed blockchain. These coins are generated in the genesis block.

So, in our example blockchain above Red and Blue must have paid BTC to our fictional coin developers. They were then given 10 and 20 coins respectively, in the genesis block.

A real world example is the Ethereum ICO:

https://blog.ethereum.org/2014/07/22/launching-the-ether-sale/

The rewards were 2000 ETH per BTC for first 2 weeks. So, if I sent them 1 BTC they added a record in Ethereum genesis block to give me 2000 ETH.

If you look at Ethereum’s genesis block, it has 8893 transactions:

https://etherscan.io/txs?block=0

These transactions are the outcome of Ethereum ICO.

If you look closely ethereum developers also got 12 million ETH in the genesis block. The account and transaction here(scroll to the end):

https://etherscan.io/txs?a=0xde0B295669a9FD93d5F28D9Ec85E40f4cb697BAe&p=8

Some people consider this was unfair.

PreMine (or Pre-mine)

When a significant chunk of a coin is mined before widespread adoption, it is called pre-mine.

An ICO is also somewhat of a pre-mine. If developers are open about their intent, it is considered fair.

So, it is necessary to lookout for any un-wanted surprises during the reward allocations for the starting blocks, especially genesis. If possible always demand your coin has some sort of blockchain explorer at the launch date to help you dig into this information.

Instamine (or Insta-Mine)

Let’s re-look at the genesis block of bitcoin again:

https://blockchain.info/block/000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f

There is a section called difficulty. It drives the mining effort required to find the correct hash. 1 is the easiest difficulty on bitcoin. To give you an idea, look at the difficulty of the most recent block at writing of this blog:

https://blockchain.info/block/00000000000000000086b374be56d5ab212b13c833df70576d3248297a6f9dc1

The difficulty is 888,171,856,257.32. So it is nearly 900 billion times more difficult to find a block now than it it was at the genesis block.

As we discussed in part 4 , block rewards decline over time. This entices people to start mining early and earn lot of coins. But, this a double edged sword. If a particular group was able to capture those starting blocks, they can control the supply. This capturing of initial/starting blocks is called instamine (insta-mine)

Dash is an example of an instamine coin. The total supply of Dash is 18.9 million coins. Due to a glitch, 25% of the coins (1.9 million) were mined within 48 hours. As per the developer, this was caused by a coding error. Difficulty change between blocks was not working correctly. So, someone was able to mine all those coins at a very low difficulty.

So again, always ask for an explorer to help you check what is happening behind the scene.

Tokens

Crowdsale was the “hot term” during ethereum launch. Tokens or ICOs were not in vogue. So, it gets quite confusing with all the new words.

In my opinion:

  1. ICO or Coin offerings should be for new blockchains. So, take coins for developing a completely new coin.
  2. Cryptocurrencies like Ethereum, Omni and NXT allow people to develop businesses on top of its blockchain. These “coins” cannot be mined per se. So, the term token and “token sale” is more suitable.

But, nowadays even the token sales are called ICOs.

We will apply some of the rules to evaluate coins in a later post.

Please note: This is supplementary for the “Blockchain and Cryptocurrency Explained” series. If you want to start from the beginning, go here.

Oft asked questions for any cryptocurrency is – How do I start using a coin? How do I mine so and so coin? Or How does one become a node or a peer? The steps for achieving any of these is similar in any coin. This post aims to provide a general outline of those steps.

Here’s the decision tree (click to see larger version)

Now to answer some questions:

What does running a full node mean?

A full node is a simple validator of transactions. It supports the cryptocurrency network by providing distributed consensus. A node requires the pc to be running all the time. Additionally, it requires a lot of data bandwidth. If you lack bandwidth or a server which can be running all the time, it’s best not to run a node.

What is the Core client?

Most coins have their own software called the core client. This is the base which is required to connect to the peers and download the whole blockchain. To use a wallet, you need blockchain connectivity. There is no other way. Example, the core software for ethereum is called geth and bitcoin is called bitcoin core.  You can find the software by searching for “coin name” core client download:

What is a wallet software and how is it different from core client?

Wallet software is a vanilla software to store your coins. It is the simplest way for anyone who wants to start using any cryptocurrency. It can’t check transactions against blockchain. As we said in previous question, there is no way to use cryptocurrencies without interacting with blockchain. So these rely on the blockchain hosted by the wallet company. Example is Exodus wallet software. It will rely on the blockchain which exodus will have running on its computers. If you just need to use cryptocurrencies you can download wallet and be done.

Why are there two different steps for wallet address creation?

In most cases, creating wallet address is a simple task in both core client or wallet software and created automatically once you open the software. But in some core client cases, like geth, this requires special knowledge and steps. If you are mining, you need a wallet address where the block rewards and fees can be stored.

How to connect peers in the network?

Most of the software connect to peers automatically. There might be some, again like ethereum’s geth, which require you to do separate steps before you can connect to peers.

What does downloading a blockchain mean?

Blockchain contains all transactions in a network. So, before you can become a node you need the whole copy before validations can be done. This is a time, bandwidth and disc space consuming process. Currently bitcoin blockchain size is 160GB while ethereum is 250GB. So, if you decide to become node for ethereum you need 250GB on your hard disk. Then an internet plan which allows you to download 250GB of data. Then depending on your speed, this download can take up to couple of days.

What is mining?

Mining is the process of finding the next block and earning coins for it – block reward and fees. It is very resource intensive – electricity bill and computing power wise both. If you don’t have the computing resources then don’t do this. If you still want to help the network, you can utilize your computer to become a node and help the network. See question 1 for considerations.

What is a miner?

The miner does the heavy lifting of finding the correct hash and next block for you to earn coins. Finding the correct miner is necessary as an inefficient one will just waste power but get no returns. Example of a good miner is cgminer for bitcoin and ethminer for ethereum. Note: Miner is a word used for both the software and the person who is running miner on his computer. So, “miner using the miner cygminer” is common in cryptocurrency world – the first reference is the “person who is mining” while the second reference is the mining software.

What does “using your resource for yourself” mean?

Here we are talking about solo mining. In this case you are mining for yourself and competing against all the miners in the world. So if there are 1000 miners with say similar computing power to yours then you have 0.1% chance of finding the next block. You need to have a blockchain copy on your computer to solo mine.

What is a mining pool?

The problem of solo mining is quite evident, not only there are lot of resources used, the probability of winning is low. This becomes even more problematic when there are people with more computing power than yours.

The alternative is pool mining. In this case, lot of people connect to a single server called the pool and use their resources collectively. So, if suppose 100 of the 1000 miners join a pool, they now have 10% chance of finding the next block. Everyone is paid according to the effort put in. If your efforts amounts to 20% of  the total pool, you will get 20% of the block rewards once the pool finds the block.

The second advantage is you don’t need to download the whole blockchain. You can use the pool’s blockchain to mine. So unlike solo mining you save a lot of resources.

It is very important to find an honest pool. You can check for reviews on coin forums etc. You can get taken for a ride. Instead of getting 20% you may end up with 5% of payout only.

How to configure a miner?

As miner is a separate piece of software it needs to connect to the blockchain to start working. In solo mining, this is easy as the miner will mostly install and connect to the core software automatically. Things become a bit difficult when you are pool mining. First you need to find the pool address. Once you have that you can start you miner with the pool address followed by your wallet address.

 

Blockchain and Cryptocurrency Explained – Part 4 – Mining

We have looked at identity, verification and trust in cryptocurrency and blockchain. In our last part, we will put everything together and look at the end to end transaction flow using mining. 

Let’s start with the often used word:

Mining

The process by which a peer or a node earns coins is called mining. The node which is earning through mining is called a miner.

Okay…but what is mining?

If you remember our discussion on hashcash – email sender had to find a specific type of hash. The rule being that the hash needed to start with 20 zeros.

Mining is a similar process where a peer in the cryptocurrency network works to verify the transaction and generate a hash out of it. A peer(node) earns coins for his effort once he finds the correct hash. Every cryptocurrency has its own rule on what exactly is the correct hash. This type of mining is also known as Proof of Work (PoW).

Note: When someone says “finding a block”, they actually mean generating the correct hash for the next block.

 

Here’s what the transaction between Red and Green looks like when we include mining. This assumes we have only one node (peer):

Reward coins?

They are of two types:

Block Reward

All cryptocurrencies start off with a fixed supply of coins. This is the maximum number of coins for a cryptocurrency. The distribution of these coins happens through “block rewards”. Any one who finds a block is given some coins from this fixed supply.

Fixed supply of coins means that these rewards need to be adjusted every now and then. This ensures adoption is fast as early adopters tend to get a lot of coins.

Cryptocurrencies also implement a feature called block generation time. This helps in controlling the supply. It also ensures block rewards are not paid out too quickly.

The rewards differ from coin to coin:

Bitcoin (BTC) 21 million coins is the total supply. Early block reward was 50 bitcoins. In Bitcoin, tapering happens in form of halving the block reward every 4 years. So, block reward reduced to 25 BTC in 2012. It further reduced to 12.5 BTC in 2016. The next reduction to 6.25 BTC will happen in 2020.

Bitcoin’s block generation is 10 minutes. So, a node can earn 1.25 new bitcoins every minute (12.5 BTC per 10 minutes). Currently ~80% of the BTC supply has been mined.

Ethereum initial supply was set to a quintillion (billion times billion). Ethereum developers wanted to have a coin unlike bitcoin. The idea is that the coin should be mine-able forever. Currently the block reward is 5 ETH. There has been discussions to reduce this down to 3 ETH.

Ethereum’s block generation is ~14-20 secs per block. So there is ~15-20 new ETH per minute.

Fees

With block reward reducing over time, cryptocurrency includes an additional incentive for miners. This incentive is the transaction fees. The node finding the new block earns all the fees from the

transaction he has included in the block.

At the time of writing this the fees for bitcoin is ~ 0.000678 BTC per transaction and, fees for ethereum is ~0.00092 ETH.

While transactions with zero fees are also acceptable, miners might delay in verifying those transactions. That is simply capitalism at play – everyone needs an incentive to do something. So, it is always better to add fees.

Going back to our above Red, Green and Blue example. If in the picture Red and Green were using bitcoin, then at the end actual transaction will be with Blue earning coins for his effort:

Red = Debit of 1 BTC for transaction + Debit of 0.000678 BTC for fees = 1.000678  BTC

Green = Credit of 1 BTC from Red

Blue = Credit of 12.5 BTC in block reward and 0.000678 BTC in fees= 12.500678 BTC earned

Full network

I have expanded on an example used earlier. Assume Red and Green are transacting a fictional coin called JeansCoin.

A full network from this pic:

  1. Red’s identity and balance is verified using a digital signature – Discussed here
  2. Verification is done by multiple people in the network or peer to peer – Discussed here
  3. Grey is only verifying identity against the blockchain. So, Grey is a node(peer) but not a miner.
  4. Red, Green and Blue are miners. So, they are not only verifying the transaction, they are also securing the network by hashing information. Discussed here
  5. There is actually a competition going on between – Red, Green and Blue. So, the first one to find the hash earns reward coins as described above.  
  6. Let’s say Blue finds the block. He will earn coins from the supply and fees from Red. Now the blockchain has an additional block.
  7. Now a new block added to the old chain. Every node needs to update their blockchain too. So the block from Blue goes out to – Red, Green and Grey.
  8. Next round of verification and transfers happen on the extended chain.

For a mainstream coin like Bitcoin, there are tons of nodes who verify and secure the network. Mining in itself is extremely competitive. People use specialized software and hardware to mine and earn those extra coins.

I hope this series has given you insights on all three parts of a cryptocurrency. In addition, money generation and how other parts fit in should also be clear now. 

Blockchain and Cryptocurrency Explained – Part 3 – Blockchain (2)

How does Hashcash tie into cryptocurrency?

Cryptocurrencies using the concept of Hashcash to generate coins and maintain blockchain. Some of the important concepts which are re-used from Hashcash:

  1. The software used for Hashcash was referred to as mint. One correct hash meant 1 token or coin (cash) to send one email.
  2. The process for finding correct nonce is called mining.
  3. Correct hash is used to prove that the sender’s computer has done some work on finding the right combination, hence the name Proof of Work 

While this method worked flawlessly for emails there was an issue when using it in a currency setting. If your bank said that each coin can be spent only once, how would that turn out? You buy a dollar worth of groceries, your grocer takes the dollar to bank to exchange, then the grocer buys a dollar worth of gas, again the dollar has to be exchanged…so and so forth. See the problem? Things get needlessly complicated.

To resolve this, in comes RPOW – Reusable Proof of Work by Hal Finney. Now the coin could be used repeatedly. To achieve this every coin was attached to each other. For example, an email flow in RPOW would be like this:

The output hash from the original message will be chained into the next email. The nonce 119598 was calculated on the extended message.

Blockchain

In a traditional money system, the bank has a general ledger detailing each transaction – debit and credits etc. They have a separate identity store which holds balance. Here’s what a traditional transaction actually looks like:

In cryptocurrency having each part being done separately is not feasible. So blockchain contains both information:

  1. Everyone’s public key (used to verify identity – check part 1)
  2. Transaction information

So, a blockchain transaction between Red and Green looks like this:

Every peer is having a copy of the blockchain and uses it to verify the ownership of coins as well as balances. Once confirmed they add entries to the blockchain to reflect new balance for Red’s key. Hence, blockchain is also sometimes referred to as distributed ledger.

To ensure trust transaction and identity information is hashed into a block. That way unless someone knows all the information it is impossible to find the hash.

Furthermore, all blocks are chained to each other like in our RPOW example. So, the block”chain” looks like this:

To reiterate a block contains two information:

  1. All transactions which have happened
  2. The nonce which used along with the transaction info to create a valid hash.

Since each block is chained to the previous and next block, it makes hacking or changing even more difficult. As the data cannot be changed it is also referred to as immutable.

How does Trust work?

Say at the 11th block Blue wants to get back her 2 coins included in block1. As everything is connected to each other, all hashes will need to be re-done since block1. This is almost impossible. Not to mention the peers would catch on and kick Blue out from the network.

Hence, blockchain has to work in conjunction with p2p network to achieve the distributed consensus.

Now remains the question of money flow – how are coins created, transactions etc in a cryptocurrency. We will discuss that in part 4.

Blockchain and Cryptocurrency Explained – Part 3– Blockchain (1)

This part on blockchain gets a little technical. So I have broken this down to two smaller pieces.

We understand p2p systems must ensure trust especially when it the whole idea is based on a system of unrelated computers. Let’s look at how the trust is achieved.

If we go back to our p2p example in part 2 , here’s what we said:

In a p2p environment, the bittorrent program checks the file it is downloading.

The question is how does the checking work and trust is established? Well, one of the ways is to do a byte by byte comparison. But that will be slow and unreliable. Instead it stores a hash of the original file and checks it against the file from ubuntu.com. If the file hash doesn’t match it is rejected.

What is hashing?

Hashing is another cryptographic technique to hide data from hackers. So it takes any data and then makes it unreadable. While each hash is unique, unlike encryption you can generate hash without any key at all. There are various forms of hashes – MD5, SHA1, SHA256 etc.

All examples below use SHA256 hash [See Appendix for notes on tools]

It differs from encryption in three more ways:

Output is irreversible:

It is one-way street; the output cannot be decrypted at all. Knowing the original message is the only solution because even a small change leads to different hash:

I have progressively capitalized the words in our message.

Output length is fixed:

I have repeated the same message thrice. As you can see the output length is still same.

It works on any data :

The second example is an Ubuntu file. To go back to our torrent trust example, the torrent file will have the above hash stored. A corrupted file’s hash will be different from the expected hash. Hence, the corrupted file will be rejected.

Innovative usage of hash

Email spam has been the bane of electronic communication. Back in the 90s, a cryptographer named Adam Back proposed a brilliant idea to counter spam. The system was called “hashcash“.

Without getting into minute details, the idea was to have the email sender’s computer to take the below information and generate a hash:

  1. email address, date and time etc
  2. random number, also called nonce 

This hash had to start with 20 zeros to be valid. Once the valid hash was found it was attached along with the email and sent out.

The email receiver’s computer could use the email content to generate another hash. It would then check the resulting hash against the received hash. If they did not match, email would be marked as spam.

Example of email flow between Red and Green (relaxed condition to 4 zeros only):

The number – 15395 is the nonce part of Red’s message. To generate the valid hash with 4 starting zeros, our sender’s (Red) computer has to check each combination:

Message Hash
1How are you?21:37 7834A5C1A266260A30D310696C0CE20811E44D853F4ECA6EF570AC595B2F6C4A
2How are you?21:37 AB2C56650D330F4A10AFF17F51BE71B0875172EE53A343B1EF620DC17B3821BD

 

so and so forth unless the correct number (nonce) and hash with required zeros is found.

15395How are you?21:37 -> 00007A092207AD90CC5DC4DDD4865A43DDD4716DA33034ACD66A52F9BE9A162A

How does all this stop spam?

On the sender’s computer finding the correct hash takes about a second. While on the receiver’s side verification takes milliseconds.

For a genuine mail sender this is not a problem. They can take the time and date, email address etc information and generate the correct hash in one second to earn the cash for one email.

For a spammer sending say 10k emails, his computer will be in peril for a long time. Each email requires 1 second so the computer will hang after every email sent. The total time it will take to send email will be 10k seconds or 2.8 hours or even more. All the while recipients verifying spam in matter of seconds.

contd.

 

Appendix

  1. Google “SHA256 hash Generator” and you will find a lot of tools to generate hash
  2. Small tutorial and tool to generate SHA256 on a pdf, video,  etc here – http://www.labtestproject.com/using_windows/step_by_step_using_sha256sum_on_windows_xp.html

Blockchain and Cryptocurrency Explained – Part 2 – Verification

In Part 1, we laid out the grounds on how the ownership works in cryptocurrency using digital signatures. While a two-way communication worked great, the question remained how will a large-scale verification work in blockchain?

Verification

Let us first define what does verification mean by going back to Mr. Red and Mr. Green. Suppose Mr. Red needs to pay Green some money. Two of the ways this money transaction can happen is:

Red has the physical signature and ATM pin as proof of ownership. That is unique to him. But, we still need a third party to verify the ownership. The third party here is the bank.

Verification is one of the major design considerations of cryptocurrency. To understand it completely let’s look back at cryptocurrency history a bit.

History

A cryptographer named David Chaum proposed an anonymous digital currency in late 80s. The idea was to issue digital money using cryptographic techniques. This money was untraceable. It mimicked cash to a certain extent. I can withdraw cash then spend it without having to worry about being traced. Hence it got the name Digicash.

The problem was – how do we verify not only the ownership but validity of the money? Chaum’s proposal also used banks as an intermediary.

Here’s how Red to Green transaction using Digicash played out:

This ideawas implemented at only one bank, Mark Twain, in the 90s. Without a user base the company had to close down.

Later there were other proposals like b-money by Wei Dai and Bitgold by Nick Sbazo. Both also proposed to use cryptography to secure minting and distribution of money.

Bitcoin

In 2008, Satoshi Nakamoto proposed and released Bitcoin [1]. The idea was to have  – “A purely peer-to-peer version of electronic cash would allow online payments to be sent directly from one party to another without going through a financial institution. Digital signatures provide part of the solution, but the main benefits are lost if a trusted third party is still required to prevent double-spending.”

Let’s unpack this:

We understand how digital signatures work and how they can be used by to proof ownership from Part 1. Digicash shows a way this works when interacting with a centralized mechanism like bank.  So, what is:

Peer to Peer

Peer to Peer is a form of distributed architecture. In p2p every task is broken down to smaller chunks. Every computer in the networks works on these chunks. Each computer in the network is considered equally competent. Confused? Let’s look at an example. One of the p2p usage is file downloads ex. Ubuntu (https://www.ubuntu.com/download/alternative-downloads – Section Bittorrent).

So if Red required a copy of Ubuntu he can do this:

File download speeds can be slow due to various reasons:

  1. Red’s location
  2. number of users downloading the same file
  3. limitations on the server

etc.

So anyone can download a bittorrent software, add the torrent file and start downloading Ubuntu. A P2P approach works like this:

Now Red connects to multiple peers including ubuntu.com and download the file.

P2P has an advantage over centralized downloads. Files will always be available. Even if ubuntu.com is offline. The file is available for download from any of the peers.

The second advantage is an integrity check.

Suppose, ubuntu.com crashes. All files on the server are now corrupt. In a centralized model, everyone will get a corrupted and unusable file.

In a p2p environment, the bittorrent program checks the file it is downloading. It compares the file found on ubuntu.com  against the file served by peers. If majority of peers agree that the file on ubuntu.com is different; the corrupt file is ignored. Think of it as a democratic process:

So how does it apply to the initial bitcoin proposal?

One, multiple servers complete the verification.

Two, all computers in the network are equally competent for verification.

Lastly, it is a democratic process wherein majority have to agree on everything on bitcoin network – transaction or otherwise.

Bitcoin doesn’t have a single trusted authority. Hence, the moniker “distributed trust” or “distributed consensus”

A bitcoin transaction between Red and Green works like below. The peers in the blockchain network work to verify Red’s digital signature  and check bitcoin balance associated with it.

While the diagram shows only 4 peers you will have 100s and 1000s of peers in the bitcoin network. Each of them have to verify the transaction. Before anyone can alter the transaction or change the rules they need 51% voting rights in the network.

At this point, many of you might say – Hold on, what about blockchain? It is actually the blockchain’s elaborate scheme that ensures trust. We will discuss how blockchain ties into the distributed trust in part 3.

Blockchain and Cryptocurrency Explained – Part 1 – Ownership

Nowadays there has been a lot of buzz around cryptocurrencies and blockchain. This has in part helped by the record breaking prices of Bitcoin and Ethereum. According to google trends report, the interest in blockchain is as high as ever:

https://trends.google.com/trends/explore?date=all&q=blockchain

There are those who are putting in money into initial coin offering(ICO) in hopes of hitting the next big jackpot. Then there are those who want to use the innovation called “blockchain” in different implementations.

Blockchain offers a world of opportunities in our hyper connected world. But there seems to a be general confusion around the technology. Over the years, I have been interested in learning the technological aspects of cryptocurrencies. I have always found the articles online to be too technical or abstract to make sense of things. Please follow along my journey as I understand each part of the crypto currency phenomena.

What is cryptocurrency?

As per Wikipedia: A cryptocurrency (or crypto currency) is a digital asset designed to work as a medium of exchange using cryptography to secure the transactions and to control the creation of additional units of the currency.

Let’s breakdown the definition even more:

Asset by definition is something we own and have rights to use. Example, a house is a physical asset. A digital asset is something which exist digitally on a computer. A good example will be your last vacation pics. These are your digital assets.

Medium of exchange is something which can be used to trade. Example, the money in your wallet is a medium of exchange. You can exchange it to get a burger, a car ride or even the house which turns into asset later.

Cryptography in pure layman terms is study of hiding information. A good example will be finding a way to securing or hiding your facebook password.

Now when we talk about a digital asset – think of your vacation photos. I can create copies of them by simply doing copy and paste. Here cryptography is used control the “copies”.

So these currencies are cryptographically secured and act like currency. Hence, the moniker “cryptocurrency”.

What types of Cryptocurrencies and blockchains are available?

By last estimate there were over 840 different coins.  Some of them defunct while others with negligible value. If you talk to someone who is into the cryptocurrency scene, they will tell you there are two major currencies:

  1. Bitcoin – Satoshi Nakomoto created bitcoin back in 2008. He also introduced the innovative technology of blockchain.
  2. Ethereum – As years passed, people found blockchain could go beyond it’s original purpose. It lead to coins like Storj – decentralised storage using blockchain etc. Each of the coins catered to a single purpose. Vitalik Buterin released Ethereum in 2015. It made it easier for people to utilize blockchain technology for whatever purpose they saw fit using “smart contracts”.

Confused? Have tons of questions like:

How does one own it?

How does one spend it?

What does cryptographically securing transaction mean?

etc etc.

Let’s look at this one step at a time. First step:

Ownership

The very first challenge in digital money is – ownership. It’s easy in case of government issued currency. If I hold the cash in hand, I am the owner. If it is a non-cash transaction then my signature is the proof.

How are digital currencies solving this? (note: words in italics are technical terms)

Encryption

Encryption is a way to ensure data or message can only be read by the intended recipient. While this doesn’t stop people from intercepting the message in between it ensures they cannot find out what the actual data/message is. Think of battle plans, whatsapp messages, your emails or even those snapchat pictures etc.

There are three parts to this – first the plaintext which is the original message. Then there is a key which is used to encrypt the message. Once the plaintext goes through encryption it becomes ciphertext. The process of deciphering the ciphertext back to the plaintext is known as decryption.

There are two types of encryption:

1.Symmetric Key

This was the very first form of encryption. It is called symmetric because encryption and decryption can be done using the same key. To understand this let’s look at an example:

The oldest known symmetric key is Caesar Cipher. The idea was to shift the alphabet by 3. So,

A=D

B=E

C=F

D=G

E=H

….

H = K

O = R

R=U

U=X

V=Y

W=Z

X=A

Y=B

Z=C

This is how encryption and decryption of a simple message flow will look like between two people – Mr. Red and Mr. Green:

explaining Caesar cipher before going to blockchain identity

As you can see both encryption and decryption requires the same key.

2. Asymmetric encryption

If you understand the nature of symmetric encryption, this shouldn’t be a tough one to guess. Using the same key to encrypt and decrypt no longer works:

Image explaining how asymmetric key is different from symmetric key before going to blockchain identity

So how does it work really? By using public-key infrastructure (PKI).

In public key encryption, everyone generates one set of keys – private and public. The public key is be shared with everyone. While only the owner is aware of the the private key. Now for a two way communication a key exchange needs to happen.

Let’s re-look at the above example to establish communication between Mr. Green and Mr. Red:

Step 1. Both of them create their own public and private key pairs

Explain Key generation before going to blockchain identity

Step 2. Both of them need to have the other person’s public key. The sharing can be through publishing it outright to doing an exchange as shown here. Important – Never share your private keys.  

Key Exchange before going to blockchain identity

Step 3. Now two-way communication can happen between Mr Red and Mr Green. Mr. Red can send message encrypted using Mr. Green’s public key. Mr. Green can decrypt the message using his own private key:

One way communication using pub/private key pair before going to blockchain identity

Similarly, Mr. Green can reply back using Mr. Red’s public key. Red’s private key is required to de-crypt this reply. Thereby establishing two-way communication.

Two way communication established before going to blockchain identity

Digital Signatures

Public-private key pair uniqueness is the most important feature of public key encryption. You can think of this as unique as your own thumb print. This uniqueness is utilized to create digital signatures.

Going back to our example above –  Suppose at some point Red doubts Green’s identity. So Red can ask Green to prove it. Green does this by writing a message and sending it along with a signature generated using the private key. Once Red receives the message, he can then use the public key on the message and verify the identity:

Using digital signature for identity including blockchain identity

Cryptocurrencies utilize the same idea to ensure ownership.

The first thing your wallet gives is – a string of numbers and alphabets – also known as your address. This is where your digital coins are stored. The address is the public key portion of PKI and can be shared with anyone. People are only associated with their public key which ensures anonymity.

Wallet also generates a private key. It helps to prove your ownership of the coins via digital signature.

Pro-tip 1: Never share your private key with anyone. This is very important as you can lose control of your coins.

A good example of this happened back in 2013. Matt Miller on Bloomberg bought a physical bitcoin card. He unintentionally showed the private key on live TV. Someone stole his bitcoins. Video here:

https://www.bloomberg.com/news/videos/b/d72e548f-c7e8-42ef-b71a-7fea29c96579

Pro-tip 2:  Always secure your private key using a strong password. It ensures an extra layer of protection. Even if someone hacks your computer they will be unable to use the private key. 

Multi-sig

Expanding on ownership, let’s look at an advanced feature provided by crypto currencies – Multiple-Signatures or Mutli-Sig.

Public-private pair key is required to generate digital signatures. In multisig, the pairing goes beyond the 1:1. It changes the equation to multiple private keys mapped to a single public key. Furthermore, we can create a rule outlining the number of private keys required to generate valid signature.

Let us go back to our example, Green runs a business with his partner Blue. A key paired created is of type 2 out of 2. Then while interacting with Red, the only way to generate a valid signature requires both Green and Blue private key too. If either of them sign a transaction with only their key, it becomes invalid:

Multisig example in blockchain

To expand this, let’s assume there is a new partner – Yellow. So, we can create a new key “pair”. This will follow 3 out of 3 rule. So, unless all three sign there is no way to generate a valid signature.

Key can also follow the “2 out of 3 rule”. In which case signing requires any two keys. So,  any two of three, Yellow, Blue or Green, can sign a transaction.

The important point here is the combination can be anything we want. So, we can do –

3 out 5 – 3 keys required out of 5

2 out 5 – 2 keys required out of 5

7 out of 10 – 7 keys required out of 10

etc.

Now that we have resolved the ownership problem, here’s the second one – While the public key infrastructure (PKI) works for two-way communication. How do we ensure mass communication between people for currency transactions?  We will cover this aspect in part 2.