Rubicon APIs Powered by The Graph
May 11th, 2022

Today we are excited to release Rubicon’s Open APIs, powered by The Graph. The Graph is a protocol that makes it possible to collect, store, and access data from Ethereum and related blockchains. Data from the Rubicon order book protocol, such as offers, swaps, and deposits or withdrawals from liquidity pools, can now be tracked and easily queried through Subgraphs.

To get started with the Rubicon Subgraphs, visit our API documentation to see an outline of their functionality as well as some example queries. You can also interact with the Rubicon subgraphs on the Graph Playground. (RubiconMarket, BathToken)

Read on to learn more about current uses for the Rubicon v1 Subgraphs and useful tips for getting started with our APIs.

Building on The Graph

Our team is committed to minimizing dependencies and single points of failure throughout the Rubicon tech stack. The launch of Rubicon Subgraphs marks an important step in our mission to provide a robust decentralized application. In the future, we are excited to grow alongside The Graph and migrate from their Hosted Service to their Decentralized Network as soon as Layer 2 networks are supported. For more details on this, check out The Graph’s Roadmap!

Our goal with this upgrade is to provide direct and easy access to data to support all Rubicon users. From an application standpoint, we are pleased to say that the web experience you now see when you navigate to is powered by The Graph and your wallet’s web3 connection!

The Graph simplifies the data cycle, enabling a fully web3-powered app experience!
The Graph simplifies the data cycle, enabling a fully web3-powered app experience!

Rubicon Subgraphs

For a more detailed explanation of the Rubicon Subgraphs, visit our API docs. You can also read the code in the Rubicon subgraphs repo on GitHub.

At a high level, the Rubicon Subgraphs watch the Rubicon smart contracts and update values in their databases based upon a predefined set of rules when someone uses the protocol. For example, when a user places a trade, it is recorded in a subgraph, which is queried to populate their History page, Open Orders, and other features on the Rubicon web app.

Rubicon v1 has two primary subgraphs:

  • RubiconMarket: Tracks all trading activity (maker & taker trades) on the Rubicon order books. Also acts as a reference for an asset’s price history on Rubicon
  • BathToken: Tracks all activity (deposits, withdrawals, & earnings) on the Rubicon liquidity pools. Also serves as a reference for the historical performance of the liquidity pools

Say hello to the World Order Book’s first APIs 🌎📖

Exploring Rubicon Data

Want to start exploring Rubicon data? You can use The Graph’s Playground tool to query data without even calling an API! Here are some example queries we think you will find useful:

  • A query to get the current offers on the Rubicon Order Books
  • A query to check the current status of Rubicon’s Liquidity Pools
  • A query to return all trades that have happened on the Rubicon protocol

Stay tuned for more on this front! We are always working to build out more open source Rubicon tooling and are excited to share more 🔜!

What’s Next?

All historical Rubicon data is on-chain, so our task is to illuminate the dark forest so our team and community can use this data to inform future decisions. Here’s what’s next in Rubicon data:

  • Rubicon v1 Dune dashboards are live, more on composable components 🔜
  • A comprehensive Rubicon metrics and analytics page is in the works 👀
  • More data feeds and tooling for market making and trading, if there is a feature you want to see in our Trading SDK let us know in Discord!

Our Head of Growth Denver built the Rubicon v1 subgraphs and continues to lead their development. He has exciting plans to continue using subgraphs for Rubicon’s critical data infrastructure. We will deploy subgraphs along with the Rubicon v1 contracts whenever we launch on new L2 networks, you can visit our docs for a list of active subgraph deployments.

About The Graph

In the past, indexing blockchain data was fairly difficult and time-consuming. Blockchain properties like finality, chain reorganizations, or uncled blocks complicated this data collection process, making it not just time-consuming, but conceptually hard to retrieve correct query results from blockchain data.

The Graph solved this indexing issue through a decentralized protocol that indexes and enables the performant and efficient querying of blockchain data. These APIs (indexed “subgraphs”) can then be queried with a standard GraphQL API. Today, there is a hosted service as well as a decentralized protocol with the same capabilities. Both are backed by the open-source implementation of Graph Node.

Rubicon Links

Thanks for reading! Here’s where you can find Rubicon online:

Alea iacta est.

(This post is for educational purposes only. Nothing in it should be construed as financial advice. Do your own research before making investments)

Arweave TX
Ethereum Address
Content Digest