Can someone please explain:
In Bitcoin proof of work, mining is done to create and validate new blocks. Who becomes the sole block producer is subject to winning a "mining puzzle".
As I understand, the difficulty is that the solution of this puzzle must have a specific number of leading zeros in the resulting hash.
My questions are:
1) must the hashing result have X number of leading zeros, or is the constraint more like "less or equal X number of leading zeros"?
2) If the mining puzzle's solution has a hash as a result, what is then the input parameters for doing the hashing? What are the miners exactly hashing, what are all the input factors? As i understand, input factors are e.g. the Nonce, previous Block's hash, etc...
3) I understand a hash function is only one way function. You have an Input which produces a unique hash. This means that if multiple different parties are hashing the same input then their hash results must be identical, right?
Given this definition, I really do not understand how the situation of orphan blocks in Bitcoin can happen? Because orphans happen for example when 2 miners at the same time solve the mining puzzle. But both are solving the exact same mining puzzle right? This means, they both have dealt with the same difficulty level of the puzzle and arrived at the same number of leading zeros for their hash, right?
How is the blockchain then distinguishing between those 2 miners, who has "put more work into the mining" if they have solved the same thing? On which parameters is the network looking to determine which of the two miners should get the reward?
Thanks