What is METASHREW?
Metashrew is a framework and set of support libraries for developing efficient indexers that sync over the Bitcoin p2p socket, built entirely to WASM. Metashrew itself is a fork of electrs, similar to esplora, but the indexing logic hardcoded into electrs is swapped out in favor of a convenient WASM runtime for which indexer programs can be built with a wide range of compilers, including systems languages such as Rust and C.
A new Paradigm:
Custom Indexing: Metashrew empowers developers to create their own custom indexes and metaprotocols. This flexibility allows for tailored data solutions that were previously unattainable without significant effort and infrastructure.
Immediate Deployment: Custom indexes built with Metashrew can be immediately deployed and accessed via Sandshrew, streamlining the development process and reducing time to market.
Who is Metashrew for?
Metashrew is targeted at developers who are working at the cutting edge of Bitcoin technology and require the ability to create custom data solutions. Developers can leverage Metashrew to build and host their own indexes, facilitating innovative applications and services.
How Metashrew Connects to Sandshrew
Metashrew complements Sandshrew by addressing the need for custom data endpoints. While Sandshrew provides a unified JSON RPC for standard data retrieval, Metashrew empowers developers to extend its capabilities by creating and hosting custom indexes. This integration ensures that developers are not dependent on infrastructure providers to support new endpoints; instead, they can build and deploy their own solutions, significantly enhancing productivity and innovation. How is it Different?
User Empowerment: Unlike traditional infrastructure providers that require developers to request new endpoints and be dependent on them, Metashrew allows developers to build and deploy their own endpoints. This decentralizes innovation and removes bottlenecks.
Ease of Use: Sandshrew's familiar JSON-RPC schema and Metashrew's WASM runtime simplify complex processes, making advanced blockchain data manipulation accessible even to those without deep expertise in blockchain technology.
Integration: Projects like Oyl Wallet can leverage these tools to enhance user interactions, providing richer data insights and more interactive experiences.
Key Features of Metashrew
WASM Runtime: Metashrew uses a WASM runtime for indexer programs, supporting a wide range of compilers including Rust and C.
Open-Source Framework: The framework is fully open-source, with a repository hosted at GitHub.
Hosted Environment: Sandshrew runs a fully hosted Metashrew-compatible environment, allowing immediate deployment of indexes or metaprotocols.
Abstracted Complexity: Metashrew abstracts the complexities of handling chain re-orgs, historical archival of index state, and efficient block sync routines.
AssemblyScript Helper Library: Supports building programs with a library that includes implementations of Bitcoin data structures and higher-order structures such as inscriptions.
With Metashrew, developers can deploy BRC-20 marketplaces, lending protocols, or other Bitcoin-native application stacks to the Sandshrew runtime, enabling a wide range of innovative solutions.
Metashrew construction:
METASHREW is a framework and set of support libraries for developing efficient indexers that sync over the Bitcoin p2p socket, built entirely to WASM. METASHREW itself is a fork of electrs
, similar to esplora
, but the indexing logic hardcoded into electrs
is swapped out in favor of a convenient WASM runtime for which indexer programs can be built with a wide range of compilers, including systems languages such as Rust and C.
The METASHREW framework is fully open-source, with a repository hosted at:
https://github.com/sandshrewmetaprotocols/metashrew
However, SANDSHREW runs a fully hosted METASHREW-compatible environment, so it is possible to design an index or metaprotocol then immediately deploy it to SANDSHREW, where functions exported by your WASM binary can be called via the metashrew_view
JSON-RPC call hosted on SANDSHREW.
In this way, the problem of designing and deploying a metaprotocol akin to ordinals or BRC20, built entirely from Bitcoin chaindata, is reduced to implementing the minimal program which simply handles a single block and translating its contents to interactions with the underlying key-value database.
The METASHREW runtime abstracts tedious considerations a developer would otherwise have to handle if he/she architected a metaprotocol from scratch, including handling chain re-orgs, historical archival of index state, and an efficient block sync routine.
Last updated