# Concept of Validating Transactions

Trying to get my head around Bitcoin. Been watching tutorials, unsure if I still understand

Alice wants to send Bob 5 Bitcoins

Alice hashes the transaction with 5 Bitcoins and send's it to Bob's mailbox, i.e his Public Key

What is the job of the Miners?

Before the transaction get added to a public ledger (i.e blockchain) do the miners validates that Alice has 5 Bitcoins to give (based on info in public ledger) by recreating the hash.

And if validation is successful, the miners earn Bitcoins, the transaction is added to Blockchain, and Bob gets his 5 Bitcoins.

Is it true that validation takes about 10 minutes or so?

Really, I've been struggling with this concept.

Thanks!

## 1 Answer

First off, Alice doesn't hash the transaction as part of validation. The hash Alice produces is simply a hash of the transaction, which is how transaction IDs are created. In truth, anyone participating in the network could hash the transaction body and arrive at the same hash. It is when the miners hash an entire block of transactions that hasing is part of the validation process.

Secondly, Bob doesn't have a "mailbox". That's not what his public key is. The blockchain is a public ledger, so Alice isn't sending the transaction to just Bob, she's announcing it to everyone. Bob can see this transaction, just like everyone else, and now has to wait for a miner to include it in a block.

Miners create blocks of transactions, and they have to create them in such a way that the rest of the network will accept them. One of the requirements is that the transactions in the block are all valid transactions. So yes, miners will validate that Alice has 5 bitcoins to give before they add the transaction to a block. If the miner cheats, and puts an invalid transaction into a block, then the rest of the network will reject that block, and the miner would have wasted their time doing the proof of work on that block.

The 10 minutes is a product of the proof of work algorithm. It is retargeted every 2,016 blocks such that on average, it takes the entire network 10 minutes to construct a block whose hash is lower than the target value (starts with a certain number of zeros). It is not a single transaction that takes 10 minutes to validate, but the construction of the entire block of transactions with the required proof of work.

Once a block with the proper proof of work has been found, it is broadcast to the network, which will accept it if the block meets all criteria. After that, Bob can see that a transaction to the public key he supplied to Alice has been included in a block. This is called a "confirmation". Once another block is mined on top of that block, the transaction is said to have 2 confirmations, and a block later, 3 confirmations...and so on.

Here's some other answers you may want to read:

What exactly is Mining?

What is proof-of-work?

• `The hash Alice produces is simply a hash of the transaction, which is how transaction IDs are created` You mean Alice's signature creates the transaction ID? Nov 8, 2016 at 18:52
• @Rhonda, no. The hash cannot contain the signature, because the signature signs the hash. This gets complicated in bitcoin. What you should focus on is understanding the proof of work system, and not get so caught up in the details. Make sure you know what a hash is, a signature is, a key pair is, a nine is, and a Merkel tree is. Then rewatch those tutorials, and you'll probably understand better. Nov 8, 2016 at 19:00
• Wow, haven't heard of a nine ... will re-watch tutorials. Thank you! Nov 8, 2016 at 19:03
• Whoops...that should say "nonce". Sorry, autocorrect. Nov 8, 2016 at 19:05
• Ah, ok then. Will mark question `answered` in this case. Nov 8, 2016 at 19:18