8

Bitcoin Monitor offers to issue a notification moments after a payment is sent to a Bitcoin address. Yet if Bitcoin transactions require ~10 min to get written into the blockchain and confirmed as official, how can payments get recognized within moments?

On the other hand, Bitcoin.network requires payment via Bitcoin before making the blockchain available for downloading. It publishes a download URL seconds after a payment is made. How can the site be sure the payment is legitimate. How does it know the payment has been made only a few seconds after payment is sent?

10

When you create a transaction, your Bitcoin wallet broadcasts it to a few full nodes on the Bitcoin peer-to-peer network. Those full nodes quickly relay it to other full nodes, and it eventually ends up at the full nodes run by the sites you linked to. That's how those sites know the transaction exists.

The full nodes also relay the transaction to Bitcoin miners. Each miner may choose to include your transaction in a block of transactions. (Miners usually choose to include the transactions that pay the highest transaction fees per kilobyte of transaction data.)

Miners have to solve a sort-of random puzzle---whichever miner solves it first can include proof they solved the puzzle in their block of transactions and send that block to full nodes. Those full nodes relay the block to other full nodes and eventually the block ends up at the full nodes run by the sites you linked to (and to the wallet of the person you paid).

The puzzles are very hard to solve, so a block with proof of a solved puzzle is hard to fake. This means any transactions in that block are considered hard to undo. Also, the next block has to point to the previous block, so it would then require solving two very hard puzzles to undo the transactions in the block containing your transactions. And it keeps getting harder and harder each time a new block is created.

As you may have guessed, it takes an average of about 10 minutes of puzzle-solving by all miners before any particular miner solves a puzzle, so it takes about 10 minutes on average for a transaction to be protected. Up until that point, you could create a duplicate transaction that steals back the money you spent---so nobody trusts high-value transactions until they appear in at least one block (and more blocks are better).

P.S. Newbie questions are always welcome!

  • thanks! i'm aware of the basics, so sorry for not making the question clear. how is that these sites can know the tx happened after a few seconds -- instead of ~10 min? – Crashalot Jan 18 '15 at 2:58
  • 1
    That's explained in the first two sentences of the answer. – David A. Harding Jan 18 '15 at 3:09
  • ok, thanks. and that initial propagation takes only a few seconds? is that lag time in any way dependent on the size of the blockchain (e.g., it will increase over time)? so basically those sites are monitoring the full nodes, as in those sites are scanning all new transactions for ones relevant to their sites? thanks again! – Crashalot Jan 18 '15 at 3:23
  • to clarify, those sites are taking a risk by recognizing the transactions so quickly (i.e., before they are confirmed)? they are betting buyers do not reverse the transaction, but this could happen, right? thanks again for your help! – Crashalot Jan 18 '15 at 3:25
  • Monitor sites aren't risking anything themselves. Users who trust unconfirmed transactions are at greatly increased risk of a "reversal" (called a double spend in Bitcoin jargon). This site has transaction propagation times. Propagation time is not correlative to the size of the block chain, but it likely does correlate to the size of individual transactions and blocks. Over time, we expect prop. time to decrease as people get better connections and the Bitcoin network protocol matures. Yes, those sites are scanning all new transactions. – David A. Harding Jan 18 '15 at 3:40
2

I think David ilustrated very well how things works, but I feel your question was not fully answered since you asked about time. So I will try to complete the answer above.

As David said in the previous answer, when you send a payment (or transaction), somethings happen at first: the sending of the transactions to one or few nodes, the broadcast of that transaction to all nodes (including miners), the placing of that transaction on a block to be mined.

All this envolves many parties but it takes less then a second or, at most, a few seconds. At this moment, all the nodes (including mining nodes) must have your transaction in a pending state. In fact, the transaction is on what is called a mining pool. It is there, but it was not included in any block yet. As David said, only by including a transaction on a block, receiver of that transaction can be safe that you will not spend the money in other place.

SO, AT THIS MOMENT, EVERYBODY KNOWS ABOUT YOUR TRANSACTION, BUT IT IS NOT CONFIRME YET.

Then, mining takes place. Mining a block takes on average 10 minutes. If you paid a good fee for that transaction or if the mining pool does not have many transactions, your transaction should be included in the next block to be mined. And this will be done by all (or, at least, most) of the miners.

As David said, mining consists of solving a puzzle. You take a set of transactions (which forms a block) and try to find a number that comply with a predetermined rule (the puzzle). The original block plus this found number is what is called a mined block. When one miner solves this puzzle, it will broadcast the block with the solution and all other nodes (including other miners) will verify it and put the block in the chain. *

NOW, RETURNING TO ANSWER ABOUT TIME.

We have two scenarios to explain how your transactions were received so fast. First, it is possible that the party that received value from you, asked the network (which means, asked one of the nodes of the network) if your transaction was received and is on the mining pool. For very small payments, it can be enough to trust you will not try to spend this money again. And this can be very fast, can take less then a second or at most few seconds.

The second scenario is when the receiving party only consider the payment done when it is confirmed, which means, a block with your transaction is included in the chain. How long does it take then? There is the time your block sits on the mining pool waiting to be include in a block. And there is the minig time. When is said that the block is mined on average in 10 minutes, it means, statistically, that it can take an hour or few seconds. So, if you were very lucky, the block including your transaction started beeing mined soon after your transaction arrived at the mining pool. And was mined very fast. This could explain a fast confirmation. It can happen but it will be an exception.

(*) There are complications when two miners find the solution at the same time. Because of that, one transaction can really be categorized as confirmed only when six more blocks are put on the chain after the one that contains the transaction. But for transactions with value bellow $1000, it is safe enough to assume confirmation with just one block. For more on that see https://en.bitcoin.it/wiki/Confirmation

2

Let us firstly divide the stages of the transaction into 2 major categories for better understanding.

Stage 1: Initiation of the transaction (Mempool)

In this stage, ALICE (sender) broadcasts a transaction she made to BOB (receiver). This transactional detail is sent in the Mempool along with the specified feed that ALICE (or some mediating platform) is ready to pay to get that transaction mined.

Stage 2: Mining of the transaction (Blockchain)

In this stage, your transaction gets appended in the block that was last mined. This block is then added to the longest chain in the existent blockchain hence confirming the transaction.

Explaining the nuances further;

In your use case, you make a transaction on a mediating platform which provides you with a wallet. Now, this wallet is divided into two parts, the hot wallet and the cold wallet. The hot wallet is used to directly write data to the blockchain and the cold wallet is a de/centralized ledger that these mediators use to keep internal transaction records. Any internal transaction is hence instantaneously realized.

For external transactions, the complexity increases a bit.

Now, say you have 2BTC and decide to make a transaction to ALICE worth 1.5BTC. You make the transaction and broadcast it in the network. This will update your balance to 0.5BTC and provide ALICE with 1.5BTC. You both can see the updated transactional records in your wallets, yet are limited from withdrawing (re-spending) the stipulated amount until the transaction is realized, hence avoiding double spend.

From what I can understand, these websites often consider Mempool transactions as validation enough to confirm transactions at their level.

P.S. I'm still learning and this may not be the perfect answer to your question.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.