Published on

Retroshades: Redefining Stellar Smart Contract Indexing.

Authors

Today we are releasing Retroshades, a technology engineered from the ground up to provide the best smart contract indexing experience of the whole Web3 ecosystem, and it's only on Soroban-supporting (SVM) chains.

This release, alongside the announcement of Zephyr, marks the most significant update to Mercury to date, and aims to revolutionize how developers approach smart contract indexing.

Some backstory

Traditional indexing methods for Soroban events can be time-consuming and complex. They often require developers to:

  1. Build customized indexing infrastructure, which can take days or even weeks to implement correctly.
  2. Rely on generic indexers with rigid data structures that are a burden to query and require extensive client-side processing.

To counter this, we started building the Zephyr Virtual Machine. The approach of the ZVM is simple: allow users to achieve the results of choosing the first path (i.e customized indexing) without the hassle of managing any infrastructure since indexers are cloud-deployed, all while being able to deal with low-level data with the same degree of control you'd have while running an indexer in your own server. Even, the host functions and the SDK helpers exposed by the Zephyr toolkit make this kind of path 100x easier to pursue, great simplifying the data pipelines of our users and abstracting the complexity of dealing with stellar core and data streams.

However, Zephyr evolved past being just a cloud platform for indexers. It's an all-in-one solution to operate on the Stellar network:

  • Fully-customizable real-time indexers.
  • Building bots and strategies.
  • Cron-jobs.
  • On-chain transaction submission.
  • Ledger scans and querying.
  • Dashboards and public indexes.
  • Serverless functions to retreive and process data from the database and the ledger.
  • Custom transaction simulation endpoints.

and the list goes on. You can check out the docs, and the github examples to have a grasp of what's possible (spolier: everything!) and encourage you to stay tuned on our X channel to discover the new additions that we're bringing to the Zephyr ecosystem.

Zephyr vs Retroshades

While Zephyr remains a powerful tool for complex on-chain data management, strategies, automations, and advanced indexing, we recognized a gap in the ecosystem that needed addressing. This realization led to the creation of Retroshades.

The Zephyr Paradigm

Zephyr excels in its comprehensive approach to blockchain data handling. It's the go-to solution for developers diving deep into the intricacies of on-chain operations. However, its power comes with a learning curve:

  • New Technology: As an innovative solution, Zephyr requires developers to invest time in learning its unique paradigms and functionalities.
  • Debugging Challenges: While powerful, Zephyr's complexity can make debugging more challenging (though we're addressing this with upcoming public VM stack traces).
  • Overkill for Simple Needs: Many smart contract developers find Zephyr's full feature set unnecessary for basic indexing workflows.

Enter Retroshades: Simplicity Meets Power

Recognizing that not every project requires the full breadth of Zephyr's capabilities, we developed Retroshades to offer a more accessible, and significantly less time consuming alternative that doesn't make efficiency sacrifices:

  • Familiar Territory: For the consumer, Retroshades equates to building indexing logic with Soroban, eliminating the need of learning anything new.
  • Rapid Implementation: Developers can create rich, efficient indexers in minutes rather than days. This occurs by leveraging runtime variables and functions from your own smart contract.
  • Streamlined Functionality: Focused specifically on indexing, Retroshades completely abstracts form the consumer the process of going from a Retroshade event/data structure on your contract to a query-efficient table with native database types as column types.

Choosing the Right Tool

  • For Complex Systems: If you're building intricate on-chain systems with advanced data needs, Zephyr remains your best choice.
  • For Efficient Indexing: If your primary goal is to create powerful, customized indexers quickly, Retroshades offers the perfect balance of simplicity and effectiveness.

By introducing Retroshades alongside Zephyr, we're ensuring that the Stellar ecosystem caters to a wide range of developer needs. Whether you're building a complex DeFi protocol or a straightforward dApp, you now have the tools to create data-rich, efficient infrastructures that can serve as robust backbones for frontends and downstream services.

What is a Retroshade?

A Retroshade is a contract-level defined data structure that might be though of as a contract event but is not. These data structures are defined and emitted within smart contracts deployed to the Mercury network (or other networks that support the SVM-retroshades-fork) and should not be part of the on-chain contract deployment.

Retroshades are not soroban events because they aren't emitted on-chain, rather they are emitted in retroshade-compatible parallel networks that mirror mainnet, such as the Mercury Retroshades network. This means that these events and all associated data retrieval logic does not live on-chain, but it's developed right within the smart contract, enabling Retroshades to contain significantly more data than a standard event, plus gaining advantage by reusing runtime variables, storage functions, contract calls, contract math functions, etc.

In short, a Retroshade enables you to write fully-featured indexers in minutes as opposed to hours or even days, and that's only possible because developers do not need to learn any new technology, because what you are writing is simply a modified version of your contract that runs on a specialized virtual machine.

How It Works

The only similar product across all of web3 is Shadow which recently raised 9M from Paradigm. Similarly, Retroshades introduces a novel approach to indexing:

  1. Integration with Smart Contracts: Developers add the Mercury feature to their Soroban smart contracts and define custom events using runtime variables, contract functions, soroban helpers, etc.

  2. Parallel Execution: Mercury runs a parallel network alongside the main Stellar network, using a modified version of the Soroban Virtual Machine (SVM) called the Retroshade SVM fork.

  3. Custom Event Emission: When transactions are executed, the Retroshade SVM emits custom events with rich, structured data.

  4. Backend Database Adaptors: These events are automatically parsed and stored in a database with native data types and custom columns, making them immediately ready for efficient querying.

Key Benefits

  1. Ease of Use: Create complex indexers in minutes instead of days or weeks.
  2. Flexibility: Fully customizable event structures tailored to your specific needs.
  3. Efficiency: Native database types and structured columns allow for faster and more intuitive queries.
  4. Familiarity: Utilize existing Soroban concepts and functions in your indexing logic.
  5. Rich Data: Incorporate cross-contract calls, storage functions, and external data sources in your indexed events.

The Best is On Stellar

The introduction of Retroshades within the Mercury ecosystem represents a big leap forward in terms of data accessibility and developer tooling within the Stellar ecosystem. The features that Mercury is now covering as a data infrastructure backbone are almost unparalleled in the whole Web3 space, helping to create a perfect environment for developers to work on Stellar and Soroban.