{"id":27203567,"url":"https://github.com/cometbft/rpc-companion","last_synced_at":"2026-02-25T14:33:20.317Z","repository":{"id":164481017,"uuid":"623622896","full_name":"cometbft/rpc-companion","owner":"cometbft","description":"Experimental RPC companion","archived":false,"fork":false,"pushed_at":"2024-11-13T08:40:12.000Z","size":37181,"stargazers_count":1,"open_issues_count":9,"forks_count":1,"subscribers_count":5,"default_branch":"main","last_synced_at":"2024-11-13T09:30:26.163Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/cometbft.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":"2023-04-04T18:38:12.000Z","updated_at":"2023-08-21T13:40:41.000Z","dependencies_parsed_at":"2023-07-09T18:01:42.193Z","dependency_job_id":"72c4efb2-2a1b-469d-96b4-9c1d4e91dbb5","html_url":"https://github.com/cometbft/rpc-companion","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cometbft%2Frpc-companion","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cometbft%2Frpc-companion/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cometbft%2Frpc-companion/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cometbft%2Frpc-companion/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cometbft","download_url":"https://codeload.github.com/cometbft/rpc-companion/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248124840,"owners_count":21051757,"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":"2025-04-09T22:40:15.458Z","updated_at":"2025-10-25T06:03:40.391Z","avatar_url":"https://github.com/cometbft.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RPC Companion (Work In Progress)\n\nThis is the repository for the RPC Companion solution based on the [ADR-101 - Data Companion Pull API](https://github.com/cometbft/cometbft/blob/main/docs/architecture/adr-101-data-companion-pull-api.md)\n\nPlease see [ADR-102 - RPC Companion](https://github.com/cometbft/cometbft/blob/main/docs/references/architecture/adr-102-rpc-companion.md) for more information in regards this implementation and architecture solution.\n\n## Starting the Postgres Database\n\n\u003e NOTE: This assumes you have [Docker](https://www.docker.com/) and Docker Compose already installed in your machine\n\nThe reference implementation of RPC Companion utilizes Postgres as its ingest service storage system to save \nthe data acquired from the node. It employs a simple schema to store the node data in a relational database. \nHowever, it does not normalize the data or utilize a schema that can store structured data such as a Block. \nEssentially, the data is saved as a byte array.\n\nIn order to run the database, access the Docker folder:\n\n`cd ./database/docker`\n\nAnd run the docker services that will host the database (Postgres) and the database IDE (pgAdmin)\n\n`docker-compose -f docker-compose.yml up`\n\n## Accessing the database with pgAdmin\n\nOpen a browser and navigate to\nhttp://127.0.0.1:5050\n\nUse the following credentials:\n\n```\nUser: pgadmin@pgadmin.com\nPassword: pgadmin123\n```\n\n## Run CometBT (with gRPC services support)\n\nCheckout the `main` branch from [cometbft](https://github.com/cometbft/cometbft) repository:\n\n```\ngit checkout https://github.com/cometbft/cometbft.git\n\ncd cometbft\nmake install\n```\n\nConfigure the gRPC services. Modify the `$HOME/.cometbft/config/config.toml` file to enable the gRPC services as per\n[these instructions](https://github.com/cometbft/cometbft/blob/main/docs/data-companion/grpc.md#enabling-the-grpc-services)\n\nStart an instance of the kvstore app, e.g.:\n\n```\ncometbft init\ncometbft start --proxy_app kvstore\n```\n\n## Start the ingest service\n\nThe ingest service has a crucial role in monitoring new blocks generated on the CometBFT node. After detecting\nthe newly created block, it retrieves the necessary information and inserts it into the database. \nOnce the data is safely stored, the service uses the data companion API to notify the node that the \ninformation can be pruned.\n\nIn order to run the ingest service please make sure you follow this steps outlined below.\n\n### Configuration\n\nOpen a new terminal tab. Create a new file in `$HOME/.rpc-companion` named `config.toml` and add the addresses\nfor the gRPC endpoints (regular and privileged) and the database connection information, e.g.:\n\n```\n[grpc_client]\naddress = \"0.0.0.0:8080\"\nprivileged_address = \"0.0.0.0:8088\"\n\n[storage]\nconnection = \"postgres://postgres:postgres@0.0.0.0:15432/postgres?sslmode=disable\"\n```\n\nSave the file.\n\n### Run the rpc-companion ingest service\n\nBuild the `rpc-companion` binary and run the ingest service\n\n```\ngo build\n\n./rpc-companion ingest service\n```\n\nIf everything is compiled and configured correctly, you will see logs displaying the ingest service fetching \nnew blocks. The service then sets the retain height information so CometBFT can prune them from its storage.\n\n```\ntime=2023-10-18T17:23:55.311-04:00 level=INFO msg=\"New block\" service=Ingest module=Fetcher method=WatchNewBlock height=1549\ntime=2023-10-18T17:23:55.312-04:00 level=INFO msg=\"Get block\" service=Ingest module=Fetcher method=GetBlock height=1549\ntime=2023-10-18T17:23:55.312-04:00 level=INFO msg=\"Processing job\" service=Ingest module=Fetcher height=1549\ntime=2023-10-18T17:23:55.314-04:00 level=INFO msg=\"Get block retain height\" service=Ingest module=Fetcher method=GetBlockRetainHeight retain_height=1548 app_retain_height=0\ntime=2023-10-18T17:23:55.316-04:00 level=INFO msg=\"Set block retain height\" service=Ingest module=Fetcher method=SetBlockRetainHeight height=1549\ntime=2023-10-18T17:23:55.316-04:00 level=INFO msg=\"Processed block job\" service=Ingest module=Fetcher method=ProcessBlockJob height=1549\ntime=2023-10-18T17:23:56.327-04:00 level=INFO msg=\"New block\" service=Ingest module=Fetcher method=WatchNewBlock height=1550\ntime=2023-10-18T17:23:56.328-04:00 level=INFO msg=\"Get block\" service=Ingest module=Fetcher method=GetBlock height=1550\ntime=2023-10-18T17:23:56.328-04:00 level=INFO msg=\"Processing job\" service=Ingest module=Fetcher height=1550\ntime=2023-10-18T17:23:56.331-04:00 level=INFO msg=\"Get block retain height\" service=Ingest module=Fetcher method=GetBlockRetainHeight retain_height=1549 app_retain_height=0\ntime=2023-10-18T17:23:56.332-04:00 level=INFO msg=\"Set block retain height\" service=Ingest module=Fetcher method=SetBlockRetainHeight height=1550\ntime=2023-10-18T17:23:56.332-04:00 level=INFO msg=\"Processed block job\" service=Ingest module=Fetcher method=ProcessBlockJob height=1550\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcometbft%2Frpc-companion","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcometbft%2Frpc-companion","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcometbft%2Frpc-companion/lists"}