The deck for a lightning talk I gave at Coding Berlin November 2019. Demonstrates how you can index data from a decentralized ledger (Ethereum) and filesystem (IPFS) using "The Graph" nodes and query them by using a pure GraphQL API.
2. some ethereum basics
● a blockchain with a fundamental smart contract system
● all transactions are executed as code
● you can write your own code.
● contract
○ stateful, extendable structure with behaviours & visibilities (“class”)
● ABI
○ application binary interface
● transaction
○ a (possibly state changing) function call on a contract
● event
○ a “log” entry that’s “emitted” inside a smart contract’s function call
○ used by external UIs for keeping track of contract actions and for auditing
@stadolf
3. ● a peer to peer based data exchange, discovery and storage protocol
● every “file” gets a unique CID based on its hashed contents
○ deduplication
○ change resilience
○ cid is the merkle tree root of a hash tree that addresses all content slices (256k)
● great as “CDN” replacement
○ content slices are cached on edges
○ the more people request a content slice the bigger / faster its availability
● content disappears, if noone “wants” it
○ as long as your daemon is running it is addressable
○ if you want to “keep” content, you must “pin” it
● “remove” requests can take long
some ipfs basics
@stadolf
5. Some Queries are simpler than others
● what’s this account’s ethereum balance?
○ -> key value lookup in eth nodes’ key value store
● how many tokens belong to this account?
○ -> scan all events of that contract for the given address
○ -> ask the contract directly, it keeps track of all balances in its state ;)
● what’s the most active address that interacts with an account and what’s the average
transaction amount?
○ ?
● Who are the owners of the CryptoKitties born between January and February of 2018?
○ ??
@stadolf
6.
7. decentralized projections for unstoppable data analysis
of Ethereum & IPFS
delivering a queryable GraphQL API at your fingertips
@stadolf
15. deploy subgraph to the hosted instance
yarn deploy
graph deploy --node https://api.thegraph.com/deploy/ --ipfs
https://api.thegraph.com/ipfs/ elmariachi111/foam-token
16. Problems solved
programmatic analysis of an event store
compiles to WASM and uploads binaries to IPFS -> everybody can reuse your mappings!
combines Ethereum & IPFS in one API
every frontend developer loves to consume GraphQL on her SPA/PWA
integrate with other APIs
@stadolf