<?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: MESG</title>
    <description>The latest articles on DEV Community by MESG (@mesgfoundation).</description>
    <link>https://dev.to/mesgfoundation</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%2F358621%2Fc796b385-043f-4f42-8528-dc114c88d6df.jpg</url>
      <title>DEV Community: MESG</title>
      <link>https://dev.to/mesgfoundation</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mesgfoundation"/>
    <language>en</language>
    <item>
      <title>Tutorial: Build an app that receives an email when ERC-20 transactions occurs</title>
      <dc:creator>MESG</dc:creator>
      <pubDate>Mon, 13 Apr 2020 20:53:42 +0000</pubDate>
      <link>https://dev.to/mesgfoundation/tutorial-build-an-app-that-receives-an-email-when-erc-20-transactions-occurs-404m</link>
      <guid>https://dev.to/mesgfoundation/tutorial-build-an-app-that-receives-an-email-when-erc-20-transactions-occurs-404m</guid>
      <description>&lt;p&gt;In this tutorial we'll cover how to recreate an ERC-20 to Email application using the MESG Framework, which will run and manage the application for you. Allowing the MESG Engine to run your application, it will also enable decentralization without any additional steps.&lt;/p&gt;

&lt;h2&gt;
  
  
  What do we want to build?
&lt;/h2&gt;

&lt;p&gt;We want to listen to all transfer events from a specific smart contract and send an email for each one of them.&lt;/p&gt;

&lt;p&gt;In order to do that, we will split this tutorial into two parts to create our application.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The triggering of the process (the ERC-20 event we want to listen to)&lt;/li&gt;
&lt;li&gt;The task to execute (the email we want to send)&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  How do we build this?
&lt;/h2&gt;

&lt;p&gt;We will use the MESG Orchestrator and will create a process file.&lt;/p&gt;

&lt;h3&gt;
  
  
  ERC-20 Transfer trigger
&lt;/h3&gt;

&lt;p&gt;Let's create our process file.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;key&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;erc20-notifications&lt;/span&gt;
&lt;span class="na"&gt;steps&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;trigger&lt;/span&gt;
    &lt;span class="na"&gt;instance&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;src&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;https://github.com/mesg-foundation/service-ethereum-erc20&lt;/span&gt;
      &lt;span class="na"&gt;env&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;PROVIDER_ENDPOINT=$(env:PROVIDER_ENDPOINT)&lt;/span&gt;
        &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;CONTRACT_ADDRESS=0xdac17f958d2ee523a2206206994597c13d831ec7&lt;/span&gt;
    &lt;span class="na"&gt;eventKey&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;transfer&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Here, we create our first step of our process that is a trigger. We listen for all the events transfer of the service that is running with the environment variables:&lt;/p&gt;

&lt;p&gt;PROVIDER_ENDPOINT : The address of the Ethereum node that will be injected during the compilation.|&lt;/p&gt;

&lt;p&gt;CONTRACT_ADDRESS : The address of the ERC-20 to watch (USDT) 0xdac17f958d2ee523a2206206994597c13d831ec7&lt;/p&gt;

&lt;h3&gt;
  
  
  Send the email
&lt;/h3&gt;

&lt;p&gt;Let's add the next task that will send an email each time our event is triggered. We will use the SendGrid service to send an email.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;key: erc20-notifications
steps:
  ...
  - type: task
    instance:
      src: https://github.com/mesg-foundation/service-email-sendgrid
      env:
        - SENDGRID_API_KEY=$(env:SENDGRID_API_KEY)
    taskKey: send
    inputs:
      from: "test@erc20notification.com"
      to: "__YOUR_EMAIL_HERE__"
      subject: "New ERC20 transfer"
      text:
        key: transactionHash
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;We just added another step of type task that will use the service configured with the environmental variable SENDGRID_API_KEY that will be set during the deployment.&lt;/p&gt;

&lt;p&gt;From this service, the task send will be called with a specific set of inputs:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;from: A constant value for the sender of the email&lt;/li&gt;
&lt;li&gt;to: The email you want to use to receive your notification&lt;/li&gt;
&lt;li&gt;subject: A subject for your email&lt;/li&gt;
&lt;li&gt;text: The text of your email. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The text input is an actual reference to the value transactionHash from our event. Every time a email will be sent, the value of the text will actually be the value of the transactionHash from the event.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://blog.mesg.com/create-a-process-to-receive-an-email-when-an-erc20-transfer-occurs/?utm_source=devto&amp;amp;utm_medium=post&amp;amp;utm_campaign=tuto"&gt;Follow the whole tutorial&lt;/a&gt;&lt;/p&gt;

</description>
      <category>opensource</category>
      <category>blockchain</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Virtual hackathon - now through April 26th</title>
      <dc:creator>MESG</dc:creator>
      <pubDate>Thu, 02 Apr 2020 23:17:53 +0000</pubDate>
      <link>https://dev.to/mesgfoundation/virtual-hackathon-now-through-april-26th-1j54</link>
      <guid>https://dev.to/mesgfoundation/virtual-hackathon-now-through-april-26th-1j54</guid>
      <description>&lt;p&gt;Hey all! I hope you're staying well out there. &lt;/p&gt;

&lt;p&gt;We're throwing an all-levels online hackathon going on now through April 26th. We'll be giving away &lt;strong&gt;$9,000 in prizes for impressive projects&lt;/strong&gt;, which can be tools, microservices and/or processes built on the MESG Framework. &lt;/p&gt;

&lt;p&gt;It's is open to devs of all levels, and criteria is pretty wide open as well, as long as it's creative, interesting and/or useful. &lt;/p&gt;

&lt;p&gt;We'd love to see you there. Go ahead and join at Devpost ⬇️&lt;/p&gt;

&lt;p&gt;&lt;a href="https://mesg-ecosystem.devpost.com/"&gt;https://mesg-ecosystem.devpost.com/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>microservices</category>
      <category>blockchain</category>
      <category>distributedsystems</category>
    </item>
  </channel>
</rss>
