Writing a Python Library for the Atto Node API
I recently wrote a Python wrapper for the Atto Node API (GitHub), and I wanted to share my journey—from figuring out how to convert Atto addresses, to designing around Python’s async model, to publishing a usable API wrapper. Hopefully, this helps someone else who's either interested in Atto or wants to see what writing an API wrapper looks like from a beginner's perspective.
🚀 Why I Started
At the time, there were no Python API wrappers available for Atto. The only libraries available targeted JS/WASM, used only by the wallet, and Kotlin.
I wanted to play around with the API, but to do that, I needed to convert an Atto public key (a base32-encoded string) into a hex string, which the API expects. I wrote some code for this in Python, the journey of which I'll expand on below.
Using curl
and copying and pasting addresses to make requests was getting
tedious, so I switched to using Python for that too.
At some point, I realized: “I’m already halfway to an API wrapper. Why not
finish it?”. There weren’t that many endpoints, so it seemed like a manageable
project.
As a student, this felt like a fun way to procrastinate from real work™.