Use nectar without using hive-nectar?

in #nectar12 days ago (edited)

Let me explain...

Been trying to get the attention of people for our proposal and just to show people how important this stuff is to me, I step out of my comfort zone and try to show how it could be important for people that don't even use python or hive-nectar.

nectarflower profile

The account_json_metadata of @nectarflower, which when done will be updated hourly, contains a the list of working nodes and benchmarks against them. I'm running it daily as I'm still working out bugs and make it nice. Along with the metrics and pretty output that @nectarflower will put out daily.

Seems like something pretty useful? No?

So, I broke out of my comfort zone and wrote a little function in javascript to use dhive to query the data and create a new instance with the updated nodelist. So, now my dhive apps and scripts will use the most up to date nodelist based on benchmark scores. Pretty sweet I think.

// Example usage
updateNodesFromAccount('nectarflower')
  .then(updatedClient => {
    console.log('Node update complete');
    // Use the updated client for further operations
    return updatedClient.database.getDynamicGlobalProperties();
  })
  .then(result => {
    console.log('Test query with updated client successful:', result.head_block_number);
  })
  .catch(error => {
    console.error('Error:', error);
  });

I don't know about you, but I hate when my scripts and cron jobs and such die because your favorite node is down. I find it frustrating, and the @fullnodeupdate account hasn't been updated since '22, which is what beem uses. Well, in order to make hive-nectar work as it's supposed to, that is a very integral part of it. So, I've been reverse engineering the benchmarks and output to match as close as possible, with some bonus data.

The full source of the updateNodesFromAccount{'nectarflower') example can be found it's own github repo here: https://github.com/TheCrazyGM/nectarflower-js

So, even if you don't believe that beem hive-nectar needs to exist, I feel it's pretty important stuff that we are doing for the community as a whole.

Maybe this will help someone, maybe it won't. But it is the kind of stuff I do daily just because I enjoy doing it. Perhaps you will support our vision:
Proposal 339: A modular open-source development framework with critical library maintenance.

As always,
Michael Garcia a.k.a. TheCrazyGM

Sort:  

Thank you for all the work you are putting in to make hive easier to work with! Someday I will understand how to make all this cool stuff work.

You can and will! - and we will keep lowering that bar, until its fun again to learn this stuff on HIVE, instead of a burden

How do you organize python code for larger projects?

For NodeJS, I find it more intuitive to split up code into submodules with imports and exports.

For python, its less intuitive to me and I end up with a ton of code in a single file. But I would prefer to have smaller files with clear separation of concerns.

I break it up into submodules and include the bits and pieces as needed. The easiest way to start a project with submodules is to us uv init --lib and it make the file structure modular instead of (uv init same as uv init --app) or uv init --script which is all one file.

image.png

and in pyproject i'll give a script path: e.g. synergy = synergy:main which pulls the main function out of __init__.py

image.png

by doing that it will give me an executable: in this cases .venv/bin/synergy or i can run it as a module e.g. python3 -m synergy

Although, you did just give me some ideas for post content. :)

untitled.gif

Not even flirting, this is a dinner date!