Bitcoin Forum

Other => Beginners & Help => Topic started by: ulhaq on February 27, 2017, 06:43:09 AM



Title: transaction times vs. time to generate new blocks
Post by: ulhaq on February 27, 2017, 06:43:09 AM
If new blocks are created every 10 minutes, how does that fit with transactions that are supposedly occurring near-instantaneously?

Eg, I was reading about the Subway in Allentown, PA, that accepts bitcoin. They use a QR code with the amount of the transaction preloaded and their address. The customer pays with their smartphone. The experiences I have heard is that the subway receives confirmation within seconds of the transactions, gives the customer the food, and moves on. So what is actually happening here?

Let's say at the time of the transaction that a block was created a minute earlier and so the next expected block is in 9 minutes. Presumably the money does not exchange hands for another 9 minutes. So what confirmation is the subway receiving and who is sending it?

As another point, how easy is it to fake the transaction?


Title: Re: transaction times vs. time to generate new blocks
Post by: odolvlobo on February 27, 2017, 07:22:02 AM
A transaction takes only a few seconds to be propagated around the world. It takes at least an average of 10 minutes to be confirmed (i.e. added to a block), but the receiver can choose to not wait for a confirmation. There is a risk in not waiting because there is always a chance that a transaction may never be confirmed; however,  the receiver can examine the transaction and may decide that the risk is low.


Title: Re: transaction times vs. time to generate new blocks
Post by: DannyHamilton on February 27, 2017, 07:25:50 AM
As another point, how easy is it to fake the transaction?

That depends on how careful the recipient is.  Regardless, faking a transaction is theft, and you can be prosecuted for that.  Do you really want to risk a criminal record so you can steal a sandwich from Subway?  

If new blocks are created every 10 minutes

They are not.  The protocol is designed to keep the long term average near 10 minutes.  The process is random, and it is entirely possible to have multiple blocks in a few seconds, or more than an hour between blocks.

how does that fit with transactions that are supposedly occurring near-instantaneously?

When you send a transaction, it is broadcast to all the connected peers on the network. Those peers all validate the transaction and then broadcast it to their connected peers.  Those peers validate it and broadcast it to their connected peers. And so on until nearly the entire network is aware of and has validated the transaction.  This process typically takes a couple of seconds.

Then all the full nodes keep the transaction in their memory pool rejecting and refusing to relay any competing transactions while they wait for a miner to confirm the transaction into a block.

So, the transaction is transmitted, validated, and known by nearly the entire network within just a few seconds.

Eg, I was reading about the Subway in Allentown, PA, that accepts bitcoin. They use a QR code with the amount of the transaction preloaded and their address. The customer pays with their smartphone. The experiences I have heard is that the subway receives confirmation within seconds of the transactions, gives the customer the food, and moves on. So what is actually happening here?

You have heard incorrectly.

Subway does not receive "confirmation" on the transaction within seconds.  What they do receive is a validated copy of the transaction from the peers that they are connected to.  Then they decide if they want to trust the transaction and the customer.  If so, then they can hand over the food.  If they decide not to trust the transaction, then they could wait for confirmation (which could happen soon, or could take quite a while).

One thing EVERY business has to do as part of operating a business whether they realize it or not is manage risk.  Accepting cash has some risk of receiving counterfeit bills without realizing it.  Accepting credit cards has some risk of accepting stolen credit cards without realizing it.  Accepting bitcoin has some risk of an unconfirmed transaction being invalidated before it confirms.  Businesses determine which risks they are willing to accept in the interest of improving the experience for their customers.  If one out of every 10,000 sandwiches sold with bitcoins results in a theft, perhaps that risk is worth it to increase sales?  If too many transactions are being invalidated, then there are steps they can take to reduce that risk.

They could make sure that the transaction paid a sufficient fee, and if it didn't then require the customer to either pay again with a proper fee or wait for confirmation.
They could connect to many peer nodes and make sure there are no competing transactions, and if there are then require the customer to wait for confirmation.
They could contract directly with large mining pools to have their transactions prioritized.
They could require the customer to provide identifying information that could be used to send the police after them (or at least to deny service to the customer in the future).

Let's say at the time of the transaction that a block was created a minute earlier and so the next expected block is in 9 minutes.

It doesn't matter when the previous block was created.  The AVERAGE time until the next block is always about 10 minutes.

Presumably the money does not exchange hands for another 9 minutes. So what confirmation is the subway receiving and who is sending it?

That depends on what you mean by "money changes hands".  The transaction is already sent and already seen within a few seconds.

Confirmation is a term that (in bitcoin related terminology) means "included in a block on the bitcoin blockchain".