Package Relay Proposal



Summary:

A proposal for p2p protocol changes to enable package relay has been put forward by Gloria Zhao on the bitcoin-dev mailing list. The proposal aims to address issues with users creating and broadcasting transactions that depend upon unconfirmed transactions, resulting in a mempool with the same contents. This can lead to a limitation in the node's ability to determine which transactions have the highest feerates.A package-aware mempool policy is proposed to help nodes consider packages of transactions as a unit, enabling them to determine whether it would be economically rational to accept a transaction to the mempool if it doesn't meet fee requirements individually. Package Relay, the concept of announcing, requesting, and downloading packages between nodes on the p2p network, has also been discussed for many years. The proposal contains two components: a generic package relay protocol and an extension of it, child-with-unconfirmed-parents packages, as version 1 package relay. The proposal introduces two main ideas, including downloading and validating packages of transactions together and providing information to help peers decide whether to request and/or how to validate transactions that are part of a package.Three new protocol messages are added for use in any version of package relay. Additionally, each version of package relay must define its own inv type and "pckginfo" message version. The sendpackages message has been defined, containing fields such as version, max_count, and max_weight, which should be sent before sending a "verack" message. Nodes should send a "sendpackages" message for each version they support during version handshake.The package relay protocol is defined by a set of rules to be followed when relaying packages between nodes. The rules include restrictions on sending and receiving "sendpackages" messages, which are used to announce the availability of transaction packages for download, as well as specifications for the "getpckgtxns" and "pckgtxns" messages which are used to request and provide package information respectively.Additionally, Version 1 Packages - child-with-unconfirmed-parents extends package relay for packages consisting of one transaction and all of its unconfirmed parents. The protocol includes new messages and inv types, such as "MSG_PCKG1" and "PCKGINFO1", which contain information about version 1 packages. Rules for this type of package are also outlined, including that they must be sorted topologically, consist of only one transaction with unconfirmed parents, and not conflict with each other. Finally, clarification is provided on when a child-with-unconfirmed-parents package should be announced and what happens if a new block arrives in between messages. Gloria Zhao, a Bitcoin Core contributor, has proposed a new protocol called "Package Relay" to improve the efficiency of transaction relay. The proposal includes three new messages: "pckginfo" to announce the existence of a package, "getpckgtxns" to request transactions in a package, and "pckgtxns" to send transactions in a package. Each package contains multiple transactions and can be negotiated during version handshake with a version number assigned to it. This proposal is aimed at minimizing network bandwidth, avoiding downloading duplicate transactions, avoiding downloading rejected transactions, and minimizing storage allocated for not-yet-validated transactions. The proposal also allows for compatibility with older clients, as well as with clients using BIP330 reconciliation-based transaction relay (Erlay). The protocol should be extensible to support different types of packages based on future desired use cases. Two "flavors" of versioning were considered, and the second option was favored because it allows for different parameters for different versions. Gloria credits Suhas Daftuar and Antoine Riard for their previous work on package relay, and thanks John Newbery and Martin Zumsande for input on the design. She also thanks several others for input on the desired interface for contracting protocols. Links to numerous resources and proposals related to the Package Relay protocol are provided for further reading.


Updated on: 2023-06-15T20:55:55.744128+00:00