A developer from BuildersDAO shared insights on Substreams composability, including his demonstration of Chainlink Substreams integration.
Learn more about Graph BuildersDAO and watch member Thomas demonstrate insights into the composability of Substreams.
Graph Builders meeting times
Without Graph BuildersDAO, there would be no Builders online office hours.
What is BuildersDAO?
BuildersDAO is a developer organization dedicated to building subgraphs and subflows. The DAO acts as a hub for new and existing protocols where the creation of subgraphs or subflows can be requested.
working principle:
Requests: The protocol will meet their needs, whether it's data indexing, analysis, or other Graph-related tasks.
Bounty: A bounty is set for the project, and skilled developers can apply to receive development tasks.
Build: Developers work on this, creating high-quality subgraphs or subflows.
Rewards: Once completed, developers will receive their fair share of bounties.
They are always looking for talented developers to join the DAO. If you are a passionate web3 builder, please consider applying through the website.
🎤 Speakers
This Graph Builders Office Hours session features Thomas, a builder and DAO developer, sharing insights from his recent projects related to Substreams composability.
Video link: https://youtu.be/2fLmnMgi4xc
📺 You can watch the entire recorded session on The Graph’s YouTube – give it a try!
The main goals of BuildersDAO:
The main goal of BuildersDAO is to promote the growth of The Graph ecosystem. The DAO achieves this by interacting with individuals who require subgraph or subflow development.
Not only do they actively seek out people in need, but they also connect with developers who may be considering other providers. Their goal is to encourage them to return to The Graph ecosystem.
Substreams are composable:
Substreams offer a powerful feature: composability, think of it like building with Lego bricks. When developers create subflows, others can easily incorporate them into their own work.
Instead of manually integrating code, you can import existing subflows, such as Lego blocks. For example, you can start with the Uniswap V2 version, build on top of it, and then deploy custom subflows.
Other developers can then build on top of your creation.
Subflow registry:
After building Substreams, go to the Substreams Registry. Here you can upload your substreams and let others find them easily.
The registry provides an interface where you can browse existing subflows and find additional details.
------Screenshot of Substreams registry
Demo
Integrate Chainlink price storage into Substreams to get ETH prices in USD
In his talk, Thomas demonstrated how to use the Substreams framework and lio smart contracts to build Substreams to track events emitted by the contract.
Thomas demonstrates the integration of Chainlink Substreams by retrieving the live price of Ethereum (ETH) in USD.
Key steps he followed:
Importing necessary substreams: Imported lio contract Substreams and Chainlink price Substreams.
Define initial block: Specify the initial block from which the subflow should start processing data.
Created a new module: Created a new module called map_usd_value to handle events in the lio contract and add USD price information. This module takes two input parameters: events from the lio contract and chainlink_price_store module output from the Chainlink Substreams package.
Accessing the Chainlink price store: In the map_usd_value map handler, he uses the module output chainlink_price_store to access the price of ETH.
Handling events: He looped through the events emitted by the lio contract and calculated the dollar value of each event using the ETH price obtained from the Chainlink store.
Output Result: The processed event with a USD value is emitted as the output of the subflow. This module can now be plugged into downstream modules such as graph_out for use by subgraphs or any other sink.
For more live workshops and step-by-step demos, join the Builders online meeting every Thursday at 17:00 UTC (12:00 ET) on The Graph Discord.
💡 This article answers the following questions:
- Why are substreams an advantage of being composable?
- What is Graph BuildersDAO?
- How can a developer register an existing subflow using it?
Follow the public account: Pinax to learn more about the technical development of block data indexing