TzGo is Blockwatch's low-level Tezos Golang SDK for reliable, high-performance applications with a focus on correctness, stability, and compliance with the Tezos protocol. Available on GitHub blockwatch-cc/tzgo.
New: Blockwatch TzGo v1.16
With the latest TzGo version v1.16, we're providing compatibility with Tezos' 13th protocol upgrade Mumbai, incorporating new data types, hashes, RPC calls, and transaction encoding for tz4 and sr1 addresses and smart rollups. Smart rollups are supported in the RPC and codec packages along with binary encoders for all new operations introduced since Protocol Lima.
We have changed TzGo's memory layout and interfaces for address and hash types. Please note that this is a breaking change: due to the new encoding data writing using earlier versions of TzGo cannot be read with the new Binary Unmarshaler
(use address.Decode(b []byte)
instead). The new format allows us to save one allocation and 24 bytes per address/hash, which results in the minimal possible sizes of 21 bytes for addresses and 32 bytes for hashes. The savings are ~50% less heap memory usage and one out of two memory allocations (instead of slices, we use fixed length Go arrays now). A positive side effect is that addresses and hashes can now be used as Golang map keys since byte arrays are directly comparable by the compiler.
As a second huge improvement we have reimplemented the protocol activation database used internally to calculate start/end blocks of cycles, voting, snapshot blocks etc. After multiple protocols have changed cycle length it's no longer straightforward to do these calculations without knowing when exactly the switch happened. This change also makes TzGo more upwards compatible since the library does not have to be aware of future protocols anymore. Applications built on top just have to follow a simple protocol to update the activation database when a new protocol is detected (this can even be done at runtime). This enables simpler support for Mondaynet and Sandbox testnets and allows to run applications across mainnet upgrades without forced redeployment.
For a full changelog, please consult the changelog file on the TzGo GitHub repo.
Feature Set
TzGo contains a full set of features to read, monitor, decode, translate, analyze and debug data from the Tezos blockchain, in particular from Tezos smart contracts. It is structured into packages that provide multiple layers of composable building blocks for maximum freedom of choice and composability. Currently, TzGo contains the following 6 core packages:
- a low-level Types library to handle hashes, addresses, keys, signatures other types found on-chain
- a powerful Micheline library to decode and translate data found in smart contract calls, storage, and bigmaps
- an RPC library for accessing the Tezos Node RPC
- a Codec library to construct and serialize operations
- a Contract library for smart contract calls and tokens
- a Signer library to sign transactions local or remote
helpers like an efficient base58 en/decoder, hash maps, etc.
Roadmap
We are committed to maintaining TzGo and keeping it up to date with new Tezos protocol upgrades, further improving its performance, and providing a best-in-class developer experience. The next version of TzGo will come with support for protocol Nairobi. Additionally, we have a few exciting features in the pipeline which will make the life of development teams building on Tezos even easier. Follow us on Twitter and join our Discord for announcements.
Links
- TzGo repository (blockwatch-cc/tzgo)
- TzGo developer documentation
- TzStats-Go repository (blockwatch-cc/tzstats-go) – TzGo's sister library for working with the TzStats Data API
Support
Developer happiness is at the core of what we do and we hope that using TzGo brings you joy. Come and talk to us via Discord and Twitter, or directly open a GitHub issue. Happy building!