---
# System prepended metadata

title: Ognyan’s CDAP Development Update 6

---

# Ognyan’s CDAP Development Update 6

In my last [update](https://hackmd.io/@ogenev/HyNI0xBzF), the following goals were set:

### Previous goals

- Run concurrently history and state networks in Trin.
- Dispatch network specific requests and responses via discv5 layer.
- Extend JSON-RPC API endpoints


### Overlay protocol implementation in Trin
To accomplish the goals above, we had to implement the overlay protocol in [Trin](https://github.com/ethereum/trin) following the general idea behind the initial Overlay Protocol specs [here](https://notes.ethereum.org/tPzmxQD_S3S3uvtpUSA0-g).

I decided to divide this task into 3 separate PRs:

- [Refactor of the Overlay protocol data structure](https://github.com/ethereum/trin/pull/103)

  The overlay data structure existed in our code but needed to be refactored in such a way that it could be initialized for each of the overlay networks in parallel, because every overlay network needs to manage its own routing table and data radius.

- [Handle overlay network events](https://github.com/ethereum/trin/pull/110)

  Handling portal network message calls required refactoring of the main discv5 handler. The idea is to introduce one portal event handler per network and the responsibility of the main discv5 handler is to dispatch all portal network events to the appropriate handlers by checking the protocol-id element in discv5 TalkReq/Resp message data.

- [Add JSON-RPC support for overlay networks](https://github.com/ethereum/trin/pull/120)

  We had json-rpc handler implemented only for the underlying discv5 protocol. To be able to serve overlay network json-rpc requests, we had to put the design hats again. The idea is similar to how we are handling the overlay portal network messages above. The main json-rpc handler is responsible for handling only discv5 endpoints and any overlay network endpoint is dispatched to the overlay protocol. The PR above claims to achieve this.

Here is a rough scheme of the new architecture introduced in Trin, supporting for now only chain history and state network. Of course, this is just the first iteration, a lot can be improved and tweaked, but I think Trin is on the right track. It is a marathon, not a sprint :)

![](https://i.imgur.com/w4YseVf.png)

### Next goals
- Draft Portal Network JSON-RPC specification.
- Implement the JSON-RPC endpoints with highest priority in Trin.



