# Final Dev Update - Light Client Support in Prysm
Hi everyone, Rupam here. Here I am, at the 21st week of EPF5. Last few months have been great and I managed to make some meaningful contributions to Ethereum. I have been working on adding light client support in [Prysm](https://github.com/prysmaticlabs/prysm) and we did make some decent progress.
## Abstract
As the project name suggests, it was focused on implementing server side light client support in Prysm. Before we move ahead let's see in brief what a light client is.
A light node is a node running light client software. Instead of keeping local copies of the blockchain data and independently verifying all the changes, they request the necessary data from some provider instead. The provider might be a direct connection to a full node or via some centralized RPC server. The data is then verified by the light node, allowing it to keep up with the head of the chain. The light node only processes block headers, only occasionally downloading the actual block contents.
There was already some work done before in Prysm regarding light clients in https://github.com/prysmaticlabs/prysm/pull/12854 and its preceding PRs but most of the work referenced an older branch of CL specs instead of `dev` and were later changed by us. Initially the plan was to only implement Altair light client full node but soon after we went ahead with the plan to implement everything upto Electra.
Another notable mention is that we decided to store and retrieve light client updates from a database instead of computing them as the computation is pretty expensive.
## Status Report
### Current State
We have broken down work on the basis of priority and have ended up with 3 different categories:
* Must have (required for having a light client that can run on a real network)
* Nice to have
* Cosmetic changes
For the duration of EPF we have tried to prioritise the "Must have" category to have a functional light client asap.
At the time of writing this, the following work has been completed:
- [x] Implement [is_better_update](https://github.com/ethereum/consensus-specs/blob/dev/specs/altair/light-client/sync-protocol.md#is_better_update)
- [x] Add Capella/Deneb changes from corresponding `full-node.md` spec files
- [x] Update the https://ethereum.github.io/beacon-APIs/?urls.primaryName=dev#/Beacon/getLightClientUpdatesByRange endpoint to return values from the database
- [x] Review the two other endpoints to make sure they return correct data and have good performance
- [x] Resolve https://github.com/prysmaticlabs/prysm/issues/14206
- [x] Stateless function that do not use the blockchain service, such as the ones in `/beacon-chain/blockchain/lightclient.go`, should be placed under `beacon-chain/core`. Create a new `/beacon-chain/core/light-client` package and move such functions there. (cosmetic change)
- [x] Implement new consensus types for all forks upto Electra and deprecate the ones in `ethpbv2` in Prysm
#### Relevant PRs:
There were a lot of PRs opened and merged and adding them here one by one would take up a lot of unnecessary space. I am taking you to github instead 😅
* [PRs by me](https://github.com/prysmaticlabs/prysm/pulls?q=is%3Apr+is%3Aclosed+author%3Arupam-04)
* [PRs by Bastin](https://github.com/prysmaticlabs/prysm/pulls?q=is%3Apr+is%3Aclosed+author%3AInspector-Butters)
### Future of the project
I have decided to keep working on this project even after EPF. The general roadmap would be to complete the following "Must have" features first:
- [ ] Add SSZ support for Beacon API endpoints (WIP)
- [ ] Store light client updates in the database (possibly one update per period)
- [ ] Implement the p2p spec: https://github.com/ethereum/consensus-specs/blob/dev/specs/altair/light-client/p2p-interface.md (and update it for Capella/Deneb) (already WIP)
- [ ] Verify light client support in the event stream endpoint works correctly: https://ethereum.github.io/beacon-APIs/?urls.primaryName=dev#/Events/eventstream (it was implemented by the previous contributor)
- [ ] Make sure we follow this part of the spec:

After this we do have some "nice to have" features that an ideal light client would have but they are not necessary to test it out on a network.
- [ ] Change the sync committee requirement for finalized update from 2/3 of all members to MIN_SYNC_COMMITTEE_PARTICIPANTS
- [ ] Implement https://github.com/ethereum/consensus-specs/pull/3553
- [ ] Beacon API handler to retrieve updates by range has lots of unnecessary code calculating periods etc
- [ ] Profile the node to assert that enabling light client support does not consume excessive memory/CPU/bandwidth
- [ ] Add light client to e2e/Kurtosis
## General Feedback about my Project
Light client has been a topic that was set to be implemented since a long time before but was never fully completed. Even at the time of writing this only 2 consensus clients, namely Nimbus and Lodestar have decent light client support. However their use cases are many, mainly in bridges and places where querying a node is required with minimal resources.
Fully implementing light client support in Prysm would ease the load off Nimbus and Lodestar and bring in a much needed diversity. Even though we are still a fair distance away from a fully working implementation, I don't plan to back down and contribute to this project until the end and I believe Bastin and our mentor Radek carry the same mentality too.
Last but not the least I'd like to thank my mentor [Radek](https://github.com/rkapka) and [Etan](https://github.com/etan-status) from Nimbus for the continued help and guidance they have provided. Also I'd thank Bastin for being a great mate and the meaningful discussions we had. Here's to more of these...
## References
* [Prysm](https://github.com/prysmaticlabs/prysm)
* [Tracking issue](https://github.com/prysmaticlabs/prysm/issues/12991)
* [Project description](https://github.com/eth-protocol-fellows/cohort-five/blob/main/projects/light-client-support-in-prysm.md)
* [Previous contributions](https://github.com/prysmaticlabs/prysm/pull/12854)
* [Light client sync endpoints](https://s1na.github.io/light-sync-endpoints/)
## Feedback about EPF
#### Great! Its just great!
If you are reading this and you want to contribute to Ethereum core development, just blindly join EPF. It doesn't matter much if you are selected or join permissionlessly, just do it.
I have previously contributed to Reth across various issues, nothing much serious. This has been my first significant contribution to Ethereum (and Prysm ofc) and I cannot thank EPF enough for creating the foundation for this. I have more confidence now and I can see how the general core dev ecosystem works. At the beginning, I used to struggle and I used to ask a lot of (useless) questions. As time passed, things got better and I got the confidence to try and double check things out when I got stuck anywhere.
Overall EPF has only contributed to my betterment and also introduced me to many talented folks around the world. Personally, I have nothing negative to say about it, indeed an unforgettable experience for me :)
Thanks a lot Josh and Mario for this awesome ride.
Signing off,
Rupam