# Notes and Questions about SSZ Query Language ![image](https://hackmd.io/_uploads/ByGHLQhVll.png) Yesterday, I sent [my initial draft](https://hackmd.io/@junsong/SJGze5cNxg) via Prysm's Discord server, and Bastin suggested to take a glimpse of [SSZ Query Language](https://github.com/eth-protocol-fellows/cohort-six/blob/master/projects/project-ideas.md#prysm-ssz-query-language) project as well. As it is tightly coupled to my initial interest ([Merkle Proofs of Everything](https://github.com/eth-protocol-fellows/cohort-six/blob/master/projects/project-ideas.md#prysm-merkle-proofs-of-everything)), I took a look of it. This post includes some notes and questions to the team. ## Notes ```json { "anchor": "<stateRoot>", "querySpec": { "validators": { "range": [ 0, 100 ], "filter": { "slashed": true, "effective_balance": { "gte": 32 } }, "fields": [ "pubkey", "effective_balance" ] } }, "includeProof": true } ``` Project [description](https://github.com/eth-protocol-fellows/cohort-six/blob/master/projects/project-ideas.md#prysm-ssz-query-language) contains an example query so that I can think of (or at least imagine) which features it should provide. ### Details 1. Without `includeProof` option, it's [a GraphQL approach](https://discord.com/channels/595666850260713488/804019759934078987/1328334567391887432) for SSZ as @fjl said. 2. To provide the feature for `includeProof`, [Merkle Proofs of Everything](https://github.com/eth-protocol-fellows/cohort-six/blob/master/projects/project-ideas.md#prysm-merkle-proofs-of-everything) should be completed. It MUST provide a proof for any path. (That's why Bastin says to look this project as well.) 3. As it should support multiple fields, it definitely needs to leverage what [Merkle Multiproof](https://github.com/ethereum/consensus-specs/blob/v1.5.0/ssz/merkle-proofs.md#merkle-multiproofs) does. 4. User will include his/her query in the body of HTTP POST request. ### An example for the Response For the given query above, my very first draft for the response is following: ```json { "dependent_root": "<stateRoot>", "execution_optimistic": false, "data": { "validators": [ { "index": 42, "fields": { "pubkey": "0x93247f2209abcacf57b75a51dafae777f9dd38bc7053d1af526f220a7489a6d3a2753e5f3e8b1cfe39b56f43611df74a", "effective_balance": "32000000000", } } ] }, "proofs": { "leaves": [ "0x...ssz_hash_of_the_pubkey_field...", "0x...ssz_hash_of_the_effective_balance...", ], "witnesses": [ { "generalized_index": 1484895, "witness": "0x...ssz_hash_of_the_withdrawal_credentials_field..." }, // and so on... ], "generalized_indices": [ 1484894, // Generalized Index for 42th validator's pubkey. 1484898, // Generalized Index for 42th validator's effective_balance. ] }, } ``` To note, generalized indices are very important to verify the multiproof. So all data is coupled with generalized indices. ## Questions 1. Please correct me if I'm wrong or getting in the different way :) 2. It seems this proposal was suggested quite long time ago. I digged some EIPs that might deal with this feature, but I couldn't find the one. (The only material that I can find is a couple of paragraphs from Etan's post.) **Will this feature be proposed as an EIP, or just remain as a client feature?** Also, was there any bottleneck for implementing this feature for other client team and Prysm as well? 3. I think I can take the both projects up, and is there any priority between those projects? So that I might adjust the timeline for the next five months. Thanks in advance!