# Implementing Payload Chunking (EIP-8101) in EL While working on prototyping Payload Chunking (EIP-8101) in Geth, I noticed several things that I would like to highlight in order to help other developers while implementing the EIP. ## BAL vs CAL BlockAccessList needs very little modification in order to support ChunkAccessList use cases. In addition to already existing logic, we need to add following functionality: ### Tracing The `AccessListTracer` should for reads also keep track of the first tx that created the read. The reads shouldn't be removed if write happens in the later tx (but it's safe not to keep reads if write happened during the same or earlier tx). ### Buliding Chunk Access List (CAL) With the tracing modification and already existing data, we have enough data to build CAL. One just has to make sure that reads are removed from the CAL if there is a write inside the same chunk (or in any earlier chunk). ### Merging CALs Merging CALs to create BAL can easily be done. One just has to remove reads from earlier chunks in later they appear as write. This is useful if we decide to keep `blockAccessListHash` field in the `Header`. ## Block Building In order to split block into chunks, not much has the change in comparison to the current process. The algorithm can look something like this: 1. Build the entire block (same as before the EIP) 2. Split block into chunks: 1. Select as many transactions as possible in a chunk, as long as chunk's `gasLimit` is not exceeded (use receipts for this). - Note that this isn't the only way to create valid chunks, but is arguably the easiest 3. Create ChunkAccessList based on indices of transaction that are in each chunk (see section above). ## StateRoot Calculation The EL client can start calculating State root as soon as all CALs are received. It doesn't have to wait to receit and/or execute all Chunks. ## Requests While validating chunks, we should keep track of created requests. Once all chunks have been processed, we can merge all requests and validate `Header.RequestsHash`.