<?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>Forem: cptMoh</title>
    <description>The latest articles on Forem by cptMoh (@mufasasa).</description>
    <link>https://forem.com/mufasasa</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%2F823688%2F29039c7a-0f7f-43f9-bf6f-922131374a85.png</url>
      <title>Forem: cptMoh</title>
      <link>https://forem.com/mufasasa</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/mufasasa"/>
    <language>en</language>
    <item>
      <title>Redeploying a Suspended Subgraph</title>
      <dc:creator>cptMoh</dc:creator>
      <pubDate>Sat, 31 Dec 2022 09:29:06 +0000</pubDate>
      <link>https://forem.com/mufasasa/redeploying-a-suspended-subgraph-2lem</link>
      <guid>https://forem.com/mufasasa/redeploying-a-suspended-subgraph-2lem</guid>
      <description>&lt;p&gt;So, it's the end of the year and I was going through all my projects for the year when I came across some of the first subgraphs that I created and are no longer active, and I thought, why don't I try and see if i can reactivate them, and share the process with you while i'm at it?&lt;/p&gt;

&lt;p&gt;First of all, I think it's important that i first of all point out that the reason we're redeploying the subgraph is because The graph protocol suspends subgraphs that have not been active over a long period of time. Active here means queries being made to the subgraph. So, it suspends any subgraphs that haven't being receiving queries to save resources.&lt;/p&gt;

&lt;p&gt;How do we get our subgraphs back up, you might ask? Well, i'm curious too, so I'm going to do just that. You can follow along as well if you want to find out how.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You need to install The Graph CLI globally using NPM or Yarn so that you can build and deploy your subgraphs. That is if you don't already have it installed. You can run the following command:
&lt;code&gt;npm install -g @graphprotocol/graph-cli&lt;/code&gt; &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;or &lt;code&gt;yarn global add @graphprotocol/graph-cli&lt;/code&gt; If you are using Yarn instead.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;I'm assuming you still have the folder and files from when you initially deployed the subgraph. And if you do not, then you can pull it from the GitHub repository that you pushed your code. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;cd into the directory that you have your subgraph code, and run the following command:&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;graph auth --product hosted-service &amp;lt;access token&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can get the subgraph access token from you subgraph's dashboard. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;After you run the above command, you are going to get a response like this:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Deploy key set for https://api.thegraph.com/deploy/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Then go on and run the following command for the actual deployment:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;graph deploy --product hosted-service &amp;lt;username&amp;gt;/&amp;lt;subgraph name&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In my case, my github username that I created the subgraph with is mufasasa and my subgraph name is 'raffle'. So, i'm going to run this command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;graph deploy --product hosted-service mufasasa/raffle
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After I ran the command, Here'e what I got on my terminal:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;apple@mohammeds-MacBook-Air raffle % graph deploy --product hosted-service mufasasa/raffle
  Skip migration: Bump mapping apiVersion from 0.0.1 to 0.0.2
  Skip migration: Bump mapping apiVersion from 0.0.2 to 0.0.3
  Skip migration: Bump mapping apiVersion from 0.0.3 to 0.0.4
  Skip migration: Bump mapping apiVersion from 0.0.4 to 0.0.5
  Skip migration: Bump mapping apiVersion from 0.0.5 to 0.0.6
  Skip migration: Bump manifest specVersion from 0.0.1 to 0.0.2
  Skip migration: Bump manifest specVersion from 0.0.2 to 0.0.4
✔ Apply migrations
✔ Load subgraph from subgraph.yaml
  Compile data source: Contract =&amp;gt; build/Contract/Contract.wasm
✔ Compile subgraph
  Copy schema file build/schema.graphql
  Write subgraph file build/Contract/abis/Contract.json
  Write subgraph manifest build/subgraph.yaml
✔ Write compiled subgraph to build/
  Add file to IPFS build/schema.graphql
                .. QmbNuvtUUdbFB8rsqz1VtoSx53rXbG8wdgDQH6rN1pdsEs
  Add file to IPFS build/Contract/abis/Contract.json
                .. QmTBd3PKuZxHfyNSjKwsF6Srz3EdRTCz1M8fphmkuGyqBw
  Add file to IPFS build/Contract/Contract.wasm
                .. QmVAhCEFiXNG6LNVmTcz4HtfZ1WoJoTXDMmFM2uLUNz2P1
✔ Upload subgraph to IPFS

Build completed: QmT4KpqDiUmvNUyofvGJSojpnucEUHfBHiYFJWWYknhyCa

Deployed to https://thegraph.com/explorer/subgraph/mufasasa/raffle

Subgraph endpoints:
Queries (HTTP):     https://api.thegraph.com/subgraphs/name/mufasasa/raffle
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And with that, my subgraph is back online and we can continue making queries to it!!&lt;/p&gt;

&lt;p&gt;Thanks for coming along this far with me, enjoy the holidays, and cheers to a wonderful and fulfilling 2023 &lt;/p&gt;

</description>
      <category>discuss</category>
      <category>ai</category>
      <category>datascience</category>
      <category>community</category>
    </item>
    <item>
      <title>A faster way of creating subgraphs</title>
      <dc:creator>cptMoh</dc:creator>
      <pubDate>Sun, 11 Dec 2022 15:07:55 +0000</pubDate>
      <link>https://forem.com/mufasasa/a-faster-way-of-creating-subgraphs-1a6k</link>
      <guid>https://forem.com/mufasasa/a-faster-way-of-creating-subgraphs-1a6k</guid>
      <description>&lt;p&gt;This is a follow-up post to my guide on &lt;a href="https://dev.to/mufasasa/creating-an-erc721nft-subgraph-3fah"&gt;Creating ERC721 Subgraphs&lt;/a&gt;. I suggest that you read that first in order to fully appreciate this faster/easier way. Also, you'd gain more in-depth knowledge on creating subgraphs if you read that first.&lt;/p&gt;

&lt;h3&gt;
  
  
  Getting Started
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;For this guide, we are going to be using the hosted service. Head over there by clicking on &lt;a href="https://thegraph.com/hosted-service/dashboard"&gt;this link&lt;/a&gt; and either create an account or login to your dashboard.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Once on your dashboard, click on the 'Add Subgraph' Button. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Fill in the required fields on the form. Make sure the name that you give to the subgraph is the same as the name you will give to your github repository for the subgraph. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Submit the form.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Next, You can click on the button to 'show commands' of how to install the graph CLI globally using either NPM or Yarn if you don't already have it installed. This is because you will need it to build and deploy subgraphs.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Initialising the Subgraph.
&lt;/h2&gt;

&lt;p&gt;The Next step is to initialise the subgraph from your terminal. But before this, you need to cd into the directory/folder that you want to write your code in. &lt;/p&gt;

&lt;p&gt;While in the directory, this is the command to run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;graph init --index-events --from-contract {Contract-address} --network {network-name} {subgraph-name}

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

&lt;/div&gt;



&lt;p&gt;Make sure you replace the 'contract-address' with the address of the contract that you want to index, the 'network-name' with the name of the network, and the 'subgraph-name' with the name of the subgraph that you want to create.&lt;/p&gt;

&lt;p&gt;For instance, if we want to create a subgraph named 'raffle' that indexes the events from a contract on the arbitrum-one network, we run the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;graph init --index-events --from-contract 0xf53d383525117d1f51bf234966e39bd1508a5948 --network arbitrum-one raffle

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;When you open the subgraph.yaml file, you'll notice that that all the events on the contract have been automatically indexed!
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;specVersion: 0.0.4
schema:
  file: ./schema.graphql
dataSources:
  - kind: ethereum
    name: Contract
    network: arbitrum-one
    source:
      address: "0xf53d383525117d1f51bf234966e39bd1508a5948"
      abi: Contract
      startBlock: 16977962
    mapping:
      kind: ethereum/events
      apiVersion: 0.0.5
      language: wasm/assemblyscript
      entities:
        - NewAuctionWinner
        - NewBid
        - NewGoldenTicketWinner
        - NewRaffleWinner
        - OwnershipTransferred
      abis:
        - name: Contract
          file: ./abis/Contract.json
      eventHandlers:
        - event: NewAuctionWinner(uint256)
          handler: handleNewAuctionWinner
        - event: NewBid(address,uint256,uint256)
          handler: handleNewBid
        - event: NewGoldenTicketWinner(uint256)
          handler: handleNewGoldenTicketWinner
        - event: NewRaffleWinner(uint256)
          handler: handleNewRaffleWinner
        - event: OwnershipTransferred(indexed address,indexed address)
          handler: handleOwnershipTransferred
      file: ./src/contract.ts
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;The schema.graphql file has also been automatically generated for you with all the contract events schema automatically generated!
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;type NewAuctionWinner @entity {
  id: ID!
  bidderID: BigInt! # uint256
  block: BigInt! # uint256
  timestamp: BigInt! # uint256
}

type NewBid @entity {
  id: ID!
  bidder: Bytes! # address
  bidderID: BigInt! # uint256
  bidAmount: BigInt! # uint256
  block: BigInt! # uint256
  timestamp: BigInt! # uint256
}

type NewGoldenTicketWinner @entity {
  id: ID!
  bidderID: BigInt! # uint256
  block: BigInt! # uint256
  timestamp: BigInt! # uint256
}

type NewRaffleWinner @entity {
  id: ID!
  bidderID: BigInt! # uint256
  block: BigInt! # uint256
  timestamp: BigInt! # uint256
}

type OwnershipTransferred @entity {
  id: ID!
  previousOwner: Bytes! # address
  newOwner: Bytes! # address
  block: BigInt! # uint256
  timestamp: BigInt! # uint256
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Now when we head over to the 'src/' directory, and open up the 'contract.ts' file, you'll also notice that all the mapping functions have already been generated! This is so easy, haha! &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So, since all the heavy lifting has already been done for us, we can just go on and deploy our subgraph. You don't have to even change anything on the code as literally all the work has been done. &lt;/p&gt;

&lt;p&gt;To deploy, run &lt;code&gt;graph auth&lt;/code&gt; on your terminal&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Choose the hosted service &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It will ask you to enter the deploy key. Head to your dashboard, copy your access token, and then paste it. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Finally, run &lt;code&gt;npm run deploy&lt;/code&gt; &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Wait for it to compile your subgraph and deploy it. &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you head to your dashboard, you will see that your Subgraph is deployed and syncing. &lt;/p&gt;

&lt;p&gt;Congratulations!!!&lt;/p&gt;

&lt;p&gt;for more information about building subgraphs and the graph protocol in general, go to &lt;a href="https://thegraph.academy/"&gt;the graph academy&lt;/a&gt;&lt;/p&gt;

</description>
      <category>graphprotocol</category>
      <category>subgraphs</category>
      <category>graphadvocates</category>
    </item>
    <item>
      <title>Creating an ERC721(NFT) Subgraph</title>
      <dc:creator>cptMoh</dc:creator>
      <pubDate>Sat, 16 Jul 2022 17:08:00 +0000</pubDate>
      <link>https://forem.com/mufasasa/creating-an-erc721nft-subgraph-3fah</link>
      <guid>https://forem.com/mufasasa/creating-an-erc721nft-subgraph-3fah</guid>
      <description>&lt;h2&gt;
  
  
  Introducing The Graph
&lt;/h2&gt;

&lt;p&gt;The Graph is the indexing and querying protocol for web3. It is a key piece of infrastructure in the decentralised web3 stack. With The Graph and open APIs called "subgraphs", developers can build applications and create and publish subgraphs that query data from blockchains.&lt;/p&gt;

&lt;p&gt;For example, developers commonly create applications that display data to the application's end users - such as trades, NFTs and DAOs. Using The Graph, developers can create applications that quickly and easily display data retrieved from blockchains. Subgraphs make it easier for developers to build on top of blockchains and enabling UIs to be highly performant with rich and dynamic data.&lt;/p&gt;

&lt;p&gt;Subgraphs index data that is defined by the developers that create it, based on what information they'd like to present in their UIs. A network of Indexers (node operators) index the subgraphs and process queries for dapps, ensuring dapps don't rely on single centralised servers.&lt;/p&gt;

&lt;h2&gt;
  
  
  Subgraphs
&lt;/h2&gt;

&lt;p&gt;Subgraphs are open APIs that are created and published by developers. In essence, a subgraph defines how to ingest, index, and serve data, and they are used by developers to build dapps.&lt;/p&gt;

&lt;p&gt;Subgraphs allow developers to more easily query complex blockchain data. Developers use subgraphs to feed data to the front-end interface of their applications, such as displaying financial data or NFT marketplace information to their users.&lt;/p&gt;

&lt;p&gt;Without The Graph, dapp developers would have to run their own centralised back-end infrastructure to query blockchain data. Furthermore, the time saved by using subgraphs enables developers to focus on building high-quality applications and front-end interfaces. Subgraphs make it easier to build on web3 protocols, reduce the need for centralised databases, and eliminate specialised engineering resources and hardware.&lt;/p&gt;

&lt;h2&gt;
  
  
  Building a Subgraph
&lt;/h2&gt;

&lt;p&gt;In this guide, we are going to look at what building a subgraph looks like by building one that indexes an ERC721 NFT Token. &lt;/p&gt;

&lt;h3&gt;
  
  
  First Steps
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;For this guide, we are going to be using the hosted service. Head over there by clicking on &lt;a href="https://thegraph.com/hosted-service/dashboard"&gt;this link&lt;/a&gt; and either create an account or login to your dashboard.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Once on your dashboard, click on the 'Add Subgraph' Button. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Fill in the required fields on the form. Make sure the name that you give to the subgraph is the same as the name you will give to your github repository for the subgraph. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Submit the form.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Next, You can click on the button to 'show commands' of how to install the graph CLI globally using either NPM or Yarn if you don't already have it installed. This is because you will need it to build and deploy subgraphs.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Initialising the Subgraph.
&lt;/h2&gt;

&lt;p&gt;The Next step is to initialise the subgraph from your terminal. But before this, you need to cd into the directory/folder that you want to write your code in. &lt;/p&gt;

&lt;p&gt;Once you're there, go on and run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;graph init subgraph-name
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Be sure to replace 'subgraph-name' with the name of the subgraph you are building. For example, since we're going to be making a bored apes subgraph, i'm going to run;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;graph init boredapes
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next, you'll be prompted to choose a protocol on the terminal. For this, we can go on and choose &lt;strong&gt;ethereum&lt;/strong&gt; &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Choose the hosted service. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Next, you will be prompted to choose the name of your subgraph. It should be ‘your-github-account/your-subgraph-name’. for example, my github account is 'mufasasa', and the name of the subgraph we're making is 'boredapes'. Therefore, i'm going to put in 'mufasasa/boredapes'. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You'll then be asked to choose the directory that you want the subgraph to be created in. you can leave it as the current directory that you are working on, so just hit the 'enter' key. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You'll be prompted to choose from the available networks. Choose mainnet. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Provide the contract address of the smart contract that you want to index. The smart contract address can be gotten from &lt;a href="https://etherscan.io"&gt;etherscan&lt;/a&gt;. We are indexing the bored apes smart contract, so you can copy and past in the address &lt;code&gt;0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You can leave the default contract name; Contract. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A new folder will be created for you with the name that you specified. Go on an cd into the folder, then open it up in your code editor. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Next, open the subgraph.yaml file and make the following edits;&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;specVersion: 0.0.4
schema:
  file: ./schema.graphql
dataSources:
  - kind: ethereum
    name: undefined
    network: mainnet
    source:
      address: "0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D"
      abi: Contract
      startBlock: "12287507"
    mapping:
      kind: ethereum/events
      apiVersion: 0.0.5
      language: wasm/assemblyscript
      entities:
        - Approval
        - Transfer
      abis:
        - name: Contract
          file: ./abis/Contract.json
      eventHandlers:
        - event: Approval(indexed address,indexed address,indexed uint256)
          handler: handleApproval
        - event: Transfer(indexed address,indexed address,indexed uint256)
          handler: handleTransfer
      file: ./src/contract.ts
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I added the StartBlock under the 'source subsection'. This is the Transaction Block of when the contract was deployed, and can be gotten from etherscan. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;I also deleted 'approval for all' in the entities and event handlers subsection.
&lt;strong&gt;Note&lt;/strong&gt; Whenever you want to index a smart contract, be sure to check the contract code and see what event(s) the contract is emitting, and then proceed accordingly. &lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Defining our Schema.
&lt;/h2&gt;

&lt;p&gt;we are now going to proceed to the schema.graphql file to define our schemas. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;The very first thing that we'll do here is delete the example schema that we were given there. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Next, we'll define the schema of our entities in this file. A prior knowledge of graphql will come in handy here. But even if you don't know graphql, then that's okay too. You can just paste the following inside your &lt;strong&gt;schema.graphql&lt;/strong&gt; file.&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;type TransferEvent @entity{

id: ID! 

" Id of the transferred token "
tokenId: BigInt!

"address of the sender "
sender: Bytes!

"address of the receiver "
destination: Bytes!

"event timestamp"
timestamp: BigInt!

"transaction hash"
transaction: Bytes!

}


type ApprovalEvent @entity{

id: ID!

" Id of the approved token "
tokenId: BigInt!

"address of the owner"
owner: Bytes!

"address of the approved"
approved: Bytes!

"event timestamp"
timestamp: BigInt!

"transaction hash"
transaction: Bytes!

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

&lt;/div&gt;



&lt;p&gt;What we're trying to do is defining the format that our entities are going to take. Kind of like defining our data models. I'll breakdown the models below so that we can have an idea of what is going on.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;type TransferEvent @entity{

id: ID! 

" Id of the transferred token "
tokenId: BigInt!

"address of the sender "
sender: Bytes!

"address of the receiver "
destination: Bytes!

"event timestamp"
timestamp: BigInt!

"transaction hash"
transaction: Bytes!

}

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

&lt;/div&gt;



&lt;p&gt;At the very beginning we are declaring the 'TransferEvent' type, and we're saying it is an entity.The fields that we want inside the transfer event are then specified inside the curly brackets.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;The first field there is the 'id' field. We then put a colon and 'ID' after it, meaning it is of type 'ID'. the exclamation mark means the field is required.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The second field is 'tokenId' which is of type 'BigInt' and is going to be holding the id of the NFT. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The third field, 'sender' is of type 'Bytes', and is also required. We are using the 'Bytes' type because we are going to be storing the wallet address of the sender in the field.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The fourth field is just like the third field, but storing the address of the receiver of the NFT. The fifth field stores the event time stamp and the sixth field stores the transaction hash.&lt;/p&gt;

&lt;p&gt;Once you are done with the schema.graphql file, head on over to the 'src' directory, and open the 'contract.ts' file. This is where we are going to define our mappings. What we are going to be doing here is directing how an emitted event from the dapp is going to be mapped and saved in our database. &lt;/p&gt;

&lt;p&gt;You can delete the automatically generated code there and paste the following code into the file;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { Transfer, Approval } from "../generated/undefined/Contract";
import { TransferEvent, ApprovalEvent } from "../generated/schema";


export function handleTransfer(event:Transfer): void {
    let transferEvent = new TransferEvent(event.transaction.hash.toHex()+"-"+event.logIndex.toString());

    transferEvent.tokenId = event.params.tokenId;

    transferEvent.sender = event.params.from;

    transferEvent.destination = event.params.to;

    transferEvent.timestamp = event.block.timestamp;

    transferEvent.transaction = event.transaction.hash;
    transferEvent.save();
}


export function handleApproval(event:Approval): void {
    let approvalEvent = new ApprovalEvent(event.transaction.hash.toHex()+"-"+event.logIndex.toString());

    approvalEvent.tokenId = event.params.tokenId;

    approvalEvent.owner = event.params.owner;

    approvalEvent.approved = event.params.approved;

    approvalEvent.timestamp = event.block.timestamp;

    approvalEvent.transaction = event.transaction.hash;
    approvalEvent.save();
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The two functions are going to be called whenever either a transfer or an approval event is emitted from the dapp. &lt;/p&gt;

&lt;p&gt;Our subgraph is now ready to be deployed!!&lt;/p&gt;

&lt;p&gt;To deploy, run &lt;code&gt;graph auth&lt;/code&gt; on your terminal&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Choose the hosted service &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It will ask you to enter the deploy key. Head to your dashboard, copy your access token, and then paste it. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Finally, run &lt;code&gt;npm run deploy&lt;/code&gt; &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Wait for it to compile your subgraph and deploy it. &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you head to your dashboard, you will see that your Subgraph is deployed and syncing. &lt;/p&gt;

&lt;p&gt;Congratulations!!!&lt;/p&gt;

&lt;p&gt;for more information about building subgraphs and the graph protocol in general, go to &lt;a href="https://thegraph.academy/"&gt;the graph academy&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Deploying a Smart Contract With Hardhat and Alchemy on an Ethereum Network</title>
      <dc:creator>cptMoh</dc:creator>
      <pubDate>Fri, 25 Mar 2022 13:42:49 +0000</pubDate>
      <link>https://forem.com/mufasasa/deploying-a-smart-contract-with-hardhat-and-alchemy-on-an-ethereum-network-27bd</link>
      <guid>https://forem.com/mufasasa/deploying-a-smart-contract-with-hardhat-and-alchemy-on-an-ethereum-network-27bd</guid>
      <description>&lt;p&gt;So, you've written your smart contract and maybe even played around with it a little on remix. But now you want to share it with all your friends and possibly even the world so that they can marvel at the wonder you've just created. &lt;/p&gt;

&lt;p&gt;I personally write my contracts on &lt;a href="https://remix.ethereum.org/" rel="noopener noreferrer"&gt;Remix IDM&lt;/a&gt;, compile it, deploy on the javascript machine, play around with it a little, and test out the functions. &lt;/p&gt;

&lt;p&gt;But Remix could be unreliable sometimes and you might want a more elaborate way of writing your contracts, including test and deployment scripts. For that, I personally like to use Hardhat and Alchemy. They are very easy to setup and use, but could be a little bit of a hassle if you have not used them before.&lt;/p&gt;

&lt;p&gt;Because of that, i'll be sharing the documented steps that I have been using to get my dApps out there through Hardhat and Alchemy.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Alchemy&lt;/strong&gt; Helps us broadcast our transaction on the blockchain when we deploy our contract. So, it is kind of like telling all the other nodes "hey everyone! A new contract has just been deployed and it's over here!!" &lt;/p&gt;

&lt;p&gt;To get started with Alchemy, just head on over to their &lt;a href="https://dashboard.alchemyapi.io/" rel="noopener noreferrer"&gt;website&lt;/a&gt; and create an account with them. &lt;/p&gt;

&lt;p&gt;After you have done that and have gotten logged in to your dashboard, click on &lt;strong&gt;Create App&lt;/strong&gt; button. It's near the top to your right. &lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz1kqj7rbajtc4hxmwiwb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz1kqj7rbajtc4hxmwiwb.png" alt="Alchemy dashboard"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A pop up will come up and you can go ahead and enter the name of the app you want to create, and add some description of the application. This is for you, by the way. To help you remember what the application is about.  &lt;/p&gt;

&lt;p&gt;For the environment, I usually leave it as development. You can select the chain you'd be working on. I've personally worked with ethereum and polygon. The last dropdown is the network selection. You can either choose the main net of your network(where real money is paid and used, by the way) or choose from a test net(where it's free and fake money is used). &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwmr01ljwjuwigfqivo1n.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwmr01ljwjuwigfqivo1n.png" alt="choosing your environment on alchemy"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;Next, copy the Key to your app and save it somewhere, we're going to need it later. You want to copy the HTTP option for this. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuzqc8et8jbhlwowldkav.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuzqc8et8jbhlwowldkav.png" alt="Alchemy API keys"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now that we're done with Alchemy, open up your terminal and create a new directory with your project name, then cd into the directory. &lt;/p&gt;

&lt;p&gt;In your project directory, run the following command;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm init &lt;span class="nt"&gt;-y&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You'll need npm installed for that to work, by the way. You can learn about installing npm &lt;a href="https://docs.npmjs.com/downloading-and-installing-node-js-and-npm/" rel="noopener noreferrer"&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Then run&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;--save-dev&lt;/span&gt; @nomiclabs/hardhat-waffle ethereum-waffle chai @nomiclabs/hardhat-ethers ethers
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To make sure that everything is running just fine, go ahead and run&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx hardhat compile
npx hardhat &lt;span class="nb"&gt;test&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It should show you that your test has passed &lt;/p&gt;

&lt;p&gt;When you check the contracts, test, and scripts folder you'd find some test files already there. You can go on and delete those. But don't delete the whole folders please, just the files inside of them.&lt;/p&gt;

&lt;p&gt;Create a new file in your contracts folder and name it with the name of the contract you want to create. This is where you will write your contract code in solidity. So, you can just go ahead and do that. Alternatively, you could also copy your code from somewhere and paste it here. I usually first try out my contract code in Remix before transferring it here.&lt;/p&gt;

&lt;p&gt;When you are done writing your contract, the next thing you'll have to do is write a 'deploy' script in your scripts folder. You can name the file 'deploy.js' This is what we are going to use to deploy your contract and get it on the blockchain for the world to see 🏄‍♂️ &lt;/p&gt;

&lt;p&gt;Here's an example of a simple contract script i've written&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5k9lpym1mppv12rrd4kk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5k9lpym1mppv12rrd4kk.png" alt="smart contract file"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And the deployment script here 👇&lt;/p&gt;

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

&lt;p&gt;The last thing you'd need to do before deploying your contract is going to your 'hardhat.config.js' file and change it to this&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;@nomiclabs/hardhat-waffle&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="nx"&gt;module&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;exports&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;solidity&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;0.8.0&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;networks&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;rinkeby&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;url&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;YOUR_ALCHEMY_API_URL&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;accounts&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;YOUR_PRIVATE_ACCOUNT_KEY&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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Edit the file and add your alchemy url for the app. Also you'll need to add your private account key. &lt;/p&gt;

&lt;p&gt;Finally, deploy your application to the blockchain by running this on your terminal 👇&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx hardhat run scripts/deploy.js &lt;span class="nt"&gt;--network&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;your blockchain network&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Note: you need to replace "{your blockchain network}" with the actual name of your network. So, if i'm deploying to rinkeby for example, it will look like this.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx hardhat run scripts/deploy.js &lt;span class="nt"&gt;--network&lt;/span&gt; rinkeby
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's it!!! you've successfully deployed your app 🎉 🎉 🎊&lt;/p&gt;

</description>
      <category>hardhat</category>
      <category>solidity</category>
      <category>web3</category>
      <category>alchemy</category>
    </item>
    <item>
      <title>FastAPI Deployment on Deta</title>
      <dc:creator>cptMoh</dc:creator>
      <pubDate>Sat, 05 Mar 2022 23:31:21 +0000</pubDate>
      <link>https://forem.com/mufasasa/fastapi-deployment-on-deta-25kd</link>
      <guid>https://forem.com/mufasasa/fastapi-deployment-on-deta-25kd</guid>
      <description>&lt;p&gt;We started using &lt;strong&gt;FastAPI&lt;/strong&gt;, the Python web framework that's fast gaining popularity recently in our organisation. Which, by the way, I recommend to everyone building APIs with python because of how fast and easy it is to setup and get going. Fast API also boasts of speeds that are on par with NodeJs and GoLang because of its async nature.&lt;/p&gt;

&lt;p&gt;Anyways, this led me to researching different ways of deploying FastAPI to a staging server for testing purposes before moving to production. Along the way, I bumped into Deta, a rather new and interesting platform as a service(PAAS), just like Heroku(which i have used a few times).&lt;/p&gt;

&lt;p&gt;What's even more interesting about Deta is the fact that I found it on FastAPIs' website. Well, that has to count for something, right? I mean, if FastAPI, which is this mean beast of a python web framework is pushing for Deta, then it too must be just as good, right? Well, dig in and follow me as we go through my journey of discovery.&lt;/p&gt;

&lt;p&gt;First of all, like i've told you before, FastAPI is really super fast to setup and get your api running in a few minutes, so, it makes sense that it will push for a platform that is just as easy and fast to make your deployments, yeah...? You got that right!&lt;/p&gt;

&lt;p&gt;Deta deployments are insanely easy and quick with FastAPI. you can get your app up and running on their micros in under five minutes! I mean if that's not impressive, then I don't know what is. just a few clicks here and there and voila. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Before you do anything else, you need to create a free account with &lt;a href="https://www.deta.sh/"&gt;Deta&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Done that? good. the very next thing you need to do is to download the Deta CLI.&lt;br&gt;
You can do that like this on a MAC/Linus OS:&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl &lt;span class="nt"&gt;-fsSL&lt;/span&gt; https://get.deta.dev/cli.sh | sh 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;br&gt;
Or like this on Windows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;iwr https://get.deta.dev/cli.ps1 &lt;span class="nt"&gt;-useb&lt;/span&gt; | iex
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Easy-peasy. now you need to login to your through your cli
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;deta login
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Now, before this next step, you need to make your your 'app' is defined in a 'main.py' file on the directory you are working from. You also need to make sure your 'requirements.txt' file is located in that same directory. If you have all of that set, then go ahead and do this:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;deta new
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It should take about a minute, and then you'll get a response that should look like this.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;deta new

Successfully created a new micro

💬 Notice the &lt;span class="s2"&gt;"endpoint"&lt;/span&gt; 🔍

&lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="s2"&gt;"name"&lt;/span&gt;: &lt;span class="s2"&gt;"fastapideta"&lt;/span&gt;,
    &lt;span class="s2"&gt;"runtime"&lt;/span&gt;: &lt;span class="s2"&gt;"python3.7"&lt;/span&gt;,
    &lt;span class="s2"&gt;"endpoint"&lt;/span&gt;: &lt;span class="s2"&gt;"https://qltnci.deta.dev"&lt;/span&gt;,
    &lt;span class="s2"&gt;"visor"&lt;/span&gt;: &lt;span class="s2"&gt;"enabled"&lt;/span&gt;,
    &lt;span class="s2"&gt;"http_auth"&lt;/span&gt;: &lt;span class="s2"&gt;"enabled"&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

Adding dependencies...


████████████████████████████████████████ 100%


Successfully installed fastapi-0.61.1 pydantic-1.7.2 starlette-0.13.6

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

&lt;/div&gt;



&lt;p&gt;That's it, super easy and fast. you can access your app when you go to that endpoint. &lt;/p&gt;

&lt;p&gt;I know what you must be thinking, lol. If deploying your fastAPI app on Deta was so easy, fast, and free, then why isn't everyone doing it, right? &lt;/p&gt;

&lt;p&gt;Not so fast, smarty pants. The reason why so many people are not doing it is because there's a catch, or a few catches, actually. &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;With the exception of mysqlite3 and their native Deta Base, Deta micros don't work well with any other database. so hard luck if you're like me and you like using MongoDB because Deta totally does not support it. At least for now. &lt;br&gt;
I suspect if you're testing your app on a staging server then you'd want to test your app as it would function on production right? well if it's not too much of a hassle switching between databases then it's not really a big deal. &lt;br&gt;
Deta Base is really easy to set up and get going as well. i guess this is starting to become a trend for anything linked with FastAPI &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;For some reason, background tasks also don't work well on Deta. so good luck trying to test out your email sending functionality as a background task, lol. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Deta only supports micro web frameworks(think FastAPI and Flask) and no Django or any other big web framework. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Web sockets also do not work well on Deta. &lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If all of these are not an issue, then you should really check out Deta for deploying your FastAPI applications. They're meant to go hand in hand. And we hope Deta gets even better in the future. we'd love to see support for more Relational and non relational databases. &lt;/p&gt;

&lt;p&gt;PS. I'd really love to hear about your thoughts on deta and FastAPI. Do you know of other ways of deployment you'd care to share? please leave a comment below. &lt;/p&gt;

</description>
      <category>python</category>
      <category>deta</category>
      <category>fastapi</category>
    </item>
    <item>
      <title>Coming to Web3 from Web2</title>
      <dc:creator>cptMoh</dc:creator>
      <pubDate>Wed, 02 Mar 2022 05:53:00 +0000</pubDate>
      <link>https://forem.com/mufasasa/coming-to-web3-from-web2-1hma</link>
      <guid>https://forem.com/mufasasa/coming-to-web3-from-web2-1hma</guid>
      <description>&lt;p&gt;As a backend developer that's curious about &lt;strong&gt;web3&lt;/strong&gt;, I have, so far learnt that the two webs differ in the following very basic and simple ways.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In the very ancient world of web2 that we're coming from, where we still use usernames and passwords to authenticate, We store all data, including user data, pertaining to an application centrally(in one place), usually controlled by a single entity.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is not the case in the very progressive and futuristic world of web3 that you are about to enter. in our bright new world, data is stored on the blockchain, this means it's not stored at just a single place, yeah, i know what your'e thinking, &lt;strong&gt;Database?!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;well, it's pretty easy to explain my friend,  there's no single database. it's all distributed across different nodes on the blockchain. Think of it this way, if you were to write your name on a single piece of paper and keep it inside a locker at home, then you know exactly where your paper is, and if someone where to break your locker and take it away, then it's gone. That's basically how it works in web2.&lt;/p&gt;

&lt;p&gt;Now, imagine if you wrote your name on a piece of paper, and then thousands of little copies of that paper are made and distributed and registered across the world. Now, your paper is everywhere. No one can steal it and deny your the pleasure of reading your name on your paper, because you can just easily get it from another source that registered it. No one person or entity controls or can take it down. This means there is no single point of failure. &lt;br&gt;
And that, my very dear old friend, is how web3 works!&lt;/p&gt;

&lt;p&gt;In a summarised one sentence, Web3 is basically a database on a blockchain! &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Oh, yeah. authentication is also pretty simple, you just connect your wallet and it's done. No need to input any usernames and passwords. this means you get to keep your own data yourself and only present them where you want to. Imagine using the same credentials for every application or website that you want to visit and interact with. This is actually possible in web3, in fact, that's how it's done.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This isn't the case with web2 where you have to send in your details to every new app or platform that you want to register on.&lt;/p&gt;

&lt;p&gt;That's all folks.&lt;/p&gt;

&lt;p&gt;ps, I just enrolled in a cool new web3 internship organised by &lt;a href="https://blockgames.gg/"&gt;Blockgames&lt;/a&gt;, &lt;a href="https://nestcoin.com/"&gt;Nestcoin&lt;/a&gt;, and &lt;a href="https://zuri.team/"&gt;Zuriteam&lt;/a&gt; it's pretty fascinating so far. wagmi &lt;/p&gt;

</description>
      <category>web3</category>
      <category>blockgames</category>
      <category>blockchain</category>
      <category>firestarter</category>
    </item>
  </channel>
</rss>
