Just for fun, I wanted to see what I could accomplish with a browser extension in a few hours on my day off yesterday - starting from scratch.
I was actually challenging myself to get it completely working in a single prompt with an LLM, but I ran out of free prompts on Claude & ChatGPT before I could accomplish that. Anyway, that might still be too much of a reach for today's LLM technology - at least with the free tier. By the end, it seemed like it was drifting further away from the goal. It didn't occur to me to try Grok, though. Maybe I'll give him a try some other time.
Here's the prompt I was working with when I ran out of free quota.
I want to build a browser extension that will query each new block on the Steem blockchain and display two pie charts. One pie chart should show the number of transactions in the last irreversible block by type. The second pie chart should show the running totals. The browser extension should also show the last_irreversible_block number, the number of blocks collected, the time/date that the last irreversible block was added to the chain, and the witness account that added it. Blocks are produced every 3 seconds.
Display the two pie charts side by side. Add a button to reset all counters to zero and save the changes. When the window is open, have the pie charts refresh after each new block is collected. When it's closed, have it keep updating the counters.
Make sure the window is big enough to hold all information with no scrolling.
Don't bother with an icon file. I'll provide a chart.min.js file in the libs directory. Put the popup files into a popup directory.
The extension should be named "SAM" (Steem Activity Monitor).
Here are linux commands to get the last_irreversible_block_number:
$ export STEEM_SHELL_API="https://steemd.steemworld.org"
$ curl -s --data '{"jsonrpc":"2.0", "method":"condenser_api.get_dynamic_global_properties", "params":[], "id":1}' | jq -S .result.last_irreversible_block_num
91081103
Here are linux commands to get all transactions from that block (along with the JSON output format):
$ export BLOCKNUM=91081103
$ export virtOnly="false"
$ curl --fail -s --data '{"jsonrpc":"2.0", "method":"condenser_api.get_ops_in_block", "params":['',''], "id":1}'
{"jsonrpc":"2.0","result":[{"trx_id":"0000000000000000000000000000000000000000","block":91081103,"trx_in_block":4294967295,"op_in_trx":0,"virtual_op":1,"timestamp":"2024-12-09T13:46:09","op":["producer_reward",{"producer":"boylikegirl.wit","vesting_shares":"436.547281 VESTS"}]},{"trx_id":"0000000000000000000000000000000000000000","block":91081103,"trx_in_block":4294967295,"op_in_trx":0,"virtual_op":2,"timestamp":"2024-12-09T13:46:09","op":["comment_payout_update",{"author":"mohinahmed","permlink":"snvcwu"}]}],"id":1}
After I ran out of free prompts, it felt so close that I wanted to get it to a legitimate breaking point, so I spent an hour or two coding the old-fashioned way.
Meet SAM, the Steem Activity Monitor.
I doubt if I'll ever work on SAM again, but it was a fun exercise. For a blast from the past, I also compared the numbers against the Java Steemometer program that I wrote a while back.
As you can see (below), they match up pretty well (after allowing for rounding and converting from ops per second
to ops per minute
). So, either they're both right or they're both wrong in exactly the same way😉. Here's a comparison where both started collecting on the same block.
SAM
- Block number 91122683 is the 4262nd block, and it's reporting 2.88 ops per second (2.88 * 60 = 172.8).
Steemometer
- Block number 91122683 is the 4262nd block and it's reporting 172 blocks per minute.
In SAM, mouseover will reveal the operation types and counts for each of the slices. For the pie charts, I'm using a utility that I learned about from @cmp2020. As you can see in the prompt, I'm using a copy of Chart.js that was downloaded from from jsdelivr.com.
Feel free to download the inaugural and probably final version of SAM.
Thank you for your time and attention.
As a general rule, I up-vote comments that demonstrate "proof of reading".
Steve Palmer is an IT professional with three decades of professional experience in data communications and information systems. He holds a bachelor's degree in mathematics, a master's degree in computer science, and a master's degree in information systems and technology management. He has been awarded 3 US patents.
Pixabay license, source
Reminder
Visit the /promoted page and #burnsteem25 to support the inflation-fighters who are helping to enable decentralized regulation of Steem token supply growth.
You've got a free upvote from witness fuli.
Peace & Love!
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit