# How resolving nonce validates transactions?

I'm going to explain a bit more about my question, by talking first about what I understand about blockchain and transaction in a decentralized network. Correct me if I'm wrong somewhere.

• In a decentralized network, every node has a copy of the ledger. If node A sends to node B an amount of bitcoins, he does it by broadcasting a message containing [sender - receiver - amount] together with a digital signature. Every other node in the network verifies the message with the signature, and if they (or the majority of them) consent that it is correct, the transaction is written into the ledger. Note that a node is not necessarily a miner, and here, to verify a message is no other than to compare 2 hashes.
• Miners validate transactions/blocks by solving a math problem which is to find nonces.

So my question is, what is the link between these 2 things? If nodes in the network are enough to verify transactions, why do we need miners? When do miners enter in the game of validating transactions? And how come that to verify transaction is relied with to find a nonce?

So my question is, what is the link between these 2 things? If nodes in the network are enough to verify transactions, why do we need miners?

Suppose Alice forms two valid transactions, one sending a bitcoin to Bob and another sending the same bitcoin to Charlie. Without the miners, how can Bob or Charlie ever know which of them gets to keep the bitcoin?

And you might think that if Alice does that, well, neither Bob nor Charlie will assume they get to keep the bitcoin and Alice just played herself. But that won't work. Say Alice is buying a phone from Bob and Bob only sees the transaction giving him the bitcoin. Without the miners, how can Bob be assured that nobody will ever see a transaction from Alice giving that same bitcoin to someone else and decide that Bob didn't get a bitcoin from Alice. How can Bob ever send Alice her phone if he can never be sure the transaction to Charlie will never be accepted by anyone?

When do miners enter in the game of validating transactions?

Miners produce a blockchain that eventually contains only one of those two transactions, allowing Bob to know for sure that he will get the bitcoin from Alice and nobody else will.

And how come that to verify transaction is relied with to find a nonce?

It has to take some significant amount of work to build valid blocks, otherwise a massive number of valid blocks could be created and Bob would never be finished trying to figure out which of them would be accepted. By making it extremely expensive to create a valid block, Bob only has a small amount of work to do and an attacker can't create large numbers of valid blocks to stymie him.

• So you say the point of miners is to avoid double-spending. Why can't we just put a timestamp to each transaction and the one that is created first is valid and the other one is rejected? Feb 17, 2022 at 10:55
• And if I understand correctly, the purpose of mining - or solving the hashing problem - is to ensure that blocks are enchained in the blockchain one by one, each after 10 minutes in the case of Bitcoin? Feb 17, 2022 at 11:38
• @HiImEins Yes, we can - arguably that is exactly what miners do: provide a decentralized timestamp on transactions (= the time of the block they end up in). You can imagine alternative sources of timestamps, but they inevitably rely on some trusted party's clock (because just because you see transaction A before transaction B does not mean that everyone sees them in the same order; communication takes time, and distance to the source is subjective). Feb 17, 2022 at 13:33