<ul>
<li>Client creates a new transaction, adds it to its memory pool</li>
<li>Client broadcasts an <code>inv</code> frame, which indicates that it has something in its memory pool, by giving the hash of the transaction to one or more connected peers</li>
<li>Peer receives <code>inv</code> frame, checks its own memory pool, it's not in there, so it sends a <code>getdata</code> frame back</li>
<li>Client receives a <code>getdata</code> frame for the transaction it just created, so it sends a <code>tx</code> with the entire transaction</li>
<li>Peer receives the <code>tx</code>, hashes it and puts it in the memory pool</li>
<li>Peer now has something new in the memory pool, and broadcasts an <code>inv</code> to all connected peers</li>
<li>Client gets an <code>inv</code> frame, notices that it's already in the memory pool, and ignores it</li>
<li>Another client gets the <code>inv</code> frame as well, <code>getdata</code>'s it, stores the <code>tx</code>, sends <code>inv</code>, and repeat that until the entire network has the transaction.</li>
</ul>

<p>References :</p>

<ul>
<li><a href="https://en.bitcoin.it/wiki/Protocol_specification#tx">tx frame</a></li>
<li><a href="https://en.bitcoin.it/wiki/Protocol_specification#Inventory_Vectors">inventory vector</a></li>
<li><a href="https://en.bitcoin.it/wiki/Protocol_specification#getdata">getdata</a></li>
</ul>

CC BY-SA 3.0
2013-04-16T21:01:36.660Z
Correct me if I'm wrong, but doesn't bitcoin only send the transaction to one peer if it originated the transaction?
Nick ODell
CC BY-SA 3.0
2013-04-16T21:02:29.510Z
@NickODell Perhaps, but that's implementation related, and not a network rule.
Tom van der Woerdt
CC BY-SA 3.0
2013-04-16T21:27:33.650Z
Thank you Tom, very clear explanation. However, I still have a question. Based on Satoshi paper http://bitcoin.org/bitcoin.pdf, the hash consists of the public key of the receiver too. I suppose that the public key is added in order to have different hashes?
anapaso
CC BY-SA 3.0
2013-04-16T22:15:44.583Z
(Disclaimer: I've never read the paper, I've only built a client.) The hash of a transaction is simply the entire transaction (`tx`) hashed (unlike blocks, which only have their headers hashed). This includes all the inputs and outputs.
Tom van der Woerdt
CC BY-SA 3.0
2013-04-17T07:11:55.813Z
how fast or how long does it take to broadcast the information to all peers? i mean when i'm mining, and somebody has already found a new block, how long would it take till i receive the information and start mining again on new block?
ulkas
CC BY-SA 3.0
2013-04-17T09:04:52.033Z
Reaching *all* peers can take a long time (maybe even up to an hour), as there are always a few edges on the network where it takes a lot longer. However, for most nodes it's a matter of seconds to maybe two minutes.
Tom van der Woerdt
CC BY-SA 3.0
2013-04-16T20:57:46.967Z
2013-04-16T21:02:58.060Z
2013-04-16T21:02:58.060Z
Tom van der Woerdt
<p>When a transaction is broadcasted to the network, what is being sent? Is it a hash? if yes, is it going to be the hash of: previous transaction + public key of the receiver? </p>

<transactions><hash>
When a transaction is broadcast to the network, what is actually being sent?
anapaso
# When a transaction is broadcast to the network, what is actually being sent?

(Asked by: username_0 on 2013-04-16)

When a transaction is broadcasted to the network, what is being sent? Is it a hash? if yes, is it going to be the hash of: previous transaction + public key of the receiver?

**Tags:** transactions, hash


---

## 1 answers

### Answer by username_1 on 2013-04-16. Score: 10 | Accepted answer

* Client creates a new transaction, adds it to its memory pool
* Client broadcasts an `inv` frame, which indicates that it has something in its memory pool, by giving the hash of the transaction to one or more connected peers
* Peer receives `inv` frame, checks its own memory pool, it's not in there, so it sends a `getdata` frame back
* Client receives a `getdata` frame for the transaction it just created, so it sends a `tx` with the entire transaction
* Peer receives the `tx`, hashes it and puts it in the memory pool
* Peer now has something new in the memory pool, and broadcasts an `inv` to all connected peers
* Client gets an `inv` frame, notices that it's already in the memory pool, and ignores it
* Another client gets the `inv` frame as well, `getdata`'s it, stores the `tx`, sends `inv`, and repeat that until the entire network has the transaction.

References :

* [tx frame](https://en.bitcoin.it/wiki/Protocol_specification#tx)
* [inventory vector](https://en.bitcoin.it/wiki/Protocol_specification#Inventory_Vectors)
* [getdata](https://en.bitcoin.it/wiki/Protocol_specification#getdata)

> **Comments:**
> **username_2**: Correct me if I'm wrong, but doesn't bitcoin only send the transaction to one peer if it originated the transaction?  
> **username_1**: @NickODell Perhaps, but that's implementation related, and not a network rule.  
> **username_0**: Thank you Tom, very clear explanation. However, I still have a question. Based on Satoshi paper http://bitcoin.org/bitcoin.pdf, the hash consists of the public key of the receiver too. I suppose that the public key is added in order to have different hashes?  
> **username_1**: (Disclaimer: I've never read the paper, I've only built a client.) The hash of a transaction is simply the entire transaction (`tx`) hashed (unlike blocks, which only have their headers hashed). This includes all the inputs and outputs.  
> **username_3**: how fast or how long does it take to broadcast the information to all peers? i mean when i'm mining, and somebody has already found a new block, how long would it take till i receive the information and start mining again on new block?  
> **username_1**: Reaching *all* peers can take a long time (maybe even up to an hour), as there are always a few edges on the network where it takes a lot longer. However, for most nodes it's a matter of seconds to maybe two minutes.  

---

