RC Angel Delegations: Using VSCode + HiveSQL to Measure Delegation Metrics

in HiveDevslast year

What's RC Angel?

Last October, I set up my account to donate 10% of its Resource Credits (RC) to RC-Angel. I have not changed the allocation since. RC angel is a service created by @deathwing that loans out RCs. For example, if a new user has difficulty broadcasting to the network because they've run out of RCs, the angel can step in and give them a resource boost. This service is also hooked up to @rishi556's GiftGiver.site where Hivers can request RC delegations for themselves or others. All of this was made possible by the new RC delegation feature in Hive Hardfork 26 (thanks, core devs!).

Asking HiveSQL about RC Delegation History

This week I learned how to ask HiveSQL (by @arcange) about Hive custom_json ops. And an interesting question is: how many times has RC angel delegated RCs on my behalf since last October?

A quick query tells me that 412 delegations have been sent from my account.

SELECT COUNT(*)
FROM TxCustoms 
WHERE timestamp > DATEADD(MONTH, -6, GETDATE()) 
AND required_posting_auth = 'hivetrending'
AND tid = 'rc'

HiveSQL can also do neat tricks like partitioning data into days/months/years buckets. Like this:

SELECT DATEPART(month, timestamp) as month_bucket, COUNT(*) as num_rows
FROM TxCustoms 
WHERE timestamp > DATEADD(MONTH, -6, GETDATE()) 
AND required_posting_auth = 'hivetrending'
AND tid = 'rc'
GROUP BY DATEPART(month, timestamp)
ORDER BY month_bucket ASC

And then I can copy the data into Google Sheets to make nice charts like this. What happened in Feb?

image.png

Calling HiveSQL from VSCode

In the past, I had dabbled with HiveSQL but struggled to find a reliable, free MSSQL client. Look no further! This VSCode extension makes it possible to connect to HiveSQL and execute queries from a VSCode text editor. Awesome!

image.png

After installing the VSCode MSSQL extension, many new commands are added to the command palette. First, "MSSQL: Add Connection" and input the connection details provided when signing up for HiveSQL access. Then, create a new file, type an MSSQL query, and run the "MSSQL: Execute Query" command. A new pane will appear on the right with the status and results.

image.png

That's it

I just wanted to share a few useful things I've learned this week. Enjoy SQL querying! Consider voting for the HiveSQL DHF proposal and Deathwing's proposal(s) to support their projects.

Signing off,
Hivetrending (pizza.witness team)

Sort:  

As someone who struggles with coding, it's really helpful for me when you share these things. I've gotten so much better and you deserve a lot of the credit. Thank you!

!PIZZA


The rewards earned on this comment will go directly to the people sharing the post on Twitter as long as they are registered with @poshtoken. Sign up at https://hiveposh.com.

Congratulations @hivetrending! You received a personal badge!

Happy Hive Birthday! You are on the Hive blockchain for 3 years!

You can view your badges on your board and compare yourself to others in the Ranking

Check out our last posts:

The Hive Gamification Proposal
Support the HiveBuzz project. Vote for our proposal!

Woot! 3 wonderful years!

Happy Hive Birthday @hivetrending
🎉🎈🎂🎉🎈

PIZZA!

PIZZA Holders sent $PIZZA tips in this post's comments:
@hurtlocker(1/20) tipped @hivetrending (x1)

You can now send $PIZZA tips in Discord via tip.cc!