author

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:

standard

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 The Graph

The Graph is the indexing and query layer of the decentralized web. Developers build and publish open APIs, called subgraphs, that applications can query using GraphQL. The Graph currently supports indexing data from Ethereum, IPFS, and PoA with more networks coming soon. To date, over 10,000 subgraphs have been deployed by ~18,000 developers for applications, such as Uniswap, Synthetix, Aragon, Gnosis, Balancer, Livepeer, DAOstack, AAVE, Decentraland, and many others.

If you are a developer building an application or Web3 application, you can use subgraphs for indexing and querying data from blockchains. The Graph allows applications to efficiently and performantly present data in a UI and allows other developers to use your subgraph too! You can deploy a subgraph or query existing subgraphs that are in the Graph Explorer. The Graph would love to welcome you to be Indexers, Curators and/or Delegators on The Graph’s mainnet. Join The Graph community by introducing yourself in The Graph Discord for technical discussions, join The Graph’s Telegram chat, or follow The Graph on Twitter! The Graph’s developers and members of the community are always eager to chat with you, and The Graph ecosystem has a growing community of developers who support each other.

The Graph Foundation oversees The Graph Network. The Graph Foundation is overseen by the Technical Council. Edge & Node is one of the many organizations within The Graph ecosystem.

There were more than 2K Curators from over 90 different countries and 172 Indexers from more than 50 countries in The Graph’s testnet. The Graph community is globally distributed, with over 4,500 GRT holders from more than 99 different countries world-wide. Delegation can happen by anyone who holds GRT. Today, there are over 5k Delegators and over 200 Indexers on The Graph Network.

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!