{"id":13567023,"url":"https://github.com/okp4/subql-okp4","last_synced_at":"2025-04-04T01:30:56.440Z","repository":{"id":176597355,"uuid":"658731764","full_name":"okp4/subql-okp4","owner":"okp4","description":"🔄 Subquery repository for OKP4 protocol","archived":false,"fork":false,"pushed_at":"2024-12-14T09:37:10.000Z","size":2066,"stargazers_count":3,"open_issues_count":16,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-12-14T10:24:57.340Z","etag":null,"topics":["blockchain","contribution-welcome","graphql","help-wanted","indexer","subql","web3"],"latest_commit_sha":null,"homepage":"https://explorer.subquery.network/subquery/okp4/nemeton-1","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/okp4.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","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-06-26T11:32:08.000Z","updated_at":"2024-12-14T09:37:13.000Z","dependencies_parsed_at":"2024-06-16T10:49:38.941Z","dependency_job_id":"ca6632b4-8504-4728-8b2c-963eed7d8bc8","html_url":"https://github.com/okp4/subql-okp4","commit_stats":null,"previous_names":["okp4/subql-okp4"],"tags_count":2,"template":false,"template_full_name":"okp4/template-oss","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/okp4%2Fsubql-okp4","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/okp4%2Fsubql-okp4/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/okp4%2Fsubql-okp4/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/okp4%2Fsubql-okp4/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/okp4","download_url":"https://codeload.github.com/okp4/subql-okp4/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247107816,"owners_count":20884793,"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":["blockchain","contribution-welcome","graphql","help-wanted","indexer","subql","web3"],"created_at":"2024-08-01T13:02:21.858Z","updated_at":"2025-04-04T01:30:56.043Z","avatar_url":"https://github.com/okp4.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"[![okp4 / subquery banner](./etc/okp4-subquery-banner.webp)](https://explorer.subquery.network/subquery/okp4/nemeton-1)\n\n# SubQL-OKP4\n\n\u003e 🔁 Subquery indexer for the [OKP4 protocol](https://okp4.network).\n\n[![release](https://img.shields.io/github/v/release/okp4/subql-okp4?style=for-the-badge\u0026logo=github)](https://github.com/okp4/subql-okp4/releases)\n[![lint](https://img.shields.io/github/actions/workflow/status/okp4/subql-okp4/lint.yml?label=lint\u0026style=for-the-badge\u0026logo=github)](https://github.com/okp4/subql-okp4/actions/workflows/lint.yml)\n[![build](https://img.shields.io/github/actions/workflow/status/okp4/subql-okp4/build.yml?branch=main\u0026label=build\u0026style=for-the-badge\u0026logo=github)](https://github.com/okp4/subql-okp4/actions/workflows/build.yml)\n[![test](https://img.shields.io/github/actions/workflow/status/okp4/dataverse-portal/test.yml?branch=main\u0026label=test\u0026style=for-the-badge\u0026logo=github)](https://github.com/okp4/dataverse-portal/actions/workflows/test.yml)\n[![conventional commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg?style=for-the-badge\u0026logo=conventionalcommits)](https://conventionalcommits.org)\n[![contributor covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg?style=for-the-badge)](https://github.com/okp4/.github/blob/main/CODE_OF_CONDUCT.md)\n[![typescript](https://img.shields.io/badge/typescript-%23007ACC.svg?style=for-the-badge\u0026logo=typescript\u0026logoColor=white)](https://www.typescriptlang.org/)\n[![prettier](https://img.shields.io/badge/prettier-1A2C34?style=for-the-badge\u0026logo=prettier\u0026logoColor=F7BA3E)](https://github.com/prettier/prettier)\n[![license][bsd-3-clause-image]][bsd-3-clause]\n[![cc-by-sa-4.0][cc-by-sa-image]][cc-by-sa]\n\nThis repository is home to the OKP4 SubQuery Indexer, a tool that provides chain data from the [OKP4 protocol](https://okp4.network) via a GraphQL API. The project is based on [SubQuery](https://subquery.network/), an open-source tool that helps create fast and reliable APIs for blockchain applications.\n\n## Explore\n\nThe following services are available:\n\n| ChainID          | Service    | Endpoint                                                    |\n| ---------------- | ---------- | ----------------------------------------------------------- |\n| `okp4-nemeton-1` | Playground | \u003chttps://explorer.subquery.network/subquery/okp4/nemeton-1\u003e |\n| `okp4-nemeton-1` | GraphQL    | \u003chttps://api.subquery.network/sq/okp4/nemeton-1\u003e            |\n\n## Install\n\n### Prerequisites\n\nBe sure to have the following properly installed:\n\n- [Node.js](https://nodejs.org/en/) `v18.18` ([Hydrogen](https://nodejs.org/en/blog/release/v18.18.0/))\n- [yarn](https://yarnpkg.com/) `v1.22`\n- [Docker](https://www.docker.com/)\n- [subql-cli](https://academy.subquery.network/run_publish/cli.html#installation) `v3.2.0` - Install SubQuery CLI globally on your terminal by using NPM (we don't recommend using Yarn to install global dependencies): `npm install -g @subql/cli@3.2.0`\n\n### Build\n\n🚚 Install the dependencies:\n\n```sh\nyarn\n```\n\nGenerate the types:\n\n```sh\nyarn prepack\n```\n\n### Build Docker\n\n🐳 Build the docker image:\n\n```sh\ndocker build -t subql-okp4 .\n```\n\nRun it:\n\n```sh\ndocker run -ti --rm --name my-indexer \\\n  -e DB_HOST=postgres \\\n  -e DB_PORT=5432 \\\n  -e DB_DATABASE=subql \\\n  -e DB_USER=subql \\\n  -e DB_PASS=secret \\\n  subql-okp4\n```\n\nProvide an alternate configuration:\n\n```sh\ndocker run -ti --rm --name my-indexer \\\n  -e DB_HOST=postgres \\\n  -e DB_PORT=5432 \\\n  -e DB_DATABASE=subql \\\n  -e DB_USER=subql \\\n  -e DB_PASS=secret \\\n  -v /path/to/new-conf.yaml:/srv/subql/project.yaml \\\n  subql-okp4\n```\n\nGive additional arguments to the subql node:\n\n```sh\ndocker run -ti --rm --name my-indexer \\\n  -e DB_HOST=postgres \\\n  -e DB_PORT=5432 \\\n  -e DB_DATABASE=subql \\\n  -e DB_USER=subql \\\n  -e DB_PASS=secret \\\n  subql-okp4 --batch-size=32 --log-level=debug\n```\n\n\u003e **_NOTE:_** To run the container in detached mode replace `-it --rm` by `-d` in the above commands.\n\n## Usage\n\n### Run\n\n🚀 Run the project with the default stack:\n\n```sh\nyarn start:docker\n```\n\n### Query\n\nOpen \u003chttp://localhost:3000/\u003e on your browser, and try the following query:\n\n```graphql\nquery {\n  _metadata {\n    chain\n    lastProcessedHeight\n    targetHeight\n  }\n}\n```\n\nYou should get the following result:\n\n```json\n{\n  \"data\": {\n    \"_metadata\": {\n      \"chain\": \"okp4-nemeton-1\",\n      \"lastProcessedHeight\": 2928706,\n      \"targetHeight\": 2928706\n    }\n  }\n}\n```\n\n## Database\n\nDuring development, it can be useful to access the database directly to inspect and understand the data indexed. The database is a PostgreSQL database, and it is run in a Docker container by the `docker-compose` command. Note that the database is contained in a Docker volume, so it will persist between runs.\n\n### CLI\n\nYou can access the PostgreSQL database via the following command:\n\n```sh\npsql -h localhost -p 5432 -U subql -d subql\n```\n\nThe tables are in the `app` schema.\n\n```sql\nsubql=\u003e SET schema 'app';\nSET\nsubql=\u003e \\dt\n              List of relations\n Schema |        Name         | Type  | Owner\n--------+---------------------+-------+-------\n app    | _metadata           | table | subql\n app    | blocks              | table | subql\n app    | messages            | table | subql\n app    | objectarium_objects | table | subql\n app    | transactions        | table | subql\n```\n\n## Metabase\n\nSince the project uses PostgreSQL to index the data, you can use [Metabase](https://www.metabase.com/) to explore the database and create dashboards.\n\nThe docker-compose comes with a profile for Metabase. To start it, run:\n\n```sh\ndocker-compose --profile metabase up\n```\n\nThen, open \u003chttp://localhost:3001/\u003e on your browser, and connect to the database with the information you can find in the `.env` file.\n\n## You want to get involved? 😍\n\nPlease check out OKP4 health files :\n\n- [Contributing](https://github.com/okp4/.github/blob/main/CONTRIBUTING.md)\n- [Code of conduct](https://github.com/okp4/.github/blob/main/CODE_OF_CONDUCT.md)\n\n## Useful Resources\n\n- [SubQuery Documentation](https://academy.subquery.network/)\n\n[bsd-3-clause]: https://opensource.org/licenses/BSD-3-Clause\n[bsd-3-clause-image]: https://img.shields.io/badge/License-BSD_3--Clause-blue.svg?style=for-the-badge\n[cc-by-sa]: https://creativecommons.org/licenses/by-sa/4.0/\n[cc-by-sa-image]: https://i.creativecommons.org/l/by-sa/4.0/88x31.png\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fokp4%2Fsubql-okp4","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fokp4%2Fsubql-okp4","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fokp4%2Fsubql-okp4/lists"}