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.
10 Answers
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!
mining is doing the work of finding nonce so that sha256(sha256(data+nonce)) < difficulty
where
- 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.
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 number of bitcoins that can be claimed decreases by half every 210,000 blocks in what is known as "halving".
The Bitcoin system uses the mining process to generate coins, secure transactions, and publish transactions.
-
21
-
22
-
10
-
2
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.
Miners maintain the immutability property of the blockchain. Proof-of-work makes it so that the cost to "undo" any mined transaction will grow with time. Miners get paid for this service: with block reward subsidy & user's transaction fees.
You can think of transactions as destroying bills and creating new bills of total same value. Nodes maintain a current database of active bills, and will reject a transaction trying to use an old bill. That's the double-spend check. It requires look-up / delete / insert operations with the UTXO database.
Popular belief is that miners get paid for the job of verifying and assembling transactions into blocks, but that is wrong. That is a job any node is capable of doing and it doesn't cost them much. Your RPi node can assemble transactions into a "block template", but it just can't fill in the 1 blank that will satisfy the last consensus rule it needs to satisfy to be a valid block - the PoW difficulty check. That's why you can't simply kick out one block and replace it with another, because finding that nonce takes time. PoW's purpose is to increase the cost of undo.
Miners get paid for the job of filling in the nonce that will produce a satisfying block header hash, they get paid for the hashes because the only way to find a satisfying nonce is to make lots of guesses and hash the guesses. The network essentially bids for the hashes with block reward subsidy and users bid for the hashes with their transaction fees, and the more total reward the more secure the whole network becomes* since the cost of "undoing" a block will be bigger because difficulty will grow higher. (*assuming constant price)
Each transaction is a business transaction with a miner, they're the recipient of the implicit output (the fee), which is a payment from user for the service of maintaining the immutability property of the ledger! Of course miners would include their own business transactions into blocks they create!
During the early days of Bitcoin, nodes did all these jobs:
- Verified incoming transactions and blocks
- Made their own transactions and broadcast them to the network
- Assembled transactions into a block template (full block, with just the nonce missing)
- Filled in the nonce to make the block header pass the PoW check
Since then, the jobs have been separated.
Now it's mostly pools who do 1-3, and "miners" are just blindly doing the 4.: getting 80 bytes of block header from the pool and grinding the nonce. How do the miners verify what they're mining? Well, they have to get paid eventually, right?
Miners get paid their reward from the pool, so to independently verify they're getting paid correctly in proportion to their work, they also need to have some regular node, which can be off-site and doesn't need to be involved in mining! In that case they run a node to verify they themselves got paid for some past work in the right currency! This gives pools the power to direct hash-power of many as they like, but the pool can't really hide what they're doing, so everyone's on good behavior.
Note that "miners" are not exclusive to a single blockchain network. All Bitcoin miners are sha256d miners, but not all sha256d miners are Bitcoin miners! The era of one blockchain is long gone. Networks bid for the hashes, miners sell the hashes.
What happens if a subset of nodes changes the rules? All nodes under old rules will reject changed rules, and all nodes with changed rules will reject old rules. This happened in 2017 with the BCH fork. If both will be mined, then both will continue to exist independently. Which will get more hashes? It will depend on market price.
Miners pay for their energy usage and hardware in some external currency, they have to exchange it to pay the bills. If they can exchange the blockchain's native currency (BTC, BCH) for the cost currency (USD, CNY), and still have something left -- then they can make a profit. Their profit depends on there being liquidity for the native currency and the native currency having value! So they don't just arbitrarily decide which network to mine. They have strong incentive to get a ROI on their hardware, and optimal mining is to mine ALL networks which have a liquid market for the rewards, and in proportion to market value of their block rewards.
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.
-
11. Bitcoin mining does not involve “solving complex mathematical puzzles”. It involves making an astronomical number of attempts at guessing a number that leads to a valid block. 2. GPU mining has not been profitable in Bitcoin since ~2013. 3. Mining doesn’t validate transactions, every node validates transactions when they add them to their mempool. Miners just build blocks from what is in their mempools.– Murch ♦Commented Oct 20, 2023 at 20:12