How is a transaction broadcasted?

1

Let's say UserA uses electrum, connected to ServerB, and hits the "Send" button to do a transaction.

What happens?

  1. The transaction is sent to ServerB only

or

  1. The transaction is sent from UserA to ServerB but also to 2 (or 10 or 100?) other servers (UserA's electrum has a list of 100 servers to connect, one after another, when he does a transaction)

or

  1. The transaction is sent from UserA to ServerB only, but ServerB broadcasts it immediately to 2 (or 10 or 100?) other servers

Especially if ServerB is late of 1 or 2 blocks from the rest of the network, what happens? Is the transaction lost? Broadcasted anyway?

Where are these rules specified in the official implementation?

Basj

Posted 2017-11-12T21:57:15.220

Reputation: 324

Answers

1

it is more like 3. The client would send the tx to a full node (let aside the complexities of SPV clients), and this full node would verify the tx by some pre defined rules. If ok, this full node transmits to other full nodes. The transaction only gets valid, if it was mined into a block. So the server you mention can be several blocks behind, but still can transmit the tx to other nodes. A very good overview of the way this happens is here:

http://chimera.labs.oreilly.com/books/1234000001802/ch06.html

also the chapter on transactions will help to clarify the picture.

pebwindkraft

Posted 2017-11-12T21:57:15.220

Reputation: 4 568