I have question regarding mining process and stratum protocol. I need for my lab to implement simple cpu miner in Node JS. I've found some info regarding ethash, and some steps. But there's no info regarding interaction with pool. Is every calculated hash must be submitted to pool or only valid hashes? Who makes PoW check, mining client or pool? How's pool calculating miners speed if only valid shares are submitted?
There are different approaches, so there's no single solution.
You can define a difficulty per miner so you are sure that the miner will send 6 solutions per minute, or 1 block each 10 seconds. And take the averange difficulty of those blocks as the miner contribution to the pool.
A miner with more hash power will be able to solve blocks with a higher difficulty, and will contribute more to the pool.
You want to achieve a balance in the communications between the pool and the miners. Lots of messages means higher bandwidth, but you want the miner always have the more recent blocks so they work is useful.
The verification of a solution is fast, so the pool should always verify the solution reported by a miner is valid.