follow the eWorld

  • This is default featured slide 1 title

    Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.

  • This is default featured slide 2 title

    Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.

  • This is default featured slide 3 title

    Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.

  • This is default featured slide 4 title

    Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.

  • This is default featured slide 5 title

    Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.

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

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:
1.Version
2.Timestamp
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
7363150066651935ba511625ab5a651043656b61f6e3930ae5ea1e89bfde9b35

hello hai1
7945f89190d35d8e3db52de7ece85a037559bb060190ff8c908add26de128f96

hello hai2
d4036e82fb36fba4a46bfe96c284b8cb5a1e838372abb435455bba725ba33fd1

hello hai3
45ffcad0a209fb2682049386ffaf32bb22278d02abae61e1018a9a35e53fd7be

hello hai4
398cad261b7743793fb0ad1e20f10eb53f8789aadae0da6c9d1b52ceeaa5e901

hello hai5
8214f44d7d5a0c12c751d0acbc70c8415a380da62c9a320c7cabf8d549eb4920
.
.
.
Hello hai10
0f8b75fade1c8da26c368afe72da279b68e31103ec5e3e30e17758e7a4081f80

(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.

Share:

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 blockchain.info 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?

Mining

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:
00000000ffff0000000000000000000000000000000000000000000000000000

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.
Share:

Like us on facebook

Popular Posts

Search This Blog

Powered by Blogger.

Labels

Labels

Recent Posts

Unordered List

  • Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
  • Aliquam tincidunt mauris eu risus.
  • Vestibulum auctor dapibus neque.

Pages

Theme Support

Need our help to upload or customize this blogger template? Contact me with details about the theme customization you need.