I have been using Uniswap's v3 subgraph to query pool and other data. On the docs page, connecting using ethers.js (smart contract transactions), https://docs.uniswap.org/sdk/guides/using-ethers:

While this tutorial doesn't use the V3 SDK - it will set us up to use it after we get the on-chain data we need.

Is there a difference in the data between the two - specifically pool prices? In addition, is it possible to perform trades, swaps, etc. Uniswap actions through Graphql? It seems from the documentation it's query only?

1 Answer 1


Collecting data from smart contracts can a cumbersome work, especially when you have a factory contract. Graph is used to make that task easier and reduce the number of requests sent to a node.

The data you get from the Graph is taken from the Uniswap contracts. Whenever an event in one of the Smart Contracts is triggered, a Graph node performs a task based on the event and stores the data. Once this is done, everyone is able to query the data from the Graph node in a single request, using a GraphQl query.

It is not possible to perform state-changing transactions through the Graph. It is only used to aggregate data. (mutate is the GraphQl terminology)

  • You're right - collecting data from SC's is cumbersome, and the graph queries are very helpful. Excellent, thank you. In terms if timely accuracy, is the data returned from the graph queries as up to date as the contract's or is there a delay? For example when trying to find arbitrage opportunities this may be an issue.
    – ElHaix
    Commented Dec 17, 2021 at 1:51
  • That depends on the how quickly the nodes sync the data. So far I had a pretty good experience with the hosted service, where I could query the data as soon a transaction had been confirmed. But there might be a delay since a transaction has to be confirmed and the graph nodes needs to process the data before making it available :)
    – Donut
    Commented Dec 17, 2021 at 6:01
  • I see, so for unless your data is not time sensitive, better to use the Subgraph for static data like token ID, symbol, etc.? This helped as well (fyi for others): thegraph.com/docs/en/about/introduction#what-the-graph-is
    – ElHaix
    Commented Dec 17, 2021 at 12:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.