Inspiration
Some backstory leading up to ETH Waterloo. Gods Unchained is in the process of activating Genesis season ERC-721 tokens. There is no good way at the moment to query for a users's collection of cards including token id, protos, and quality. At the moment immutable's api does allow for querying a given player's cards by 0x address, although unfortunately the token ids are not included. So, I asked in the ETH Waterloo #mentor-help discord channel for some direction here. Which lead me to The Graph.
For anyone unfamiliar with The Graph, the platform enables building a subgraph which then syncs with Ethereum's blockchain enabling simple yet powerful Graph QL queries to fetch exactly the data needed.
For anyone unfamiliar with Gods Unchained, think Magic the Gathering meets Hearthstone meets Blockchain.
If you still don't know what a subgraph is it's basically something that indexes and structures data for querying. The Graph's getting started does a good job of walking through subgraphs. https://thegraph.com/docs/quick-start
TLDR; I was struggling with a way to fetch all of an owner's Gods Unchained tokens as well as the token's proto and quality. The Graph was the answer.
Read on to find out how it works...
What it does
A subgraph to run single queries for returning rich data from the Gods Unchained token contract.
A demo for displaying Gods Unchained card collections by owner.
How I built it
The project was built with a combination of
- The Gods Unchained token contract
- The Graph
- GraphQL
- VS Code text editor HTML CSS Javascript
Challenges I ran into
Have you ever written a subgraph? A bit of a learning curve to get up and running. Definitely a fun experience with many Ohhhh so that's how that works moments.
Accomplishments that I'm proud of
What I learned
All about subgraphs and querying Ethereum smart contracts
What's next for Gods Unchained Subgraph
Did someone say Gods Ungraphed?
Built With
- ethereum
- godsunchained
- graphql
- javascript
- solidity
- thegraph
Log in or sign up for Devpost to join the conversation.