He does not.
He’s got no option but to randomly figure various amounts until he receives the ideal hash. Whichever miner handles to perform so first gets his cube inserted into the blockchain.
As stated by the Bitcoin protocol, this entire procedure should take approximately ten minutes. As there are always new miners with various quantities of computing power, the amount of all zeros required will occasionally change.
Additionally, it plays an very important role — it ensures that the integrity and security of the whole system.
How can it do this?
Well, because every block includes the hash of the final block because its header, even 1 change to a single personality in any of those trades would lead not just to some change in the block’s hash — but into each and every block in the series.
That usually means that if a person would like to change a trade, they’d need to recalculate each and every block which arrived before, that might need an impossible level of calculating power. Additionally, it usually means that every time a new block is inserted, the blockchain gets more protected.
Suppose Alice has an online store that takes Bitcoin payments. Bob comes to her site and places the order for an iPhone. If Bob selects Bitcoin because the payment choice, Alice would, obviously, await the payment verification prior to sending the iPhone.
But due to the manner blockchain functions, Bob could attempt to defraud Alice by initiating two trade messages with the identical touch — one where he sends the money to the Alice, and the other where he sends himself in another address.
After Alice sees the trade message sending her money, she’d send the item. But in the event the trade where Bob sends himself that the money makes it on the blockchain prior to the legitimate trade, then that is the one which’s likely to go through — so Bob ends up becoming his iPhone at no cost.
This makes it look like Alice were clever, she would not ship the iPhone shortly after the trade was broadcast; rather, she’d wait till it is about the blockchain.
But really, not even that’s great enough.
This is only because sometimes, more than 1 block is inserted at one time, developing a fork at the series. In these examples, another miner who completes a block may select which branch he would like to put in to. Pretty fast 1 branch will end up longer than another. While this occurs the shorter branch is dumped, and all of the trades on it are reunite into the mempool.
As a result of this, it’s suggested to wait for six blocks to be inserted into the series before contemplating a trade complete. The trades which have been recently introduced to the blockchain are occasionally known as hot trades.
But let us look at another hypothetical: What if Bob was able to make two divisions, with a single block comprising the valid trade, and another the deceptive one? And he added into the fraudulent one in exactly the exact same speed other miners added into the one. Alice, viewing the branch together with the legitimate trade increase, would find a false sense of safety, causing her to ship the iPhone. Finally, however, Bob can create his series more, sending the valid trade back into the mempool. Since it has the exact same signature as the deceptive trade, if it has picked up again, it is going to be considered invalid.
However, in fact, it is impossible.
This is only because it requires computational ability and time to resolve and include a block. In spite of a remarkably strong chip, so as to pull of the stunt Bob would have to control over half CPU over the Bitcoin network. That’s the reason why this idea may be known as a 51% assault.
In fact, the branch together with the legitimate trade could wind up longer, along with the deceptive trade would get dropped back into the mempool. From the time it gets picked up by the other miner, since the signature was used at the legitimate trade, it could be considered invalid.
All that said, even though Bob did manage to acquire control of the system, the period of resources and time it would require to cheat the machine just is not worthwhile. He’d make more Bitcoin just mining based on the principles.