Hello, my name is Nader Dabit. I'm a Developer Relations Engineer at Edge and Node. And today I'm going to be speaking about building GraphQL APIs on top of Ethereum, but also the Ethereum virtual machine. You can think of the Ethereum virtual machine, it's kind of like the React of the blockchain world. You learn this one skillset, and you can build not only on the Ethereum blockchain, but any EVM compatible blockchain, meaning a handful of different Ethereum layer twos and side chains, as well as other completely different blockchains like Avalanche, Celo, and many others that are out there.
So with that being said, let's go ahead and get started. So how we interact with and build on top of blockchains is much different than what we're used to in the traditional web. In a blockchain, data isn't stored in a format that can be efficiently or easily consumed directly from other applications or front ends. The problem is that you need to have the data indexed and organized for efficient retrieval. Traditionally, that's the work that's done in the centralized tech stack, but that indexing layer was missing in the Web3 stack.
So in the traditional web stack, databases, servers, APIs, they filter, sort, paginate, and join data before it's returned to our client applications, typically via some type of HTTP request. And these types of data transfer nations are essentially not possible when reading data directly from Ethereum or other blockchains. So in the past, developers and teams would build out and operate their own proprietary indexing servers. But this requires significant hardware and engineering resources, and also broke the important security principles around decentralization. So around the year 2018, the graph began being built to solve this problem. The graph is an indexing protocol for querying blockchain networks like Ethereum and IPFS.
So let's talk about how the graph works. So let's take a look at a couple of other indexing systems that we might be using in the day to day world that we're already used to. So search engines like Google crawl the internet, they index relevant data and they make it available for users like us to search via their web interface or their APIs. And without this indexing layer, it would be kind of hard for us to know where to look for, where to look and how to find relevant information across the web. So you could think of the search engines that we use on a day-to-day basis, kind of like an indexing layer. Another similar analogy is a library. So using an indexing system like the Dewey Decimal system, we know exactly where to find the book that we're looking for without having to go looking book by book throughout the entire library.
Using the graph, developers can build APIs called subgraphs. A subgraph defines how to efficiently index data in a deterministic way and make it available for querying from frontend applications. Subgraphs live in between the blockchain and the UI, providing an important piece of software infrastructure, a flexible, performant and decentralized API layer. Once a subgraph is deployed and the data is indexed, apps can start querying the data without relying on any centralized service provider, and instead they can lean on a query marketplace that's comprised of a decentralized network of indexers, all competing to provide the best service at the best price. Right now the graph serves over 1 billion queries per day, and many types of applications in the Web3 world are using it, including DeFi, gaming, NFT marketplaces, and a handful of other types of applications. So to get started, you would go to thegraph.com, and in the user interface here, you can go ahead and define the subgraph name, along with any other searchable metadata that you'd like to be made available. Next you would use the open source graph CLI tooling to scaffold out a subgraph locally that you can then begin building on.
Comments