Tuxedo
- Team Name: Off-Narrative Labs
- Payment Address: 0x5a335908df9D2C47304338E3b744579Ed7C6a64d (DAI)
- Level: 2 🐤
Project Overview 📄
Develop Substrate runtimes based on the UTXO model.
Overview
Tuxedo is a framework for developing Substrate runtimes based on the Unspent Transaction Output (UTXO) model. The letters utxo are contained in the word tuxedo, hence the name.
In the broader blockchain space, there are essentially two models for creating state machines, or runtimes, as they are known in the Substrate ecosystem. Those two models are the Account System as seen in Ethereum, Polkadot, and others, and the UTXO System as seen in Bitcoin, Monero, Cardano, and others. Currently the defacto way to write Substrate runtimes is with FRAME, which is based on the account system, and any project wishing to build on the utxo system is left to write a runtime from scratch or find a home in another ecosystem. Tuxedo would be a couterpart to FRAME based on UTXOs rather than accounts.
Tuxedo would make the UTXO model more visible and accessible in the Substrate ecosystem and begin to create a diversity of runtime frameworks in addition to FRAME, a trend that we hope will continue beyond Tuxedo itself.
Project Details
The primary advantage of UTXOs is that they are highly parallelizable. This fits well in Polkadot's multichain ecosystem where parachains execute and communicate asynchronously, and will be an even bigger advantage if (hopefully when) DAG based chains become popular, a trend that is already kicked off with projects like Aleph Zero, and many others outside the Polkadot ecosystem, including Hedera Hashgraph, Nano, and Casper Labs.
The UTXO data model is relatively well established by Bitcoin as well as research from IOHK in their Abstract Model and Extended UTXO Model. Our primary tasks would be to implement this in Rust and expose a standard API for chain developers to build on. This is analogous to the API exposed by FRAME System and the Pallets built on top.
Our core data types follow similarly, to the IOHK research cited above. The primary differences are that we do not assume a native cryptocurrency and rely on Tuxedo Pieces (analogous to FRAME Pallets) to provide the validation logic, rather than the UTXOs themselves.
/// A UTXO transaction specifies some inputs to be consumed, and some new outputs to be created.
struct Transaction {
/// The inputs refer to currently existing unspent outputs that will be consumed by this transaction
inputs: BTreeSet<Input>,
/// Similar to inputs, Peeks refer to currently existing utxos, but they will be read only, and not consumed
peeks: BTreeSet<Input>,
/// The new outputs to be created by this transaction.
outputs: Vec<Output>,
}
/// A single output of a transaction which has an owner and some associated data
struct Output {
/// The address that owns this output. Based on either a public key or a Tuxedo Piece
owner: Address,
/// The data associated with this output. In the simplest case, this will be a token balance, but could be arbitrarily rich state.
data: Vec<u8>,
}
/// A single input references the output to be consumed or peeked at and provides some witness data, possibly a signature.
struct Input {
/// A previously created output that will be consumed by the transaction containing this input.
output: OutputId,
/// A witness proving that the output can be consumed by this input. In many cases including that of a basic cryptocurrency, this will be a digital signature.
redeemer: Vec<u8>,
}
The core of the API exposed developers who create Tuxedo Pieces, will roughly follow this trait. We expect this will have to get more specific as our development shows us what we haven;t yet considered.
/// The API of a Tuxedo Piece
trait TuxedoPiece {
/// The type of data stored in Outputs associated with this Piece
type Data;
/// The validation function to determine whether a given input can be consumed.
fn validate(transaction: Transaction, input: Input) -> bool;
}
This grant does not strive to create the entire rich ecosystem of Tuxedo pieces that we hope to eventually be developed on top of Tuxedo. Rather it strives to create the core of the Tuxedo system and a few of the most important and exemplary pieces. Specifically, we strive to develop the analogs to FRAME Executive, FRAME System, Pallet Balances, and Pallet Transaction Payment.
Ecosystem Fit
Tuxedo is a framework for writing Substrate runtimes. Substrate is the toolkit for building virtually all parachain nodes as well as many standalone blockchains. As such, Tuxedo provides a richer set of options to runtime developers, and hopes to attract teams to the Substrate / Polkadot ecosystem who may have otherwise gone elsewhere.
The primary users of Tuxedo will be parachain and runtime developers who will use Tuxedo directly to structure their runtimes. Of course, the user base will trickle downstream as well to users of those parachains that choose to build with Tuxedo. However, chain users will use Tuxedo only indirectly.
There are no projects like this in the Substrate ecosystem, although they do exist in the broader blockchain space; Cardano being the most notable example.
While it fulfills a similar role, Tuxedo is not intended to compete with FRAME, but rather to compliment it, by welcoming projects that fit naturally with the utxo model into the Substrate ecosystem, as FRAME does for projects that fit the accounts model.