Author

Topic: Pushing Transactions to other Bitcoin Clients (Read 1723 times)

legendary
Activity: 1232
Merit: 1094
February 20, 2015, 02:30:39 PM
#8
The process of pushing out inventory messages first makes sense, but what stops a node from broadcasting massive amounts of 'inv' messages (for which there is no actual block/transaction data) and clogging up the network? Will the node that does this get banned by its peers?

In that case all that nodes peers will ask for the transactions.  When they are received, they go into the orphan pool.  That means that they are valid, but at least one input is unknown.

Since they aren't committed to the memory pool, those nodes don't forward them onward.  A node which spams only ends up spamming their direct peers.
zvs
legendary
Activity: 1680
Merit: 1000
https://web.archive.org/web/*/nogleg.com
February 20, 2015, 12:16:39 PM
#7
you just announce the new txid by sending inv message to all your peers.
when they realize they don't know it, they will ask you for the data, using getdata message.

I would also add (since it is sometimes a point of confusion) that transactions you create are no different than transactions you receive from a peer in this respect.  When your node learns of "something new" in this case a transaction, your node validates it, adds it to the local memory pool, and notifies peers by sending a INV message.
I thought it was only broadcast to 25% of peers

isn't that what trickle is for? (*and syncnode)
member
Activity: 88
Merit: 12
February 20, 2015, 11:46:59 AM
#6
The process of pushing out inventory messages first makes sense, but what stops a node from broadcasting massive amounts of 'inv' messages (for which there is no actual block/transaction data) and clogging up the network? Will the node that does this get banned by its peers?
hero member
Activity: 906
Merit: 1034
BTC: the beginning of stake-based public resources
February 20, 2015, 11:01:08 AM
#5
Thank you very much. This is very helpful.

I have one other question. Is there a way to trigger the sending of a transaction from the client locally on the machine it is running on or does the client expect this request to come from another Bitcoin client on the network, i.e. is this done over a bind()ed TCP socket? Or can it also be done via something like an RCP API?
donator
Activity: 1218
Merit: 1079
Gerald Davis
February 20, 2015, 10:43:01 AM
#4
you just announce the new txid by sending inv message to all your peers.
when they realize they don't know it, they will ask you for the data, using getdata message.

I would also add (since it is sometimes a point of confusion) that transactions you create are no different than transactions you receive from a peer in this respect.  When your node learns of "something new" in this case a transaction, your node validates it, adds it to the local memory pool, and notifies peers by sending a INV message.
legendary
Activity: 2053
Merit: 1356
aka tonikt
February 20, 2015, 10:36:56 AM
#3
you just announce the new txid by sending inv message to all your peers.
when they realize they don't know it, they will ask you for the data, using getdata message.
legendary
Activity: 1232
Merit: 1094
February 20, 2015, 08:42:26 AM
#2
I understand a Bitcoin client can request a transaction from another client on the network, effectively a pull request. However can a client push a transaction to another client on the network, a push request?

Yes, but they aren't supposed to.

The sequence is that a node sends its peers "inv" (inventory) messages.  This is a list of transaction and/or block hashes that the node has.  

They can contain a single hash.  If the peer doesn't have the transaction, it then sends a "getdata" message to request the transaction(s).  This prevents transactions being sent to nodes that already have them and wasting bandwidth.  Hashes are still 32 bytes per transaction though, so still uses up some bandwidth.

Nodes can simply send transactions ("tx" messages) without being asked for them, but that wastes bandwidth and isn't the recommended way to do it.

Quote
If so:
  • What triggers the transaction being sent?

When a node commits a transaction to its memory pool, it then notifies all peers that it has the transaction.

Committing a transaction to the memory pool means that the transaction is valid and all inputs are either in blocks or also in the memory pool.

The memory pool is the list of transactions that the node would include in any block it created.

Quote
  • Can you specify who the recipient is?

Uh, not sure what you mean here.  Nodes can send transactions to only certain peers if they want.  The default operation is to broadcast the "inv" message.

If Bloom filters are used, then only transactions which match the bloom filters are sent.

Quote
  • Can you point me to the code which implements this?

This is where new transactions are handled and the memory pool is checked here.  If they are accepted, then there is a call to relay them.

The relay call is in net.cpp.  This calls push inventory.
hero member
Activity: 906
Merit: 1034
BTC: the beginning of stake-based public resources
February 20, 2015, 08:21:22 AM
#1
I understand a Bitcoin client can request a transaction from another client on the network, effectively a pull request. However can a client push a transaction to another client on the network, a push request?

If so:
  • What triggers the transaction being sent?
  • Can you specify who the recipient is?
  • Can you point me to the code which implements this?
Jump to: