Public HafSQL database on HAF

Edited Jan 2025

The endpoint listed in this post is deprecated and will be dropped soon.
See https://mahdiyari.gitlab.io/hafsql/#connection-settings

The above includes the new public database as well as documentations related to that database.


What is HafSQL

It is built to run on HAF and provide gateway to certain data. For example with hafsql, you can query all the operations and virtual operations by their parameters. This includes getting custom_json operations based on their id with incredible speed. Or searching transfers based on their memo. Or having list of incoming delegations.

It is just the matter of what data do you want or need. Then we can add certain indexes to provide that data easily.

On top of that, hafsql-api is built to provide JSON-RPC 2.0 API access. This again makes it possible to add/manage custom APIs that translate to SQL queries.

Why this post

Although it is fairly "easy" to set up a development environment in 20 minutes and play with HAF and HafSQL, it is not as accessible for everyone. Thus I am providing a public database that is open to anyone. Just remember, this public database is not meant to be used in a production environment in your application.

Play with it and see what data is available and what is not and see how it can help your project. It is possible to add a custom API designed for your needs to hafsql-api that we can potentially run on all the public RPC nodes. Including rpc.mahdiyari.info. Check my previous related posts and gitlab for example API calls.

Here are the details for the public HafSQL database.

host: [Deprecated - read first paragraph] hafsql.mahdiyari.info
port: 5432
database: haf_block_log
user: hafsql_public
password: hafsql_public

This server has been running for couple of months now. There is also a backup server running just in case. There is a 45s timeout on queries. If you hit the timeout it usually means the query is not using an index. You can change your query around, or open an issue, or MR, or reach out to me to potentially add a new index to fit your query if needed.


https://gitlab.com/mahdiyari/hafsql
https://gitlab.com/mahdiyari/hafsql-api

I would also recommend DBeaver as a free database manager.

H2
H3
H4
Upload from PC
Video gallery
3 columns
2 columns
1 column
19 Comments