Bitcoin Forum

Other => Beginners & Help => Topic started by: litehacker on January 04, 2013, 01:12:13 AM



Title: Please help me understand mining.
Post by: litehacker on January 04, 2013, 01:12:13 AM
1. From what I understand, bitcoin miners find a hash code. For each hash code they find they are rewarded 50 BTC. (Now it's 25 BTC and it will continue to decrease at an exact rate.) How exactly are these newly found hash codes converted to bitcoins?

2. In the weusecoins bitcoin video, it was said that 'every transaction is verified by a miner.' I'm not sure of that was an analagy. From what I understand, miners just find hashes. I thought everyone in the network verfies the transaction, not just miners. Is this correct?


Title: Re: Please help me understand mining.
Post by: DeathAndTaxes on January 04, 2013, 01:16:26 AM
Miners don't just find hashcodes.

Miners solve blocks.  They take unconfirmed tx, validated them, pack them into a block and then find a hash which "solves"* the block.  As part of the block creation they are allowed to add a special coinbase tx which mints a certain number of new coins (it was 50 and now is 25) called the block subsidy along with any tx fees included in the tx which are part of the block to an address the miner/pool controls.  This serves two purposes, first it provides a financial incentive to keep the network secure and second it slowly increases the supply of coins.  Once a miner solves a block it broadcasts the block to other nodes who validate it and add it to the blockchain.  Miners then start working on the next block in the chain including more unconfirmed transactions and looking for a solution to that block.  The process never ends.  Miners ARE transactions validators.  Not only do they validate that transactions are valid the blockchain they produce provides a record which prevents someone from spending the same coins twice. The network is designed so that no matter how many miners there are one block will be found roughly once every ten minutes.   M ining is intentionally difficult to make it very very expensive for someone to try and rewrite history.  Without miners the coins would have no value.   People could spend the same coin over and over and over, not just twice (double spend) but hundreds or thousands or millions of times.  If you could spend the same dollar bill a million times you likely wouldn't need any more money.  :)  If everyone could do that then a dollar would be worthless.   Without miners there are no blocks, without blocks there is no blockchain, without the blockchain the coins have no value.

TL/DR version:
Miners secure the network.  Miners validate transactions and create the permanent record (the blockchain) which prevent double spends.



* By "solve" the miner must randomly try hashes to find one which is smaller than the target which is based on current difficulty.  difficulty adjusts every 2016 blocks in order to make the process of solving a block harder or easier and thus keep the generation rate roughly stable.


Title: Re: Please help me understand mining.
Post by: litehacker on January 04, 2013, 02:08:14 AM
If the amount of bitcoins will stop at 21 million, when the system reaches that limit, won't the miners stop mining?
Miners are supposed to keep this whole thing running, right? Am I missing something here?


Title: Re: Please help me understand mining.
Post by: 21after2 on January 04, 2013, 02:09:54 AM
If the amount of bitcoins will stop at 21 million, when the system reaches that limit, won't the miners stop mining?
Miners are supposed to keep this whole thing running, right? Am I missing something here?

Nope, you're not missing anything. That's one of the worries about the future of BTC. It seems that transaction fees will have to become more common to encourage miners to keep up the network. That's my understanding of the bit I've read about it, at any rate. I'm sure more knowledgable board members will provide a better response.


Title: Re: Please help me understand mining.
Post by: litehacker on January 04, 2013, 02:27:46 AM
What? Transaction fees are optional by the sender correct?
You are saying that people will be voluntarily adding transaction fees in the future, or otherwise be at risk of miners not supporting them?
People currently try to stop transaction fees. A lot of them don't understand why they are there..


Title: Re: Please help me understand mining.
Post by: 21after2 on January 04, 2013, 02:33:04 AM
Transaction fees are optional now, but there will be no incentive to mine once all the BTC has been mined except for the purposes of earning transaction fees. Some miners may not feel that the small amount of fees to be worth the effort. A lot of people try to speculate how this will be worked around. You might be able to find more info on the wiki as well.


Title: Re: Please help me understand mining.
Post by: odolvlobo on January 04, 2013, 03:52:25 AM
Mining is the process of adding transactions to the official record, the "block chain". When a miner adds a "block" of transactions, she gets the reward plus the fees. The hash that miners compute is part of the process of adding a block. Miners compete to be the first to find an acceptable value that allows them to add the block to the block chain. Adding a block is intentionally made more difficult so that a block is added every 10 minutes on average, no matter how many miners there are.

Miners can also exclude transactions with no fees attached. So, in order to make sure that your transaction goes through, you will want to pay a fee even though you don't have to.


Title: Re: Please help me understand mining.
Post by: mitty on January 04, 2013, 03:54:38 AM
I think the basic idea right now is that larger transactions (such as ones that send coins from/to multiple addresses) should include a fee due to the fact that their larger size makes them propagate through the network slower than a smaller transaction, and that they take more resources (i.e., disk space) to store.

Miners can choose which transactions to include in a block, and a transaction needs to be included in a block to be confirmed.  A block has a specific size limit, so miners would most likely choose which transactions to include based on the transaction fee amount if the currently unconfirmed transactions are larger than the maximum allowed block size.

Higher transaction fee = associated transaction confirmed more quickly due to higher incentive to include in block.

Mining is required to keep Bitcoin working, and no one will mine if there's no financial incentive to do so.  Therefore, transaction fees will essentially be required once the block reward significantly diminishes.


Title: Re: Please help me understand mining.
Post by: DeathAndTaxes on January 04, 2013, 04:06:06 AM
What? Transaction fees are optional by the sender correct?
You are saying that people will be voluntarily adding transaction fees in the future, or otherwise be at risk of miners not supporting them?

You can voluntarily pay a tx fee now or otherwise be at "risk" of a miner not including your tx in the next block.  It is freedom on both sides.  You are free to not include a fee, or choose the amount of the fee to include and likewise miners are free to choose which tx to include in a block.  A miner can (and some do) refuse your tx if it has no or insufficient fee.  Now most miners are rational and know that while the subsidy exists it makes sense to create value for the overall network and thus will include free or low paying transactions but many limit how many free transaction they include in each block.

Over time the subsidy will decline and tx fees will rise.  The goal is for the network to be supported completely be fees eventually.   One way to look at it is that the subsidy is a form of indirect fee.  It is additional coins added to the "coin supply" and thus they devalue the existing coins.  1% more coins (making all your coins worth 1% less) has the the same economic effect as paying 1% in fees for the year.


Title: Re: Please help me understand mining.
Post by: RyNinDaCleM on January 04, 2013, 04:28:32 AM
What? Transaction fees are optional by the sender correct?
You are saying that people will be voluntarily adding transaction fees in the future, or otherwise be at risk of miners not supporting them?

You can voluntarily pay a tx fee now or otherwise be at "risk" of a miner not including your tx in the next block.  It is freedom on both sides.  You are free to not include a fee, or choose the amount of the fee to include and likewise miners are free to choose which tx to include in a block.  A miner can (and some do) refuse your tx if it has no or insufficient fee.  Now most miners are rational and know that while the subsidy exists it makes sense to create value for the overall network and thus will include free or low paying transactions but many limit how many free transaction they include in each block.

Over time the subsidy will decline and tx fees will rise.  The goal is for the network to be supported completely be fees eventually.   One way to look at it is that the subsidy is a form of indirect fee.  It is additional coins added to the "coin supply" and thus they devalue the existing coins.  1% more coins (making all your coins worth 1% less) has the the same economic effect as paying 1% in fees for the year.


With the newer clients, isn't there a minimum amount of time the coins must sit to have that option? It may be the size of the payment, though I recall reading something like 8 days, or a number of blocks or something. I occasionally make a payment and am forced to pay a fee (BTC0.0005).  It's a very cheap fee at anyway. By far cheaper than any other payment method.


Title: Re: Please help me understand mining.
Post by: DeathAndTaxes on January 04, 2013, 04:32:49 AM
There are anti-spam rules but the rules are somewhat complex so I left them out of the basic economics.  The anti-spam rules really aren't intended to benefit miners, they are more to protect the network from denial of service attack (generating terabytes upon terabytes of transactions by sending tiny amounts back and forth between addresses).

The complete mandatory fee rules are here:
https://en.bitcoin.it/wiki/Transaction_fees

The simple version is
"one bitcoin day".  If the input for your tx (the output doesn't matter) is one bitcoin day old it can avoid the anti-spam rule.  So if you receive 1 BTC you could spend it without fee in 1 day.  If you received 10 BTC you could sepnd it in ~2.4 hours without a fee.  If you received 0.1 BTC you could spend it in 10 days without a fee.  If your coins are too young you can either pay the mandatory fee, send it anyways using a hacked client (and hope someone includes it in a block) or wait until the coins are older.


Title: Re: Please help me understand mining.
Post by: RyNinDaCleM on January 04, 2013, 04:36:10 AM
There are anti-spam rules but the rules are somewhat complex so I left them out of the basic economics.  The anti-spam rules really aren't intended to benefit miners, they are more to protect the network from denial of service attack (generating terabytes upon terabytes of transactions by sending tiny amounts back and forth between addresses).

The complete mandatory fee rules are here:
https://en.bitcoin.it/wiki/Transaction_fees

The simple version is
"one bitcoin day".  If the input for your tx (the output doesn't matter) is one bitcoin day old it can avoid the anti-spam rule.  So if you receive 1 BTC you could spend it without fee in 1 day.  If you received 10 BTC you could sepnd it in ~2.4 hours without a fee.  If you received 0.1 BTC you could spend it in 10 days without a fee.  If your coins are too young you can either pay the mandatory fee, send it anyways using a hacked client (and hope someone includes it in a block) or wait until the coins are older.

Ahh, yes! Thank you!