During the last P2P meeting, @sdaftuar pointed the lack of a transactions propagation framework thus hindering progress in the tx-relay network area, devoid of clear goals to achieve.
This is a blocking issue in a spawn of subjects, like countering cheap RBF replacements, increasing mempool feerate of resources constraints nodes, better support of Bitcoin applications with more demanding fee/tx-relay requirements, scope of tx-rejection filter, etc
Core mechanisms of Tx-Relay
I think one of the starter goal of the tx-relay network is obviously to let miners discover the best-feerate transactions candidate for inclusion in block. As Bitcoin censorship-resistance lays on distribution of mining, bias in tx-relay topology privileging a subset of miners with an advantage in fee discovery may provoke disequilibrium beyond their hashrate contributions. Thus an unstructured p2p network, vetted of uniform tx-relay peers selection is likely the best option. A distributed network is also more-robust against infrastructure disruption or targeted transaction censorship.
An additional goal is preserving the pseudonymity of transactions original broadcaster which can be enforced with high guarantees only if tx-relay topology is non-observable by a protocol participants or a coalition of them. Introduction of randomized timers at propagation (e.g #14897) is an improvement towards this direction, even if research has hinted that the number of tx-relay mechanisms potentially exploitable to learn about topology is likely wide. Future improvements like mempool rebroadcasts (https://github.com/bitcoin/bitcoin/pull/16698) or initial-broadcast-over-Tor-only may improve the situation.
Lastly, an other important goal to consider is bandwidth-savings, as underscored in the Erlay paper, a too prohibitive tx-relay cost disincentives potential node operators, especially running full-relay public ones contributing the most to good health of the network. This goal might be in trade-offs with aforementioned ones, where tx-relay peering redundancy increases robustness and higher mempool rebroadcast frequencies add noise to the propagation graph at the price of higher bandwidth costs.
Tx-Relay & Node Policies
If the set of messages as inherited from first protocol versions or specified in peer services BIPs defines what bitcoin data structures are accepted by compliant peers, AFAIU it doesn't mandate a relay behavior, neither outlaw a superset of constraints on p2p messages, at the discretion of local node. This superset of constraints is I guess what people commonly called P2P network transaction policy, even in fact such policies vary by full-node implementation, versions and local node settings.
On the Core side, such policies encompass some DoS/vulnerabilities counter-measures like SCRIPT_VERIFY_MINIMALIF at the script interpreter level or MIN_STANDARD_TX_NONWITNESS_SIZE at the mempool level, invariants which can't be disabled by local settings, so we can qualify them as implementation/version policy . Another range of policies checks are vetted with hopefully anti-DoS default values like incrementalRelayFee or m_limit_descendant but configurable by node operator to express a different pricing of resources offered to the network or increasing the chance to learn good feerate chain of transactions by accepting higher DoS risks.
Due to this divergence of policies across the network and adding to the absence of events order in a distributed system, mempools convergence has never been considered as a goal. However, there is a p2p mechanism for peers to discover and adapt its peers policies, namely feefilter. This mechanism prevent bandwidth-waste by will-be-rejected low-feerate transactions. Further p2p mechanisms could be devised to improve peer policy negotiation, like txfilter announcing the local standardness applied or utxofeerate announcing the feerate of a package for a known utxo spend candidate. That said, communicating more information to opportunistically save more bandwidth is likely quickly bounded.
Fee/Relay Assumptions for Bitcoin Applications
Bitcoin applications aiming to confirm their transactions should ensure first to be connected to a high number of tx-relay peers, then ensure these transactions are formatted to pass at least testmempoolaccept of their local nodes. If a propagation failure is detected or suspected, a) a rotation should be triggered to probabilistically find a peer with an identical policy, at least for the subset of policy rules you share or b) a warning can be triggered back to the user hinting to do something about likely a badly-formatted transaction.
Such model doesn't work great with regards to multi-party Bitcoin applications (e.g LN or vaults), where signing interactivity is costly or impossible. Further, if a transaction is time-sensitive with regards to advancing state of protocol forward, propagation failures are direct risks for fund safety. Even further such potential propagation failures could be exploited by a malicious counterparty, if applications participants are assumed to be distrusted. Such application can never be sure that transaction will confirm but should be able to express its best-feerate bid for this time-sensitive transaction, even if bid isn't won due to a better blockspace demand.
Any such application/protocol developper will be confronted with the following questions:
- how to decide the format of my transactions (size, scripts, witness, minimal fee, ...) ?
- what should be the size/weight of chain of transactions ?
- what should be my tx-relay strategy and should rebroadcast/peer rotation be triggered ?
- what fee-bumping strategy are offered between RBF, CPFP, Parent-Pay-For-Child, etc ? how network mempools will evaluate each one ? how a malicious counterparty could leverage them ?
- what dev process will follow ecosystem/implementations in case of rules tightening/changes potentially hindering application/protocol security, e.g what are Core guarantees wrt to carve-out backward-compatibility ?
Historically, we have an example of BIP 125, specifying out the mempool RBF policy, ready to be consumed as an interface by Bitcoin applications. But otherwise, due to fear of silently breaking an obscure policy rule, some application are literally leaking them in their stack (see https://github.com/ElementsProject/lightning/blob/4302afd9a58f0c455bb812b63e9cdf377ebb74d4/bitcoin/signature.c#L214)
Of course to avoid getting stuck in endless debates, here few questions we may evaluate as a guideline:
- what have been historically propagation assumptions of Bitcoin applications ? how newer class of Bitcoin applications should conceive their operational and security models with regards to propagation ?
- should we support requirements of newer classes of Bitcoin applications ? If so, what should be the scope and expressivity of an fee/tx-relay API rules ?
- what set of constraints (DoS, bandwidth, privacy, deployment, ...) do we have to bind to ?