Update mempool docs#1034
Conversation
|
@danieljperry I am still reviewing the content itself but noticed we are removing the mempool page and instead having a mempool/intro page. We should either have that intro page be at the mempool (no /intro) url or we will want to add a redirect to ensure the link chia-blockchain/architecture/mempool/ does not break (redirect to chia-blockchain/architecture/mempool/intro/) |
| slug: /chia-blockchain/architecture/mempool/block-creation | ||
| --- | ||
|
|
||
| When the farmer makes a block, they will select the highest fee-per-cost transactions from the mempool until they reach the maximum block size. These spend bundles are combined into one large spend bundle, which is guaranteed to be valid, since all spend bundles in the mempool must spend disjointed coins. |
There was a problem hiding this comment.
Should we indicate this is default behavior of the reference farmer? (other farmers might have different transaction selection logic like hpool not allowing 0 mojo transactions)
There was a problem hiding this comment.
This was briefly mentioned in the intro section, but I will make it even clearer.
|
|
||
| When the farmer makes a block, they will select the highest fee-per-cost transactions from the mempool until they reach the maximum block size. These spend bundles are combined into one large spend bundle, which is guaranteed to be valid, since all spend bundles in the mempool must spend disjointed coins. | ||
|
|
||
| Coin spends cannot impact other coin spends, which is a very nice property of UTXO systems, and allows parallelization of validation and block creation. The aggregate spend bundle also has one aggregate signature, which is a combination of every signature from every transaction in that block. |
There was a problem hiding this comment.
This seems incorrect, coin spends can assert one another requiring others occur and there are other ways in which coins interact and can impact one another (ex. oracles)
There was a problem hiding this comment.
I think it's just worded poorly. I'll update it.
|
|
||
| Coin spends cannot impact other coin spends, which is a very nice property of UTXO systems, and allows parallelization of validation and block creation. The aggregate spend bundle also has one aggregate signature, which is a combination of every signature from every transaction in that block. | ||
|
|
||
| For performance reasons, the chia-blockchain codebase currently creates only smaller blocks (less than 50% of the maximum size) in order to keep the blockchain smaller and easier to run. This "throttle" is likely to be removed in future versions, after additional optimizations have been performed. |
There was a problem hiding this comment.
This is not accurately portrayed, we are at max block fill now but the mempool only accepts transactions that are less than 50% of a block (per transaction not in total)
|
|
||
| ### Picking transactions | ||
|
|
||
| The mempool data structure maintains all mempool items ordered by fee per cost, highest fee first. |
There was a problem hiding this comment.
This seems to duplicate the information above
|
|
||
| This logic is implemented in [chia/full_node/mempool.py](https://github.com/Chia-Network/chia-blockchain/blob/main/chia/full_node/mempool.py) in `create_block_generator()`. | ||
|
|
||
| Since Q2 2025, we use a new algorithm (`create_block_generator2()`) which interleaves picking transactions and serializing them (in compressed form). This way, we have a good understanding of the exact cost of the block and can keep filling it with more transactions if the previous ones compressed well. |
There was a problem hiding this comment.
We should have the version and if it was height bound include the height at thich this was enforced
There was a problem hiding this comment.
I'll add the version, but it wasn't enforced at a specific block (it is outside of consensus).
|
|
||
| The mempool is a required facet of Chia due to the decentralized nature of the blockchain. Transaction blocks occur approximately every 52 seconds, and it's impossible to predict who will win a block. Therefore, all transactions must be broadcast to the whole network and stored locally until they are confirmed. Additionally, it is normal to have more pending transactions than can fit in a single block, so the mempool also acts as a queue for inclusion into the blockchain. | ||
|
|
||
| For more information about the mempool, see our [blog post](https://www.chia.net/2024/01/12/getting-to-know-the-mempool-and-transaction-fees/) on this subject. |
There was a problem hiding this comment.
Should this link to the other pages being added too?
| @@ -0,0 +1,81 @@ | |||
| --- | |||
| title: Identical Spend Deduplication | |||
| slug: /chia-blockchain/architecture/mempool/isd | |||
There was a problem hiding this comment.
should this slug be more url friendly? (/chia-blockchain/architecture/mempool/identical-spend-deduplication)
|
|
||
| ### Replacement | ||
|
|
||
| A spend that supports Dedup is not considered in conflict with an existing spend of the same coin that also supports Dedup. The new spend must also use the exact same solution as the existing spend. The mempool implementation checks that the solution `bytes` are identical. |
There was a problem hiding this comment.
Dedup is capitalized here but not in other instances
| @@ -0,0 +1,36 @@ | |||
| --- | |||
| title: Replace by Fee | |||
| slug: /chia-blockchain/architecture/mempool/rbf | |||
There was a problem hiding this comment.
SHould we also make this slug url friendly? (replace-by-fee instead of rbf)
| slug: /chia-blockchain/architecture/mempool/updates | ||
| --- | ||
|
|
||
| After a new block is added to the blockchain, all full nodes must look at the coins that were spent in that new block, and remove them from the mempool. The full node does not need to reapply every transaction again, since Chia coin spends are deterministic and sandboxed (see the [Coin Set Intro page](/chia-blockchain/coin-set-model/intro) for more information). The full node only needs to look at the spent coins in the new block, and if there are any transactions that spend one of those coins, they are removed from the mempool. This means the mempool can be very large, the codebase can be simple, and high performance can be achieved. |
There was a problem hiding this comment.
For how little is on this page should it just be added to the overview page?
BrandtH22
left a comment
There was a problem hiding this comment.
Also block-formation-basics.md in the chia academy docs has the old mempool link and should be updated
| ```yaml | ||
| full_node: | ||
| block_creation: 1 # Enable new algorithm | ||
| block_creation_timeout: 30 # 30 second timeout |
There was a problem hiding this comment.
The default is 2 seconds not 30: https://github.com/Chia-Network/chia-blockchain/blob/0d5a394cf996a49626e009b3f8ac10ed645b74c3/chia/util/initial-config.yaml#L330
| The full conditions for replace by fee are: | ||
|
|
||
| 1. The new spend bundle needs to include at least all the spends in the original one (the super set rule) | ||
| 2. The new spend bundle needs to pay a higher fee per cost than the original one (and higher than the [minimum fee required for inclusion](https://docs.chia.net/chia-blockchain/architecture/mempool/#fee-required-for-inclusion)) |
There was a problem hiding this comment.
This link needs to be updated for the changes in this pr
|
|
||
| ### Transaction Deduplication | ||
|
|
||
| Starting in Chia 2.5.5, the mempool automatically detects and deduplicates identical spend transactions. When multiple transactions attempt to spend the same coin with identical parameters, only one will be kept in the mempool, reducing memory usage and improving overall performance. |
There was a problem hiding this comment.
I believe ISD was added in 1.8.2 and 2.5.5 upgraded that logic
Note
Low Risk
Documentation and navigation only; no runtime or consensus code changes.
Overview
Replaces the monolithic
architecture/mempoolpage with a Mempool doc category (intro,fees,block-creation,time-locks,rbf,fast-forward,isd,updates,migration) wired insidebars.js.Much of the former page is moved into those files; block-creation, fast-forward, isd, time-locks, and rbf gain new implementation-focused detail (e.g.
create_block_generator2(), FF/dedup rules, pending/conflict caches, RBF fast-forward rule). Inbound links incosts,block-rewards,cryptocurrency-intro, andfaq(plus matching zh-Hans pages) now target the new slugs such as/mempool/introand/mempool/fees.Reviewed by Cursor Bugbot for commit 228a663. Bugbot is set up for automated code reviews on this repo. Configure here.