I am new in the blockchain field, and I am trying to build my own block explorer from scratch to really learn about Bitcoin. I am currently running a full node in a raspberry pi, and I have already decoded the chainstate/UTXO-set with a levelDB library for Node.js. The content of this database is not exactly what I found in the documentation around, but led me well enough to fully decode this database.
Basically, the keys are the transaction ids with the index of the output, and the values contain the height, wether it is a coinbase transaction or not, the amount, and the address (before the base58 encoding) of every utxo.
However, I don't really know how to query this database in an efficient way to get all the utxos for a specific address without scanning the whole chainstate. It took me about 10 minutes to get all the utxos of a single address which is totally unacceptable.
I guess my specific question is how do I query this database through the values instead of the keys? Or if there is a better way to do this, maybe through the blockchain itself? maybe to an RPC bitcoin-cli call?