#state-transition #themelio #structures #data #transaction #coin #header

bin+lib themelio-stf

Core state-transition function and data structures for Themelio

28 releases

0.11.13 Nov 6, 2022
0.11.11 Sep 13, 2022
0.11.8 Jul 30, 2022
0.9.15 Mar 19, 2022
0.5.1 Jul 19, 2021

#1744 in Magic Beans

Download history 2/week @ 2024-02-18 63/week @ 2024-02-25 1/week @ 2024-03-03 1/week @ 2024-03-10 23/week @ 2024-03-17 6/week @ 2024-03-24 1142/week @ 2024-03-31

1,172 downloads per month
Used in 6 crates

MPL-2.0 license


themelio-stf: themelio's core state transition function

This crate contains the data structures and core algorithms that comprise Themelio's core state transition function. Any piece of software needing to validate Themelio transactions or answer questions like "what happens to the Themelio state if transactions A, B, and C happen" can use this minimal-dependency crate.

The State type

The most important type in the crate is State, and the closely associated type SealedState. The yellow paper talks about them further, but in short:

  • State represents an mutable Themelio world-state and it's not directly serializable. It includes all the information needed to validate new transactions and blocks, such as a SMT of all outstanding coins, Melmint parameters, etc. It has methods taking Transactions etc that advance the state, as well as others to produce serializable blocks, headers, etc.
  • SealedState represents a sealed state. This roughly corresponds to the notion of "the blockchain state at a given height". Blocks represent transitions from one SealedState to another.


This crate is the most consensus-critical part of Themelio, and essentially defines the entire on-chain logic of the Themelio blockchain.

Versions incompatible with the latest Themelio state are thus all yanked.


~589K SLoC