{"id":14669255,"url":"https://github.com/vitwit/cada","last_synced_at":"2025-09-08T23:31:23.399Z","repository":{"id":252211425,"uuid":"839313583","full_name":"vitwit/cada","owner":"vitwit","description":"Cada is a cosmos module, connects cosmos chains with Avail. Using this any cosmos chain or rollapp use Avail as DA layer.","archived":false,"fork":false,"pushed_at":"2024-09-19T07:40:38.000Z","size":532,"stargazers_count":2,"open_issues_count":15,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-09-19T08:16:20.464Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vitwit.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-07T11:06:11.000Z","updated_at":"2024-09-19T05:40:01.000Z","dependencies_parsed_at":"2024-09-16T07:57:23.187Z","dependency_job_id":"7d012afd-7d4d-49ac-8b60-c6cf019c2c6b","html_url":"https://github.com/vitwit/cada","commit_stats":null,"previous_names":["vitwit/avail-da-module","vitwit/cada"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vitwit%2Fcada","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vitwit%2Fcada/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vitwit%2Fcada/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vitwit%2Fcada/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vitwit","download_url":"https://codeload.github.com/vitwit/cada/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":232362733,"owners_count":18511615,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-09-12T02:01:12.930Z","updated_at":"2025-01-03T16:31:04.233Z","avatar_url":"https://github.com/vitwit.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"# CADA (Cosmos Avail DA module)\n\nCADA is a module designed to connect Cosmos sovereign chains with the Avail network, making it easier for any Cosmos chain or rollapp to use Avail as their Data Availability (DA) layer. With CADA, developers can improve the scalability and security of their decentralized applications within the Cosmos ecosystem. It enables better data handling and availability, allowing Cosmos-based chains to tap into the strengths of Avail and build a more connected and resilient blockchain network.\n\n# Integration Guide\n\nTo integrate the CADA module into your application, follow the steps outlined in the [integration guide](./x/cada/integration_docs/README.md)\n\nNote: Ensure that the Avail light client URL is correctly configured for the module to function as expected. For instructions on setup Avail locally, please refer to [this documentation](https://github.com/rollkit/avail-da?tab=readme-ov-file#avail-da).\n\n# How It Works\n\nCADA(Cosmos Chain): Initiates the process by running the PreBlocker ABCI method.\n\nRequest to Relayer: Sends block range information to the relayer.\n\nRelayer: Fetches the block data from the Cosmos Provider and posts it to the Avail Light Client.\n\nAvail Light Client: Confirms whether the data is available.\n\nIf Yes: Broadcast the Avail height and status.\n\nIf No: Retry data submission.\n\nValidators: Vote to confirm the data availability, updating the blob status to \"Success\" or \"Failure\" based on results.\n\n\nThese are main components in the workflow:\n\n## 1. CADA\n\nThe core functionality of the **CADA** module is integrated with and operates on the Cosmos blockchain.\n\nIn the CADA module:\n\n- At each block interval, the `PreBlocker` ABCI method sends a request to the `Relayer`, specifying the range of block heights that are ready to be posted to the **Avail** Data Availability (DA) network.\n![Data Submission](https://github.com/user-attachments/assets/fc4d23cc-f6bd-4210-8407-47a57adcc290)\n\n- The chain is responsible for aggregating vote extensions from all validators and verifying whether the data has been made available on Avail.\n- Since verification requires communicating with the light client, an asynchronous voting mechanism is needed. **Vote extensions** enable this asynchronous voting mechanism for verification purposes.\n\n![Vote Extension](https://github.com/user-attachments/assets/ea5b10ab-fb64-4ed0-8761-44675a852a01)\n\n## 2. Relayer\n\nThe **Relayer** facilitates communication between the Cosmos Chain, the Avail light client, and the Cosmos Provider.\n\n- **Data Submission**: The relayer is responsible for fetching block data from the Cosmos provider and posting it to the Avail light client via an HTTP request.\n- Based on the response from the light client, the relayer submits a transaction informing the validators of the data availability status and the specific Avail block height where the data is included, so that validators can verify it.\n  \n- **Data Verification**: During verification, the relayer communicates with the Avail light client to confirm whether the data is truly available at the specified height.\n\n\n## 3. Avail Light Node\n\nThe **Avail Light Client** allows interaction with the Avail DA network without requiring a full node, and without having to trust remote peers. It leverages **Data Availability Sampling (DAS)**, which the light client performs on every newly created block.\n\n- The chain communicates with the Avail light client via the relayer during the data submission and data availability verification processes.\n\nFind more details about the Avail Light Client [here](https://docs.availproject.org/docs/operate-a-node/run-a-light-client/Overview).\n\n## 4. Cosmos Provider\n\nThe **Cosmos Provider** is responsible for fetching block data via RPC so that the data can be posted to Avail for availability checks.\n\n\n# Workflow\n\n- At each block interval, a request is sent from the `PreBlocker` ABCI method to the Keeper, specifying the range of block heights that are ready to be posted to the `Avail` DA network.\n- The range of block heights should be from `provenHeight + 1` to `min(provenHeight + MaxBlocksLimitForBlob, CurrentBlockHeight)`.\n\n- If the status of the previous blocks is either `SUCCESS` or `FAILURE`, the status can be updated to `PENDING`.\n     \n     ``` \n     range = [fromBlock, toBlock] // (fromBlock \u003c toBlock \u003c CurrentBlock)\n     status = PENDING\n     ```\n\n- The `Proposer` of the block will make a request to the `Relayer` to post the blocks data by passing the range of blocks to be posted.\n\n- The `Relayer` fetches the blocks data from the local provider, converts the blocks data to bytes, and posts that data to `Avail`.\n\n- Once the success of data availability is confirmed, the `Relayer` broadcasts the `Avail height` at which the blob data is made available using the `MsgUpdateBlobStatus` transaction.\n\n- The status, Avail height, and voting deadline will be updated in the state.\n\n    ```\n    status = IN_VOTING\n    availHeight = tx.availHeight\n    votingEndBlock = currentBlock + votingInterval\n    ```\n\n\n\n- At block height `VotingEndBlock - 1`, all the validators verify if the specified blocks data is truly made available at the specified Avail height. They cast their vote (YES or NO) using `vote extensions`.\n\n- At block height `VotingEndBlock`, all the votes from `vote_extensions` will be collected and aggregated. If the collective `voting power is \u003e 66%`, the status will be updated\n\n    ```\n    status = SUCCESS // success and ready for next blocks\n    provenHeight = Range EndHeight // End Height from the given block range\n\n    ```\n- In case of failure at any stage, the whole flow will be repeated.\n\n---\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvitwit%2Fcada","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvitwit%2Fcada","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvitwit%2Fcada/lists"}