Skip to content
flex edited this page Jul 24, 2024 · 17 revisions

Protorunes HAS a specification

And you're reading it!

Protorunes is a standard and specification for a class of metaprotocols which are compatible with the runes protocol, in the sense that runes can be burned into a protorunes representation where they may have additional utility.

Protorunes can provide a framework for programmable runes, or otherwise provide mechanisms by which runes can serve as protocol tokens for applications. The standard supports a set of primitives which can be used as building blocks to build AMMs, lending protocols, or a full-fledged smart contract runtime.

How are protorunes assets created?

The protorunes standard ensures that runes can always be burned onto a protorunes-compatible subprotocol and transacted with using the same Runestone structure as they can be on the runes metaprotocol. A subprotocol is not protorunes-compatible if it has any logic to counterfeit runes which did not enter the system via a protoburn.

Subprotocols can define new assets to exist strictly on the subprotocol, whose identifier can make use of the bytespace of a RuneId, in a manner in which RuneIds for these protorunes are ensured not to clash with any RuneIds possible on the runes metaprotocol.

Refer to the genesis protoburn transaction here: https://mempool.space/tx/eb2fa5fad4a7f054c6c039ff934c7a6a8d18313ddb9b8c9ed1e0bc01d3dc9572

How can I create a protorunes-compatible subprotocol?

Anybody can build a protorunes-based system! A subprotocol is really just an indexer program, and the protorunes template project in this repository has all of the work done for you. Indexer program builds can be run in the metashrew indexer stack:

https://github.com/sandshrewmetaprotocols/metashrew

Subprotocols can be forked from the canonical protorune repository at https://github.com/kungfuflex/protorune and built as portable WASM binaries that can be tested in isolation, using the test harness which comes in the package. Test classes are provided from:

https://github.com/sandshrewmetaprotocols/metashrew-test

An implementer need only implement the ProtoMessage#handle(MessageContext) function in the _start export of the indexer program and interpret any runtime messages, which may use any serialization format including leb128 or even protobuf, for which we also provide a safe implementation at https://github.com/sandshrewmetaprotocols/protobuf-as

When built with the protorune repository as a starting point and builds run in metashrew, subprotocols automatically get the archival of state by block height, similar to an Ethereum node run in archive mode. Subprotocols can implement any API in their view layer. They are just normal functions exported from the AssemblyScript starting point, or if you use Rust, they can be exported as extern "C" symbols. Provided with the metashrew framework is a complete set of Bitcoin structures and associated parsers, for practical application development on Bitcoin: https://github.com/sandshrewmetaprotocols/metashrew-as.

Any indexer can be built on metashrew, and many already are. It happens to be a lightweight way to draft metaprotocols on Bitcoin L1, and it is used in the canonical protorune implementation for its specialized utility in indexer development.