The terms blocksonly and block-relay-only that are used in Bitcoin Core are very similar. What is the difference between them?
While both of these disable transaction relay, they are conceptually used for different purposes:
Block-relay-only connections (see this post for more details) are hard-to-detect connections with the goal of hardening the network against eclipse attacks. They have been introduced in v0.19.0.1 (2019) - since then, nodes will by default make two additional outgoing block-relay-only connections.
Blocksonly mode is an optional startup option (
-blocksonly), introduced in v0.12.0 (2016) that has the goal of reducing the bandwidth of a node to a minimum by not participating in transaction relay.
There are various differences between these:
- -blocksonly is a global startup option (applying to all connections) that is either active or not, block-relay-only is connection-specific.
- A node in -blocksonly mode participates in address relay, while a node will never send out addresses over block-relay-only connections and ignores incoming addresses.
- A node in -blocksonly signals not to receive any transactions and will disconnect peers that don't comply, but it will make an exception for whitelisted peers. There is no such exception for block-relay-only connections.
- A node in -blocksonly mode may in special cases send out own transactions to its peers (for example if submitted directly via RPC). A node will never send a transaction over a block-relay-only connection.
- A node in -blocksonly mode still treats two of their outbound connections as block-relay-only (for which then the stricter block-relay-only rules take precedence).