<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
    <channel>
        <title>syahirAmali.eth</title>
        <link>https://paragraph.com/@syahiramali</link>
        <description>A web3 developer beginning his journey. I'll be trying my best to record and blog things I do, much like a diary.</description>
        <lastBuildDate>Sun, 24 May 2026 05:53:24 GMT</lastBuildDate>
        <docs>https://validator.w3.org/feed/docs/rss2.html</docs>
        <generator>https://github.com/jpmonette/feed</generator>
        <language>en</language>
        <image>
            <title>syahirAmali.eth</title>
            <url>https://storage.googleapis.com/papyrus_images/9a89ad19273adf5f2176132fd91cb7fd508530b99ac83eab589f2cac1b503dca.jpg</url>
            <link>https://paragraph.com/@syahiramali</link>
        </image>
        <copyright>All rights reserved</copyright>
        <item>
            <title><![CDATA[#001 What are smart contracts?]]></title>
            <link>https://paragraph.com/@syahiramali/001-what-are-smart-contracts</link>
            <guid>dJKDJqXRnTf6eOzJ6BnC</guid>
            <pubDate>Sat, 09 Apr 2022 09:51:19 GMT</pubDate>
            <description><![CDATA[Getting into web3, one of the first things you’ll stumble upon will the concepts of smart contracts. To put it simply, smart contracts are a set of instructions that are stored on the blockchain, and will run predetermined conditions when they’re interacted with. The term “smart contract” was first coined by Nick Szabo in an article he wrote in 1994. Nick compared vending machines to smart contract as they are the primitive ancestors. While there are other factors involved, in essence a vendi...]]></description>
            <content:encoded><![CDATA[<p>Getting into web3, one of the first things you’ll stumble upon will the concepts of smart contracts.</p><p>To put it simply, smart contracts are a set of instructions that are stored on the blockchain, and will run predetermined conditions when they’re interacted with.</p><p>The term “smart contract” was first coined by Nick Szabo in an article he wrote in 1994. Nick compared vending machines to smart contract as they are the primitive ancestors.</p><p>While there are other factors involved, in essence a vending machine is simply just:</p><pre data-type="codeBlock" text="Pick your favorite snack + Insert money = Boom comes out your snack
"><code>Pick your favorite snack + Insert <span class="hljs-attr">money</span> = Boom comes out your snack
</code></pre><p>This magical process is programmed into the vending machine, much like how logical functions will be programmed into a smart contracts. While smart contracts are able to do much more and go way beyond. They are still very much alike!</p><p>While we can spend hours making the coolest vending machine we could, here is a very basic example of what a vending machine could look like:</p><pre data-type="codeBlock" text="contract VendingMachine {

  address owner;
  mapping(address =&gt; uint256) candyBarBalance;

  constructor() {
    owner = msg.sender;
    candyBarBalance[address(this)] = 10;
  }

  function refillCandy(uint amount) public { ... }

  function purchaseCandy(uint amount) public payable { ... }
}
"><code><span class="hljs-class"><span class="hljs-keyword">contract</span> <span class="hljs-title">VendingMachine</span> </span>{

  <span class="hljs-keyword">address</span> owner;
  <span class="hljs-keyword">mapping</span>(<span class="hljs-keyword">address</span> <span class="hljs-operator">=</span><span class="hljs-operator">></span> <span class="hljs-keyword">uint256</span>) candyBarBalance;

  <span class="hljs-function"><span class="hljs-keyword">constructor</span>(<span class="hljs-params"></span>) </span>{
    owner <span class="hljs-operator">=</span> <span class="hljs-built_in">msg</span>.<span class="hljs-built_in">sender</span>;
    candyBarBalance[<span class="hljs-keyword">address</span>(<span class="hljs-built_in">this</span>)] <span class="hljs-operator">=</span> <span class="hljs-number">10</span>;
  }

  <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">refillCandy</span>(<span class="hljs-params"><span class="hljs-keyword">uint</span> amount</span>) <span class="hljs-title"><span class="hljs-keyword">public</span></span> </span>{ ... }

  <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">purchaseCandy</span>(<span class="hljs-params"><span class="hljs-keyword">uint</span> amount</span>) <span class="hljs-title"><span class="hljs-keyword">public</span></span> <span class="hljs-title"><span class="hljs-keyword">payable</span></span> </span>{ ... }
}
</code></pre><p>So as a user in the web3 space, you would most likely be interacting with this contract, and the <em>purchaseCandy</em> function through a very nice front-end. And the smart contract will ensure that you have selected enough candy bars for purchase, there is enough in stock, and you are sending the correct value as payment. Once all of these conditions have passed the stock(amount) of candy bars in the vending machine will decrease, and will be added to the user.</p><pre data-type="codeBlock" text="contract VendingMachine {

function purchaseCandy(uint amount) public payable {
    //checks for amount of candy being bought
    require(amount &gt; 0, 
      &quot;You need to buy atleast 1 candy bar!&quot;);

    //checks for balance of candy in our vending machine
    require(candyBarBalance[adress(this)] &gt;= amount, 
      &quot;There is not enough candy bars in stock!&quot;);

    //checks for value being sent is correct
    require(msg.value == amount * 1 ether, 
      &quot;You will need to pay atleast 1 ETH per candy bar to make your purchase!&quot;);

    candyBarBalance[address(this)] -= amount;
    candyBarBalance[msg.sender] += amount;

  }
}
"><code><span class="hljs-class"><span class="hljs-keyword">contract</span> <span class="hljs-title">VendingMachine</span> </span>{

<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">purchaseCandy</span>(<span class="hljs-params"><span class="hljs-keyword">uint</span> amount</span>) <span class="hljs-title"><span class="hljs-keyword">public</span></span> <span class="hljs-title"><span class="hljs-keyword">payable</span></span> </span>{
    <span class="hljs-comment">//checks for amount of candy being bought</span>
    <span class="hljs-built_in">require</span>(amount <span class="hljs-operator">></span> <span class="hljs-number">0</span>, 
      <span class="hljs-string">"You need to buy atleast 1 candy bar!"</span>);

    <span class="hljs-comment">//checks for balance of candy in our vending machine</span>
    <span class="hljs-built_in">require</span>(candyBarBalance[adress(<span class="hljs-built_in">this</span>)] <span class="hljs-operator">></span><span class="hljs-operator">=</span> amount, 
      <span class="hljs-string">"There is not enough candy bars in stock!"</span>);

    <span class="hljs-comment">//checks for value being sent is correct</span>
    <span class="hljs-built_in">require</span>(<span class="hljs-built_in">msg</span>.<span class="hljs-built_in">value</span> <span class="hljs-operator">=</span><span class="hljs-operator">=</span> amount <span class="hljs-operator">*</span> <span class="hljs-number">1</span> <span class="hljs-literal">ether</span>, 
      <span class="hljs-string">"You will need to pay atleast 1 ETH per candy bar to make your purchase!"</span>);

    candyBarBalance[<span class="hljs-keyword">address</span>(<span class="hljs-built_in">this</span>)] <span class="hljs-operator">-</span><span class="hljs-operator">=</span> amount;
    candyBarBalance[<span class="hljs-built_in">msg</span>.<span class="hljs-built_in">sender</span>] <span class="hljs-operator">+</span><span class="hljs-operator">=</span> amount;

  }
}
</code></pre><p>Since smart contracts aren’t actually <em>smart</em> nor is it actually legally binding or enforceable by law. As can be seen from the vending machine example, smart contracts does well in translating business rules and processes into a program. It’s safe to say that many web3 project or protocol that writes and stores data in the blockchain uses a form of smart contract or another.</p><p>It has enabled the possibility to automate, and decentralize complex transactions over the network securely. Smart contracts are integral and are here to stay in the web3 space.</p><p>While we won’t be going deeper into smart contracts <em>yet</em>, <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://www.fon.hum.uva.nl/rob/Courses/InformationInSpeech/CDROM/Literature/LOTwinterschool2006/szabo.best.vwh.net/idea.html">here</a> you may find Nick Szabo’s article <strong><em>The Idea of Smart Contracts</em></strong>.</p>]]></content:encoded>
            <author>syahiramali@newsletter.paragraph.com (syahirAmali.eth)</author>
            <enclosure url="https://storage.googleapis.com/papyrus_images/a4d5fbaa99bfe7426ac4d433595afa88e9e2b55bd20e61d1a633a33c66109f94.png" length="0" type="image/png"/>
        </item>
        <item>
            <title><![CDATA[#000 It's a start...]]></title>
            <link>https://paragraph.com/@syahiramali/000-it-s-a-start</link>
            <guid>oK9AIgjsrdeYIl3pBLdF</guid>
            <pubDate>Sun, 27 Mar 2022 09:23:28 GMT</pubDate>
            <description><![CDATA[&#x3C;Code>Hello World&#x3C;/Code> We all have that one thing we wished we had recorded, a picture of, that ‘what if’. Hi, I’m Syahir, your fairly average web developer whos recently ventured into the web3 space and is looking to make a personal change. As I continue learning and discovering more about myself and my journey as a web3 developer, I realized there was many things I wanted to leave a note of, share, and even contribute. So here is my attempt at something which would hopefully res...]]></description>
            <content:encoded><![CDATA[<pre data-type="codeBlock" text="&lt;Code&gt;Hello World&lt;/Code&gt;
"><code><span class="hljs-operator">&#x3C;</span>Code<span class="hljs-operator">></span>Hello World<span class="hljs-operator">&#x3C;</span><span class="hljs-operator">/</span>Code<span class="hljs-operator">></span>
</code></pre><p>We all have that one thing we wished we had recorded, a picture of, that ‘what if’.</p><p>Hi, I’m Syahir, your fairly average web developer whos recently ventured into the web3 space and is looking to make a personal change.</p><p>As I continue learning and discovering more about myself and my journey as a web3 developer, I realized there was many things I wanted to leave a note of, share, and even contribute.</p><p>So here is my attempt at something which would hopefully resemble a personal blog, a record of my journey as a developer, things I would like to say, as well as useful web3 resource.</p><p>My reason for doing so is purely to benefit my growth and maybe hopefully share what I have learnt with others. I’ve discovered that the best developers, and people whom I looked up to had always been generous when it came to sharing information and opinion.</p><p>With that being said, this is where it begins, my personal blog, and sharing platform.</p><p>Feel free to reach out to me on <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://twitter.com/SyahirAmali">twitter</a>.</p>]]></content:encoded>
            <author>syahiramali@newsletter.paragraph.com (syahirAmali.eth)</author>
            <enclosure url="https://storage.googleapis.com/papyrus_images/4036104374303baac93771dccd5ba48558203e7a61d26222e41558c69fb1a6f8.jpg" length="0" type="image/jpg"/>
        </item>
    </channel>
</rss>