<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Deni</title>
    <description>The latest articles on DEV Community by Deni (@denitech).</description>
    <link>https://dev.to/denitech</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F618752%2Fd5523baf-afd7-4f86-acbf-3384eadaa00a.jpg</url>
      <title>DEV Community: Deni</title>
      <link>https://dev.to/denitech</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/denitech"/>
    <language>en</language>
    <item>
      <title>Mina Protocol: small chain, big dreams</title>
      <dc:creator>Deni</dc:creator>
      <pubDate>Fri, 19 Apr 2024 17:20:00 +0000</pubDate>
      <link>https://dev.to/denitech/mina-protocol-small-chain-big-dreams-2o02</link>
      <guid>https://dev.to/denitech/mina-protocol-small-chain-big-dreams-2o02</guid>
      <description>&lt;p&gt;In my X &lt;a href="https://x.com/DeniTechh/status/1775955525546434806"&gt;video&lt;/a&gt; and &lt;a href="https://x.com/DeniTechh/status/1779216422503387518"&gt;post&lt;/a&gt;, I briefly introduced &lt;a href="https://twitter.com/MinaProtocol"&gt;Mina Protocol.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The lightweight blockchain with its focus on scalability, privacy and the community.&lt;/p&gt;

&lt;p&gt;Today I would like to talk about why Mina is the platform for developers to build dApps on, and why this matters for the users and the community.&lt;/p&gt;

&lt;p&gt;We know that Mina's blockchain is only a staggering 22KB. Which is approximately a post on X. Now why is this such a feat and why does this matter to developers?&lt;/p&gt;

&lt;p&gt;Let's find out ;)!&lt;/p&gt;

&lt;h3&gt;
  
  
  Small chain, big dreams.
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8v71edl3rad7ievn5ew6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8v71edl3rad7ievn5ew6.png" alt="Small chain, big dreams, x post." width="594" height="220"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A lighter blockchain such as Mina Protocol, requires fewer resources to operate and participate in the network. This means devs and users don't need powerful hardware (read: expensive gaming PCs / high-end smartphones) or massive storage to interact and build on the blockchain.&lt;/p&gt;

&lt;p&gt;Lower resource requirements make it easier for developers to set up and maintain nodes, reducing operational costs and technical know-how.&lt;/p&gt;

&lt;p&gt;Besides "entry requirements" (this starts to read like a gaming blog "how to run Crysis") smaller blockchains sync faster than bigger ones. Developers can set up new nodes or join the network more quickly, making the development and deployment process faster.&lt;/p&gt;

&lt;p&gt;Additionally, transaction validation times are shorter, enabling DApps to provide near-real-time feedback to users. This speed and responsiveness make the user (and developer) experience better, making DApps feel like normal apps, and more competitive with their centralized competitors.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why scalability matters.
&lt;/h3&gt;

&lt;p&gt;We talked about Mina and scalability, but why is that important?&lt;br&gt;&lt;br&gt;
Lighter blockchains are more scalable because they don't burden nodes with the storage and processing which is associated with a growing transaction history. As Mina's blockchain is a constant-sized one, it stays at 22KB, which means developers can use this to their advantage.&lt;/p&gt;

&lt;p&gt;As a result, building DApps can scale to user growth and the volume of transactions.&lt;/p&gt;

&lt;p&gt;This might seem trivial/normal since we are used to how Web2 apps work, but in the world of Web3 and user growth, this is crucial.&lt;/p&gt;

&lt;h3&gt;
  
  
  Less costs.
&lt;/h3&gt;

&lt;p&gt;Another aspect of having a lighter blockchain is maintaining and operating a node on a lighter blockchain typically means lower costs compared to heavier blockchains.&lt;/p&gt;

&lt;p&gt;With reduced resource requirements and faster syncing times, developers can save on costs and make use of their resources more efficiently. Lower costs also make it easier for developers to bootstrap their projects, potentially attract investors, and maintain their DApps over the longer term, which means more users, more growth, and more reach.&lt;/p&gt;

&lt;p&gt;This means more dApps are used and built over time, which provides users with more choice, and a bigger "app" market. Essentially: a win for developers, a win for users, and a win for Web3!&lt;/p&gt;

&lt;h3&gt;
  
  
  For the community.
&lt;/h3&gt;

&lt;p&gt;Finally, Mina is not only developer-friendly, but also user-friendly. Because a lighter blockchain means (the apps) it is more accessible to a wider range of users, whether those with limited hardware capabilities or those with limited internet connectivity/data. This means more happy users and happy developers :).&lt;/p&gt;

&lt;p&gt;This all comes together when developers can target and reach demographics without worrying about the technical or internet constraints of their users. So like we mentioned, more reach, more impact, more happiness!&lt;/p&gt;

&lt;h3&gt;
  
  
  Mina and big dreams!
&lt;/h3&gt;

&lt;p&gt;In summary, a lighter blockchain makes developing and scaling easier, reduces costs for developing and maintaining, and improves accessibility for both developers and users.&lt;/p&gt;

&lt;p&gt;This all makes it easy for developers to create and maintain DApps, grow their user base, and keep an active community in the decentralized world of Web3.&lt;/p&gt;

&lt;p&gt;Thanks to Mina Protocol, with its small chain, big dreams are achievable.&lt;/p&gt;




&lt;p&gt;Thank you for reading! There is much more to Mina Protocol, so please join the community and make friends on Mina's &lt;a href="https://discord.com/invite/minaprotocol"&gt;Discord&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Build on Mina with their extensive &lt;a href="https://www.google.com/search?client=safari&amp;amp;rls=en&amp;amp;q=mina+documentation&amp;amp;ie=UTF-8&amp;amp;oe=UTF-8"&gt;documentation&lt;/a&gt;, and share your work with the community on Discord and X.&lt;/p&gt;

&lt;p&gt;Happy building!&lt;/p&gt;

</description>
      <category>web3</category>
      <category>mina</category>
      <category>blockchain</category>
      <category>minaprotocol</category>
    </item>
    <item>
      <title>👀 A developer’s overview of SubQuery</title>
      <dc:creator>Deni</dc:creator>
      <pubDate>Tue, 05 Mar 2024 16:54:21 +0000</pubDate>
      <link>https://dev.to/denitech/a-developers-overview-of-subquery-2g3p</link>
      <guid>https://dev.to/denitech/a-developers-overview-of-subquery-2g3p</guid>
      <description>&lt;p&gt;In a world of decentralisation, blockchains and dapps, it’s hard to stand out. But that’s exactly what SubQuery managed to do. A key tool that makes it easier for web3 apps (dapps) to work with data.&lt;/p&gt;

&lt;p&gt;At its core, SubQuery simplifies the complex process of data indexing and querying.&lt;/p&gt;

&lt;p&gt;This way, developers can focus on building user-centric applications without being thrown off by the overly complicated ramifications of blockchain data structures. &lt;/p&gt;

&lt;p&gt;The architecture is designed with flexibility and scalability in mind.&lt;/p&gt;

&lt;p&gt;The open-source indexer allows us to run their indexing nodes, providing full control over data processing and querying capabilities. &lt;/p&gt;

&lt;p&gt;Devs, for us, this component is essential for projects that require customised indexing logic or those that prioritise data sovereignty.&lt;/p&gt;

&lt;p&gt;On the other hand, SubQuery's managed service offers a hassle-free alternative. SubQuery’s team takes care of the infrastructure management, allowing developers to concentrate on their application logic.&lt;/p&gt;

&lt;p&gt;In essence, SubQuery brings it all together with:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;An open-source data indexer.&lt;/li&gt;
&lt;li&gt;A managed service solution.&lt;/li&gt;
&lt;li&gt;A decentralised network marketplace.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Each of these fulfilling a unique role in levelling up the efficiency and scalability of web3 dapps.&lt;/p&gt;

&lt;p&gt;Just take a look at all the (157 and growing) supported networks &lt;a href="https://subquery.network/networks"&gt;right here!&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now that went over the basic introduction, let’s dive a little deeper into each component!&lt;/p&gt;

&lt;h3&gt;
  
  
  Data Indexer
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnba9xxtbbfyz12jy3p65.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnba9xxtbbfyz12jy3p65.png" alt="Image description" width="800" height="324"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;At the heart of SubQuery is its open-source data indexer, a tool designed to be fast, flexible, and reliable. &lt;/p&gt;

&lt;p&gt;This indexer serves as the foundation for developers, allowing them to create custom APIs tailored to their specific project needs. &lt;/p&gt;

&lt;p&gt;With support for over 157 blockchain networks, developers gain the ability to efficiently access and manipulate blockchain data for their applications.&lt;/p&gt;

&lt;p&gt;Since it’s open source, you can check out the SubQuery Github &lt;a href="https://github.com/subquery/subql?tab=readme-ov-file"&gt;here&lt;/a&gt;!&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Managed Service&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1znay94zpfn89zk0rrdp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1znay94zpfn89zk0rrdp.png" alt="Image description" width="800" height="534"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;SubQuery's optional managed service solution offers a centralised infrastructure hosting option for developers seeking enhanced capabilities. &lt;/p&gt;

&lt;p&gt;This provides features such as dedicated databases, redundant clusters for improved reliability, intelligent multicluster routing, and advanced monitoring and analytics. &lt;/p&gt;

&lt;p&gt;The goal is to streamline the development process by offering a robust and managed environment for blockchain data operations, making developers' job easier.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Decentralised network marketplace&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flx9jq5o80wiopb1eg7v8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flx9jq5o80wiopb1eg7v8.png" alt="Image description" width="800" height="522"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The decentralised marketplace within the SubQuery ecosystem operates with the &lt;a href="https://coinmarketcap.com/currencies/subquery-network/"&gt;SQT token&lt;/a&gt;, providing a unique avenue for participants to engage in buying and selling blockchain data. &lt;/p&gt;

&lt;p&gt;This marketplace is a hub for network participants including node operators offering indexing and RPCs services &lt;/p&gt;

&lt;p&gt;In other words, SubQuery's comprehensive approach addresses the critical challenge of accessing blockchain data for Web3 applications. &lt;/p&gt;

&lt;p&gt;By combining the:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;flexibility of an open-source data indexer&lt;/li&gt;
&lt;li&gt;the advanced features of a managed service solution&lt;/li&gt;
&lt;li&gt;and the decentralised transactional power of a marketplace&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;SubQuery positions itself as a catalyst for the seamless development and deployment of blockchain-powered applications. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://twitter.com/SubQueryNetwork"&gt;Join the SubQuery community and be part of the movement shaping the future of Web3!&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  A New Project
&lt;/h1&gt;

&lt;p&gt;Let’s initialise a new project that provides you with a working SubQuery project in your chosen layer-1 network. This will provide a basic understanding of how SubQuery works!&lt;/p&gt;

&lt;h3&gt;
  
  
  Prerequisites
&lt;/h3&gt;

&lt;p&gt;Before we get to your first blockchain project with SubQuery, we need to make sure you have installed the required supporting software.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://nodejs.org/en/"&gt;NodeJS&lt;/a&gt;&lt;/strong&gt;: A modern (e.g. the LTS version) installation of NodeJS.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://docker.com/"&gt;Docker&lt;/a&gt;&lt;/strong&gt;: This tutorial will use Docker to run a local version of SubQuery's node.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;1. Install the SubQuery CLI&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;The first step is to install SubQuery globally on your terminal using NPM. &lt;/p&gt;

&lt;p&gt;It’s not recommended to use &lt;code&gt;yarn global&lt;/code&gt; for installing &lt;code&gt;@subql/cli&lt;/code&gt; because of its poor dependancy management. It may lead to multiple errors.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="err"&gt;#&lt;/span&gt; &lt;span class="nx"&gt;NPM&lt;/span&gt;
&lt;span class="nx"&gt;npm&lt;/span&gt; &lt;span class="nx"&gt;install&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;g&lt;/span&gt; &lt;span class="p"&gt;@&lt;/span&gt;&lt;span class="nd"&gt;subql&lt;/span&gt;&lt;span class="sr"&gt;/cl&lt;/span&gt;&lt;span class="err"&gt;i
&lt;/span&gt;
&lt;span class="err"&gt;#&lt;/span&gt; &lt;span class="nx"&gt;Test&lt;/span&gt; &lt;span class="nx"&gt;that&lt;/span&gt; &lt;span class="nx"&gt;it&lt;/span&gt; &lt;span class="nx"&gt;was&lt;/span&gt; &lt;span class="nx"&gt;installed&lt;/span&gt; &lt;span class="nx"&gt;correctly&lt;/span&gt;
&lt;span class="nx"&gt;subql&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="nx"&gt;help&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  &lt;strong&gt;2. Initialise a new SubQuery Project&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Run &lt;code&gt;subql init&lt;/code&gt; inside the directory that you want to create a SubQuery project in.&lt;/p&gt;

&lt;p&gt;After that, you will be asked a list of questions as you proceed ahead:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Project name&lt;/strong&gt;: A project name for your SubQuery project.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Network family&lt;/strong&gt;: The layer-1 blockchain network family that this SubQuery project will index. Use the arrow keys to select from the available options (scroll down as there are multiple pages).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Network&lt;/strong&gt;: The specific network that this SubQuery project will index. Use the arrow keys to select from the available options (scroll down as there are multiple pages).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Template project&lt;/strong&gt;: Select a SubQuery template project that will provide a starting point in the development. For some networks we provide multiple examples.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;RPC endpoint&lt;/strong&gt;: Provide an HTTP or websocket URL to a running RPC endpoint, which will be used by default for this project. You can use public endpoints for different networks, your own private dedicated node, or just use the default endpoint. This RPC node must have the entire state of the data that you wish to index, so we recommend an archive node.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Git repository&lt;/strong&gt;: Provide a Git URL to a repo that this SubQuery project will be hosted in.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Authors&lt;/strong&gt;: Enter the owner of this SubQuery project here (this can be your name, etc) or accept the provided default.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Description&lt;/strong&gt;: Provide a short paragraph about your project that describes what data it contains and what users can do with it, or accept the provided default.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Version&lt;/strong&gt;: Enter a custom version number or use the default (&lt;code&gt;1.0.0&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;License&lt;/strong&gt;: Provide the software license for this project or accept the default (&lt;code&gt;MIT&lt;/code&gt;).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here is an example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="nx"&gt;subql&lt;/span&gt; &lt;span class="nx"&gt;init&lt;/span&gt;
&lt;span class="nx"&gt;Project&lt;/span&gt; &lt;span class="nx"&gt;name&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;subql&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;starter&lt;/span&gt;&lt;span class="p"&gt;]:&lt;/span&gt; &lt;span class="nx"&gt;test&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;subquery&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;project&lt;/span&gt;
&lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="nx"&gt;Select&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="nx"&gt;network&lt;/span&gt; &lt;span class="nx"&gt;family&lt;/span&gt; &lt;span class="nx"&gt;Ethereum&lt;/span&gt;
&lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="nx"&gt;Select&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="nx"&gt;network&lt;/span&gt; &lt;span class="nx"&gt;Ethereum&lt;/span&gt;
&lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="nx"&gt;Select&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="nx"&gt;template&lt;/span&gt; &lt;span class="nx"&gt;project&lt;/span&gt; &lt;span class="nx"&gt;ethereum&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;starter&lt;/span&gt;     &lt;span class="nx"&gt;Starter&lt;/span&gt; &lt;span class="nx"&gt;project&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="nx"&gt;Ethereum&lt;/span&gt; &lt;span class="nx"&gt;networks&lt;/span&gt;
&lt;span class="nx"&gt;RPC&lt;/span&gt; &lt;span class="nx"&gt;endpoint&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;https&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="c1"&gt;//eth.api.onfinality.io/public]:&lt;/span&gt;
&lt;span class="nx"&gt;Git&lt;/span&gt; &lt;span class="nx"&gt;repository&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;https&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="c1"&gt;//github.com/subquery/ethereum-subql-starter]: https://github.com/jamesbayly/test-subquery-project  ^ Author [SubQuery Team]: James Bayly&lt;/span&gt;
&lt;span class="nx"&gt;Description&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;This&lt;/span&gt; &lt;span class="nx"&gt;project&lt;/span&gt; &lt;span class="nx"&gt;can&lt;/span&gt; &lt;span class="nx"&gt;be&lt;/span&gt; &lt;span class="nx"&gt;use&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="nx"&gt;starting&lt;/span&gt; &lt;span class="nx"&gt;po&lt;/span&gt;&lt;span class="p"&gt;...]:&lt;/span&gt; &lt;span class="nx"&gt;A&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;example&lt;/span&gt; &lt;span class="nx"&gt;ethereum&lt;/span&gt; &lt;span class="nx"&gt;SubQuery&lt;/span&gt; &lt;span class="nx"&gt;project&lt;/span&gt;
&lt;span class="nx"&gt;Version&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mf"&gt;0.0&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]:&lt;/span&gt;
&lt;span class="nx"&gt;License&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;MIT&lt;/span&gt;&lt;span class="p"&gt;]:&lt;/span&gt;
&lt;span class="nx"&gt;Preparing&lt;/span&gt; &lt;span class="nx"&gt;project&lt;/span&gt;&lt;span class="p"&gt;...&lt;/span&gt; &lt;span class="nx"&gt;done&lt;/span&gt;
&lt;span class="nx"&gt;test&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;subquery&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;project&lt;/span&gt; &lt;span class="nx"&gt;is&lt;/span&gt; &lt;span class="nx"&gt;ready&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After you complete the initialisation process, you will see a folder with your project name created inside the directory. Please note that the contents of this directory should be near identical to what's listed in the &lt;strong&gt;&lt;a href="https://academy.subquery.network/build/introduction.html#directory-structure"&gt;Directory Structure&lt;/a&gt;&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Finally, run the following command to install the new project’s dependencies from within the new project's directory.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="nx"&gt;cd&lt;/span&gt; &lt;span class="nx"&gt;PROJECT_NAME&lt;/span&gt;
&lt;span class="nx"&gt;yarn&lt;/span&gt; &lt;span class="nx"&gt;install&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You have now successfully initialised your first SubQuery project in a few simple steps.&lt;/p&gt;

&lt;p&gt;Let’s now customise the standard template project for a specific blockchain of interest.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;3. Make Changes to Your Project&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;We should start with modifying 3 important files.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The GraphQL Schema in &lt;code&gt;schema.graphql&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;The Project Manifest in &lt;code&gt;project.ts&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;The Mapping functions in &lt;code&gt;src/mappings/&lt;/code&gt; directory.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;SubQuery supports various blockchain networks and provides a dedicated guide for each of them. Select your preferred blockchain under &lt;strong&gt;2. Specific Chains&lt;/strong&gt; and continue the quick start guide.&lt;/p&gt;

&lt;h1&gt;
  
  
  Aurora Quick Start (EVM)
&lt;/h1&gt;

&lt;p&gt;Aurora is a next generation Ethereum compatible blockchain &amp;amp; ecosystem that runs on the NEAR Protocol. This powers the innovations behind Aurora cloud - the fasters path for Web2 businesses to capture the value of Web3.&lt;/p&gt;

&lt;p&gt;Since SubQuery fully supports NEAR and Aurora, you can index data from both execution environments in the same SubQuery project and into the same dataset.&lt;/p&gt;

&lt;p&gt;In the earlier &lt;strong&gt;&lt;a href="https://academy.subquery.network/quickstart/quickstart.html"&gt;Quickstart&lt;/a&gt;&lt;/strong&gt; section , you should have taken note of three crucial files. &lt;/p&gt;

&lt;p&gt;Please initialise a NEAR Network project. Now, let’s move forward and update these configurations.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Your Project Manifest File&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;This file is the entry point to your project. It defines most of the details on how SubQuery will index and transform the chain data.&lt;/p&gt;

&lt;p&gt;For EVM chains, there are three types of mapping handlers (you can have more than one in each project):&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://academy.subquery.network/build/manifest/ethereum.html#mapping-handlers-and-filters"&gt;BlockHanders&lt;/a&gt;&lt;/strong&gt;: On each and every block, run a mapping function&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://academy.subquery.network/build/manifest/ethereum.html#mapping-handlers-and-filters"&gt;TransactionHandlers&lt;/a&gt;&lt;/strong&gt;: On each and every transaction that matches optional filter criteria, run a mapping function&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://academy.subquery.network/build/manifest/ethereum.html#mapping-handlers-and-filters"&gt;LogHanders&lt;/a&gt;&lt;/strong&gt;: On each and every log that matches optional filter criteria, run a mapping function&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;As we are indexing all transfers and approvals for the Wrapped NEAR smart contract, the first step is to import the contract abi definition which can be obtained from &lt;strong&gt;&lt;a href="https://explorer.aurora.dev/address/0xC42C30aC6Cc15faC9bD938618BcaA1a1FaE8501d/contracts#address-tabs"&gt;here&lt;/a&gt;&lt;/strong&gt;. &lt;/p&gt;

&lt;p&gt;Copy the entire contract ABI and save it as a file called &lt;code&gt;erc20.abi.json&lt;/code&gt; in the &lt;code&gt;/abis&lt;/code&gt; directory.&lt;/p&gt;

&lt;p&gt;This section in the Project Manifest now imports all the correct definitions and lists the triggers that we look for on the blockchain when indexing.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Since we are indexing all transfers and approvals for the Wrapped NEAR smart contract, you need to update the &lt;code&gt;datasources&lt;/code&gt; section as follows:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;dataSources&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;EthereumDatasourceKind&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Runtime&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// We use ethereum runtime since NEAR Aurora is a layer-2 that is compatible&lt;/span&gt;
      &lt;span class="na"&gt;startBlock&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;42731897&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// Block with the first interaction with NEAR https://explorer.aurora.dev/tx/0xc14305c06ef0a271817bb04b02e02d99b3f5f7b584b5ace0dab142777b0782b1&lt;/span&gt;
      &lt;span class="na"&gt;options&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="c1"&gt;// Must be a key of assets&lt;/span&gt;
        &lt;span class="na"&gt;abi&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;erc20&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="na"&gt;address&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;0xC42C30aC6Cc15faC9bD938618BcaA1a1FaE8501d&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// this is the contract address for wrapped NEAR https://explorer.aurora.dev/address/0xC42C30aC6Cc15faC9bD938618BcaA1a1FaE8501d&lt;/span&gt;
      &lt;span class="p"&gt;},&lt;/span&gt;
      &lt;span class="na"&gt;assets&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Map&lt;/span&gt;&lt;span class="p"&gt;([[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;erc20&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;file&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;./abis/erc20.abi.json&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;}]]),&lt;/span&gt;
      &lt;span class="na"&gt;mapping&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="na"&gt;file&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;./dist/index.js&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="na"&gt;handlers&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
          &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="na"&gt;handler&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;handleTransaction&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;EthereumHandlerKind&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Call&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// We use ethereum runtime since NEAR Aurora is a layer-2 that is compatible&lt;/span&gt;
            &lt;span class="na"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
              &lt;span class="c1"&gt;// The function can either be the function fragment or signature&lt;/span&gt;
              &lt;span class="c1"&gt;// function: '0x095ea7b3'&lt;/span&gt;
              &lt;span class="c1"&gt;// function: '0x7ff36ab500000000000000000000000000000000000000000000000000000000'&lt;/span&gt;
              &lt;span class="na"&gt;function&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;approve(address spender, uint256 rawAmount)&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="p"&gt;},&lt;/span&gt;
          &lt;span class="p"&gt;},&lt;/span&gt;
          &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="na"&gt;handler&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;handleLog&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;EthereumHandlerKind&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Event&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="na"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
              &lt;span class="c1"&gt;// address: "0x60781C2586D68229fde47564546784ab3fACA982"&lt;/span&gt;
              &lt;span class="na"&gt;topics&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
                &lt;span class="c1"&gt;//Follows standard log filters https://docs.ethers.io/v5/concepts/events/&lt;/span&gt;
                &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Transfer(address indexed from, address indexed to, uint256 amount)&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
              &lt;span class="p"&gt;],&lt;/span&gt;
            &lt;span class="p"&gt;},&lt;/span&gt;
          &lt;span class="p"&gt;},&lt;/span&gt;
        &lt;span class="p"&gt;],&lt;/span&gt;
      &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="p"&gt;],&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The above code indicates that you will be running a &lt;code&gt;handleTransaction&lt;/code&gt; and &lt;code&gt;handlelog&lt;/code&gt; mapping function whenever there is an &lt;code&gt;approve&lt;/code&gt; or &lt;code&gt;Transfer&lt;/code&gt; log on any transaction from the &lt;strong&gt;&lt;a href="https://explorer.aurora.dev/address/0xC42C30aC6Cc15faC9bD938618BcaA1a1FaE8501d/contracts#address-tabs"&gt;Wrapped NEAR contract&lt;/a&gt;&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Update Your GraphQL Schema File&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;schema.graphql&lt;/code&gt; file determines the shape of your data from SubQuery due to the mechanism of the GraphQL query language. Hence, updating the GraphQL Schema file is the perfect place to start. It allows you to define your end goal right at the start.&lt;/p&gt;

&lt;p&gt;Remove all existing entities and update the &lt;code&gt;schema.graphql&lt;/code&gt; file as follows. Here you can see we are indexing block information such as the id and the blockHeight along with addresses such as to, from, owner and spender, along with the contract address and value as well.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nx"&gt;Transaction&lt;/span&gt; &lt;span class="p"&gt;@&lt;/span&gt;&lt;span class="nd"&gt;entity&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;ID&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt; &lt;span class="err"&gt;#&lt;/span&gt; &lt;span class="nx"&gt;Transaction&lt;/span&gt; &lt;span class="nx"&gt;hash&lt;/span&gt;
  &lt;span class="na"&gt;txHash&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;String&lt;/span&gt;
  &lt;span class="na"&gt;blockHeight&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;BigInt&lt;/span&gt;
  &lt;span class="na"&gt;to&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;String&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;
  &lt;span class="na"&gt;from&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;String&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;
  &lt;span class="na"&gt;value&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;BigInt&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;
  &lt;span class="na"&gt;contractAddress&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;String&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nx"&gt;Approval&lt;/span&gt; &lt;span class="p"&gt;@&lt;/span&gt;&lt;span class="nd"&gt;entity&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;ID&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt; &lt;span class="err"&gt;#&lt;/span&gt; &lt;span class="nx"&gt;Transaction&lt;/span&gt; &lt;span class="nx"&gt;hash&lt;/span&gt;
  &lt;span class="na"&gt;value&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;BigInt&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;
  &lt;span class="na"&gt;owner&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;String&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;
  &lt;span class="na"&gt;spender&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;String&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;
  &lt;span class="na"&gt;contractAddress&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;String&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;SubQuery simplifies and ensures type-safety when working with GraphQL entities, smart contracts, events, transactions, and logs. &lt;/p&gt;

&lt;p&gt;The SubQuery CLI will generate types based on your project's GraphQL schema and any contract ABIs included in the data sources.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;yarn codegen
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This action will generate a new directory (or update the existing one) named &lt;code&gt;src/types&lt;/code&gt;. Inside this directory, you will find automatically generated entity classes corresponding to each type defined in your &lt;code&gt;schema.graphql&lt;/code&gt;. &lt;/p&gt;

&lt;p&gt;These classes facilitate type-safe operations for loading, reading, and writing entity fields. You can learn more about this process in &lt;strong&gt;&lt;a href="https://academy.subquery.network/build/graphql.html"&gt;the GraphQL Schema section&lt;/a&gt;&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;It will also generate a class for every contract event, offering convenient access to event parameters, as well as information about the block and transaction from which the event originated. &lt;/p&gt;

&lt;p&gt;You can find detailed information on how this is achieved in the &lt;strong&gt;&lt;a href="https://academy.subquery.network/build/introduction.html#evm-codegen-from-abis"&gt;EVM Codegen from ABIs&lt;/a&gt;&lt;/strong&gt; section. All of these types are stored in the &lt;code&gt;src/types/abi-interfaces&lt;/code&gt; and &lt;code&gt;src/types/contracts&lt;/code&gt; directories.&lt;/p&gt;

&lt;p&gt;You can import all these types:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;Approval&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;Transaction&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;../types&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;ApproveTransaction&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nx"&gt;TransferLog&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;../types/abi-interfaces/Erc20Abi&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Check out the &lt;strong&gt;&lt;a href="https://academy.subquery.network/build/graphql.html"&gt;GraphQL Schema&lt;/a&gt;&lt;/strong&gt; documentation to get in-depth information on &lt;code&gt;schema.graphql&lt;/code&gt; file.&lt;/p&gt;

&lt;p&gt;Now that you have made essential changes to the GraphQL Schema file, let’s proceed ahead with the Mapping Function’s configuration.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Add a Mapping Function&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Mapping functions define how blockchain data is transformed into the optimised GraphQL entities that we previously defined in the &lt;code&gt;schema.graphql&lt;/code&gt; file.&lt;/p&gt;

&lt;p&gt;Navigate to the default mapping function in the &lt;code&gt;src/mappings&lt;/code&gt; directory. You will be able to see three exported functions: &lt;code&gt;handleBlock&lt;/code&gt;, &lt;code&gt;handleLog&lt;/code&gt;, and &lt;code&gt;handleTransaction&lt;/code&gt;. Replace these functions with the following code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;Approval&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;Transaction&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;../types&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;ApproveTransaction&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nx"&gt;TransferLog&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;../types/abi-interfaces/Erc20Abi&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;assert&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;assert&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;handleLog&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;TransferLog&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="nb"&gt;Promise&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="k"&gt;void&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;logger&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;info&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`New transfer transaction log at block &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;blockNumber&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nf"&gt;assert&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;args&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;No log.args&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;transaction&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;Transaction&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
    &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;transactionHash&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;txHash&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;transactionHash&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;blockHeight&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;BigInt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;blockNumber&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="na"&gt;to&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;args&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;to&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;from&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;args&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;from&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;value&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;args&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toBigInt&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
    &lt;span class="na"&gt;contractAddress&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;address&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;});&lt;/span&gt;

  &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;transaction&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;save&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;handleTransaction&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;tx&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;ApproveTransaction&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="nb"&gt;Promise&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="k"&gt;void&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;logger&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;info&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`New Approval transaction at block &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;tx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;blockNumber&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nf"&gt;assert&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;tx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;args&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;No tx.args&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;approval&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;Approval&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
    &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;tx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;hash&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;owner&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;tx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;from&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;spender&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;tx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;args&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
    &lt;span class="na"&gt;value&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;BigInt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;tx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;args&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nf"&gt;toString&lt;/span&gt;&lt;span class="p"&gt;()),&lt;/span&gt;
    &lt;span class="na"&gt;contractAddress&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;tx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;to&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;});&lt;/span&gt;

  &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;approval&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;save&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;handleTransaction&lt;/code&gt; function receives a &lt;code&gt;tx&lt;/code&gt; parameter of type &lt;code&gt;ApproveTransaction&lt;/code&gt; which includes transaction log data in the payload. &lt;/p&gt;

&lt;p&gt;We extract this data and then save this to the store using the &lt;code&gt;.save()&lt;/code&gt; function (&lt;em&gt;Note that SubQuery will automatically save this to the database&lt;/em&gt;).&lt;/p&gt;

&lt;p&gt;Check out our &lt;strong&gt;&lt;a href="https://academy.subquery.network/build/mapping/ethereum.html"&gt;Mappings&lt;/a&gt;&lt;/strong&gt; documentation to get more information on mapping functions.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Build Your Project&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Next, build your work to run your new SubQuery project. Run the build command from the project's root directory as given here:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;yarn build
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, you are ready to run your first SubQuery project. Let’s check out the process of running your project in detail.&lt;/p&gt;

&lt;p&gt;Whenever you create a new SubQuery Project, first, you must run it locally on your computer and test it and using Docker is the easiest and quickest way to do this.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Run Your Project Locally with Docker&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;docker-compose.yml&lt;/code&gt; file defines all the configurations that control how a SubQuery node runs. For a new project, which you have just initialised, you won't need to change anything.&lt;/p&gt;

&lt;p&gt;However, visit the &lt;strong&gt;&lt;a href="https://academy.subquery.network/run_publish/run.html"&gt;Running SubQuery Locally&lt;/a&gt;&lt;/strong&gt; to get more information on the file and the settings.&lt;/p&gt;

&lt;p&gt;Run the following command under the project directory:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;yarn start:docker
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  &lt;strong&gt;Query your Project&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Next, let's query our project. Follow these three simple steps to query your SubQuery project:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Open your browser and head to &lt;code&gt;http://localhost:3000&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;You will see a GraphQL playground in the browser and the schemas which are ready to query.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmbbbcss0zowgeoj2m7fa.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmbbbcss0zowgeoj2m7fa.png" alt="Image description" width="800" height="437"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Find the &lt;em&gt;Docs&lt;/em&gt; tab on the right side of the playground which should open a documentation drawer. This documentation is automatically generated and it helps you find what entities and methods you can query.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Try the following queries to understand how it works for your new SubQuery starter project. Don’t forget to learn more about the &lt;strong&gt;&lt;a href="https://academy.subquery.network/run_publish/query/graphql.html"&gt;GraphQL Query language&lt;/a&gt;&lt;/strong&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight graphql"&gt;&lt;code&gt;&lt;span class="c"&gt;# Write your query or mutation here&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="n"&gt;query&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="n"&gt;transactions&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;first&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;orderBy&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;BLOCK_HEIGHT_ASC&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="n"&gt;totalCount&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="n"&gt;nodes&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="n"&gt;txHash&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="n"&gt;blockHeight&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="n"&gt;to&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="n"&gt;from&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="n"&gt;contractAddress&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Congratulations! You have now a locally running SubQuery project that accepts GraphQL API requests for transferring data.&lt;/p&gt;

&lt;h1&gt;
  
  
  The TL;DR
&lt;/h1&gt;

&lt;p&gt;With SubQuery, you can easily access and manipulate blockchain data, as they address the critical need for efficient, scalable, and flexible data indexing and querying solutions. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://subquery.network/home"&gt;Having said all that, now is a good time to visit SubQuery and start building!&lt;/a&gt;&lt;/p&gt;

</description>
      <category>subquery</category>
      <category>web3</category>
    </item>
  </channel>
</rss>
