The Graph Foundation unveils Scalar: a microtransaction for every query

Scalar is a scalable microtransaction solution built on the Connext Vector protocol for fast and cheap GRT query fees in The Graph Network.


The Graph’s decentralized indexing and query protocol facilitates secure, paid queries of blockchain data. Every query on The Graph Network is individually priced by Indexers and paid for by Consumers, which will typically be application developers. The Graph’s hosted service query volume exceeded 14 billion queries in February and over 19 billion in March, up over 100x since January 2020, indicating a continuous rise in adoption of Ethereum dapps.

One of the main challenges in transferring query traffic over from the hosted service to the decentralized network has been determining how to support query transactions for billions of monthly queries without increasing load time for dapp users. If a single transaction increases the time to serve a page by just 250 milliseconds, 19 billion transactions would increase the aggregate wait time by more than 150 years. Waiting for pages to load is not a productive use of two human lifespans every month. Moreover, slow transaction speeds can deter users from interacting with applications and have been a primary pain point in the advancement of Web3 and the crypto economy.

Yet a microtransaction system to enable The Graph cannot just be high throughput and low-latency. We knew the solution needed to be decentralized, fault-tolerant, trustless, efficiently utilize available liquidity, and debunk the myth that centralization leads to better performance.

After nearly two years of intense research and development on state channels, The Graph Foundation is excited to unveil a scalable microtransaction system that uses the Connext Vector protocol with the throughput to accommodate The Graph’s growth for years to come. We call it Scalar.

Zac Burns, Software Engineer at Edge & Node says,


Web3 transactions shouldn’t require monumental engineering effort. Web3 developers want to focus on the core business and know that transactions will scale with demand instead of toppling their infrastructure. That’s why we worked with The Graph Foundation to build Scalar.

Scalar: a microtransaction solution for processing queries

Scalar is a scalable microtransaction technology built on the Connext Vector protocol and uses state channels to aggregate and compress transactions before being finalized on-chain. The Graph Network uses Scalar for processing all query transactions between Indexers and Consumers paying for an application’s queries. Scalar emphasizes performance at every layer - from data flow architecture to CPU and memory optimizations. Scalar is now ready for the Web3 ecosystem and will be open sourced for the betterment of Web3 and Ethereum communities so any application can use Scalar for processing transactions efficiently.

Scalar is written in Rust for performance and for routing we rely on Connext Vector, an ultra-minimal state channels framework. Connext has worked closely with The Graph Foundation and Edge & Node throughout Scalar’s development. As a result, Vector has been explicitly created with The Graph’s use-case in mind. Here is a diagram of the transaction lifecycle from an Indexer’s perspective showing each layer:

Scalar transaction lifecycle for an Indexer

Every Scalar transaction starts associated with a single query and is sent from the Consumer (e.g. dapp making the query) to the Indexer. A receipt aggregates serial transactions for that Consumer’s queries over time. A Vector transfer serves as a unit of collateral and aggregates multiple receipts to allow query parallelism.

Next, each transfer is rolled into a Vector channel. The channel allows participants to have concurrent transfers across different processes and seamlessly swap out transfers before they run out of collateral. Another Vector channel on the receiving end of the transaction aggregates transactions from many other participants through a router.

Finally, all transactions for an allocation are submitted in a single withdrawal on-chain (Ethereum) that distributes the query transactions via the rebate pool.

Scalar is optimized for use cases with many transactions in parallel at any moment. The Connext and The Graph teams have worked hard to bring this solution to life so other projects in Web3 can benefit and make scalable transactions possible.

Eva Beylin, Director at The Graph Foundation added,


In order for Web3 infrastructure to function efficiently, transactions must be as frictionless as possible. Indexers are the backbone of Web3 and Scalar will enable efficient and cheap query fee transactions, ensuring they can grow their operations and serve The Graph Network. Scalar solves this problem for The Graph and will allow other builders to bring efficient transaction to their users.

Restoring the web’s original vision

The Graph’s hosted service has seen consistent usage growth, representing a mass movement and interest in the decentralized Internet. In March alone, The Graph’s hosted service processed more than 19 billion queries – over 600 million queries per day. The number of developers deploying subgraphs has also grown nearly 20% month over month. The major jump in Web3 use cases such as DeFi and NFTs has created unprecedented demand for a truly decentralized and scalable query processing system.

Yaniv Tal, Co-Founder and CEO of Edge & Node says,


The original vision of the web included a microtransaction system used for payments, refunds, and tipping. This system was started but never finished, though remnants of it can be seen in the ‘payment required’ 402 error code. Scalar completes the work of the early Internet architects by putting microtransactions directly into the fabric of the web.

The Graph Network is one of the fastest-growing decentralized networks. Dapps using The Graph include DeFi giants Uniswap, AAVE, Synthetix, 1inch, Balancer and Curve. Coinmarketcap and CoinGecko also leverage subgraphs to pull data. Subgraphs are also used by large NFT marketplaces such as Upshot, Zora, KnownOrigin, Foundation, Mintbase, Decentraland, Bondly, and SuperRare.

About Edge & Node

Edge & Node the initial team behind The Graph, is working to build a vibrant decentralized future. Edge & Node is a software development company dedicated to the advancement of the decentralized Internet (Web3) and proliferation of trust-minimized applications.

The Edge & Node team has extensive experience in developing and maintaining open source software, tools, and applications. Through a mix of services, in-house products and open source software, there is no idea too big or too small in Web3 that we can’t build. You can follow Edge & Node on Twitter and LinkedIn. Work with E&N - jobs page.

About Connext

Connext is a network of state channels enabling fast transfers on Ethereum and between EVM chains. While Connext’s core focus is now on cross-chain interoperability for the Ethereum L2 ecosystem, they’re working closely with the Edge & Node team to bring ultra-scalable microtransactions to the Decentralized Web. .

Connext is an open source, community-driven project from the ground up. Follow us on Twitter or join the Connext Community to get involved!

About The Graph

The Graph is the source of data and information for the decentralized internet. As the original decentralized data marketplace that introduced and standardized subgraphs, The Graph has become web3’s method of indexing and accessing blockchain data. Since its launch in 2018, tens of thousands of developers have built subgraphs for dapps across 40+ blockchains - including  Ethereum, Arbitrum, Optimism, Base, Polygon, Celo, Fantom, Gnosis, and Avalanche.

As demand for data in web3 continues to grow, The Graph enters a New Era with a more expansive vision including new data services and query languages, ensuring the decentralized protocol can serve any use case - now and into the future.

Discover more about how The Graph is shaping the future of decentralized physical infrastructure networks (DePIN) and stay connected with the community. Follow The Graph on X, LinkedIn, Instagram, Facebook, Reddit, and Medium. Join the community on The Graph’s Telegram, join technical discussions on The Graph’s Discord.

The Graph Foundation oversees The Graph Network. The Graph Foundation is overseen by the Technical Council. Edge & Node, StreamingFast, Semiotic Labs, The Guild, Messari, GraphOps, Pinax and Geo are eight of the many organizations within The Graph ecosystem.


Category
Graph Protocol
Author
The Graph Foundation
Published
April 21, 2021

The Graph Foundation

View all blog posts