Hello,
We started to discover how we can setup Cardano RPC to be able to get blockchain data via API.
Accordingly to the Cardano architecture, we need just some components. We can interact using GraphQL with data stored in PostgreSQL DB and collected by DB-Sync from the Full node.
App --> GraphQL API --> PostgreSQL <-- DB Sync <-- Node
Also, we found information about cardano-node-ogmios, but looks like it is not solution we need.
The easiest way to run all this is using docker compose.
We already started
- Postgres - works
- Node - in sync
- DB-Sync - follow node and sync data
- GraphQL - doesn’t work (Connection refused)
- Hashura - started and we can access console but not clear why do we need it
- Ogmios - not use it because it is not specified on the Architecture diagram
Issue
GraphQL container is up and running and we also enabled debug logs
graphql | {"name":"cardano-graphql","hostname":"65f028378a05","pid":1,"level":20,"module":"Db","msg":"pgSubscriber: Connected","time":"2022-05-25T11:30:23.065Z","v":0}
graphql | {"name":"cardano-graphql","hostname":"65f028378a05","pid":1,"level":30,"module":"Server","msg":"Initializing","time":"2022-05-25T11:30:23.066Z","v":0}
graphql | {"name":"cardano-graphql","hostname":"65f028378a05","pid":1,"level":30,"module":"HasuraClient","msg":"Initializing","time":"2022-05-25T11:30:23.466Z","v":0}
graphql | {"name":"cardano-graphql","hostname":"65f028378a05","pid":1,"level":20,"module":"HasuraClient","msg":"{\"level\":\"info\",\"msg\":\"Help us improve Hasura! The cli collects anonymized usage stats which\\nallow us to keep improving Hasura at warp speed. To opt-out or read more,\\nvisit https://hasura.io/docs/1.0/graphql/manual/guides/telemetry.html\\n\",\"time\":\"2022-05-25T11:30:23Z\"}\n{\"level\":\"info\",\"msg\":\"Applying migrations...\",\"time\":\"2022-05-25T11:30:24Z\"}\n{\"level\":\"info\",\"msg\":\"nothing to apply\",\"time\":\"2022-05-25T11:30:24Z\"}\n","time":"2022-05-25T11:30:24.355Z","v":0}
graphql | {"name":"cardano-graphql","hostname":"65f028378a05","pid":1,"level":40,"module":"Db","msg":"pgSubscriber: cardano-db-sync-extended starting, schema will be reset","time":"2022-05-25T11:31:12.982Z","v":0}
graphql | {"name":"cardano-graphql","hostname":"65f028378a05","pid":1,"level":30,"module":"CardanoNodeClient","msg":"Initializing. This can take a few minutes...","time":"2022-05-25T11:31:13.469Z","v":0}
graphql | {"name":"cardano-graphql","hostname":"65f028378a05","pid":1,"level":20,"msg":"Establishing connection to cardano-node: Attempt 1 of 101, retrying...","time":"2022-05-25T11:31:13.481Z","v":0}
graphql | {"name":"cardano-graphql","hostname":"65f028378a05","pid":1,"level":20,"module":"DataFetcher","instance":"ServerHealth","msg":"Initial value fetched","time":"2022-05-25T11:31:14.483Z","v":0}
graphql | {"name":"cardano-graphql","hostname":"65f028378a05","pid":1,"level":20,"msg":"Establishing connection to cardano-node: Attempt 2 of 101, retrying...","time":"2022-05-25T11:31:14.487Z","v":0}
graphql | {"name":"cardano-graphql","hostname":"65f028378a05","pid":1,"level":20,"module":"DataFetcher","instance":"ServerHealth","msg":"Initial value fetched","time":"2022-05-25T11:31:15.687Z","v":0}
graphql | {"name":"cardano-graphql","hostname":"65f028378a05","pid":1,"level":20,"msg":"Establishing connection to cardano-node: Attempt 3 of 101, retrying...","time":"2022-05-25T11:31:15.690Z","v":0}
graphql | {"name":"cardano-graphql","hostname":"65f028378a05","pid":1,"level":20,"module":"DataFetcher","instance":"ServerHealth","msg":"Initial value fetched","time":"2022-05-25T11:31:17.132Z","v":0}
Questions
We can’t connect to the GraphQL playground and port is not opening and we have the following questions
-
How long GraphQL will initialize?
-
To which node it is trying to connect, because it needs connection only to Postgres accordingly to the Architecture?
-
Accordingly to the Architecture diagram we need Node/DB-Sync/Postgres/GraphQL. What is about Hashura/Ogmios, do we need them and why?
Their configuration is specified in the docker-compose for cardano-graphql. -
Is Cardano Node store all blockchain data?
Analogy from Ethereum - Archive node, will we be able to discover all the transactions, starting from the genesis? -
If Node store all the data, is there a way to prune old data?
-
DB-Sync started to sync data with PostgreSQL and we see
64G node-db
/60G postgres
.
It means that we have two copies of the data, one on the Node and second in the PostgreSQL?
Is there a way to maintain just one copy of the data? It may refer to Q.2 - pruning. -
Should we wait Node to be sync before running DB-Sync or it will handle all by itself and handle all sync/pauses/delays and so on?
-
DB-Sync extended is the same docker image and
EXTENDED=true
variable activate extended mode?
If we initially started in a simple mode (without variable), can be change it and an epoch table will be added or we need to do a full re-sync?