subql okp4
v1.0.1

? OKP4协议的子查询索引器。
该存储库是OKP4子查询索引器的所在地,该工具通过GraphQL API从OKP4协议提供链条数据。该项目基于子查询,这是一种开源工具,可帮助创建用于区块链应用程序的快速可靠的API。
可用以下服务:
| 链条 | 服务 | 端点 |
|---|---|---|
okp4-nemeton-1 | 操场 | https://explorer.subquery.network/subquery/okp4/nemeton-1 |
okp4-nemeton-1 | GraphQl | https://api.subquery.network/sq/okp4/nemeton-1 |
确保正确安装以下内容:
v18.18 (氢)v1.22v3.2.0通过使用NPM在您的终端上安装子查询CLI(我们不建议使用YARN安装全局依赖项): npm install -g @subql/[email protected]?安装依赖项:
yarn生成类型:
yarn prepack?构建Docker图像:
docker build -t subql-okp4 .运行它:
docker run -ti --rm --name my-indexer
-e DB_HOST=postgres
-e DB_PORT=5432
-e DB_DATABASE=subql
-e DB_USER=subql
-e DB_PASS=secret
subql-okp4提供替代配置:
docker run -ti --rm --name my-indexer
-e DB_HOST=postgres
-e DB_PORT=5432
-e DB_DATABASE=subql
-e DB_USER=subql
-e DB_PASS=secret
-v /path/to/new-conf.yaml:/srv/subql/project.yaml
subql-okp4向SubQL节点提供其他参数:
docker run -ti --rm --name my-indexer
-e DB_HOST=postgres
-e DB_PORT=5432
-e DB_DATABASE=subql
-e DB_USER=subql
-e DB_PASS=secret
subql-okp4 --batch-size=32 --log-level=debug注意:在上述命令中,以独立模式运行容器,替换
-it --rmby-d。
使用默认堆栈运行项目:
yarn start:docker打开http:// localhost:3000/在您的浏览器上,尝试以下查询:
query {
_metadata {
chain
lastProcessedHeight
targetHeight
}
}您应该得到以下结果:
{
"data" : {
"_metadata" : {
"chain" : " okp4-nemeton-1 " ,
"lastProcessedHeight" : 2928706 ,
"targetHeight" : 2928706
}
}
}在开发过程中,直接访问数据库以检查和理解索引的数据可能很有用。该数据库是一个PostgreSQL数据库,它是由docker-compose命令在Docker容器中运行的。请注意,数据库包含在Docker卷中,因此它将在运行之间持续。
您可以通过以下命令访问PostgreSQL数据库:
psql -h localhost -p 5432 -U subql -d subql表格在app架构中。
subql => SET schema ' app ' ;
SET
subql => dt
List of relations
Schema | Name | Type | Owner
-- ------+---------------------+-------+-------
app | _metadata | table | subql
app | blocks | table | subql
app | messages | table | subql
app | objectarium_objects | table | subql
app | transactions | table | subql由于该项目使用PostgreSQL来索引数据,因此您可以使用Metabase探索数据库并创建仪表板。
Docker-Compose带有用于Metabase的配置文件。要开始,请运行:
docker-compose --profile metabase up然后,在浏览器上打开http:// localhost:3001/,并使用.env文件中可以找到的信息连接到数据库。
请查看OKP4健康文件: