<ul>
<li>A node learns about a new transaction, either from a peer or of it's own creation. </li>
<li>It announces to every one of it's peers (8+ typically) with an <code>inv</code>entory message that it has learned about a transaction or block with a particular ID. </li>
<li>If the connected peer doesn't already know about the announced transaction, it sends a <code>getdata</code> request back asking for the contents of the transaction. If it already knows about the transaction, no <code>getdata</code> is made in response.</li>
</ul>

<p>Within a few seconds (less than 5s on average currently) every peer in the network has the relayed transaction. This is possible because of the mesh layout of the network, every node connects to every other node through some degree of separation. The design makes it incredibly difficult to determine if a node created a transaction or is just relaying it, this is by design.</p>

CC BY-SA 3.0
2014-02-12T21:46:57.603Z
The type of structure is known as a "gossip network". Where nodes in network try to know as much as possible.
John T
CC BY-SA 3.0
2014-02-12T21:48:49.263Z
You mention it can know about a transaction "from a peer or of it's own creation", but what is meant by "of it's own creation"? I initiate a transaction from my Android wallet, how does that reach the first node? The node itself isn't creating the transaction? thanks!
QFDev
CC BY-SA 3.0
2014-02-12T22:53:11.870Z
I'm not sure how the android wallet works, but it's probably different to the normal network topography. In the case of other lite clients (see, `spv client` on the wiki), it will announce to normal peers on the network and ignore everything else going on. It's a bit different to how normal nodes work.
user13413
CC BY-SA 3.0
2014-02-12T21:38:26.983Z
2014-02-12T21:38:26.983Z
user13413
<p>I'd suggest you read this blog post about using the raw Bitcoin protocol: <a href="http://www.righto.com/2014/02/bitcoins-hard-way-using-raw-bitcoin.html" rel="noreferrer">http://www.righto.com/2014/02/bitcoins-hard-way-using-raw-bitcoin.html</a></p>

<p>To answer your question, you should specifically read the "How to find peers" section of that post. Specifically this part:</p>

<blockquote>
  <p>There's a chicken-and-egg problem, though, of how to find the first
  peer. Bitcoin clients solve this problem with several methods. Several
  reliable peers are registered in DNS under the name bitseed.xf2.org.
  By doing a nslookup, a client gets the IP addresses of these peers,
  and hopefully one of them will work. If that doesn't work, a seed list
  of peers is hardcoded into the client.</p>
</blockquote>

<p>and</p>

<blockquote>
  <p>The hardcoded peer list in the Bitcoin client is in <code>chainparams.cpp</code> in
  the array pnseed. For more information on finding Bitcoin peers, see
  <a href="https://bitcoin.stackexchange.com/questions/3536/how-bitcoin-clients-find-each-other">How Bitcoin clients find each other</a> or <a href="https://en.bitcoin.it/wiki/Satoshi_Client_Node_Discovery" rel="noreferrer">Satoshi client node discovery</a>.</p>
</blockquote>

CC BY-SA 3.0
2014-02-12T21:56:59.213Z
2014-02-12T21:56:59.213Z
2017-04-13T12:47:33.660Z
Luca Matteis
<p>I am trying to understand Bitcoin at a more fundamental level. I'd like to know how a new transaction enters and propagates across the network? I've read many Bob and Alice type scenarios where it's said that "the transaction is broadcast to the network". If there are many nodes on the Bitcoin network, how does the wallet know which node to initially broadcast the transaction to?</p>

<p><strong>EDIT</strong></p>

<p>Just for clarification, I'm referring to the process of sending from the client wallet (e.g. Mycelium on Android) to Node 1, before it gets propagated to all other nodes. How does my wallet know which node to send to first, or does it just randomly pick one?</p>

<transactions><wallet><sending><nodes>
How does a bitcoin transaction enter the network?
QFDev
# How does a bitcoin transaction enter the network?

(Asked by: username_0 on 2014-02-12)

I am trying to understand Bitcoin at a more fundamental level. I'd like to know how a new transaction enters and propagates across the network? I've read many Bob and Alice type scenarios where it's said that "the transaction is broadcast to the network". If there are many nodes on the Bitcoin network, how does the wallet know which node to initially broadcast the transaction to?

**EDIT**

Just for clarification, I'm referring to the process of sending from the client wallet (e.g. Mycelium on Android) to Node 1, before it gets propagated to all other nodes. How does my wallet know which node to send to first, or does it just randomly pick one?

**Tags:** transactions, wallet, sending, nodes


---

## 2 answers

### Answer by username_3 on 2014-02-12. Score: 8 | Accepted answer

I'd suggest you read this blog post about using the raw Bitcoin protocol: <http://www.righto.com/2014/02/bitcoins-hard-way-using-raw-bitcoin.html>

To answer your question, you should specifically read the "How to find peers" section of that post. Specifically this part:

> There's a chicken-and-egg problem, though, of how to find the first
> peer. Bitcoin clients solve this problem with several methods. Several
> reliable peers are registered in DNS under the name bitseed.xf2.org.
> By doing a nslookup, a client gets the IP addresses of these peers,
> and hopefully one of them will work. If that doesn't work, a seed list
> of peers is hardcoded into the client.

and

> The hardcoded peer list in the Bitcoin client is in `chainparams.cpp` in
> the array pnseed. For more information on finding Bitcoin peers, see
> [How Bitcoin clients find each other](https://bitcoin.stackexchange.com/questions/3536/how-bitcoin-clients-find-each-other) or [Satoshi client node discovery](https://en.bitcoin.it/wiki/Satoshi_Client_Node_Discovery).


---

### Answer by username_1 on 2014-02-12. Score: 4

* A node learns about a new transaction, either from a peer or of it's own creation.
* It announces to every one of it's peers (8+ typically) with an `inv`entory message that it has learned about a transaction or block with a particular ID.
* If the connected peer doesn't already know about the announced transaction, it sends a `getdata` request back asking for the contents of the transaction. If it already knows about the transaction, no `getdata` is made in response.

Within a few seconds (less than 5s on average currently) every peer in the network has the relayed transaction. This is possible because of the mesh layout of the network, every node connects to every other node through some degree of separation. The design makes it incredibly difficult to determine if a node created a transaction or is just relaying it, this is by design.

> **Comments:**
> **username_2**: The type of structure is known as a "gossip network". Where nodes in network try to know as much as possible.  
> **username_0**: You mention it can know about a transaction "from a peer or of it's own creation", but what is meant by "of it's own creation"? I initiate a transaction from my Android wallet, how does that reach the first node? The node itself isn't creating the transaction? thanks!  
> **username_1**: I'm not sure how the android wallet works, but it's probably different to the normal network topography. In the case of other lite clients (see, `spv client` on the wiki), it will announce to normal peers on the network and ignore everything else going on. It's a bit different to how normal nodes work.  

---

