- This repo has a fully functional subgraph that implements File Data Sources and Full Text Search.
- For this workshop, I used this address and this metadata from the Beanz NFT collection.
- Clone and deploy this repo's subgraph to start tinkering with File Data Sources.
- Install graph-cli:
yarn global add @graphprotocol/graph-cli
-
Create a subgraph through Subgraph Studio but do not deploy it just yet. Instead of deploying a boilerplate subgraph, you'll be deploying this repo's subgraph to your newly created Subgraph Studio dashboard.
-
Clone this repo, then
yarn install
. -
Copy/paste the Authentication Key from Subgraph Studio into your terminal and authenticate your computer.
-
cd <yourSubgraphFolder>
from this repo and copy/paste thegraph deploy --studio <nameOfYourSubgraph>
from Subgraph Studio into your terminal to deploy this repo's subgraph. -
Wait 20-30 min for the subgraph to index IPFS. Once indexed, you will not have to wait this long again.
-
Begin querying our File Data Sources subgraph!
-
This repo's subgraph has Full Text Search feature integrated as its quite useful when querying NFT Metadata.
Use a NFT marketplace like Opensea to find an NFT and gather its contract address and open its link to its IPFS metadata.
You can find this data on each NFT on Opensea by navigating to a specific NFT, clicking on its details
-> contract address
and token ID
.
Use Miniscan to find important information relevant to your subgraph (smart contract name, ABI, startblock).
2. Go to Subgraph Studio, and build a new subgraph
-
Follow the instructions in Subgraph Studio to spin up a new subgraph on your local computer using
graph-cli
. -
Enter information gathered from MiniScan about your smart contract into
graph-cli
as prompted. -
Choose "yes" when asked if wanting to index events as entites.
-
graph deploy
... to deploy your subgraph
- subgraph.yaml (Subgraph Manifest)
- src/mappings.ts (Subgraph Logic)
- schema.graphql (Presented Subgraph Data)
- Refer to documentation and the subgraph in this repo for specific changes and techniques.
- Read The Graph Unlocks a New Web3 Use Case: Organizing Off-chain Data by Craig Tutterow
- Learn about the Data Edge GIP
- Send the Data Edge smart contract the Qm hash and any other metadata you'd like formatted properly, and it will emit that message as an event. Useful for getting the chain to trigger a IPFS file search for a specific hash that was passed to the smart contract.
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity ^0.8.12;
/// @title Data Edge contract is only used to store on-chain data, it does not
/// perform execution. On-chain client services can read the data
/// and decode the payload for different purposes.
/// NOTE: This version emits an event with the calldata.
contract EventfulDataEdge {
event Log(bytes data);
/// @dev Fallback function, accepts any payload
fallback() external payable {
emit Log(msg.data);
}
}
- Cryptocoven File Data Sources (and older ipfs.cat) Subgraph
- Messari Subgraphs
- EIP-721 (NFTS on The Graph Network)
- Lens Protocol
- Unlock Protocol on The Graph Network
- Open Sea Subgraph
- LiNEAR
- Aave Gotchi
- Tellor
- Live Peer
- ENS
- UMA on The Graph Network
- https://github.com/schmidsi/hackathon-starterkit
- https://github.com/scaffold-eth/scaffold-eth#-scaffold-eth
- https://github.com/Developer-DAO/resources
- https://dev.to/dabit3/the-complete-guide-to-full-stack-ethereum-development-3j13
- https://github.com/itsjerryokolo/CryptoPunks
- https://github.com/dabit3/building-a-subgraph-workshop
- https://thegraph.com/docs/developer/quick-start
- https://thegraph.com/discord
- https://protean-labs.github.io/subgrounds/