crypto-org-chain / crypto-org-chain/cronos
Graphql endpoint
- Dominant language
- Go
- Stars
- 336
- Forks
- 299
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 4
Description
**Is your feature request related to a problem? Please describe.**
Making multiple RPC calls to read contract storage data can be slow as the call need to go trough the EVM then converted to JSON format. If we could have a Graphql endpoint that reads directly trough the node database that would make the process faster.
**Describe the solution you'd like**
Based on this issue, it seems that Tendermint are not planning on supporting it : https://github.com/tendermint/tendermint/issues/3253
I'm talking about mainly supporting something like this: https://eips.ethereum.org/EIPS/eip-1767
In GETH we can start a graphql endpoint with our node by adding the argument --graphql to the geth command.
**Describe alternatives you've considered**
I made a first attempt to build one on my the node I'm running but I encountered a problem, not only that my knowledge right now would not let me decode effectively and in short time the data store in tx_data.db, state.db and blockstore.db located in the data directory, but as soon that I tried to access that data using python driver of leveldb database, the database apparently got corrupted and the node stopped syncing, I tried to restart it and it just crashed and I got the error : ERR failed to open DB: error="failed to intialize ddatabse: file missing".
Transaction indexing might be another alternative to achieve this solution but I can't figure out how yet. The main languages that I know most are python and javascript but mostly Python: https://docs.tendermint.com/master/app-dev/indexing-transactions.html
**Additional context**
Someone in the discord told that All I have to do to have something like the one in geth is just to install graphql on top of the node, I figure out that in top of that I needed to implement a resolver, and that's when I went to read the node database to see what I could do and by that action I corrupted the database since golelvedb only allow one process to read it at a time (but that process can have multiple threads, maybe that how geth do it).
Finally, I would like to know if there a possibility to achieve this in cronosd ? or that I should stop trying ? and if there is but no one is working on it, from where can I start please ?
Contributor guide
Assessment
This issue has not been assessed yet.