p2p – Broadcast valid blocks to the network without local full nodes
What message can he send to the node to ensure that his valid block will be broadcast to the network and added to the chain?
You can never be confident. The node you are connecting to may be malicious, malfunctioning, or the connection itself may be faulty. However, sending your friend’s block to as many nodes as possible will definitely increase your chances of good propagation.
What should the format/encoding be?
What communication protocol should he use?
The Bitcoin P2P protocol has roughly three mechanisms for notifying the network of new blocks.
- old
inv
/getdata
/block
machine: firstinv
A message containing an inventory item of type MSG_BLOCK(2) and a block hash. The peer can then request the actual block data (if it doesn’t already exist) using:getdata
A message containing similar inventory items of type MSG_BLOCK or MSG_WITNESS_BLOCK (depending on whether you want witness data) and you will then respond by sending:block
A message containing the block header and transaction vector in serialized format (the same format in which the transaction hash is calculated). If you typegetdata
If MSG_WITNESS_BLOCK, witnesses must be included in the transaction using BIP144 encoding. If the peer does not yet have an ancestor for the block, you can trigger a fetch for the ancestor using:getdata
orgetheaders
(You are expected to respond as follows:headers
message). - that much BIP130 mechanism: When negotiating using:
sendheaders
Blocks can be announced to peers via messages upon connection.headers
message insteadinv
. This allows peers to request missing parent headers before actually receiving the entire block. that muchgetdata
anddata
In this case, the steps in the previous approach remain unchanged. - that much BIP152 mechanism (Compact block). The details of the actual protocol are too complicated to explain here in one paragraph, but the rough idea is to pass only a (short) identifier for each transaction in a block to the peer. Peers can reconstruct blocks themselves and request missing transactions if possible.
In some cases, Bitcoin Core also allows unwanted blocks. block
Message sent without prior action getdata
. This is the easiest approach, but it’s not guaranteed to work.
Will the full node require any specific operating system configuration or additional software to facilitate this?
Any (honest) full node can verify the block and forward it to its peers. Obviously, people with more processing power or better networking connections can get things done faster.
Additionally, let’s say my friend would especially appreciate a response within 10 minutes.
Haha, sorry, it’s too late!