create account

HafSQL V1.0.0-beta by mahdiyari

View this thread on: hive.blogpeakd.comecency.com
· @mahdiyari ·
$206.78
HafSQL V1.0.0-beta
<center>![HafSQL.png](https://files.peakd.com/file/peakd-hive/mahdiyari/23uEsNRBN8VFqNkR4aCSQNwDRgLN2G4wfa9XnM9DyWZQwdrNaay2JikkpGnTU2eaS7JzA.png)</center>

HafSQL runs on a HAF node and makes it possible to run certain queries on the HAF data. It does this by parsing the data already present in the HAF database and adding additional indexes and tables.

As I wrote in [the original proposal post](https://peakd.com/hive-139531/@mahdiyari/dhf-proposal-hive-related-development), the first application is the HafSQL itself and the second is a way to provide this data to the apps and users.

It is fast and easy to setup on any HAF node and doesn't take that much space. Fast here doesn't mean 10 minutes. It can take around 10 hours to be ready on a HAF node which depends on the hardware. It is fast in regards that we are dealing with nearly 5 billion operations.

The first app is self explanatory but for the second one the original plan was to parse the SQL queries in a middleware and forward them into the database. What ended up being is a jussi compatible API endpoint that provides a JSON-RPC2 API access.

I did implement an structure to allow custom queries be implemented in the API as the community or the apps ask for them. For example one custom query that is already added is getting comments/posts sorted by their pending payout value.

I thought about this for a while and I think API is the better approach and will make it easier for public nodes to install and run. Some might decide to provide open access to the database and I will probably provide a public instance shortly too.
***
### Beta version
It is not really beta because it is ready but it might need some more testing in production and feedback before being fully released.

I encourage developers and anyone using hivesql to go through list of the available APIs and see if anything is missing in their opinion.

I expect to add some additional custom queries but I don't have a clear idea of what is being used.

***
### Going forward
The proposal has ended few days ago and I was doing the final touches since then. I expect to work on this project probably a few more days. Maybe not in terms of coding but testing in production, documenting, and adding custom queries that might come up.

The first motivation for starting this project was having an open source alternative to hivesql (which we have been paying $4,000 monthly through DHF). But a few times during the development I though about going a little bit further and replacing the hivemind too. HafSQL only misses a couple of things that is available on hivemind. I can try developing further but will need more feedback. I'm not sure yet how will public node providers go about this project.

***
### How HafSQL works
Examples:
- Get all the transfer operations that have memo="test"
```
curl -s --data '{"jsonrpc":"2.0", "method":"hafsql.op_transfer", "params":{"memo": "test"}, "id":1}' https://rpc.mahdiyari.info
```

- Get all the delegations to account "ocdb"
```
curl -s --data '{"jsonrpc":"2.0", "method":"hafsql.delegations", "params":{"delegatee": "ocdb"}, "id":1}' https://rpc.mahdiyari.info
```

Checkout the gitlab page of the [hafsql-api](https://gitlab.com/mahdiyari/hafsql-api) for the full list of APIs.

***
### Testing
You can try playing with the APIs or you can replay a [HAF](https://gitlab.syncad.com/hive/haf) node with the 5 million block_log and install HafSQL there. It should take maybe around 10-30 minutes. This can be helpful before running on a production HAF node as well.

Installation instructions are provided in the gitlab repository of each app. All the APIs are listed there as well as their parameters etc.

HafSQL: https://gitlab.com/mahdiyari/hafsql
HafSQL-API: https://gitlab.com/mahdiyari/hafsql-api
RPC node: https://rpc.mahdiyari.info

***

Thanks for all the support. I appreciate it.
πŸ‘  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 672 others
properties (23)
authormahdiyari
permlinkhafsql-v100-beta
categoryhive-139531
json_metadata{"app":"peakd/2023.6.5","format":"markdown","tags":["hivedev","hive","hafsql","haf","dhf"],"users":["mahdiyari"],"image":["https://files.peakd.com/file/peakd-hive/mahdiyari/23uEsNRBN8VFqNkR4aCSQNwDRgLN2G4wfa9XnM9DyWZQwdrNaay2JikkpGnTU2eaS7JzA.png"]}
created2023-06-28 10:56:42
last_update2023-06-28 10:56:42
depth0
children11
last_payout2023-07-05 10:56:42
cashout_time1969-12-31 23:59:59
total_payout_value103.450 HBD
curator_payout_value103.332 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length3,882
author_reputation199,864,818,197,856
root_title"HafSQL V1.0.0-beta"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id124,851,168
net_rshares454,955,256,904,155
author_curate_reward""
vote details (736)
@adedayoolumide ·
$0.32
Good work πŸ‘
πŸ‘  
properties (23)
authoradedayoolumide
permlinkre-mahdiyari-2023628t14425157z
categoryhive-139531
json_metadata{"tags":["hivedev","hive","hafsql","haf","dhf"],"app":"ecency/3.0.32-vision","format":"markdown+html"}
created2023-06-28 13:42:51
last_update2023-06-28 13:42:51
depth1
children0
last_payout2023-07-05 13:42:51
cashout_time1969-12-31 23:59:59
total_payout_value0.160 HBD
curator_payout_value0.161 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length11
author_reputation154,075,048,924,028
root_title"HafSQL V1.0.0-beta"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id124,854,407
net_rshares708,257,750,760
author_curate_reward""
vote details (1)
@beejoodie · (edited)
Looking at software and mobile app development through the prism of complexity theory is an intriguing experience. Software development, like complexity theory, is characterized by a complex web of interdependencies, emergent features, and adaptability. This is particularly true when looking at the <a href="https://gowombat.team/">Go Wombat</a> process.
properties (22)
authorbeejoodie
permlinksawy6r
categoryhive-139531
json_metadata{"app":"hiveblog/0.1","links":["https://gowombat.team/"]}
created2024-03-25 17:06:27
last_update2024-04-02 09:08:18
depth1
children0
last_payout2024-04-01 17:06:27
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length355
author_reputation0
root_title"HafSQL V1.0.0-beta"
beneficiaries
0.
accountdbuzz
weight500
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id132,323,601
net_rshares0
@bigtakosensei ·
Nice! πŸ™πŸΎ

!PIZZA
properties (22)
authorbigtakosensei
permlinkre-mahdiyari-2023628t115047642z
categoryhive-139531
json_metadata{"tags":["hive-139531","hivedev","hive","hafsql","haf","dhf"],"app":"ecency/3.0.41-mobile","format":"markdown+html"}
created2023-06-28 16:50:48
last_update2023-06-28 16:50:48
depth1
children0
last_payout2023-07-05 16:50:48
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length16
author_reputation72,759,560,419,713
root_title"HafSQL V1.0.0-beta"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id124,859,778
net_rshares0
@emeka4 ·
$0.32
Thanks for sharing and keep up the good work.
πŸ‘  
properties (23)
authoremeka4
permlinkre-mahdiyari-2023628t16743230z
categoryhive-139531
json_metadata{"tags":["hive-139531","hivedev","hive","hafsql","haf","dhf"],"app":"ecency/3.0.41-mobile","format":"markdown+html"}
created2023-06-28 15:07:42
last_update2023-06-28 15:07:42
depth1
children0
last_payout2023-07-05 15:07:42
cashout_time1969-12-31 23:59:59
total_payout_value0.160 HBD
curator_payout_value0.160 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length45
author_reputation234,954,374,968,228
root_title"HafSQL V1.0.0-beta"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id124,856,515
net_rshares703,871,742,500
author_curate_reward""
vote details (1)
@hivebuzz ·
Congratulations @mahdiyari! Your post has been a top performer on the Hive blockchain and you have been rewarded with this rare badge

<table><tr><td><img src="https://images.hive.blog/60x60/http://hivebuzz.me/badges/toppayoutday.png"></td><td>Post with the highest payout of the day.</td></tr>
</table>

<sub>_You can view your badges on [your board](https://hivebuzz.me/@mahdiyari) and compare yourself to others in the [Ranking](https://hivebuzz.me/ranking)_</sub>
<sub>_If you no longer want to receive notifications, reply to this comment with the word_ `STOP`</sub>



**Check out our last posts:**
<table><tr><td><a href="/hive-122221/@hivebuzz/pud-202307"><img src="https://images.hive.blog/64x128/https://i.imgur.com/805FIIt.jpg"></a></td><td><a href="/hive-122221/@hivebuzz/pud-202307">Hive Power Up Day - July 1st 2023</a></td></tr><tr><td><a href="/hive-106258/@hivebuzz/hivefest-trf-2023"><img src="https://images.hive.blog/64x128/https://files.peakd.com/file/peakd-hive/hivebuzz/23wC7eJH6F57ZLKQHzTxzC23zx8AzVrmxWD6PyZtoHcCjQafpgtZyNrpVjoVY1cYLKmYH.png"></a></td><td><a href="/hive-106258/@hivebuzz/hivefest-trf-2023">Announcing the Travel Reimbursement Fund for HiveFest⁸</a></td></tr></table>
properties (22)
authorhivebuzz
permlinknotify-mahdiyari-20230629t010842
categoryhive-139531
json_metadata{"image":["http://hivebuzz.me/notify.t6.png"]}
created2023-06-29 01:08:42
last_update2023-06-29 01:08:42
depth1
children0
last_payout2023-07-06 01:08:42
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length1,208
author_reputation369,408,881,845,935
root_title"HafSQL V1.0.0-beta"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id124,870,266
net_rshares0
@ibbtammy ·
Keep the good work going bro!

You rock!
properties (22)
authoribbtammy
permlinkre-mahdiyari-rwzs6c
categoryhive-139531
json_metadata{"tags":["hive-139531"],"app":"peakd/2023.6.5"}
created2023-06-29 01:59:00
last_update2023-06-29 01:59:00
depth1
children0
last_payout2023-07-06 01:59:00
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length40
author_reputation234,384,783,125,660
root_title"HafSQL V1.0.0-beta"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id124,871,006
net_rshares0
@jakiro12 ·
awesome i will try it in a future, know i am learning more about sql queries :D
πŸ‘Ž  
properties (23)
authorjakiro12
permlinkrwzjgd
categoryhive-139531
json_metadata{"app":"hiveblog/0.1"}
created2023-06-28 22:50:36
last_update2023-06-28 22:50:36
depth1
children0
last_payout2023-07-05 22:50:36
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length79
author_reputation39,029,549,016,609
root_title"HafSQL V1.0.0-beta"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id124,867,992
net_rshares-5,256,317,280
author_curate_reward""
vote details (1)
@latinowinner ·
$0.31
keep the good work up
πŸ‘  
properties (23)
authorlatinowinner
permlinkre-mahdiyari-2023628t224046378z
categoryhive-139531
json_metadata{"tags":["hivedev","hive","hafsql","haf","dhf"],"app":"ecency/3.0.33-vision","format":"markdown+html"}
created2023-06-28 12:40:45
last_update2023-06-28 12:40:45
depth1
children0
last_payout2023-07-05 12:40:45
cashout_time1969-12-31 23:59:59
total_payout_value0.156 HBD
curator_payout_value0.156 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length21
author_reputation2,955,726,961,554
root_title"HafSQL V1.0.0-beta"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id124,853,122
net_rshares689,535,984,782
author_curate_reward""
vote details (1)
@pizzabot · (edited)
RE: HafSQL V1.0.0-beta
<center>PIZZA!
 The Hive.Pizza team manually curated this post.

$PIZZA slices delivered:
@bigtakosensei<sub>(2/5)</sub> tipped @mahdiyari 


<sub>You can now send $PIZZA tips in <a href="https://discord.gg/hivepizza">Discord</a> via tip.cc!</sub></center>
properties (22)
authorpizzabot
permlinkre-hafsql-v100-beta-20230628t110826z
categoryhive-139531
json_metadata"{"app": "pizzabot"}"
created2023-06-28 11:08:27
last_update2023-06-28 16:51:12
depth1
children0
last_payout2023-07-05 11:08:27
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length256
author_reputation7,614,217,529,688
root_title"HafSQL V1.0.0-beta"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id124,851,446
net_rshares0
@theguruasia ·
Wow this is very interesting! Will try this soon.
$WINE
properties (22)
authortheguruasia
permlinkre-mahdiyari-rx0afh
categoryhive-139531
json_metadata{"tags":["hive-139531"],"app":"peakd/2023.6.5"}
created2023-06-29 08:33:18
last_update2023-06-29 08:33:18
depth1
children0
last_payout2023-07-06 08:33:18
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length55
author_reputation72,574,001,616,540
root_title"HafSQL V1.0.0-beta"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id124,878,363
net_rshares0
@vlad26 ·
@tipu curate
properties (22)
authorvlad26
permlinkre-mahdiyari-2023628t154859249z
categoryhive-139531
json_metadata{"tags":["hivedev","hive","hafsql","haf","dhf"],"app":"ecency/3.0.33-vision","format":"markdown+html"}
created2023-06-28 12:49:00
last_update2023-06-28 12:49:00
depth1
children0
last_payout2023-07-05 12:49:00
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length12
author_reputation23,669,857,969,677
root_title"HafSQL V1.0.0-beta"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id124,853,298
net_rshares0