Bitcoin Forum

Other => Beginners & Help => Topic started by: Automatic on November 27, 2013, 12:49:56 AM



Title: How am I, the payee, notified so quickly of incoming transactions?
Post by: Automatic on November 27, 2013, 12:49:56 AM
Literally seconds after sending a payment across the global, I'm notified of it. How does this work? There must be some sort of direct connection going on, and, not it just being relayed by randomized P2P connections.

So, how does it generate the quickest route to me? If we left it down to randomness, I'm sure it'd take at-least a minute, if not a whole lot longer, am I wrong?


Title: Re: How am I, the payee, notified so quickly of incoming transactions?
Post by: Foxpup on November 27, 2013, 03:03:40 AM
It doesn't generate the quickest route, or any particular route at all. When someone sends a transaction, it is sent to every peer that client is connected to, and every one of those peers relays it on to every peer that they're connected to, and so on, taking every possible route. Obviously one of those routes must be the quickest one.

That's not to say you can't set up a direct connection in order to guarantee that a fast route will always be available, but that simply isn't necessary for most applications.


Title: Re: How am I, the payee, notified so quickly of incoming transactions?
Post by: btcton on November 27, 2013, 04:44:21 AM
To add to the above post, even if it took the longest route to get to you, you would probably not notice any delay still. You can sort of compare it to websites. You can load a European website from Australia in less than a second without noticing the difference between that and a website located in your neighbor's house.


Title: Re: How am I, the payee, notified so quickly of incoming transactions?
Post by: Automatic on November 28, 2013, 04:11:36 AM
It doesn't generate the quickest route, or any particular route at all. When someone sends a transaction, it is sent to every peer that client is connected to, and every one of those peers relays it on to every peer that they're connected to, and so on, taking every possible route. Obviously one of those routes must be the quickest one.

That's not to say you can't set up a direct connection in order to guarantee that a fast route will always be available, but that simply isn't necessary for most applications.

So, I drew it out in paint to help explain it to myself (Not very good with P2P imagination, if I'm honest), and, I understand that. In the below picture I drew, where nodes are in a 'circle' (Obviously they geographically could be anywhere, and, connected to any node anywhere else), each node is connected to four other nodes, two to it's left, and, two to it's right. The originating node is red, the receiving node is green, the fastest route is blue, and, any 'extra' relays are black:-

https://i.imgur.com/JpWjrGH.png

Now, everyone should (in theory, am I wrong?) receive the same transaction four times, and, broadcast it off three times (Excluding the sender, who receives it zero times and sends it four times). Now, what if that happens, and, everyone is happy that all their 'connected' nodes know that this transaction exists, but, then a new node connects to the network BEFORE the transaction is put into a block? That means that it doesn't have to 'update' to said block, as, the transaction hasn't been placed into a block yet, but, everyone already thinks everyone else is aware of it.

So, they connect (Pink node), and, connect to four random nodes themselves (Brown lines):-
https://i.imgur.com/c2rv2Op.png

At this point, would the pink node be unaware of any transaction before they joined, but, after the most recent block? I know I'm deviating away from the main question I asked, but, I feel like you explained it pretty well and I don't need any more explanation on that topic, however, it did spark this question.