I have heard that mining is for people with ready hardware and blah blah blah... But what exactly is it? Does it operate like real mining? I mean, people talk about it like you are physically mining.
3Transaction validation process is called mining. For each block of transactions validated, the successful miner receives bitcoin reward. michaelnielsen.org/ddi/how-the-bitcoin-protocol-actually-works– RP.Mar 4, 2014 at 4:13
David Schwartz's answer is entirely accurate, but all that "bitspeak" might be a little intimidating to the average user. Let me try and put it into more plain language:
The way Bitcoin works is that instead of having one central authority who secures and controls the money supply (like most governments do for their national currencies), this work is spread out all across the network. Most of the heavy lifting for Bitcoin is done by "miners".
Miners collect the transactions on the network (like "Alice pays Karim 10 bitcoins" and "Liam pays Sofia 8.3 bitcoins") into large bundles called blocks. These blocks are strung together into one continuous, authoritative record called the block chain, which doesn't permit any conflicting transactions. This is necessary because without it people would be able to sign the same bitcoins over to two different recipients, like writing cheques for more money than you have in your account. The block chain lets you know for sure exactly which transactions count and can be trusted (so no bad cheques!).
The way Bitcoin makes sure there is only one block chain is by making blocks really hard to produce. So instead of just being able to make blocks at will, miners have to compute a cryptographic hash of the block that meets certain criteria. Bitcoiners refer to this process as "hashing". The only way to find a cryptographic hash that's "good enough to count" is to try computing a whole bunch of them until you get lucky and find one that works. This is the "lottery" that David Schwartz refers to, because miners who successfully create a block are rewarded some bitcoins according to a preset schedule. The difficulty of the criteria for the hash is continually adjusted based on how frequently blocks are appearing, so more competition equals more work needed to find a block. Modern dedicated mining hardware (e.g. ASIC miners) can try trillions of hashes per second, so to be competitive in this race to find hashes miners need specialised hardware, otherwise they will tend to spend more on electricity than they make in the "lottery".
In addition to the hash criteria, a block needs to contain only valid, non-conflicting transactions. So the other main task for miners is to carefully validate all the transactions that go into their blocks, otherwise they won't get any reward for their work!
Because of all this work, when a Bitcoin client signs on to the network it can trust the block chain that was most difficult to produce (since this is evidently the one that was being worked on by the most miners). If there was a "fake" blockchain competing with the real ones (say, where someone pretends that they didn't actually give Sofia those 8.4 bitcoins and they still have them), the fraudster would have to do as much work as the whole rest of the network to make their block chain look as trustworthy. So essentially, the intense work that goes into finding blocks through hashing secures the network against fraud. There is also, of course, some nifty code that figures out how to choose between conflicting transactions; and what to do if two people find valid blocks at the same time.
One last thing: why is it called mining? In the original analogy, people who performed this essential work were compared to gold miners digging the gold out of the ground so that everyone could use it. But in reality, Bitcoin "miners" are just running computer programs on very specialised hardware that automates the process of securing the network. To sum up, this software
- Collects transactions from the network
- Validates them, and doesn't allow conflicting ones
- Puts them into large bundles called blocks
- Computes cryptographic hashes over and over until if finds one "good enough to count"
- Then submits the block to the network, adding it to the block chain and earning a reward in return.
That's mining in a nutshell!
3Great answer. Perhaps just one thing to add - a Transaction being included in a Block constitutes its first Confirmation, and each successive block adds one more Confirmation.– ypocatFeb 2, 2014 at 16:53
can trust the block chain that was most difficult to produce (since this is evidently the one that was being worked on by the most miners)-- I don't understand the concept of collaboration which this statement implies. Miners can work together to create a single block? How does that work?– user60758Sep 28, 2017 at 19:58
2Blockchain, not block. Miners produce blocks separately but produce blockchains together. Oct 3, 2017 at 22:32
mining is doing the work of finding nonce so that sha256(sha256(data+nonce)) < difficulty
- nonce is an integer number the miner chooses freely (this choosing of the nonce and checking if the condition (< difficulty) is met comprises the work
- data is a hash over the contents of the block (transactions) and the previous block's hash
- sha256() is the SHA-256 cryptographic hashing function (wikpedia SHA-2 article)
- difficulty is a value that is adjusted consensually by the nodes of the bitcoin network to adjust for change in network computation power in order to have one block every 10 minutes found by the network
The resulting nonce is the proof of work: since it's impossible to find nonce without essentially trying different nonces and calculating the two hash functions, having found a nonce that satisfies the condition is proof this work of searching and calculating has in fact been done.
This is the central idea behind Bitcoin to solve the double spending problem: due to the inclusion of the previous block's hash in data (this links the blocks to form a chain) and the fact that the honest nodes of the network always do their work on the longest chain of blocks, a double spending attack involves calculating (and later publishing) a forked block chain in secret that is longer than the "honest chain" (containing the transaction that should be undone). Due to the work required to do this, this race can only be won if the attacker has greater computation power than the rest of the network together. Since using such computation power to honestly mine is likely more profitable than pulling a double-spend, the incentive for doing a double-spend attack is low.
5I think this answer is too terse for the audience. This might be fine on Cryptography.SE, but the typical Bitcoin user might not know what nonce or sha256 means. I suspect the typical Bitcoin user might have heard of something called a "hash" but has no idea that your answer is referring to the application of hash functions. Sep 12, 2011 at 21:16
30Personally, I think that technical answers might cohabit with non-technical ones. In this case some explanations on what is data and difficulty are needed, otherwise nobody will learn anything. Not even a cryptographer. Sep 12, 2011 at 21:23
3I like Stéhane Gimenez' idea of explaining stuff (data, nonce, sha256, etc.) after the short and precise definition of mining. I'm new to stackexchange... can I (should I) edit my answer? Sep 13, 2011 at 7:44
4This actually is more what I was looking for. Once you get the basics, it becomes more difficult to delve deeper. Thanks. Dec 13, 2012 at 17:22
3Shouldn't "difficulty" be "target" in this case? I'm not a BTC expert, just wondering... Feb 21, 2014 at 14:38
Mining is the process of securing transactions and committing them into the bitcoin public chain. It requires winning a kind of computational lottery where each hash you perform is like buying one ticket. The Bitcoin protocol currently permits the miner who generates a block to claim 50 bitcoins as well as any transaction fees for the transactions that miner chooses to include.
The Bitcoin system uses the mining process to generate coins, secure transactions, and publish transactions.
20The block reward is now 25 bitcoins. Jun 29, 2013 at 6:36
21The block reward is now 12.5 bitcoins. Oct 23, 2016 at 14:41
7The block reward is now 6.25 bitcoins. Jun 27, 2020 at 10:16
Mining is just doing computational work to secure the transaction block chain. A side effect of mining is creation of new coins and earning additional money by signing on transactions.
In more simple terms: Actual mining means, you sweat digging something and then find some useful metals. In bitcoin mining, your computer sweats calculating blocks and in return the bitcoin protocol gives you some bitcoins.
And in actual mining, you find precious metals which doesn't belong to anyone. Similarly, in bitcoin mining, the bitcoin protocol generates new bitcoins (Only upto 21 millions though) (which are not belonged to anybody) and gives you.
So the word "mining" makes perfect sense.
The answers in this section all present different, useful perspectives. Another useful, but non-technical perspective is:
Mining is a battle between those who want to see Bitcoin succeed for the greater good, and those who don't care if it is destroyed as long as they achieve some victory, even if only to be part of the destruction (they might not get any BTCs from their destructive efforts).
In other words, Bitcoin is a fascinating attempt to establish an alternate money system. Since the P2P, decentralised architecture is integral to its success it is, by design, open to any participant. The mining process assumes that some participants are evil. It pitches 'good' against 'evil' in the hope that 'good' will continue to succeed and maintain the integrity of the network.
Mining is just running a application on your computer to confirm the transactions of the crypto currency for which you get paid as fees.
I will say mining is the soul of crypto currency, according to today's scenario everyone creating new coin everyday but some of them goes to the moon and some of them just vanish in a couple of weeks, why? because a coin is alive until there are people to mine it. Take a example of a coin which has only 100 miners and you bought 1000 such coins after a few days miners stopped mining that coin, now you cannot sell that coin to anyone even if you have a potential buyer, why? because your transaction will not confirm until there are people mining that coin. The price of coins go up because of mining, why? because as many miners start mining the currency the difficulty increases, with the increase of difficulty mining coins will take more time, more miners more demand less coins. Increment in rates.
Bitcoin mining is the process of adding transaction records to Bitcoin's public ledger of past transactions or blockchain. This ledger of past transactions is called the block chain as it is a chain of blocks.
Bitcoin mining is intentionally designed to be resource-intensive and difficult so that the number of blocks found each day by miners remains steady. Individual blocks must contain a proof of work to be considered valid. This proof of work is verified by other Bitcoin nodes each time they receive a block. Bitcoin uses the hashcash proof-of-work function.
The primary purpose of mining is to allow Bitcoin nodes to reach a secure, tamper-resistant consensus. Mining is also the mechanism used to introduce Bitcoins into the system: Miners are paid any transaction fees as well as a "subsidy" of newly created coins.
Miners do expensive computation to solve puzzle and they broadcast it over the network. It contains a number called nonce which can be used to easily verify that actual work was done. This is called proof of work. The solution takes lot of trials and is computationally difficult but it can be easily verified by other nodes on network. Any evesdropper, if tries to alter any block or transactions, will need to do alter all following blocks in blockchain that will get exponentially difficult. Thus it makes alterations in block impossible and a secure and tamper resistant ledger is created on blockchain.
Mining is also the mechanism used to introduce Bitcoins into the system. Miners are paid any transaction fees as well as a "subsidy" of newly created coins. This both serves the purpose of disseminating new coins in a decentralized manner as well as motivating people to provide security for the system.
Bitcoin mining is the process by which new bitcoins are created and transactions are verified and added to the public ledger, known as the blockchain. It involves solving complex mathematical puzzles using computer hardware, such as specialized mining devices called Application-Specific Integrated Circuit (ASIC) miners or graphics processing units (GPUs).
Here's a brief overview of how Bitcoin mining works:
Miners collect and validate recent Bitcoin transactions into a data structure called a block. Miners then compete to find a solution to a complex mathematical problem, called the proof-of-work algorithm, which is based on the block's content and the previous block's unique hash. The first miner to find the solution, or the valid hash, broadcasts it to the network. Other miners verify the solution, and if it's correct, they add the block to their version of the blockchain. The miner who found the valid hash is rewarded with a certain number of newly created bitcoins (called the block reward) and transaction fees from the transactions included in the block. The process repeats roughly every 10 minutes for each new block. Bitcoin mining serves two purposes: it creates new bitcoins in a controlled and predictable manner, and it secures the network by validating transactions and maintaining a decentralized consensus.
The mining process is designed to become more difficult over time as the total number of bitcoins in existence approaches its maximum limit of 21 million. This increasing difficulty helps maintain the 10-minute block interval and ensures that the network remains secure as more miners join the system.
It's important to note that Bitcoin mining consumes a significant amount of electricity, which has led to concerns about its environmental impact. Consequently, there is ongoing debate about potential changes to the mining process to make it more energy-efficient or to explore alternative consensus mechanisms.