Skip to content

Instantly share code, notes, and snippets.

Counterintuitive Runtime

The Cosmos SDK has a KV store that smart contracts and modules can read and write to. Reading from and writing to this KV store costs gas and is metered as follows:

func KVGasConfig() GasConfig {
	return GasConfig{
		HasCost:          1000, // does key exist?
		DeleteCost:       1000, // delete key
		ReadCostFlat:     1000, // start reading