From 7c2bebb7c307956b8a4e4cdc55f39cb0bf107d52 Mon Sep 17 00:00:00 2001 From: Rigidity Date: Tue, 5 Mar 2024 20:15:00 -0500 Subject: [PATCH 01/11] Add initial draft of the CHIP --- CHIPs/chip-new-wallet-protocol.md | 254 ++++++++++++++++++++++++++++++ 1 file changed, 254 insertions(+) create mode 100644 CHIPs/chip-new-wallet-protocol.md diff --git a/CHIPs/chip-new-wallet-protocol.md b/CHIPs/chip-new-wallet-protocol.md new file mode 100644 index 00000000..2444601a --- /dev/null +++ b/CHIPs/chip-new-wallet-protocol.md @@ -0,0 +1,254 @@ +| CHIP Number | < Creator must leave this blank. Editor will assign a number.> | +| :------------ | :----------------------------------------------------------------------- | +| Title | New Wallet Sync and Mempool Update Protocol | +| Description | Wallet protocol messages for syncing coins and transactions from a node. | +| Author | [Brandon Haggstrom](https://github.com/Rigidity) | +| Editor | < Creator must leave this blank. Editor will be assigned.> | +| Comments-URI | < Creator must leave this blank. Editor will assign a URI.> | +| Status | < Creator must leave this blank. Editor will assign a status.> | +| Category | Standards Track | +| Sub-Category | Network | +| Created | 2024-03-05 | +| Requires | None | +| Replaces | None | +| Superseded-By | None | + +## Abstract + +This CHIP proposes a new set of protocol messages for syncing a light wallet against a full node. It solves many pain points with the current protocol, prevents DoS (Denial of Service) issues for certain use cases, and enables certain optimizations while syncing. In addition, this protocol will enable wallets to subscribe to transactions in the mempool. + +## Motivation + +Currently the wallet protocol enables you to register for updates for a set of coin ids or puzzle hashes. The initial coin states will be included in the response, and further coin state updates will be sent to you as new blocks are farmed or whenever a reorg occurs. This does a good job at keeping the wallet informed about the current state of its coins, but it has a few shortcomings. This protocol is an attempt to address these issues and make light wallets more stable and efficient. + +First of all, if you subscribe to a set of puzzle hashes and there are more coins than would fit in a response, it will be truncated. This makes it impossible to download the full set of coins if it exceeds a certain size. This protocol solves this by paginating the response, sending coin data grouped by block height in each batch. This way you can sync up to the peak eventually, regardless of how many coins you are downloading. + +There is also currently no way to request the current state of coins without subscribing to them. Additionally, subscriptions cannot be removed later either, meaning you will eventually hit the subscription limit through normal use, even if you only need the coin information one time (for example when constructing a CAT spend). The new protocol allows you to do both of these things, preventing unnecessary subscriptions where possible. + +The new wallet sync protocol also forces you to handle reorgs, by rejecting the request if the claimed header hash does not match the height provided. Reorgs can occur both while you while you are syncing a set of puzzle hashes (if there is a lot of data to be synced), and after you reconnect your wallet to the network (if a reorg happened to occur right after you went offline). If a wallet does not handle reorgs properly, it can result in incorrect coin state data being stored in its database. + +You will also be able to opt in to receiving updates for relevant transactions as they enter or leave the mempool. + +## Backwards Compatibility + +The changes to the wallet protocol are fully backwards compatible. + +## Rationale + +Another way to accomplish the goals for syncing outlined above would be to stream coin states from the node to the wallet until you have reached the peak. This way you can receive a consistent snapshot of the blockchain database and apply updates as needed from there. However, this forces the node to spend an arbitrarily long amount of time sending data to the wallet until complete, which is a major concern for both performance and opening up the potential for DoS attacks. + +The reasoning for doing it this way, by requesting coin state in batches, is that you can rate limit the requests consistently, preventing wallets from easily overloading the node with expensive operations. The wallet can handle reorgs on the fly by backtracking (or finding a common fork point), and can ask the node to automatically subscribe it to future updates once the initial coin state is synced. This solves both the performance concern and the requirement to have consistent data. + +Instead of syncing from a starting height, the new protocol uses a previous height and header hash to sync off of. The reasoning here is that you can use the last known peak when reconnecting to the network to start from (assuming no reorg has occurred). As well as this, and to prevent reorg issues, the header hash is now required. If the wallet does not know the header hash, it can sync from genesis instead. + +The protocol update PR has been shared with the community a couple times, and though it hasn't reached community consensus, feedback thus far has seemed positive. This CHIP is to facilitate feedback on both the protocol and its implementation, and to ensure that it solves various developer and user concerns with the current light wallet protocol. + +## Specification + +### Add Puzzle Subscriptions + +```py +class RequestAddPuzzleSubscriptions: + puzzle_hashes: List[bytes32] + +class RespondAddPuzzleSubscriptions: + puzzle_hashes: List[bytes32] + height: uint32 + header_hash: bytes32 +``` + +Adds puzzle hashes to the subscription list until the limit has been reached, returning the hashes that were actually added. +If the limit is exceeded, the wallet can either bail or subscribe with other nodes instead. +Also gives the current peak height and header hash. + +Note that unlike `RegisterForPhUpdates`, this does not return any coin states. +There is a `RequestPuzzleState` message which fetches the current coin states instead. +The idea of this is to enable you to subscribe only, request current state only, or do both at the same time. + +### Add Coin Subscriptions + +```py +class RequestAddCoinSubscriptions: + coin_ids: List[bytes32] + +class RespondAddCoinSubscriptions: + coin_ids: List[bytes32] + height: uint32 + header_hash: bytes32 +``` + +Adds coin ids to the subscription list until the limit has been reached, returning the ids that were actually added. +If the limit is exceeded, the wallet can either bail or subscribe with other nodes instead. +Also gives the current peak height and header hash. + +Note that unlike `RegisterForCoinUpdates`, this does not return any coin states. +There is a `RequestCoinState` message which fetches the current coin states instead. +The idea of this is to enable you to subscribe only, request current state only, or do both at the same time. + +### Remove Puzzle Subscriptions + +```py +class RequestRemovePuzzleSubscriptions: + puzzle_hashes: Optional[List[bytes32]] + +class RespondRemovePuzzleSubscriptions: + puzzle_hashes: List[bytes32] +``` + +Removes puzzle hashes from the subscription list (or all of them if `None`), returning the hashes that were actually removed. + +### Remove Coin Subscriptions + +```py +class RequestRemoveCoinSubscriptions: + coin_ids: Optional[List[bytes32]] + +class RespondRemoveCoinSubscriptions: + coin_ids: List[bytes32] +``` + +Removes coin ids from the subscription list (or all of them if `None`), returning the ids that were actually removed. + +### Request Puzzle State + +```py +class RequestPuzzleState: + puzzle_hashes: List[bytes32] + previous_height: Optional[uint32] + header_hash: bytes32 + filters: CoinStateFilters + subscribe_when_finished: bool + +class RespondPuzzleState: + puzzle_hashes: List[bytes32] + height: uint32 + header_hash: bytes32 + is_finished: bool + coin_states: List[CoinState] + +class RejectPuzzleState: + pass + +class CoinStateFilters: + include_spent: bool + include_unspent: bool + include_hinted: bool + min_amount: uint64 +``` + +Requests coin states that match the given puzzle hashes (or hints). + +Unlike `RegisterForPhUpdates`, this does not add subscriptions for the puzzle hashes automatically. +When `subscribe_when_finished` is set to `True`, it will add subscriptions, but only once the last batch has been requested. + +As well as this, previously it was impossible to get all coin records if the number of items exceeded the limit. +This implementation allows you to continue where you left off with `previous_height` and `header_hash`. + +If a reorg of relevant blocks occurs while doing so, `previous_height` will no longer match `header_hash`. +This can be handled by a wallet by simply backtracking a bit, or restarting the sync from genesis. It could be inconvenient, but at least you can detect it. +In the event that a reorg is detected by a node, `RejectPuzzleState` will be returned. This is the only scenario it will be rejected directly like this. + +Additionally, it is now possible to filter out spent, unspent, or hinted coins, as well as coins below a minimum amount. +This can reduce the risk of spamming or DoS of a wallet in some cases, and improve performance. + +If `previous_height` is `None`, you are syncing from genesis. The `header_hash` should match the genesis challenge of the network you are connected to. + +### Request Coin State + +```py +class RequestCoinState: + coin_ids: List[bytes32] + previous_height: Optional[uint32] + header_hash: bytes32 + subscribe: bool + +class RespondCoinState: + coin_ids: List[bytes32] + coin_states: List[CoinState] + +class RejectCoinState: + pass +``` + +Request coin states that match the given coin ids. + +Unlike `RegisterForCoinUpdates`, this does not add subscriptions for the coin ids automatically. +When `subscribe` is set to `True`, it will add and return as many coin ids to the subscriptions list as possible. + +Unlike the new `RequestPuzzleState` message, this does not implement batching for simplicity. The order is also not guaranteed. +However, you can still specify the `previous_height` and `header_hash` to start from. + +If a reorg of relevant blocks has occurred, `previous_height` will no longer match `header_hash`. +This can be handled by a wallet depending on the use case (for example by restarting from zero). It could be inconvenient, but at least you can detect it. +In the event that a reorg is detected by a node, `RejectCoinState` will be returned. This is the only scenario it will be rejected directly like this. + +If `previous_height` is `None`, you are syncing from genesis. The `header_hash` should match the genesis challenge of the network you are connected to. + +### Request Transactions + +```py +class RequestTransactions: + pass + +class RespondTransactions: + transaction_ids: List[bytes32] +``` + +Provides a list of every transaction in the mempool that matches one of your coin id or puzzle hash subscriptions. + +### Transaction Updates Capability + +A new `TRANSACTION_UPDATES` capability, with a value of `5`. This opts in to receiving the below transaction update messages. + +### Transaction Added + +```py +class TransactionAdded: + transaction_id: bytes32 + cost: uint64 + fees: uint64 +``` + +By enabling the new transaction update capability, you are opting in to receiving this message. It is sent whenever a new validated transaction enters the mempool, as long as it matches one or more of your subscriptions. + +### Transaction Added + +```py +class TransactionsRemoved: + transaction_ids: List[bytes32] + reason: uint8 # MempoolRemoveReason + +class MempoolRemoveReason(Enum): + CONFLICT = 1 + BLOCK_INCLUSION = 2 + POOL_FULL = 3 + EXPIRED = 4 +``` + +By enabling the new transaction update capability, you are opting in to receiving this message. It is sent whenever transactions leave the mempool, as long as they match one or more of your subscriptions. + +## Test Cases + +There are various test cases for syncing and subscribing to coin state updates in [test_new_wallet_protocol.py](https://github.com/Chia-Network/chia-blockchain/blob/8cbde05d05d9c447300c9faac21cade9acc6d7db/tests/wallet/test_new_wallet_protocol.py). + +## Reference Implementation + +The new wallet sync and subscription protocol is [implemented in this PR](https://github.com/Chia-Network/chia-blockchain/pull/17340). + +Transaction updates have not yet been implemented, and will likely be in a followup PR. + +## Security + +This wallet protocol update is not an attempt to improve, nor should it have any effect on, validation against untrusted full nodes. You should always keep multiple peers connected so that you can detect whether or not a peer is giving you bad data, and prevent omission. + +## Additional Assets + +None + +## Copyright + +Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/). + +``` + +``` From 52de25c7325f27618292d7f5e93c865592753d30 Mon Sep 17 00:00:00 2001 From: Rigidity Date: Tue, 5 Mar 2024 20:15:23 -0500 Subject: [PATCH 02/11] Remove empty code block --- CHIPs/chip-new-wallet-protocol.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/CHIPs/chip-new-wallet-protocol.md b/CHIPs/chip-new-wallet-protocol.md index 2444601a..2abc0371 100644 --- a/CHIPs/chip-new-wallet-protocol.md +++ b/CHIPs/chip-new-wallet-protocol.md @@ -248,7 +248,3 @@ None ## Copyright Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/). - -``` - -``` From 2a8f1b674b95085f10f299d516738116bbb5a85b Mon Sep 17 00:00:00 2001 From: Rigidity Date: Tue, 5 Mar 2024 20:16:51 -0500 Subject: [PATCH 03/11] Simplify name --- CHIPs/chip-new-wallet-protocol.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHIPs/chip-new-wallet-protocol.md b/CHIPs/chip-new-wallet-protocol.md index 2abc0371..4f29426a 100644 --- a/CHIPs/chip-new-wallet-protocol.md +++ b/CHIPs/chip-new-wallet-protocol.md @@ -1,6 +1,6 @@ | CHIP Number | < Creator must leave this blank. Editor will assign a number.> | | :------------ | :----------------------------------------------------------------------- | -| Title | New Wallet Sync and Mempool Update Protocol | +| Title | New Wallet Sync Protocol | | Description | Wallet protocol messages for syncing coins and transactions from a node. | | Author | [Brandon Haggstrom](https://github.com/Rigidity) | | Editor | < Creator must leave this blank. Editor will be assigned.> | From f416cfe9747bbd4aef9adb7283ecf6521c10f0ef Mon Sep 17 00:00:00 2001 From: danieljperry Date: Wed, 6 Mar 2024 10:42:52 +0800 Subject: [PATCH 04/11] Assign CHIP-26 --- CHIPs/{chip-new-wallet-protocol.md => chip-0026.md} | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) rename CHIPs/{chip-new-wallet-protocol.md => chip-0026.md} (94%) diff --git a/CHIPs/chip-new-wallet-protocol.md b/CHIPs/chip-0026.md similarity index 94% rename from CHIPs/chip-new-wallet-protocol.md rename to CHIPs/chip-0026.md index 4f29426a..72ea16bb 100644 --- a/CHIPs/chip-new-wallet-protocol.md +++ b/CHIPs/chip-0026.md @@ -1,11 +1,11 @@ -| CHIP Number | < Creator must leave this blank. Editor will assign a number.> | +| CHIP Number | 0026 | | :------------ | :----------------------------------------------------------------------- | | Title | New Wallet Sync Protocol | | Description | Wallet protocol messages for syncing coins and transactions from a node. | | Author | [Brandon Haggstrom](https://github.com/Rigidity) | -| Editor | < Creator must leave this blank. Editor will be assigned.> | -| Comments-URI | < Creator must leave this blank. Editor will assign a URI.> | -| Status | < Creator must leave this blank. Editor will assign a status.> | +| Editor | [Dan Perry](https://github.com/danieljperry) | +| Comments-URI | [CHIPs repo, PR #100](https://github.com/Chia-Network/chips/pull/100) | +| Status | Draft | | Category | Standards Track | | Sub-Category | Network | | Created | 2024-03-05 | @@ -25,7 +25,7 @@ First of all, if you subscribe to a set of puzzle hashes and there are more coin There is also currently no way to request the current state of coins without subscribing to them. Additionally, subscriptions cannot be removed later either, meaning you will eventually hit the subscription limit through normal use, even if you only need the coin information one time (for example when constructing a CAT spend). The new protocol allows you to do both of these things, preventing unnecessary subscriptions where possible. -The new wallet sync protocol also forces you to handle reorgs, by rejecting the request if the claimed header hash does not match the height provided. Reorgs can occur both while you while you are syncing a set of puzzle hashes (if there is a lot of data to be synced), and after you reconnect your wallet to the network (if a reorg happened to occur right after you went offline). If a wallet does not handle reorgs properly, it can result in incorrect coin state data being stored in its database. +The new wallet sync protocol also forces you to handle reorgs, by rejecting the request if the claimed header hash does not match the height provided. Reorgs can occur both while you are syncing a set of puzzle hashes (if there is a lot of data to be synced), and after you reconnect your wallet to the network (if a reorg happened to occur right after you went offline). If a wallet does not handle reorgs properly, it can result in incorrect coin state data being stored in its database. You will also be able to opt in to receiving updates for relevant transactions as they enter or leave the mempool. From 55ff639650052d7411e6242f579cc755da8c1814 Mon Sep 17 00:00:00 2001 From: Rigidity Date: Wed, 27 Mar 2024 14:33:27 -0400 Subject: [PATCH 05/11] Add error codes and remove AddSubscription messages --- CHIPs/chip-0026.md | 52 +++++++++------------------------------------- 1 file changed, 10 insertions(+), 42 deletions(-) diff --git a/CHIPs/chip-0026.md b/CHIPs/chip-0026.md index 72ea16bb..9120d21f 100644 --- a/CHIPs/chip-0026.md +++ b/CHIPs/chip-0026.md @@ -45,46 +45,6 @@ The protocol update PR has been shared with the community a couple times, and th ## Specification -### Add Puzzle Subscriptions - -```py -class RequestAddPuzzleSubscriptions: - puzzle_hashes: List[bytes32] - -class RespondAddPuzzleSubscriptions: - puzzle_hashes: List[bytes32] - height: uint32 - header_hash: bytes32 -``` - -Adds puzzle hashes to the subscription list until the limit has been reached, returning the hashes that were actually added. -If the limit is exceeded, the wallet can either bail or subscribe with other nodes instead. -Also gives the current peak height and header hash. - -Note that unlike `RegisterForPhUpdates`, this does not return any coin states. -There is a `RequestPuzzleState` message which fetches the current coin states instead. -The idea of this is to enable you to subscribe only, request current state only, or do both at the same time. - -### Add Coin Subscriptions - -```py -class RequestAddCoinSubscriptions: - coin_ids: List[bytes32] - -class RespondAddCoinSubscriptions: - coin_ids: List[bytes32] - height: uint32 - header_hash: bytes32 -``` - -Adds coin ids to the subscription list until the limit has been reached, returning the ids that were actually added. -If the limit is exceeded, the wallet can either bail or subscribe with other nodes instead. -Also gives the current peak height and header hash. - -Note that unlike `RegisterForCoinUpdates`, this does not return any coin states. -There is a `RequestCoinState` message which fetches the current coin states instead. -The idea of this is to enable you to subscribe only, request current state only, or do both at the same time. - ### Remove Puzzle Subscriptions ```py @@ -127,13 +87,17 @@ class RespondPuzzleState: coin_states: List[CoinState] class RejectPuzzleState: - pass + reason: uint8 # RejectStateReason class CoinStateFilters: include_spent: bool include_unspent: bool include_hinted: bool min_amount: uint64 + +class RejectStateReason(IntEnum): + REORG = 0 + EXCEEDED_SUBSCRIPTION_LIMIT = 1 ``` Requests coin states that match the given puzzle hashes (or hints). @@ -167,7 +131,11 @@ class RespondCoinState: coin_states: List[CoinState] class RejectCoinState: - pass + reason: uint8 # RejectStateReason + +class RejectStateReason(IntEnum): + REORG = 0 + EXCEEDED_SUBSCRIPTION_LIMIT = 1 ``` Request coin states that match the given coin ids. From e2fcb17e4a055254619056815ef0382f6dede24c Mon Sep 17 00:00:00 2001 From: danieljperry Date: Tue, 7 May 2024 14:03:16 +0800 Subject: [PATCH 06/11] Add new mempool PR --- CHIPs/chip-0026.md | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/CHIPs/chip-0026.md b/CHIPs/chip-0026.md index 72ea16bb..09145688 100644 --- a/CHIPs/chip-0026.md +++ b/CHIPs/chip-0026.md @@ -45,6 +45,14 @@ The protocol update PR has been shared with the community a couple times, and th ## Specification +This CHIP's design allows wallets to opt in to receive updates via a new capability. + +Whenever a new subscription to puzzle hashes (via `RequestPuzzleState`) or coin IDs (via `RequestCoinState`) is added, the wallet will receive a list of every transaction ID that relates to those subscriptions. + +Whenever transactions are added or removed from the mempool, the protocol will send the transaction ID to every peer that has subscribed to anything inside of it (spent or created coin IDs, puzzle hashes, or hints). + +The full node then gives coin state updates, as well as mempool transaction updates. + ### Add Puzzle Subscriptions ```py @@ -233,9 +241,9 @@ There are various test cases for syncing and subscribing to coin state updates i ## Reference Implementation -The new wallet sync and subscription protocol is [implemented in this PR](https://github.com/Chia-Network/chia-blockchain/pull/17340). - -Transaction updates have not yet been implemented, and will likely be in a followup PR. +The new wallet sync and subscription protocol is implemented in the following Pull Requests from the `chia-blockchain` GitHub repository: +* [#17340](https://github.com/Chia-Network/chia-blockchain/pull/17340) -- new subscription and wallet sync protocol +* [#17980](https://github.com/Chia-Network/chia-blockchain/pull/17980) -- mempool updates ## Security From 2829c082b8f821b561ce3e9b2afb0c132bb0f31c Mon Sep 17 00:00:00 2001 From: Rigidity Date: Tue, 4 Jun 2024 02:28:56 -0400 Subject: [PATCH 07/11] Add new messages --- CHIPs/chip-0026.md | 61 ++++++++++++++++++++++++++-------------------- 1 file changed, 35 insertions(+), 26 deletions(-) diff --git a/CHIPs/chip-0026.md b/CHIPs/chip-0026.md index c6720be4..eddf7606 100644 --- a/CHIPs/chip-0026.md +++ b/CHIPs/chip-0026.md @@ -160,48 +160,56 @@ In the event that a reorg is detected by a node, `RejectCoinState` will be retur If `previous_height` is `None`, you are syncing from genesis. The `header_hash` should match the genesis challenge of the network you are connected to. -### Request Transactions +### Mempool Updates Capability -```py -class RequestTransactions: - pass +A new `MEMPOOL_UPDATES` capability, with a value of `5`. This opts in to receiving the below mempool update messages. + +### Mempool Items Added -class RespondTransactions: +```py +class MempoolItemsAdded: transaction_ids: List[bytes32] ``` -Provides a list of every transaction in the mempool that matches one of your coin id or puzzle hash subscriptions. - -### Transaction Updates Capability +This message will only be sent if `MEMPOOL_UPDATES` is supported by both the wallet and the node. It is sent whenever a new valid transaction enters the mempool, as long as it matches one or more of your subscriptions. -A new `TRANSACTION_UPDATES` capability, with a value of `5`. This opts in to receiving the below transaction update messages. +In addition, when you first subscribe to one or more puzzle hashes or coin ids using the new subscription messages in described earlier, you will receive an initial `MempoolItemsAdded` message containing a list of transaction ids of existing mempool items that match those subscriptions. It is possible to receive transactions which you have already received previously, so it's up to the wallet to filter them out. -### Transaction Added +### Mempool Items Removed ```py -class TransactionAdded: +class MempoolRemoveReason(Enum): + CONFLICT = 1 + BLOCK_INCLUSION = 2 + POOL_FULL = 3 + EXPIRED = 4 + +class RemovedMempoolItem: transaction_id: bytes32 - cost: uint64 - fees: uint64 + reason: uint8 # MempoolRemoveReason + +class MempoolItemsRemoved: + removed_items: List[RemovedMempoolItem] ``` -By enabling the new transaction update capability, you are opting in to receiving this message. It is sent whenever a new validated transaction enters the mempool, as long as it matches one or more of your subscriptions. +This message will only be sent if `MEMPOOL_UPDATES` is supported by both the wallet and the node. It is sent whenever a transaction leaves the mempool for any of the above reasons, as long as it matches one or more of your subscriptions. -### Transaction Added +### Request Cost Info ```py -class TransactionsRemoved: - transaction_ids: List[bytes32] - reason: uint8 # MempoolRemoveReason +class RequestCostInfo: + pass -class MempoolRemoveReason(Enum): - CONFLICT = 1 - BLOCK_INCLUSION = 2 - POOL_FULL = 3 - EXPIRED = 4 +class RespondCostInfo: + max_transaction_cost: uint64 + max_block_cost: uint64 + max_mempool_cost: uint64 + mempool_cost: uint64 + mempool_fee: uint64 + bump_fee_per_cost: uint8 ``` -By enabling the new transaction update capability, you are opting in to receiving this message. It is sent whenever transactions leave the mempool, as long as they match one or more of your subscriptions. +This gives various information about the costs of transactions, blocks, and the mempool. It can be useful for ensuring a transaction is valid prior to submitting it, as well as estimating fees. ## Test Cases @@ -210,8 +218,9 @@ There are various test cases for syncing and subscribing to coin state updates i ## Reference Implementation The new wallet sync and subscription protocol is implemented in the following Pull Requests from the `chia-blockchain` GitHub repository: -* [#17340](https://github.com/Chia-Network/chia-blockchain/pull/17340) -- new subscription and wallet sync protocol -* [#17980](https://github.com/Chia-Network/chia-blockchain/pull/17980) -- mempool updates + +- [#17340](https://github.com/Chia-Network/chia-blockchain/pull/17340) -- new subscription and wallet sync protocol +- [#17980](https://github.com/Chia-Network/chia-blockchain/pull/17980) -- mempool updates ## Security From 4e258ce5ecdb343b4b39c06e3d9a95370ccd2b09 Mon Sep 17 00:00:00 2001 From: Rigidity Date: Tue, 4 Jun 2024 02:36:25 -0400 Subject: [PATCH 08/11] Add message types section --- CHIPs/chip-0026.md | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/CHIPs/chip-0026.md b/CHIPs/chip-0026.md index eddf7606..8214493b 100644 --- a/CHIPs/chip-0026.md +++ b/CHIPs/chip-0026.md @@ -45,14 +45,25 @@ The protocol update PR has been shared with the community a couple times, and th ## Specification -This CHIP's design allows wallets to opt in to receive updates via a new capability. +This CHIP's design allows wallets to opt in to receive mempool updates via a new capability. -Whenever a new subscription to puzzle hashes (via `RequestPuzzleState`) or coin IDs (via `RequestCoinState`) is added, the wallet will receive a list of every transaction ID that relates to those subscriptions. +Whenever a new subscription to puzzle hashes (via `RequestPuzzleState`) or coin IDs (via `RequestCoinState`) is added, the wallet will receive a list of every transaction ID that relates to those subscriptions in a `MempoolItemsAdded` message. Whenever transactions are added or removed from the mempool, the protocol will send the transaction ID to every peer that has subscribed to anything inside of it (spent or created coin IDs, puzzle hashes, or hints). The full node then gives coin state updates, as well as mempool transaction updates. +### Message Types + +The messages types have the following values: + +```py +mempool_items_added = 104 +mempool_items_removed = 105 +request_cost_info = 106 +respond_cost_info = 107 +``` + ### Remove Puzzle Subscriptions ```py From 2b3d9ae159d3794fae3eddcaf1ba024d237f64e5 Mon Sep 17 00:00:00 2001 From: danieljperry Date: Tue, 4 Jun 2024 14:48:14 +0800 Subject: [PATCH 09/11] Move status to Review --- CHIPs/chip-0026.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CHIPs/chip-0026.md b/CHIPs/chip-0026.md index 8214493b..9dd95985 100644 --- a/CHIPs/chip-0026.md +++ b/CHIPs/chip-0026.md @@ -5,7 +5,7 @@ | Author | [Brandon Haggstrom](https://github.com/Rigidity) | | Editor | [Dan Perry](https://github.com/danieljperry) | | Comments-URI | [CHIPs repo, PR #100](https://github.com/Chia-Network/chips/pull/100) | -| Status | Draft | +| Status | Review | | Category | Standards Track | | Sub-Category | Network | | Created | 2024-03-05 | @@ -232,6 +232,8 @@ The new wallet sync and subscription protocol is implemented in the following Pu - [#17340](https://github.com/Chia-Network/chia-blockchain/pull/17340) -- new subscription and wallet sync protocol - [#17980](https://github.com/Chia-Network/chia-blockchain/pull/17980) -- mempool updates +- [#18052](https://github.com/Chia-Network/chia-blockchain/pull/18052) -- performance improvement +- [#18096](https://github.com/Chia-Network/chia-blockchain/pull/18096) -- split capabilities for each service ## Security From 077cd9e758b02bed6717a7eed8fe90ede9c58fb8 Mon Sep 17 00:00:00 2001 From: danieljperry Date: Thu, 20 Jun 2024 09:38:47 -0500 Subject: [PATCH 10/11] Move CHIP-26 to Last Call --- CHIPs/chip-0026.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHIPs/chip-0026.md b/CHIPs/chip-0026.md index 9dd95985..4a0ed20e 100644 --- a/CHIPs/chip-0026.md +++ b/CHIPs/chip-0026.md @@ -5,7 +5,7 @@ | Author | [Brandon Haggstrom](https://github.com/Rigidity) | | Editor | [Dan Perry](https://github.com/danieljperry) | | Comments-URI | [CHIPs repo, PR #100](https://github.com/Chia-Network/chips/pull/100) | -| Status | Review | +| Status | Last Call | | Category | Standards Track | | Sub-Category | Network | | Created | 2024-03-05 | From e9f3eeea3fb2650babf150685296134fe86d7b45 Mon Sep 17 00:00:00 2001 From: danieljperry Date: Fri, 5 Jul 2024 08:06:39 -0500 Subject: [PATCH 11/11] Move CHIP-26 to Final --- CHIPs/chip-0026.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHIPs/chip-0026.md b/CHIPs/chip-0026.md index 4a0ed20e..544a27d3 100644 --- a/CHIPs/chip-0026.md +++ b/CHIPs/chip-0026.md @@ -5,7 +5,7 @@ | Author | [Brandon Haggstrom](https://github.com/Rigidity) | | Editor | [Dan Perry](https://github.com/danieljperry) | | Comments-URI | [CHIPs repo, PR #100](https://github.com/Chia-Network/chips/pull/100) | -| Status | Last Call | +| Status | Final | | Category | Standards Track | | Sub-Category | Network | | Created | 2024-03-05 |