Latest Updates from Tech world;

Showing posts with label bitcoin. Show all posts
Showing posts with label bitcoin. Show all posts

Monday, 1 January 2018

What is the puzzle solved by bitcoin miners to earn new coins?

What Puzzle is solved by miners?What is Bitcoin cryptographic hash function?How bitcoin mining is done?What is SHA-256?

bitcoin cryptographic puzzle and sha 256
Everybody tells that bitcoin miners solve some complex mathematical cryptographic puzzle to earn new bitcoins. But only few explains what is that puzzle and how it works. Actually it not a complex puzzle.Miners do some guess work to find the solution. To understand this puzzle , first thing to understand is ‘what is cryptographic hash function?’

What is Cryptographic Hash Function?

Cryptographic hash function is basically a mathematic function where you take an input or a message put it into the hash function, output appears to a random series of characters. Hash is different from encryption. In encryption encrypted data can be decrypted. Hash is a one way function – it cannot be decrypted back.. So cryptographic hash is preferred for secure transmission of passwords and data validation. Even if some one intercept hashed data, it will be meaning less to them since original data cannot be recovered. It is also useful for checking data loss while transmission. Data can be validated with it’s hash to ensure that correct and full data is received at end point.

 bitcoin cryptographic hash function sha256

Characterisits of a cryptographic hash function are:

1.It must be computationally easy to produce o/p from i/p
2.It has to be computationally infeasible. That means it is not easy to find the input for a given output.
3.It has to be deterministic. It means for a the same input , output should be the same all the time.
4.if you change a message slightly, the output hash will be entirely different
5.It has to be infeasible for you to find two messages  produce same hash.

SHA-256 cryptographic Hash in bitcoin mining process

Hash function used in bitcoin is SHA-256(Secure Hash Algorithm). SHA-256 is one of the successor hash functions to SHA-1, and is one of the strongest hash functions available.
We have discussed about block chain in previous article. In a block there will be block header.Block header contains:
3.Hash of the previous block
4.Merkele root
5.Difficulty target
Version is the nothing but bitcoin’s  current software version. Timestamp is the approximate time at which block is generated.

Previous block hash is the Hash of the header of the previous block added to the block chain.

Merkle root is basically all the transactions in the block hashed together. It can be viewed as a signature for all the transactions in the block.

Difficulty target is to set difficulty level of the cryptographic puzzle, so that it takes 10 min for all bitcoin miners all together to solve the puzzle. It is a 64 bit hash looks like 000000000ad4bcf645…..
When bitcoin mining software try to find out the next block, it will take a block header and hash on them. If generated hash is less than or equal to difficulty target we have found next bitcoin block. It is extra ordinary to get a hash less than difficulty target. So, basically bitcoin mining software has to try billions or trillions of times to find a value less than target function.

But we know that Hash function is deterministic. If we perform hash on the same block header o/p is going to be the same all the time.That is where the role of ‘nounce’ comes.

Example:Here are few messages and their SHA-256 Hash.
hello hai

hello hai1

hello hai2

hello hai3

hello hai4

hello hai5
Hello hai10

(You yourselves can try this at xorbin SHA 256 calculator)

Look at above example. It took 10 attempt to find a hash of ‘hello hai’ with one ‘0’ in the beginning. In bitcoin environment target hash is a extremely small hexadecimal number starts with 14 zeros. It may look likes 00000000000000adb5674fd67e……..Then you can image how many attempt will be required to find a number starting with 14 zeros and also less than that number.As the times goes on ,difficulty level will increased by appending more number of zeroes in the beginning side. Nounce in this example is 1 to 10.

The bitcoin mining software performs hash on the header if hash is not less than the target , it will increment the ‘nounce’ by 1, and performs hashing again. Actually hashing is done on concatenated value of  header and nounce.  If it still not valid, again nounce will get incremented by 1. As we have seen when input is modified slightly , output hash is entirely different. This process continues till it finds a hash that is valid and that will become next block in the chain. It will takes trillions of tries to find a valid hash. So , success of mining depends on computing power of the mining system. Higher  the computing power ,higher the chance of win.

Friday, 22 December 2017

How does bitcoin works?

Bitcoin:What is it?How does it work?How to use it?What is meant by a cryptocurrency?What is block chain?What is bitcoin mining?

How does bitcoin works
The Bitcoin is attracting global attention due to it's recent surge in value and growing acceptance as a form of payment with more and more merchants, retailers and individuals.To understand what is bit coin really is and how it works,a little technical knowledge is required.In this article we have tried to answer a few questions arise in your mind about bitcoin and it's working in simple words.

What is bitcoin?

Bitcoin is a digital cryptocurrency believed to be developed by a pseudonym entity Known as Satoshi Nakamoto.It is It is just one among thousands of cryptocurrencies. But it is widely accepted as the first successful and most popular cryptocurrency on web.

Bitcoin is a software developed based on the blockchain protocoal.It appeared on the internet in January 2009.

Blockchain:Block chain is distributed ledger that can record record financial transactions.It is a continuously growing list of records, called blocks, which are linked and secured using cryptography. Each block typically contains a hash pointer(an address) as a link to a previous block,a timestamp and transaction data.

A blockchain is typically managed by a peer-to-peer network collectively adhering to a protocol for validating new blocks. Once recorded, the data in any given block cannot be altered retroactively without the alteration of all subsequent blocks, which requires involvement of the network majority.So,a blockchain cannot be corrupted easily unless majority users want to bring down the network.

How blockchain works?

Here is the sequence of changes occurs in a blockchain network during a transaction is performed

The blockchain database isn’t stored in any single location, meaning the records it keeps are truly public and easily verifiable. No centralized version of this information exists for a hacker to corrupt. Hosted by millions of computers simultaneously, its data is accessible to anyone on the internet. Since each block is linked to previous block via hash pointer data corruption becomes nearly impossible.To corrupt a block it's subsequent block also need to be edited.

Blockchain originally devised for the digital currency, Bitcoin,but the tech community is now finding other potential uses for the technology.

Blockchain is a list of verified transactions. For example,A sent X bitcoin to B on December 14, 2017, between 12:10 p.m and 12:20 p.m.Bitcoin's blockchain is public. Anyone can download it.
Bitcoin transaction data available on website

We have seen there is no central authority to verify transactions and maintain ledger.Then who will do this verification and ledger maintains? Are they paid for this?

Usually in a currency system central bank is responsible for the issue of currency.Here who will issue bitcoin?


The process of issuing new bitcoin into the circulation is called mining. Miners will verify transaction and add validated transaction to the ledger. As a reward of their work new coins will be issued and given to them.

At first it seems to be simple.But real process involved in mining is difficult.Bitcoin's software makes the process artificially time consuming.If mining process is made simple bitcoin will be worthless. Think about Gold.Why it so much valuable?Because , it is rare and limited and process involved in mining and purification is expensive

It's not just one transaction individuals are trying to verify. All the transactions are gathered into blocks with a virtual lock on them.A miner has to verify a block of 1MB of data. By verifying transactions, miners are helping to prevent the "double-spending problem." If no one is verifying any transactions fraudsters may have the chance to spend the same coin again and again.

After transaction verification you will get some task to complete. One who complete this task is the winner of subsequent bitcoins issued.To earn something "proof of work" is required.

Miners receives the latest block of transaction data. They run the data through a cryptographic algorithm that generates a "hash," a string of numbers and letters that serves to verify the information's validity, but does not reveal the information itself.
Actually there is no advanced math or computation is involved in this 'math problem'.What miners doing is trying to be the first one to come up with a 64-digit hexadecimal number (a "hash") that is less than or equal to the target hash. It's basically guess work.

To generate maximum number of hashes you need high power computing devices.Powers of such computers are expressed in MegaHash per second(MH/s) or GigaHash per second(MH/s)
Answer to the said math problem is a 64-digit hexadecimal number. Then, you can image how difficult is to guess that number.

Miners don't generate 64 bit hex number, instead they generate 'nouces' ( "number only used once," )and the nonce is the key to generating these 64-bit hexadecimal numbers In Bitcoin mining, a nonce is 32 bits in size--much smaller than the hash, which is 256 bits(64*4). The first miner whose nonce generates a hash that is less than or equal to the target hash is awarded credit for completing that block, and is awarded the newly issued bitcoin.

Here you can see the details of the block number 350010 and it's corresponding hash,nounces,reward etc..
block hash and nounces in bitcoin
All target hashes begin with zeros--at least eight zeros, and up to 63 zeros.

There is no minimum target, but there is a maximum target set by the Bitcoin Protocol. No target can be greater than this number:

You may have doubt in mind that is it so much difficult to guess a hexa decimal number. You can check the current difficulty level of guessing a nounce that produce a hash less than or equal to a target hash from the block explorer site. When I am writing this it has reached {"difficulty":1873105475221.611}. That means chance of win for a nounce is 1/ 1873105475221.611.

Let us analyze this situation with some smaller number.

Suppose target hash is between 1 and 100.Three persons were asked to guess the target number.They need not guess exact number ,instead number less than or equal to the target. First person guesses 25, second person 27 and third person 67.But the target was 45. Then Who is the winner. First and second guessed a number less than 45 which satisfies the condition for a win. In bitcoin scenario , there cannot be two winner. So, person who have verified block with maximum number of transactions will the winner.

You may be thinking if you choose the smallest number ,you could be the winner all the time. This is not possible in bitcoin mining algorithm.'Nounce' once used cannot be reused.Nounces are the key to the hashes. Hash function used in bitcoin is SHA-256 Cryptographic Hash Algorithm.To understand bitcoin completely ,you must know SHA-256 algorithm We will be discussing deeply about SHA-256 algorithm and bitcoin in our coming article.

Thursday, 14 December 2017

Origin of Bitcoin and mystery surrounding it

How Bitcoin originated and who created it?

how and who created bitcoin and mystery behind bitcoin

Bitcoin originated in 2009.Since then Bitcoin has experienced significant highs and lows. Last week, the cryptocurrency surpassed an $16,000 evaluation for the first time in history. Bitcoin is considered the preeminent cryptocurrency in the world. There's plenty of mystery surrounding its creation.Who created it ,how it is created etc..

Here is the timeline of Bitcoin,
In 2008, the first inklings of bitcoin begin to circulate the web. In August 2008, the domain name was registered online. Two months later, a paper entitled 'Bitcoin: A Peer-to-Peer Electronic Cash System' authored by ‘Satoshi Nakamoto’.But who is this Satoshi Nakamoto.Identity of Satoshi Nakamoto is still unknown.It may be a single genius or a group of talents who like to stay anonymous for number of reasons.

Bitcoin runs through an autonomous software program.Bitcoin is just one among thousands of cryptocurrency.

In 2010, a handful of merchants started accepting bitcoin in lieu of established currencies.
The cryptocurrency began attracting interest from tech elites, as well. In 2012, Cameron and Tyler Winklevoss purchased $10 million worth of bitcoin, and, in less than a year their investment had more than tripled. It's been estimated the Winklevoss twins own 1% of all available bitcoin.

In 2011, the Silk Road, an online marketplace for illegal drugs, launches. It uses bitcoin as its chief form of currency.

Two years after its origin, the mysterious figure known as "Satoshi Nakamoto" disappears from the web.

Google "Satoshi Nakamoto" and the results will lead you straight to image after image of an elderly Asian man. This is Dorian S. Nakamoto, named "Satoshi Nakamoto" at birth. He is almost 70 years old, lives in Los Angeles with his mother, and, as he has reminded people hundreds of times, is not the creator of Bitcoin.

The Craig Wright controversy:In 2016, Australian entrepreneur Craig Wright claimed to be the creator of Bitcoin and provided disputed code as proof. But finally he also withdrew.

In the course of determining the identity of Satoshi Nakamoto, there's one person who has been thumbed again and again: hyper-secretive cryptocurrency expert Nick Szabo, who was not only fundamental to the development of Bitcoin, but also created his own cryptocurrency called "bit gold" in the late '90s.

In 2014, a team of linguistic researchers studied Nakamoto's writings alongside those of thirteen potential bitcoin creators. The results, they said, were indisputable. “The number of linguistic similarities between Szabo’s writing and the Bitcoin whitepaper is uncanny," the researchers reported, "none of the other possible authors were anywhere near as good of a match."Szabo firmly denied these claims, both in The New York times story and in a tweet: "Not Satoshi, but thank you."

Recently , Tesla and SpaceX founder Elon Musk denied being Bitcoin's creator. 

Nakamoto has written extensively about Bitcoin, authoring close to 80,000 words on the subject in the course of two years. His work reads like that of a native English speaker. Judging by Nakamoto’s spelling, and his use of British colloquialisms, it's thought he might hail from the UK. The timing of his posts seem to indicate this fact as well: It's been pointed out that Nakamoto posted during UK daylight hours.

The Wikipedia entry on Satoshi Nakamoto names at least 13 potential candidates as being responsible for the creation of Bitcoin.

Why would the inventor of the world's number one cryptocurrency choose to remain anonymous?It might have number of reasons.

History of such currencies are not quite good.

In 1998, Hawaiian resident Bernard von NotHaus dabbled in a fledgling form of currency called "Liberty Dollars" to disastrous results: He was charged with violating federal law and sentenced to six months of house arrest, along with a three-year probation.

In 2007, one of the first digital currencies, E-Gold, was shut down amid contentious circumstances by the government on grounds of money laundering.

If the inventor of Bitcoin wants to remain anonymous, it's for good reason: by maintaining anonymity, they've avoided adverse legal consequences, making their anonymity at least partially responsible for the currency's success.

Besides, one of the founding principals of Bitcoin is that it's a decentralized currency, untethered to conspicuous institutions or individuals. In his original proposition on Bitcoin, Nakamoto wrote, "What is needed is an electronic payment system based on cryptographic proof instead of trust, allowing any two willing parties to transact directly with each other without the need for a trusted third party."

A closer look at one of Nakamoto's original postings on the proposal of Bitcoin sheds some light on his possible motivations.

In February 2009, Nakamoto wrote, "The root problem with conventional currency is all the trust that's required to make it work. The central bank must be trusted not to debase the currency, but the history of fiat currencies is full of breaches of that trust. Banks must be trusted to hold our money and transfer it electronically, but they lend it out in waves of credit bubbles with barely a fraction in reserve. We have to trust them with our privacy, trust them not to let identity thieves drain our accounts."

Even after 9 years of its creation , brain behind bitcoin is still a mystery.

Read Bit coin original Whitepaper:
Join Our Newsletter