Storing data on the blockchain has its advantages, but also disadvantages.
The Graph can be a solution for indexing and querying data on the blockchain efficiently.
Let's introduce The Graph with this thread.
↓
Table of Contents
Definition
Examples
Bored Ape Yacht Club basic ops
BAYC advanced ops
Getting data is not easy
Home-made solution
Home-made solution problems
Indexing blockchain data is hard
The Graph solution
GitHub
How The Graph Works
Flow
Conclusion
💯 days of Web3
Support
Definition
"The Graph" is a decentralized protocol for blockchains, starting with Ethereum.
The Graph core functionalities are:
- indexing data
- querying data
It makes it let you query data that it would be difficult to query directly.
Examples
"Uniswap" and "Bored Ape Yacht Club" (BAYC) projects, for example, store their data on the Ethereum blockchain.
Reading data and querying data on these big projects can be very hard.
BAYC basic operations
Let's take the Bored Ape Yacht Club (BAYC).
Some basic operations are possible
We can get:
- the owner of a certain Ape
- the content URI of an Ape based on their ID
- the total supply
This is because they are coded directly into the smart contract.
BAYC advanced operations
Example of advanced operations:
- advanced filtering.
- relationships.
- aggregation.
- search.
In these cases, which are still not rare cases, it's not possible to query and filter this information directly with the contract.
Getting the data is not easy
To get the data, you have to:
- process every single transfer event ever emitted.
- read metadata from IPFS using Token ID and IPFS hash.
- aggregate it.
Even for these relatively simple things, it would take a lot of time to do this in a browser
Home-made solution
To solve the problem of getting data, you can:
- build your own server.
- process the transactions in the server.
- save them to a DB.
- build an API endpoint on top of it to query the data.
Home-made solution problems
But the home-made solution has some cons:
- it's resource-intensive
- it needs maintenance
- it presents a single point of failure
- it breaks security decentralization properties.
Indexing blockchain data is hard.
It's not enough.
Some Blockchain properties complicate this process even more:
- finality
- chain reorganizations
- uncled blocks
In this case, it's not just about time but also about the complexity of the operation.
The Graph solution
The Graph solves this with a decentralized protocol.
It allows efficient querying of blockchain data.
These APIs (subgraphs) can be queried with standard GraphQL API.
There is a hosted service as well as a decentralized protocol with the same capabilities.
How The Graph Works
The Graph indexes data using subgraph descriptions.
It defines:
- smart contracts of interest
- important events
- how to map event data to data (stored in a DB)
Flow
1️⃣Dapp adds transactions
2️⃣Smart contract emits events
3️⃣Graph Node scans for new blocks/subgraph data
4️⃣Graph Node finds subgraph events & runs the provided mapping handlers
5️⃣Dapp queries Graph Node for data, using GraphQL endpoint and displays data
src: The Graph docs
Conclusion
The Graph is an indexing protocol for querying networks (like Ethereum and IPFS).
Everyone can build/publish open APIs (subgraphs), making data easily accessible.
It looks promising and probably needs more attention. It is a big project.
💯 days of Web3
I am on the challenge of posting on Web3 content every day for 100 days.
Day 76
Here is the GitHub repository with all the Tweets, day by day
No, It is not enough to right-click and save it on your PC.
A thread from valid sources to have a clearer idea around them.
↓
Table of Contents
Intro
NFT: Non-Fungible Token
NFT key concepts
Fungible Items
Internet of assets
NFTs ability
NFT examples
Ownership
Special Properties
What can you do if you OWN an NFT
What can you do if you CREATE an NFT
NFT Royalties
NFT Scarcity
NFT standard
The end?
↓
Intro
Digital artists are changing their lives change thanks to huge crypto sales.
Celebrities are spotting new opportunities to connect with fans.
But NFTs are way more: they can be used to represent ownership of ANY unique asset.
✏️Have a Topic
🧑🤝🧑Guests
📝Have a structure
⏰Have an idea of the duration
🗓️Regular Spaces
🙋♀️Make an introduction
🛑Check profiles before inviting
⛔Moderate the Space
📌Pin a tweet for the questions
👋Don't just say bye space
😁Enjoy
↓
✏️Have a topic
Twitter spaces should have a title.
Unless you intentionally want a very random Twitter space, avoid titles like "let's talk, Hi I am XYZ, let's just make a space", "chatting".
Give people a reason to join your Space.
🧑🤝🧑Guests
Having guests related to the topic can really boost up your Twitter Space.
They would also hopefully help you to promote your Space, which is a great plus especially if you haven't already a huge account