For pool mining, what exactly is a share?
Can someone please explain exactly what a share is in the context of pool mining? I have a superficial understanding of testing random nonces to find a hash under the current difficulty. I also understand that mining pools set a custom easier difficulty to target a relatively easy to attain share difficulty (~10 minutes).
What I don't understand is how those shares translate to finding real blocks. Say one out of a thousand shares is a valid real new block. Why wouldn't miners just submit that hash themselves, and send the rest of the easier shares to the pool?
I'm sure I have a fundamental misunderstanding, but can't figure out what it is. I guess somehow the pool has some secret that it can combine w/ the submitted shares to see if that share matches a block, but that is a guess.
Any help would be greatly appreciated.
You guess right, as a pool client you can't figure if a work package contains something valuable. Only the pool knows and is the real client of the Ethereum network. You only do blind computation.
THis is not an answer but more on the question, I might have misunderstood the responses but no one layed out what a "share" is exactly. I know its a piece of work submitted but what value does it have and what kind of work is it, for it to be useful to the pool or the block being found.
Lots of answers here, but none of them has actually answered the question "what is a share?"
In almost all mining pools, a share is a block "solution" not quite good enough to be published as an actual block, but still good enough that it's really hard to find them. This means that shares can be used to measure how much work you're doing, but just with much finer and more consistent granularity than actual block solutions, which are far too rare for small miners.
So, just as an example, suppose that the current difficulty was 10,000. To become valid blocks, an attempted block with a specific nonce has to be "better" than 10,000. In this situation, the pool might set their "share difficulty" at 100. So with each nonce you try, your software will check to see how "good" the difficulty of the resulting block is. Most of these blocks will be below 100 in "difficulty level", but a small amount of them will be over 100 in difficulty level (and still less than 10,000). These "better than 100 but still less than 10,000" blocks are the ones we're calling the "shares". They can be sent into the mining pool, even though they aren't good enough to be published on the open network as actual blocks. Inside these shares the mining pool will be clearly marked as the recipient of any potential block reward, which means that the mining pool can use the number of shares you submit as unfakeable evidence of how much work your machine is doing to try and find blocks for the pool, even if you've never found one yet. Which is good, because it takes forever to find actual blocks.
As you mine along, happily submitting shares, then every once in blue moon you will come across a solution that is not only good enough to be a share, it's actually good enough to be a real block! That is, it has difficulty "over 10,000" and so it meets not just the share criteria but the full network standard of difficulty, which is much harder. This one you would still submit to the pool, but when they get it they will go ahead and publish it out over the actual network, receiving a nice fat reward that gets distributed amongst everyone according to the shares they've been submitting. Of course, these aren't real numbers, and most software works by just telling your machine to look for blocks over 100 and not worry about what the network difficulty is. But still, we can see how someone who isn't doing actual mining would never be able to find any shares in the first place, which means this is actually reasonably secure from the pool's perspective as a way of measuring how much work everyone is doing.
I've glossed over a lot of details here, because there are some subtle tricks the pool needs to be careful of (block withholding attacks anyone?), but that in a nutshell is what shares actually are: totally normal blocks that don't meet the full requirements to be published on the network, but still meet some smaller requirement set by the pool to count as proof you're mining with the pool set as the recipient.
Now, why can't the miner just submit any actual blocks themselves to take the whole reward? Two reasons: first, in order for their shares to be valid they have to have the pool set as the recipient, so the mined block already gives the reward to the pool no matter who broadcasts it, and second (as indicated by zanzu) the pool doesn't actually bother giving the whole block out to miners, just a template for the header that contains the hashes of the actual block contents).
What the miner could do is secretly throw away the valid block instead of sending it back to the pool. That would hurt the rest of the pool more than the miner because only a small portion of the reward from it would have actually come back to them, and for a bunch of complicated game theory reasons this could maybe result in an advantage if the same miner also had a lot of other mining power not on the pool at all. (This is the "block withholding attack" I mentioned above). But it starts to be noticeable in the statistics if you do it a lot, and also it doesn't provide any benefit to the typical small-time miner. So these attacks are presumed to be fairly rare. There are certain types of reward schemes that are more or less resistant to the strategy, but most people don't seem to be very concerned about these attacks in general. So all in all the basic "share" strategy is pretty much good enough.
TL;DR: shares are "failed blocks" that a pool uses as evidence of a small miner's participation.
So why wouldn't a small miner set each worker to a very low "share difficulty" of 10 for example? Doesn't this make it seem to the pool that my worker is contributing more shares?
@Gaia I am also trying to figure this out. So far I keep my rig on 24/hrs but I see no entries in my wallet. I have mined nearly 800 shares. Is that not enough?
@Gaia The pool calculates how much each share is worth. So if supposedly you are mining at difficulty of 10 and you sent 20 in a single round that means you have a total share value of 200. Where as other miners are mining at difficulty of 100 and they only sent 2 shares at the same round then that has a total share value of 200. The pool doesn't only count how many shares you sent but how much is the worth of your every share is.
Participants in a mining pool only receive the parameters (block header parameters, etc..) required for them to compute the POW. However, as illustrated here, a block also includes a Merkle-Patricia state trie, a transaction Merkle tree, and a receipt Merkle tree. The pool miners do not have (and do not need) these tri/ees while attempting to compute the POW.
Consequently, only the pool master has the full dataset required to submit a new block to the blockchain once one of the pool miners has (semi-blindly) computed the solution to the POW.
zanzu accurately describes the architecture that prevents pool miners from controlling the work delivered to the pool, but to answer your question:
What exactly is a share?
A share is the miner's portion of the reward block that is (generally) proportional to the amount of work they contributed to the overall effort of mining that individual block. This is oversimplified, but say it took 1,000 Mh to mine the block and I contributed 25 Mh/s over 2 seconds so I provided 50 Mh to the overall computation, then my share of that reward is (50 / 1,000 == 0.05 == 5%).
NOTE: this is in a PPS scheme (pay-per-share)
PPLNS (Pay Per Last N Shares) is a bit different, since some luck is involved.
The differences between the two are outlined on From MinerGate:
Pay Per Last N Shares is what PPLNS stands for.This method of calculating payouts includes a "luck" factor. Using PPLNS your payout per share will have a large range(30% more or less on your payouts), but on average, PPLNS earns more than PPS (by 5% or so) in the long run (a month or more).
PPS is also known as Pay Per Share. It is a more direct method where you get a standard payout rate for each share completed.This method eliminates the "luck" in your payout, but can decrease your total income per share by around 5%.Using PPS you get a set number of cryptocoins per share of work you have solved. It has no luck involved so the payouts do not fluctuate.
To mine a block mining pool, you need to find a "good" nonce for the header.
The header includes a field "beneficiary", which has to be set to the account to receive the block reward.
If the beneficiary was not set to the mining pool address, then all my "bad" nonces cannot be turned in as "shares".
If I find a block for the pool, I can't go and simply rewrite the beneficiary, as this would invalidate my nonce!