GoTezos Q4 Update

BriceAldrich
5 min readJan 1, 2021

Summary

This document serves as a technical update on the progress of the GoTezos software library for Q4 (August-December). Although the project will still be maintained to the best of my ability this will be the final Tezos grant related update.

Improvements

The focus of quarter 4 has largely been around key management, local forging for script expressions (specifically used in Big Maps), RPC completion for Delphi and Edo, bug fixing, and improving the library design and structure.

Key Management

In the previous version of GoTezos (V3) only ed25519 (tz1) was supported as a key type. Go Tezos now supports importing keys, and signing for NistP256 (tz3) and secp256k1 (tz2). The keys package in GoTezos also experienced clean up and refactoring from GoTezos V3.

Script Expression Forging

In addition to key management GoTezos now supports local forging for all script expressions. This allows you to query big_maps with any supported key type.

RPC Completion

GoTezos now offers the complete list of protocol specific RPC’s for both Delphinet and Edonet. V4 also includes the removal of deprecated RPC’s.

New RPC’s added include:

Library Improvements

GoTezos went under construction again for V4 and now has some core library improvements.

HTTP Client

GoTezos improved the way it handles HTTP requests by leveraging the capabilities of the go-resty library. By leveraging this library GoTezos decouples some of the lower level http code and replaces it with a battle tested client packed with features that can make GoTezos easily extensible.

You can easily handle redirects, manage certificates, retries, add before/after middleware. While most of these features can be done with the core http client, which is what go-resty is built on, leveraging this library makes it simple for the user. GoTezos by default uses the default resty client but this can be overrode by using the OverrideClient function.

In addition to changing the http client, GoTezos now bubbles up the client responses with each HTTP request. As an example check out the Block function. You can see the function returns the *resty.Response in the signature. This will allow users of GoTezos to better log and debug their applications at the network layer. You can see an example of how can use the resty.Response type here.

Improved BlockIDs

Users of GoTezos may notice the Head function is missing. This function used to get the head block. This is because GoTezos has pragmatically introduced BlockIDs. This allows users to write less code and identify blocks in a multitude of ways.

As an example on why this might be useful. In GoTezos V3 you would need to do something like this to fetch the current baking rights:

head, err := r.Head()if err != nil {// Do something with the error. Please.}bakingRights, err := r.BakingRights(BakingRightsInput{Blockhash: head.Hash})if err != nil {// Do something with the error. Please.}fmt.Println(bakingRights)

But with GoTezos V4 we can now skip a step:

resp, bakingRights, err := r.BakingRights(BakingRightsInput{BlockID: &rpc.BlockIDHead})if err != nil {// Do something with the error. Please.// Maybe checkout that response}fmt.Println(bakingRights)

Improved Documentation:

GoTezos V4 includes thorough in-code documentation. Each public type is documented with what the type is for as well as what RPC it is associated with it. Additionally each RPC function is documented with the path it will request, the RPC, as well as a description of what it does.

You can also use GoDoc to view the documentation generated from the code comments.

The above links may not accurately reflect the current documentation because pkg.go.dev hasn’t indexed the latest tag. You can get the latest GoDoc by running

godoc -http:6060

Then visiting the following URLs:

Milestones

Conclusion

I want to thank the Tezos Foundation and TQ Tezos for funding the development of this Library for 2020. It has been an amazing learning experience, lead to personal growth/career development, and opened up many opportunities beyond what the grant has provided.

Going forward I will not be asking or applying for any more funding around this project. I do plan to maintain it, respond to issues and pull requests, but will not be actively adding new features. That’s not to say that new features won’t be added from time to time. I will still actively be working on Tezos through camlCase, where I will be dedicating my time to smart contracts and functional programming with Haskell.

--

--

BriceAldrich

Software Development, Cryptocurrency, Investing/Personal Finance