Nectarflower-go, nectar without nectar 2
hive-186392·@thecrazygm·
0.000 HBDNectarflower-go, nectar without nectar 2
Similar to my [nectaflower-js](https://github.com/TheCrazyGM/nectarflower-js) library that I made for this post [Use Nectar without using Hive-Nectar](/@thecrazygm/use-nectar-without-using-hive-nectar). I decided to show that what I'm working on can be incredibly useful to the hive community even those that wouldn't make use of hive-nectar. So here is my attempt at the [nectarflower-go](https://github.com/TheCrazyGM/nectarflower-go) library to make use of the json metadata from @nectarflower, that is updated hourly! ```go package main import ( "fmt" "log" "github.com/thecrazygm/nectarflower-go/hive" ) func main() { // Create a client just to fetch nodes client := hive.NewClient() // Get nodes from account nodeData, err := client.GetNodesFromAccount("nectarflower") if err != nil { log.Fatalf("Error fetching nodes: %v", err) } // Print the list of passing nodes fmt.Println("Passing nodes:") for _, node := range nodeData.Nodes { fmt.Println(node) } } ```  But in order to make it work, it had to have a working client, so that is included as well, it's fairly crude, but does function. Here is an example of it grabbing the block 10 back from current head. ```go // Create a client client := hive.NewClient() // Get the current block number var props map[string]any err := client.Call("database_api.get_dynamic_global_properties", nil, &props) if err != nil { log.Fatalf("Error fetching global properties: %v", err) } // Convert to int64 currentBlockNum, ok := props["head_block_number"].(float64) if !ok { log.Fatalf("Error getting block number") } // Fetch a specific block targetBlockNum := int64(currentBlockNum) - 10 blockParams := map[string]any{ "block_num": targetBlockNum, } var block map[string]any err = client.Call("block_api.get_block", blockParams, &block) if err != nil { log.Fatalf("Error fetching block: %v", err) } // Access block data blockData, ok := block["block"].(map[string]any) if ok { fmt.Printf("Block ID: %v\n", blockData["block_id"]) } ``` If you want to see the [full example](https://github.com/TheCrazyGM/nectarflower-go/blob/main/example/main.go), it's in the github.  --- I'll continue doing what I love and hope that it maybe helps someone else out there. Plus, it's always great to learn new things, and I've been learning golang slowly over the last year or so. This just gave me a proper foot in the behind to get better at it. As usual, Michael Garcia a.k.a. TheCrazyGM
👍 steembasicincome, sbi2, sbi3, sbi4, sbi5, sbi6, joeyarnoldvn, anikys3reasure, awesomegames007, piestrikesback, shauner, sbi-tokens, qwertm, tub3r0, briefmarken, noloafing, sneakyninja, netzisde, bububoomt, thedailysneak, michael561, pixelfan, sbi7, emsenn0, gamer00, sbi8, sbi9, sbi10, kiemis, txracer, ecoinstant, votehero, quochuy, fatman, voter002, eturnerx, cryptoknight12, jozefkrichards, onewolfe, dpend.active, sketching, mxm0unite, unschool, unschooler, tibfox, ecoinstats, abrockman, accelerator, treasure.hoard, thecrazygm.bank, mithrildestiny, everythingsmgirl, bengy, aakom, a-bot, bigmoneyman, ecosaint, quintaesencia, ecobanker, archon-gov, irisworld, monsterrerentals, voxmortis, ykretz, meno, omra-sky, mes, magic.byte, eforucom, artlover, dkidfit, archonapp, zzz.accounting, upfundme, tehox, lrekt01, he-index, elianaicgomes, hivebuzz, lizanomadsoul, manncpt, jnmarteau, crypticat, pinmapple, roelandp, greddyforce, discovereurovelo, fronttowardenemy, princessmewmew, xsasj, itchyfeetdonica, musicandreview, kimzwarch, gabrielatravels, vcclothing, web-gnar, minedovermatter, alexandrefeliz, stoken.quest, likedeeler, lolz.byte, sw4p, urun,