<?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: Romain @devvnomad</title>
    <description>The latest articles on DEV Community by Romain @devvnomad (@devvnomad).</description>
    <link>https://dev.to/devvnomad</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%2F809193%2F8bac3e67-1a4f-4ac3-ab3e-36b3b1971d45.png</url>
      <title>DEV Community: Romain @devvnomad</title>
      <link>https://dev.to/devvnomad</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/devvnomad"/>
    <language>en</language>
    <item>
      <title>How I made a Web3 app to reward my community with tokens</title>
      <dc:creator>Romain @devvnomad</dc:creator>
      <pubDate>Tue, 15 Feb 2022 07:20:53 +0000</pubDate>
      <link>https://dev.to/devvnomad/how-i-made-a-web3-app-to-reward-my-community-with-tokens-5ik</link>
      <guid>https://dev.to/devvnomad/how-i-made-a-web3-app-to-reward-my-community-with-tokens-5ik</guid>
      <description>&lt;p&gt;When I started my web3 journey I got a freelance contract: Add web3 features to an existing app and &lt;strong&gt;reward the users with our token&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The point of rewarding the community was:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;To motivate the community to &lt;strong&gt;do something&lt;/strong&gt; to earn a token.&lt;/li&gt;
&lt;li&gt;The brand wanted to have its own token to &lt;strong&gt;improve branding&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Rewarding the user with tokens is becoming more and more common these days.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Our users should &lt;strong&gt;get 5 tokens&lt;/strong&gt; when completing their profile (bio, curriculum, social media links, etc.).&lt;/p&gt;

&lt;p&gt;But we could imagine rewarding users for many other kinds of actions, such as: commenting on a post or sharing a post on social media.&lt;/p&gt;

&lt;h2&gt;
  
  
  Create a token  ⚒️
&lt;/h2&gt;

&lt;p&gt;The first major task was to create a token.&lt;/p&gt;

&lt;p&gt;After some research and discussions with other DEV, I decided to use an &lt;a href="https://ethereum.org/en/developers/docs/standards/tokens/erc-20/" rel="noopener noreferrer"&gt;ERC-20 token&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I made one million token supplies and decided to lock half of it using a &lt;a href="https://www.investopedia.com/terms/h/hashed-timelock-contract.asp" rel="noopener noreferrer"&gt;time lock contract&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Locking tokens is for purpose to give &lt;a href="https://www.certik.com/resources/blog/technology/Timelock" rel="noopener noreferrer"&gt;trust&lt;/a&gt; to your tokens to your users.&lt;/p&gt;

&lt;h2&gt;
  
  
  Get the wallet public ID of the user 🆔
&lt;/h2&gt;

&lt;p&gt;Then, I had to connect my front-end to Metamask API (or to &lt;a href="https://walletconnect.com/" rel="noopener noreferrer"&gt;wallet connect&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;The goal is to get the &lt;strong&gt;wallet public ID of my users&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;With this wallet public ID I will be able to &lt;strong&gt;transfer&lt;/strong&gt; to theses users my &lt;strong&gt;reward’s tokens&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;I also needed to add our token to their Metamask wallet. Which was something I could handle with the Metamask API.&lt;/p&gt;

&lt;p&gt;I then simply saved the wallet public ID on the user table. I will use this public ID later.&lt;/p&gt;

&lt;h2&gt;
  
  
  Reward the users when they complete their profile 👏
&lt;/h2&gt;

&lt;p&gt;When a user completes his profile on the app we need to send him 5 tokens.&lt;/p&gt;

&lt;p&gt;Firstly I made a &lt;strong&gt;« reward »&lt;/strong&gt; table on the back-end. I want to know whether that specific type of reward was already given to this user.&lt;/p&gt;

&lt;p&gt;Then on my back-end, I needed to make an endpoint that would trigger a &lt;strong&gt;function to make a token transaction&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;To make a transaction I used &lt;strong&gt;&lt;a href="https://docs.ethers.io/v5/" rel="noopener noreferrer"&gt;etherJs&lt;/a&gt;&lt;/strong&gt; on my NodeJs app. When the conditions are met, I &lt;strong&gt;make a new transaction from my wallet ID to the user walletID&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;I also pay the &lt;a href="https://www.investopedia.com/terms/g/gas-ethereum.asp" rel="noopener noreferrer"&gt;gas fee&lt;/a&gt; using my wallet automatically. My server &lt;strong&gt;can access my wallet using my wallet&lt;/strong&gt;’&lt;strong&gt;s private key.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;When a transaction is successful, the user will get a notification and the token will appear in his wallet.&lt;/p&gt;

&lt;h2&gt;
  
  
  Deploy our token to the Polygon network 🕸
&lt;/h2&gt;

&lt;p&gt;Using Ethereum network is expensive when it comes to pay gas fee. That’s one of the reasons we decided to go for &lt;a href="https://polygon.technology/" rel="noopener noreferrer"&gt;Polygon Matic&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Polygon is also a part of the blockchain network. However, the cost to operate is well cheaper than on Ethereum.&lt;/p&gt;

&lt;p&gt;On &lt;a href="http://localhost" rel="noopener noreferrer"&gt;localhost&lt;/a&gt; I was using a &lt;a href="https://academy.bit2me.com/en/what-is-testnet/" rel="noopener noreferrer"&gt;Testnet network&lt;/a&gt;. A fake network, that I set up with &lt;a href="https://hardhat.org/" rel="noopener noreferrer"&gt;HardhatJs&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I now needed to push my ERC-20 token to Polygon network.&lt;/p&gt;

&lt;p&gt;I used again HardhatJs in order to deal with this.&lt;/p&gt;

&lt;h2&gt;
  
  
  Security concerns 🔒
&lt;/h2&gt;

&lt;p&gt;When it comes to Web3 and Blockchain, I had to make sure that my setup was safe 😀&lt;/p&gt;

&lt;p&gt;By safe I mean:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;I don’t want bots to be able to make thousands of transactions.&lt;/li&gt;
&lt;li&gt;I don’t want people to use my wallet ;)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is what I did for this app:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;I stored the wallet private key on the environment global variables of my server.&lt;/li&gt;
&lt;li&gt;That wallet contains only a few Ethers. Enough to pay a few months of gas fee&lt;/li&gt;
&lt;li&gt;That wallet contains only 1% of the tokens we created.&lt;/li&gt;
&lt;li&gt;A user cannot get multiple reward tokens for the same type of reward. For example, the type of reward was « set-up-profile-reward ».&lt;/li&gt;
&lt;li&gt;Only logged users will get a reward.&lt;/li&gt;
&lt;li&gt;We verify that the user is the right one by signing the bearer token. We stored the signature of that bearer token on the server.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is how that process looks:&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%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1643955843672%2F_TiW5WCma.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%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1643955843672%2F_TiW5WCma.png" alt="Screen Shot 2022-02-04 at 2.23.45 PM.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  What’s Next?
&lt;/h3&gt;

&lt;p&gt;I’m planning in the future, to release Saas App using Web3 and to accept more freelance contract using that technology.&lt;/p&gt;

&lt;p&gt;👉 You can &lt;strong&gt;&lt;a href="https://twitter.com/devvnomad" rel="noopener noreferrer"&gt;follow me there&lt;/a&gt;&lt;/strong&gt; on Twitter, as I continue to document my journey.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>How I became a Web3 dev in just 7 days and got my first 8000$ Web3 contract</title>
      <dc:creator>Romain @devvnomad</dc:creator>
      <pubDate>Fri, 04 Feb 2022 08:32:54 +0000</pubDate>
      <link>https://dev.to/devvnomad/how-i-became-a-web3-dev-in-just-7-days-and-got-my-first-8000-web3-contract-1mmc</link>
      <guid>https://dev.to/devvnomad/how-i-became-a-web3-dev-in-just-7-days-and-got-my-first-8000-web3-contract-1mmc</guid>
      <description>&lt;p&gt;A few weeks ago I got a Web3 project. I have 6 years of full-stack development, and I was a CTO for half a year. &lt;/p&gt;

&lt;p&gt;However, I never had to deal with Blockchain or Web3 before&lt;/p&gt;

&lt;p&gt;But, I like being challenged! And I know to learn stuff when I need it.&lt;/p&gt;

&lt;p&gt;This is how I successfully learnt Web3 from scratch, and I delivered that contract.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;This is how you can also proceed and become a Web3 developer.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

&lt;h3&gt;
  
  
  Day 1-2 - Mass learning 📚
&lt;/h3&gt;

&lt;p&gt;During the 2 first days, I learnt &lt;code&gt;in mass&lt;/code&gt;. That period had for purpose to understand the basics of Web3 and Blockchain. &lt;/p&gt;

&lt;p&gt;First, I started to go on Youtube to watch videos about it. &lt;/p&gt;

&lt;p&gt;When I don’t get a new word or a concept I write it in my list. Then I will try to find new videos or articles about these terminologies.&lt;/p&gt;

&lt;p&gt;Example: Gas fee, Smart Contract, DAO, Dapp, DEX, ERC-20, non-fungible token, Gwei, ICO ...&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;I write new concepts in my list and I will  check them later&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Each video gives me an average of 5-8 new terms.&lt;/p&gt;

&lt;p&gt;Watching 5 videos will already give me a new list of 25 other concepts to understand later…&lt;/p&gt;

&lt;p&gt;I made a notion page, where I wrote everything I understood. I will never reread these notes. I write for the sake of memorization.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;I spent around 7 hours by day for 2 days to do just that. In the subway, office, or when walking (podcast).&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;My goal was simple: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;To submerge myself in this web3 world, to get lost.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I will most of the time not understand more than 60% of what I'm watching or reading. But that’s all fine at this point.&lt;/p&gt;

&lt;p&gt;That knowledge will come back later on in some way...&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The goal 🎯: to submerge myself into web3.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;After 2 days,&lt;/strong&gt; I feel like I have reached a &lt;em&gt;rabbit hole&lt;/em&gt;. I knew it would happen. Each concept brings a new concept. It’s endless...&lt;/p&gt;

&lt;p&gt;However, I know that I need to pass to the next phase at this point. I need to put into practice the few things I understood.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;🔨 The next step: to &lt;strong&gt;put in practice&lt;/strong&gt; all that knowledge  &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Here is a list of the resources I used during that period:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;📌 &lt;a href="https://www.youtube.com/c/WhiteboardCrypto"&gt;Whiteboard Crypto&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;📌 &lt;a href="https://www.youtube.com/channel/UCZM8XQjNOyG2ElPpEUtNasA"&gt;Eat the blocks&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;📌 &lt;a href="https://www.youtube.com/channel/UCQ7fLN3LWrePtqGLibU7KCA"&gt;Web3 Examples&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt; &lt;/p&gt;

&lt;h3&gt;
  
  
  Day 3 - To define the scope of the Web3 project I will work on
&lt;/h3&gt;

&lt;p&gt;I got a freelance project with some requirements: I checked the specs and tried to summarize them as much as I could with my current knowledge of Web3:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;👉 We need to make our own token.&lt;/li&gt;
&lt;li&gt;👉 When a user does something on the website (share an article, complete his profile), we send him our token.&lt;/li&gt;
&lt;li&gt;👉 The user needs to be able to add his wallet to our website.&lt;/li&gt;
&lt;li&gt;👉 We need to deploy that token on the Polygon Matic network.&lt;/li&gt;
&lt;li&gt;👉 When sending a token to the user, we need to automatically pay the gas fee.&lt;/li&gt;
&lt;li&gt;👉 For that, we need to allow our backend to pay that gas fee with our wallet.&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Scoping&lt;/strong&gt; the project allowed me to think more clearly about the next steps.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Then for each of these items I tried to understand which &lt;strong&gt;library and logic&lt;/strong&gt; I would have to implement.&lt;/p&gt;

&lt;p&gt;I spent 4-5 hours searching on Google and writing pseudo-code.&lt;/p&gt;

&lt;p&gt;Then I asked a senior blockchain DEV if my plan looked credible to him.&lt;/p&gt;

&lt;p&gt;I also asked him some points I was confused about. For example, what would be the best way to automatically &lt;strong&gt;pay the gas fee.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;That discussion was fruitful, but I knew I still had a lot to learn and understand!&lt;/p&gt;

&lt;p&gt;Now I needed To see &lt;strong&gt;how&lt;/strong&gt; other people are making Web3 app&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Next, let’s get my hand dirty, let’s practice and understand things by doing.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt; &lt;/p&gt;

&lt;h3&gt;
  
  
  Day 4-5-6: Make my hand dirty with other Github repositories. 🔨
&lt;/h3&gt;

&lt;p&gt;That’s when I started to look on GitHub for Web3 repositories having similar functionality to what I wanted to achieve.&lt;/p&gt;

&lt;p&gt;When I find a repository, I look at the code. I analyze it and try to make it work.&lt;/p&gt;

&lt;p&gt;I then take some piece of that code and try to make it work on a new project.&lt;/p&gt;

&lt;p&gt;By doing that, I start to understand more clearly the thing I watched on YouTube or read on some blog.&lt;/p&gt;

&lt;p&gt;This is when I have some moment of: « Oh yeah, this is why…! » 😀&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;By playing with Web3 repo, the &lt;strong&gt;&lt;em&gt;theory starts to make sense&lt;/em&gt;&lt;/strong&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Here is a list of the resources I used during that period:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;📌 &lt;a href="https://buildspace.so/"&gt;BuildSpace&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;📌 &lt;a href="https://www.youtube.com/channel/UCgWS9Q3P5AxCWyQLT2kQhBw"&gt;Moralis Web&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;📌 &lt;a href="https://www.youtube.com/channel/UC7mca3O0DmdSG2Cr80sOD7g"&gt;Nader Dabit&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;📌 &lt;a href="https://cryptodevhub.io/wiki/ethereum-virtual-machine-tutorials"&gt;CryptoDevHub&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt; &lt;/p&gt;

&lt;h3&gt;
  
  
  Day 7: To assemble the puzzle 🧩 and to re-scope my project
&lt;/h3&gt;

&lt;p&gt;Right, after 2 days of playing with repositories and making code snippets, I started to understand what needed to be done for my Web3 project.&lt;/p&gt;

&lt;p&gt;I updated a little bit of my plan. And made it &lt;strong&gt;simpler and more secure&lt;/strong&gt; than before.&lt;/p&gt;

&lt;p&gt;Then again, I asked another blockchain DEV to check it out. « Better!  » &lt;/p&gt;

&lt;p&gt;I’m ready to go and I will spend 2-3 weeks to finish that project.&lt;/p&gt;

&lt;p&gt;What I learnt so far during this week: 📕&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;To set up smart contracts with Solidity and use Openzeppelin.&lt;/li&gt;
&lt;li&gt;To handle user’s wallet with Metamask API and Wallet connect.&lt;/li&gt;
&lt;li&gt;To set up a Testnet environment with HardhatJs.&lt;/li&gt;
&lt;li&gt;To interact with my smart contract and make transactions on the back-end using etherJs&lt;/li&gt;
&lt;li&gt;To deploy smart contract into Polygon Matic.&lt;/li&gt;
&lt;li&gt;To make timelock smart contracts.&lt;/li&gt;
&lt;li&gt;A minimum of security when it comes to set-up blockchain’s features&lt;/li&gt;
&lt;li&gt;...&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt; &lt;/p&gt;

&lt;p&gt;I made a &lt;a href="https://mailchi.mp/171cd94f6acb/3udm90jz7h"&gt;PDF&lt;/a&gt; with all the resources I have been using in my web3 journey: &lt;a href="https://mailchi.mp/171cd94f6acb/3udm90jz7h"&gt;check it out here&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  What’s Next?
&lt;/h3&gt;

&lt;p&gt;I’m planning in the future, to release Saas App using Web3 and also to accept more freelance contracts using that technology.&lt;/p&gt;

&lt;p&gt;👉 You can &lt;strong&gt;&lt;a href="https://twitter.com/devvnomad"&gt;follow me there&lt;/a&gt;&lt;/strong&gt; on Twitter, as I continue to document my journey.&lt;/p&gt;

</description>
      <category>web3</category>
      <category>blockchain</category>
      <category>ethereum</category>
      <category>polygon</category>
    </item>
  </channel>
</rss>
