Hey everyone, I'm feeling in a better mood today, and I want to thank everyone who supports me. Your encouragement means a lot. A comment on [one of my previous `hive-nectar` posts](@thecrazygm/hive-nectar-v013-the-green-edition) got me thinking. I was asked why I decided to port a large, complex library like `beem` instead of starting with something simpler. That question stuck with me: how hard would it be to build a Hive library from scratch, with just the features I would want for quick projects? I don't think anyone has started a library from scratch in some time. So, I took a stab at it. I'm excited to share the result, even in its early stages. ![image.png](https://files.peakd.com/file/peakd-hive/thecrazygm/AJeb2E93xw1DKHqGBBzexaqWTrEuwf2vyEvxqko52XBmC6Bjjhx1iVdx413ryQP.png) ## Introducing: NectarLite **NectarLite** is a brand-new, lightweight Python library for interacting with the Hive blockchain. It's built from the ground up to be simple, fast, and easy to use, especially for scripts and one‑off projects where a full‑featured library would be overkill. - **GitHub Repository:** [https://github.com/TheCrazyGM/nectarlite](https://github.com/TheCrazyGM/nectarlite) I had planned to wait until it was more mature, but with #HiveFest happening, I thought now would be the perfect time to share it with the community. --- ### What About Hive‑Nectar? This does **not** mean `hive-nectar` is dead. `hive-nectar` is a fully‑featured, battle‑tested library that I and many others rely on for large, complex applications. We have far too many projects depending on it to ever abandon it. Instead, building NectarLite is a valuable learning experience. It's allowing me to explore different approaches and gain a deeper understanding of the Hive blockchain's nuances. The lessons I learn and the clean code I develop here will eventually find their way back into `hive-nectar` proper, helping me to improve that larger codebase. Trust me, it's still a mess. Think of it this way: - **Hive‑Nectar** is the comprehensive, all‑in‑one toolkit for heavy‑duty projects. - **NectarLite** is the sleek, minimalist tool for when you just need to get a simple job done quickly and efficiently. --- ### Key Features of NectarLite I'm building NectarLite with a specific vision in mind, liberally borrowing concepts I like from `hive-nectar` and changing the things I don't. The focus is on a clean, understandable, and powerful low‑level interface. - **Fully Asynchronous Support:** Built with modern `async` capabilities from the start. - **Round‑Robin Node Calls:** Automatically rotates through a list of API nodes to ensure reliability. - **Low‑Level API Interface:** Gives you direct control over your interactions with the blockchain. - **HAF Integration:** Offloads call lookups to HAF endpoints where it makes sense (like reputation and balance). - **Manual Transaction Building:** Provides the tools to build and sign transactions manually, giving you full control. --- ### NectarLite in Action Here’s a quick look at how easy it is to stream votes from the blockchain. #### Synchronous Example ```python from nectarlite.api import Api from nectarlite.stream import Stream # Stream new votes and print them api = Api(["https://api.hive.blog"]) listener = Stream(api=api, blockchain_mode="head") for vote in listener.on("vote"): print(f"New Vote! Voter: {vote.voter}, Post: @{vote.author}/{vote.permlink}") ``` #### Asynchronous Example with Node Rotation ```python import asyncio from nectarlite.api import AsyncApi from nectarlite.stream import AsyncStream async def main(): # Will alternate between nodes on each API call api = AsyncApi(["https://api.hive.blog", "https://api.syncad.com"]) listener = AsyncStream(api=api, blockchain_mode="head") async for transfer in listener.on("transfer"): print(f"{transfer['from']} -> {transfer['to']} {transfer['amount']}") if __name__ == "__main__": asyncio.run(main()) ``` --- ### Get Involved If this project excites you, I'd love for you to check it out. You can see the project's direction on the [ROADMAP.md](https://github.com/TheCrazyGM/nectarlite/blob/main/ROADMAP.md) and find more [examples](https://github.com/TheCrazyGM/nectarlite/tree/main/examples) in the repository. NectarLite is not on PyPI yet, but you can install it directly from GitHub: ```bash # Using pip pip install git+https://github.com/TheCrazyGM/nectarlite # Using uv uv pip install git+https://github.com/TheCrazyGM/nectarlite ``` **Word of warning:** This is still very much in an alpha/beta stage. The core API is stable for the features that are implemented, but it could change at any time as I continue development. ### The Future I plan on having a core set of libraries that function similarly to each other for different languages as well. `Golang` and `Rust` are on my list, but I wanted to work with what I know best to get a high‑level understanding of the finer points first. It's one thing to maintain and clean up an existing codebase, it's a whole other thing to start from scratch. As always, Michael Garcia a.k.a. TheCrazyGM