Subsquid Now Supports Acala, Bringing Fast and Performant Indexing to Acala DApp Developers

Dan Reecer
Acala
Published in
6 min readDec 19, 2022

After many months of work behind the scenes, we are glad to officially announce that Subsquid has integrated with Acala. Subsquid already supports indexing for EVM+ smart contracts on both Acala and its sister network, Karura. Now, the two teams have agreed to work together on multiple initiatives that will improve both developer and user experiences across the entire Polkadot ecosystem.

Below I’ll go over some details of the Subsquid integration, as well as some background information on Subsquid for those who are learning about them for the first time.

Acala + Subsquid

Acala and Karura run a fundamentally different EVM implementation than other Polkadot ecosystem chains. This EVM+ pallet, intended to bring the best of Ethereum and Substrate together, has enabled Acala to achieve three design goals: (1) empower users to have a seamless Acala experience whilst using a Substrate wallet, (2) enable protocol-level composability for EVM and Substrate runtime, and (3) give developers a wider range of tooling support.

Since @subsquid/substrate-processor@1.9.0 squid SDK natively supports handlers for indexing smart contracts deployed to Acala and Karura.

  • To subscribe to events emitted by a specific contract(s) and/or matching a topic filter, use: addAcalaEvmExecuted(contract: ‘*’ | string | string[], options?: AcalaEvmExecutedOptions & NoDataSelection)
    Documentation
  • Similarly, to subscribe to EVM logs emitted by unsuccessful EVM transactions, use addAcalaEvmExecuted(contract: ‘*’ | string | string[], options?: AcalaEvmExecutedOptions & NoDataSelection)
    Documentation

Meet Subsquid: Indexing and ETL for next-gen dApps

Founded in late 2021, Subsquid is the team behind squids, a new standard for Web3 data extraction and transformation. The idea for Subsquid was born out of the need for customizable and performant indexing, which co-founder Dmitry Zhelezov faced when building the infrastructure for a decentralized video streaming service. None of the available tools at that time could handle the fast-pace of this next-gen use case.

When making updates to the dApp using existing solutions, the ETL (extract, transform, load) infrastructure took ages to sync, and iterations added weeks to development time. Ultimately, Dmitry understood that a modular architecture was needed to speed things up — only by splitting on-chain data ingestion from transformation and presentation would it be possible for the dApp to get the data it needed and serve it to users with the required low-latency.

Subsquid’s architecture consists of Archives, which pre-index the data, and squids, where the developer’s custom logic is applied. Thanks to its novel design, Subsquid can sync up to 50,000 blocks per second. Apart from record breaking speed, squids also allow for a level of customization and developer freedom that just isn’t provided by other indexers and ETL frameworks.

  • Full control over the target database (Postgres), including custom migrations and ad-hoc queries in the handler.
  • Custom target databases and data formats (e.g. CSV).
  • Arbitrary code execution in the data handler.
  • Extension of the GraphQL API with arbitrary SQL.
  • Secret environment variables, allowing for seamless use of private third-party JSON-RPC endpoints and integration with external APIs.
  • API versioning and aliasing.
  • API caching.

To learn more about Subsquid’s architecture, visit the documentation.

What is a squid?

A squid is a faster, easier, and cheaper way to retrieve Web3 data, transform it, and use it to build advanced features into next-gen blockchain applications. While often compared to Subgraphs, squids are in fact far more customizable Node.js projects that can be easily configured to serve millions of dApp users at millisecond latencies through GraphQL APIs. Squids can also be used for analytics use cases, and can interface directly with popular data tools such as Grafana, Google Big Query, Amazon Athena, and even Microsoft Excel.

What makes squids different?

Of indexing solutions and API builders on the market, squids are by far the most robust in terms of speed, performance, and their growing list of features aimed at empowering developers to create sophisticated dApps.

Speed

Thanks to a series of advanced engineering choices (outlined here), squids run at speeds well above other similar solutions. In a benchmark test carried out by their team, a squid replicating the Uniswap v3 Subgraph synced in 1 hour and 40 minutes.

With massively reduced sync times, developers are enabled to iterate faster and build better data pipelines for their applications. Rapidly evolving Web3 projects can finally stay agile as they work to achieve their business goals and respond to market demands.

Apply advanced logic

With the monolithic indexing architecture of Subgraphs and similar solutions, it just isn’t possible to efficiently carry out the kind of sophisticated data aggregations that the next generation of Web3 applications will require. Modular squids can make calls to external APIs and libraries, and interface with other data sources — including other squids!

Flexible scaling

Web3 builders require back-end infrastructure that is able to scale along with their applications. As a dApp’s user base grows, its squid can quickly be reconfigured through tweaks to the database and gateways and by setting environment variables. No other ETL allows for this kind of flexibility.

Predictable pricing

One of the biggest pain points Subsquid hears is that Web3 project teams are unable to predict indexing costs because they must pay using a volatile token. This will not be the case when retrieving and transforming data using a squid.

Currently, Subsquid (including the hosting of squids in the Aquarium) is free of charge. When we do eventually transition to a monetized service, payments will be accepted in stablecoins. We intend to offer predictable monthly subscriptions (freemium model). Your CFO will be very happy!

XCM, Analytics, and Ecosystem Development

Both the Subsquid and Acala teams are working hard on tooling for, and implementations of, the Cross-Consensus Messaging (XCM) format. As new XCM channels get opened, squid SDK will be essential to developers on Acala and Karura, as well as on other Substrate-based chains that would like to interact in some way with the Acala ecosystem.

In due time, the Subsquid and Acala teams will also release some documentation of recent implementations of squid SDK that were used when investigating the incident concerning aUSD last August. We are very much looking forward to working together with Subsquid to continue bringing the highest standard of safety for user funds to the Polkadot ecosystem.

Build with Subsquid on Acala

To begin building a squid on Acala or Karura, developers may clone the Substrate template, follow this tutorial and refer to this documentation on Subsquid’s EVM+ support. For technical support, please feel free to join the SquidDevs chat on Telegram.

About Subsquid

Subsquid is the team behind squids, a new standard for Web3 data extraction and transformation. Squids already power hundreds of applications across dozens of EVM, Substrate, and WASM-based chains. With modular architecture and a host of advanced features, Subsquid offers the most resource-efficient and developer-friendly way to build, test, and deploy customized APIs for blockchain-facing applications.

Twitter | Discord | LinkedIn | Telegram | Github | Newsletter

About Acala

Acala is a decentralized finance network powering the aUSD ecosystem. The core product, Acala USD, is a decentralized, multi-collateral, crypto-backed stablecoin serving as the native stablecoin of the Polkadot ecosystem. Acala’s Ethereum-compatible blockchain has built-in DeFi protocols for application developers to leverage, including a trustless staking derivative (liquid DOT — LDOT), a decentralized exchange, and the EVM+, a hybrid EVM offering fully Ethereum-compatible development environment plus full compatibility with Substrate.

Build with Acala

Linktree | Discord | Website | Twitter | GitHub | Wiki | Newsletter | YouTube

--

--