Skip to content

Instantly share code, notes, and snippets.

View aaronc's full-sized avatar

Aaron Craelius aaronc

View GitHub Profile
aaronc /
Last active May 10, 2022 23:48
good container graphviz output
digraph "" {
graph [bb="0,0,1990.1,405.6"];
node [color=black,
subgraph cluster_b {
graph [bb="1075.8,136,1473.8,212.8",
label="Module: b",
aaronc / schema.sql
Last active November 23, 2021 02:39
tendermint/cosmos postgres index
num smallserial primary key,
chain_id text not null unique
chain_num smallint not null references chain,
height BIGINT not null,


  • for binary encoding we almost always want protobuf
  • for json we almost always want amino for querier backwards compatibility (protobuf json will happen elsewhere)
  • in some cases we want to allow amino as a fallback for interfaces


type Marshaler interface {
aaronc /
Last active November 17, 2023 17:59
Protobuf Canonical Encoding Rules

proto3 Canonical Encoding Rules (CER)

This defines a set of encoding rules for Protocol Buffers 3 (proto3) for serializing messages deterministically such that the serialized form is suitable for signing and encoding in cryptographic attestations (ex. Merkle trees). Similar to ASN.1 and Cap'n Proto, a set of "canonical encoding rules" (CER) is used to define a canonical encoding where the basic proto3 specification does not do so. In this sense, the default protocol buffers specification provides a set of "basic encoding rules" which are not deterministic, and we extend that specification to support deterministic encoding for cryptographic use cases.

aaronc /
Created September 26, 2019 13:59
Amino compatibility "amino-compat" proposal



aaronc /
Created September 26, 2019 13:50
An alternate upgrade coordination mechanism


Our current upgrade module uses the gov module to trigger a planned upgrade, this has a few potential downsides:

  • if a hot-fix release is needed, the network needs to wait for the full voting window
  • if validators need to postpone an upgrade after the governance vote due to some issues found in testing, they can't do that
  • no built-in way to abort an upgrade in case the upgrade handler fails


"binaries": {
"darwin/amd64": "",
"linux/amd64": ""

Keybase proof

I hereby claim:

  • I am aaronc on github.
  • I am aaroncr ( on keybase.
  • I have a public key ASCD3PDnlWKAdlNdbqIhut64-s5Bqh_BOMbdEFSNobkTzwo

To claim this, I am signing this object:

Hackatom Berlin

Regen Network, and our compatriots from TruStory, IOV, Althea and Wallet Connect combined forces to become Team Gaians for the Berlin HackAtom. This blog will review what we created and what it can be used for.

Our team focused on hacking towards a clear use case: user friendly participation in smart contracts about ecological health. In order to create usable functionality for this the team had to overcome some key challenges: create a smart contracting framework for the Cosmos SDK and improved key management.

And that is exactly what was accomplished. In 36 hours, the team pulled together an incredibly powerful and flexible, smart contracting module using WebAssembly (Wasm) and key management modules that interact to create platform that is more powerful and robust than Ethereum, and built in the Cosmos SDK, making interoperability with other chains easy.

Let’s walk through the functionality that was built using the use-case we considered - a simple three-party contract for Regen Netw

aaronc /
Last active October 31, 2022 23:09
Key groups, msg and fee delegation from the Gaians team at Hackatom Berlin 2019

Fee delegation

The delegation module also allows for fee delegation via some changes to the AnteHandler and StdTx. The behavior is similar to that described above for Msg delegations except using the interface FeeAllowance instead of Capability:

// FeeAllowance defines a permission for one account to use another account's balance
// to pay fees