{"componentChunkName":"component---src-templates-tag-js","path":"/tags/blockchain/","result":{"data":{"site":{"siteMetadata":{"title":"LoginRadius Blog"}},"allMarkdownRemark":{"totalCount":2,"edges":[{"node":{"fields":{"slug":"/engineering/guest-post/ethereum-smart-contract-tutorial/"},"html":"<h2 id=\"what-is-a-smart-contract\" style=\"position:relative;\"><a href=\"#what-is-a-smart-contract\" aria-label=\"what is a smart contract permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What is a Smart Contract?</h2>\n<p><a href=\"https://en.wikipedia.org/wiki/Smart_contract\"><strong>Smart Contracts</strong></a> 📝 are simple programs stored on a blockchain network.</p>\n<p>You can say it's like an agreement between two people in the form of computer code. The transactions in a smart contract are processed by the blockchain and stored as a <strong>42 character hex address</strong> with the prefix <code>\"0x\"</code>). All of which means that they can be sent automatically without needing a third party.</p>\n<p><strong>🤔 Remember:</strong> They're stored in a public database. And once a smart contract is deployed, it cannot be changed.</p>\n<h2 id=\"what-is-solidity\" style=\"position:relative;\"><a href=\"#what-is-solidity\" aria-label=\"what is solidity permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What is Solidity?</h2>\n<p>Solidity is one of the most popular languages used for building smart contracts on Ethereum Blockchain. It's also an object-oriented programming language.</p>\n<h2 id=\"build-your-first-smart-contract\" style=\"position:relative;\"><a href=\"#build-your-first-smart-contract\" aria-label=\"build your first smart contract permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Build Your First Smart Contract</h2>\n<ol>\n<li>Open <strong><code>Remix</code> IDE</strong> from <a href=\"https://remix.ethereum.org/\">here</a>.</li>\n<li>Click on <code>Sure</code> and then <code>Done</code>.</li>\n<li>Under <code>default_workshop</code>, click on <code>create new file</code>.</li>\n<li>Rename it as <code>Hostel.sol</code>.</li>\n</ol>\n<p>Now you're ready to write your first <strong>Smart Contract</strong>. 🤩</p>\n<h3 id=\"contract-code\" style=\"position:relative;\"><a href=\"#contract-code\" aria-label=\"contract code permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Contract Code</h3>\n<ol>\n<li>You have to provide the <code>solidity version</code> in the smart contract:</li>\n</ol>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"ruby\" data-index=\"0\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk1\">pragma solidity ^</span><span class=\"mtk7\">0.5</span><span class=\"mtk1\">.</span><span class=\"mtk7\">16</span><span class=\"mtk1\">;</span></span></code></pre>\n<ol start=\"2\">\n<li>Now create the main contract named <code>Hostel</code>:</li>\n</ol>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"ruby\" data-index=\"1\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk1\">contract </span><span class=\"mtk12\">Hostel</span><span class=\"mtk1\">{</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    ...</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span></code></pre>\n<ol start=\"3\">\n<li>Now, inside the <code>contract Hostel{...}</code> follow the steps below.</li>\n<li>Create some variables where the smart contract will store the <a href=\"https://ethereum.stackexchange.com/questions/20874/payable-function-in-solidity\"><strong>payable</strong></a> <code>address</code> (42 char hex string with prefix : <code>\"0x\"</code>) of the <code>Landlord</code> &#x26; the <code>Tenant</code>.</li>\n</ol>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"ruby\" data-index=\"2\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk1\">    address payable tenant;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    address payable landlord;</span></span></code></pre>\n<ol start=\"5\">\n<li>Create some <a href=\"https://ethereum.stackexchange.com/questions/19380/external-vs-public-best-practices\"><strong>public</strong></a> variables where the smart contract will store some integer values. For this, there's a data type called <code>uint</code> (256-bit unsigned integer)</li>\n</ol>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"ruby\" data-index=\"3\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk1\">    uint </span><span class=\"mtk4\">public</span><span class=\"mtk1\"> no_of_rooms = </span><span class=\"mtk7\">0</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    uint </span><span class=\"mtk4\">public</span><span class=\"mtk1\"> no_of_agreement = </span><span class=\"mtk7\">0</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    uint </span><span class=\"mtk4\">public</span><span class=\"mtk1\"> no_of_rent = </span><span class=\"mtk7\">0</span><span class=\"mtk1\">;</span></span></code></pre>\n<ol start=\"6\">\n<li>Now, create a <code>structure</code> to store details of each Hostel room like <code>Hostel no.</code>, <code>Hostel name</code>, <code>Hostel address</code>, <code>No of total agreements</code>, <code>Monthly rent</code>, <code>One-time security deposit</code>, <code>Last agreement sign time</code>, <code>Vacancy</code>, <code>Landlord address</code>, and <code>Current Tenant Address</code>.</li>\n</ol>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"ruby\" data-index=\"4\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk1\">    struct </span><span class=\"mtk12\">Room</span><span class=\"mtk1\">{</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        uint roomid;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        uint agreementid;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        string roomname;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        string roomaddress;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        uint rent_per_month;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        uint securityDeposit;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        uint timestamp;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        bool vacant;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        address payable landlord;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        address payable currentTenant;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    }</span></span></code></pre>\n<ol start=\"7\">\n<li><code>map</code> previous <code>structure</code> with a <code>uint</code>(named : <code>roomid</code>).</li>\n</ol>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"ruby\" data-index=\"5\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk1\">mapping(uint =&gt; </span><span class=\"mtk12\">Room</span><span class=\"mtk1\">) </span><span class=\"mtk4\">public</span><span class=\"mtk1\"> </span><span class=\"mtk12\">Room_by_No</span><span class=\"mtk1\">;</span></span></code></pre>\n<ol start=\"8\">\n<li>Similar to the above, create a <code>structure</code> for each <code>Rental Agreement</code> and map that with a <code>uint</code>(named: <code>agreementid</code>). This will store details like: <code>Hostel no.</code>, <code>Agreement No</code>, <code>Hostel name</code>, <code>Hostel address</code>, <code>Monthly rent</code>, <code>One-time security deposit</code>,<code>Lockin Period</code>, <code>Agreement sign time</code>, <code>Landlord address</code>, and <code>Tenant Address</code>.</li>\n</ol>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"ruby\" data-index=\"6\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk1\">    struct </span><span class=\"mtk12\">RoomAgreement</span><span class=\"mtk1\">{</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        uint roomid;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        uint agreementid;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        string </span><span class=\"mtk12\">Roomname</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        string </span><span class=\"mtk12\">RoomAddresss</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        uint rent_per_month;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        uint securityDeposit;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        uint lockInPeriod;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        uint timestamp;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        address payable tenantAddress;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        address payable landlordAddress;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    }</span></span></code></pre>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"ruby\" data-index=\"7\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk1\">mapping(uint =&gt; </span><span class=\"mtk12\">RoomAgreement</span><span class=\"mtk1\">) </span><span class=\"mtk4\">public</span><span class=\"mtk1\"> </span><span class=\"mtk12\">RoomAgreement_by_No</span><span class=\"mtk1\">;</span></span></code></pre>\n<ol start=\"9\">\n<li>Now, create a <code>structure</code> for each <code>Rent</code> payment and map that with a <code>uint</code>. This will store details like: <code>Rent No.</code>, <code>Hostel no.</code>, <code>Agreement No</code>, <code>Hostel name</code>, <code>Hostel address</code>, <code>Monthly rent</code>, <code>Rent payment time</code>, <code>Landlord address</code>, and <code>Tenant Address</code>.</li>\n</ol>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"ruby\" data-index=\"8\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk1\">    struct </span><span class=\"mtk12\">Rent</span><span class=\"mtk1\">{</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        uint rentno;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        uint roomid;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        uint agreementid;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        string </span><span class=\"mtk12\">Roomname</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        string </span><span class=\"mtk12\">RoomAddresss</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        uint rent_per_month;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        uint timestamp;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        address payable tenantAddress;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        address payable landlordAddress;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    }</span></span></code></pre>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"ruby\" data-index=\"9\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk1\">   mapping(uint =&gt; </span><span class=\"mtk12\">Rent</span><span class=\"mtk1\">) </span><span class=\"mtk4\">public</span><span class=\"mtk1\"> </span><span class=\"mtk12\">Rent_by_No</span><span class=\"mtk1\">;</span></span></code></pre>\n<ol start=\"10\">\n<li>\n<p>Create some <a href=\"https://ethereum.stackexchange.com/questions/48971/what-are-function-modifiers\"><strong>modifiers</strong></a> that will help you verify a few things before running a function.</p>\n<p>Here <code>require(...);</code> means that if the given condition is not satisfied, the function won't execute, and the given string will appear as an error code.</p>\n</li>\n</ol>\n<p>The following will check if the message sender is the landlord.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"ruby\" data-index=\"10\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk1\">    modifier onlyLandlord(uint </span><span class=\"mtk12\">_index</span><span class=\"mtk1\">) {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk4\">require</span><span class=\"mtk1\">(msg.sender == </span><span class=\"mtk10\">Room_by_No</span><span class=\"mtk1\">[</span><span class=\"mtk12\">_index</span><span class=\"mtk1\">].landlord, </span><span class=\"mtk8\">&quot;Only landlord can access this&quot;</span><span class=\"mtk1\">);</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk12\">_</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    }</span></span></code></pre>\n<p>The following will check if the message sender is anyone except the landlord.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"ruby\" data-index=\"11\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk1\">    modifier notLandLord(uint </span><span class=\"mtk12\">_index</span><span class=\"mtk1\">) {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk4\">require</span><span class=\"mtk1\">(msg.sender != </span><span class=\"mtk10\">Room_by_No</span><span class=\"mtk1\">[</span><span class=\"mtk12\">_index</span><span class=\"mtk1\">].landlord, </span><span class=\"mtk8\">&quot;Only Tenant can access this&quot;</span><span class=\"mtk1\">);</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk12\">_</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    }</span></span></code></pre>\n<p>The following will check whether the room is vacant or not.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"ruby\" data-index=\"12\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk1\">    modifier </span><span class=\"mtk12\">OnlyWhileVacant</span><span class=\"mtk1\">(uint </span><span class=\"mtk12\">_index</span><span class=\"mtk1\">){</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk4\">require</span><span class=\"mtk1\">(</span><span class=\"mtk10\">Room_by_No</span><span class=\"mtk1\">[</span><span class=\"mtk12\">_index</span><span class=\"mtk1\">].vacant == </span><span class=\"mtk4\">true</span><span class=\"mtk1\">, </span><span class=\"mtk8\">&quot;Room is currently Occupied.&quot;</span><span class=\"mtk1\">);</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk12\">_</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    }</span></span></code></pre>\n<p>The following will check whether the tenant has enough <code>Ether</code> in his wallet to pay the rent.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"ruby\" data-index=\"13\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk1\">    modifier enoughRent(uint </span><span class=\"mtk12\">_index</span><span class=\"mtk1\">) {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk4\">require</span><span class=\"mtk1\">(msg.value &gt;= uint(</span><span class=\"mtk10\">Room_by_No</span><span class=\"mtk1\">[</span><span class=\"mtk12\">_index</span><span class=\"mtk1\">].rent_per_month), </span><span class=\"mtk8\">&quot;Not enough Ether in your wallet&quot;</span><span class=\"mtk1\">);</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk12\">_</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    }</span></span></code></pre>\n<p>The following will check whether the tenant has enough <code>Ether</code> in his wallet to pay a one-time security deposit and one month's rent in advance.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"ruby\" data-index=\"14\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk1\">    modifier enoughAgreementfee(uint </span><span class=\"mtk12\">_index</span><span class=\"mtk1\">) {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk4\">require</span><span class=\"mtk1\">(msg.value &gt;= uint(uint(</span><span class=\"mtk10\">Room_by_No</span><span class=\"mtk1\">[</span><span class=\"mtk12\">_index</span><span class=\"mtk1\">].rent_per_month) + uint(</span><span class=\"mtk10\">Room_by_No</span><span class=\"mtk1\">[</span><span class=\"mtk12\">_index</span><span class=\"mtk1\">].securityDeposit)), </span><span class=\"mtk8\">&quot;Not enough Ether in your wallet&quot;</span><span class=\"mtk1\">);</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk12\">_</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    }</span></span></code></pre>\n<p>The following will check whether the tenant's address is the same as who has signed the previous rental agreement.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"ruby\" data-index=\"15\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk1\">    modifier sameTenant(uint </span><span class=\"mtk12\">_index</span><span class=\"mtk1\">) {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk4\">require</span><span class=\"mtk1\">(msg.sender == </span><span class=\"mtk10\">Room_by_No</span><span class=\"mtk1\">[</span><span class=\"mtk12\">_index</span><span class=\"mtk1\">].currentTenant, </span><span class=\"mtk8\">&quot;No previous agreement found with you & landlord&quot;</span><span class=\"mtk1\">);</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk12\">_</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    }</span></span></code></pre>\n<p>The following will check whether any time is left for the agreement to end.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"ruby\" data-index=\"16\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk1\">    modifier </span><span class=\"mtk12\">AgreementTimesLeft</span><span class=\"mtk1\">(uint </span><span class=\"mtk12\">_index</span><span class=\"mtk1\">) {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        uint </span><span class=\"mtk12\">_AgreementNo</span><span class=\"mtk1\"> = </span><span class=\"mtk10\">Room_by_No</span><span class=\"mtk1\">[</span><span class=\"mtk12\">_index</span><span class=\"mtk1\">].agreementid;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        uint time = </span><span class=\"mtk10\">RoomAgreement_by_No</span><span class=\"mtk1\">[</span><span class=\"mtk12\">_AgreementNo</span><span class=\"mtk1\">].timestamp + </span><span class=\"mtk10\">RoomAgreement_by_No</span><span class=\"mtk1\">[</span><span class=\"mtk12\">_AgreementNo</span><span class=\"mtk1\">].lockInPeriod;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk4\">require</span><span class=\"mtk1\">(now &lt; time, </span><span class=\"mtk8\">&quot;Agreement already Ended&quot;</span><span class=\"mtk1\">);</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk12\">_</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    }</span></span></code></pre>\n<p>The following will check whether 365 days have passed after the last agreement has been created.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"ruby\" data-index=\"17\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk1\">    modifier </span><span class=\"mtk12\">AgreementTimesUp</span><span class=\"mtk1\">(uint </span><span class=\"mtk12\">_index</span><span class=\"mtk1\">) {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        uint </span><span class=\"mtk12\">_AgreementNo</span><span class=\"mtk1\"> = </span><span class=\"mtk10\">Room_by_No</span><span class=\"mtk1\">[</span><span class=\"mtk12\">_index</span><span class=\"mtk1\">].agreementid;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        uint time = </span><span class=\"mtk10\">RoomAgreement_by_No</span><span class=\"mtk1\">[</span><span class=\"mtk12\">_AgreementNo</span><span class=\"mtk1\">].timestamp + </span><span class=\"mtk10\">RoomAgreement_by_No</span><span class=\"mtk1\">[</span><span class=\"mtk12\">_AgreementNo</span><span class=\"mtk1\">].lockInPeriod;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk4\">require</span><span class=\"mtk1\">(now &gt; time, </span><span class=\"mtk8\">&quot;Time is left for contract to end&quot;</span><span class=\"mtk1\">);</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk12\">_</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    }</span></span></code></pre>\n<p>The following will check whether 30 days have passed after the last rent payment.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"ruby\" data-index=\"18\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk1\">    modifier </span><span class=\"mtk12\">RentTimesUp</span><span class=\"mtk1\">(uint </span><span class=\"mtk12\">_index</span><span class=\"mtk1\">) {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        uint time = </span><span class=\"mtk10\">Room_by_No</span><span class=\"mtk1\">[</span><span class=\"mtk12\">_index</span><span class=\"mtk1\">].timestamp + </span><span class=\"mtk7\">30</span><span class=\"mtk1\"> days;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk4\">require</span><span class=\"mtk1\">(now &gt;= time, </span><span class=\"mtk8\">&quot;Time left to pay Rent&quot;</span><span class=\"mtk1\">);</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk12\">_</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    }</span></span></code></pre>\n<ol start=\"11\">\n<li>Now, create some <a href=\"https://docs.soliditylang.org/en/v0.4.24/introduction-to-smart-contracts.html\"><strong>functions</strong></a></li>\n</ol>\n<p>The following function will be used to add Rooms.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"ruby\" data-index=\"19\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk1\">    function addRoom(string memory </span><span class=\"mtk12\">_roomname</span><span class=\"mtk1\">, string memory </span><span class=\"mtk12\">_roomaddress</span><span class=\"mtk1\">, uint </span><span class=\"mtk12\">_rentcost</span><span class=\"mtk1\">, uint  </span><span class=\"mtk12\">_securitydeposit</span><span class=\"mtk1\">) </span><span class=\"mtk4\">public</span><span class=\"mtk1\"> {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk4\">require</span><span class=\"mtk1\">(msg.sender != address(</span><span class=\"mtk7\">0</span><span class=\"mtk1\">));</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        no_of_rooms ++;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        bool </span><span class=\"mtk12\">_vacancy</span><span class=\"mtk1\"> = </span><span class=\"mtk4\">true</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk10\">Room_by_No</span><span class=\"mtk1\">[no_of_rooms] = </span><span class=\"mtk12\">Room</span><span class=\"mtk1\">(no_of_rooms,</span><span class=\"mtk7\">0</span><span class=\"mtk1\">,</span><span class=\"mtk12\">_roomname</span><span class=\"mtk1\">,</span><span class=\"mtk12\">_roomaddress</span><span class=\"mtk1\">, </span><span class=\"mtk12\">_rentcost</span><span class=\"mtk1\">,</span><span class=\"mtk12\">_securitydeposit</span><span class=\"mtk1\">,</span><span class=\"mtk7\">0</span><span class=\"mtk1\">,</span><span class=\"mtk12\">_vacancy</span><span class=\"mtk1\">, msg.sender, address(</span><span class=\"mtk7\">0</span><span class=\"mtk1\">)); </span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    }</span></span></code></pre>\n<p>Now, create a function to sign the rental agreement for a hostel room between the landlord and a tenant.</p>\n<p>Before creating the <code>signAgreement</code> function, remember the following:</p>\n<ul>\n<li>The function will only execute if the user is <code>Tenant</code>, meaning that the user's address and the landlord's address don't match.</li>\n<li>The function will only execute if the user has enough ether (payable 'ether') in their Ethereum wallet.(Enough ether means = one-time security deposit + 1st month's rent)</li>\n</ul>\n<p>Let's use those modifiers here, so that:</p>\n<ul>\n<li>The function <code>signAgreement</code> will only execute only if the said room is vacant and the tenant has enough ether in their wallet.</li>\n</ul>\n<p>Remember those modifiers in point no.10? Use those modifiers here to execute the following function.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"ruby\" data-index=\"20\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk1\">    function signAgreement(uint </span><span class=\"mtk12\">_index</span><span class=\"mtk1\">) </span><span class=\"mtk4\">public</span><span class=\"mtk1\"> payable notLandLord(</span><span class=\"mtk12\">_index</span><span class=\"mtk1\">) enoughAgreementfee(</span><span class=\"mtk12\">_index</span><span class=\"mtk1\">) </span><span class=\"mtk12\">OnlyWhileVacant</span><span class=\"mtk1\">(</span><span class=\"mtk12\">_index</span><span class=\"mtk1\">) {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk4\">require</span><span class=\"mtk1\">(msg.sender != address(</span><span class=\"mtk7\">0</span><span class=\"mtk1\">));</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        address payable </span><span class=\"mtk12\">_landlord</span><span class=\"mtk1\"> = </span><span class=\"mtk10\">Room_by_No</span><span class=\"mtk1\">[</span><span class=\"mtk12\">_index</span><span class=\"mtk1\">].landlord;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        uint totalfee = </span><span class=\"mtk10\">Room_by_No</span><span class=\"mtk1\">[</span><span class=\"mtk12\">_index</span><span class=\"mtk1\">].rent_per_month + </span><span class=\"mtk10\">Room_by_No</span><span class=\"mtk1\">[</span><span class=\"mtk12\">_index</span><span class=\"mtk1\">].securityDeposit;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk12\">_landlord</span><span class=\"mtk1\">.transfer(totalfee);</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        no_of_agreement++;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk10\">Room_by_No</span><span class=\"mtk1\">[</span><span class=\"mtk12\">_index</span><span class=\"mtk1\">].currentTenant = msg.sender;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk10\">Room_by_No</span><span class=\"mtk1\">[</span><span class=\"mtk12\">_index</span><span class=\"mtk1\">].vacant = </span><span class=\"mtk4\">false</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk10\">Room_by_No</span><span class=\"mtk1\">[</span><span class=\"mtk12\">_index</span><span class=\"mtk1\">].timestamp = block.timestamp;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk10\">Room_by_No</span><span class=\"mtk1\">[</span><span class=\"mtk12\">_index</span><span class=\"mtk1\">].agreementid = no_of_agreement;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk10\">RoomAgreement_by_No</span><span class=\"mtk1\">[no_of_agreement]=</span><span class=\"mtk12\">RoomAgreement</span><span class=\"mtk1\">(</span><span class=\"mtk12\">_index</span><span class=\"mtk1\">,no_of_agreement,</span><span class=\"mtk10\">Room_by_No</span><span class=\"mtk1\">[</span><span class=\"mtk12\">_index</span><span class=\"mtk1\">].roomname,</span><span class=\"mtk10\">Room_by_No</span><span class=\"mtk1\">[</span><span class=\"mtk12\">_index</span><span class=\"mtk1\">].roomaddress,</span><span class=\"mtk10\">Room_by_No</span><span class=\"mtk1\">[</span><span class=\"mtk12\">_index</span><span class=\"mtk1\">].rent_per_month,</span><span class=\"mtk10\">Room_by_No</span><span class=\"mtk1\">[</span><span class=\"mtk12\">_index</span><span class=\"mtk1\">].securityDeposit,</span><span class=\"mtk7\">365</span><span class=\"mtk1\"> days,block.timestamp,msg.sender,</span><span class=\"mtk12\">_landlord</span><span class=\"mtk1\">);</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        no_of_rent++;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk10\">Rent_by_No</span><span class=\"mtk1\">[no_of_rent] = </span><span class=\"mtk12\">Rent</span><span class=\"mtk1\">(no_of_rent,</span><span class=\"mtk12\">_index</span><span class=\"mtk1\">,no_of_agreement,</span><span class=\"mtk10\">Room_by_No</span><span class=\"mtk1\">[</span><span class=\"mtk12\">_index</span><span class=\"mtk1\">].roomname,</span><span class=\"mtk10\">Room_by_No</span><span class=\"mtk1\">[</span><span class=\"mtk12\">_index</span><span class=\"mtk1\">].roomaddress,</span><span class=\"mtk10\">Room_by_No</span><span class=\"mtk1\">[</span><span class=\"mtk12\">_index</span><span class=\"mtk1\">].rent_per_month,now,msg.sender,</span><span class=\"mtk12\">_landlord</span><span class=\"mtk1\">);</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    }</span></span></code></pre>\n<p>Now, create a function that the tenant will use to pay the monthly rent to the landlord.</p>\n<p>Before creating the <code>payRent</code> function, remember the following:</p>\n<ul>\n<li>The function will only execute if the user's address and previous tenant's address both are the same, meaning that the user can only pay rent if he/she has signed an agreement with the landlord within the last 365 days.</li>\n<li>The function will only execute if the tenant had paid his/her previous rent more than a month ago.</li>\n<li>The function will only execute if the user has enough ether (payable 'ether') in his/her Ethereum wallet. (enough ether = enough room rent).</li>\n</ul>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"ruby\" data-index=\"21\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk1\">    function payRent(uint </span><span class=\"mtk12\">_index</span><span class=\"mtk1\">) </span><span class=\"mtk4\">public</span><span class=\"mtk1\"> payable sameTenant(</span><span class=\"mtk12\">_index</span><span class=\"mtk1\">) </span><span class=\"mtk12\">RentTimesUp</span><span class=\"mtk1\">(</span><span class=\"mtk12\">_index</span><span class=\"mtk1\">) enoughRent(</span><span class=\"mtk12\">_index</span><span class=\"mtk1\">){</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk4\">require</span><span class=\"mtk1\">(msg.sender != address(</span><span class=\"mtk7\">0</span><span class=\"mtk1\">));</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        address payable </span><span class=\"mtk12\">_landlord</span><span class=\"mtk1\"> = </span><span class=\"mtk10\">Room_by_No</span><span class=\"mtk1\">[</span><span class=\"mtk12\">_index</span><span class=\"mtk1\">].landlord;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        uint </span><span class=\"mtk12\">_rent</span><span class=\"mtk1\"> = </span><span class=\"mtk10\">Room_by_No</span><span class=\"mtk1\">[</span><span class=\"mtk12\">_index</span><span class=\"mtk1\">].rent_per_month;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk12\">_landlord</span><span class=\"mtk1\">.transfer(</span><span class=\"mtk12\">_rent</span><span class=\"mtk1\">);</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk10\">Room_by_No</span><span class=\"mtk1\">[</span><span class=\"mtk12\">_index</span><span class=\"mtk1\">].currentTenant = msg.sender;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk10\">Room_by_No</span><span class=\"mtk1\">[</span><span class=\"mtk12\">_index</span><span class=\"mtk1\">].vacant = </span><span class=\"mtk4\">false</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        no_of_rent++;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk10\">Rent_by_No</span><span class=\"mtk1\">[no_of_rent] = </span><span class=\"mtk12\">Rent</span><span class=\"mtk1\">(no_of_rent,</span><span class=\"mtk12\">_index</span><span class=\"mtk1\">,</span><span class=\"mtk10\">Room_by_No</span><span class=\"mtk1\">[</span><span class=\"mtk12\">_index</span><span class=\"mtk1\">].agreementid,</span><span class=\"mtk10\">Room_by_No</span><span class=\"mtk1\">[</span><span class=\"mtk12\">_index</span><span class=\"mtk1\">].roomname,</span><span class=\"mtk10\">Room_by_No</span><span class=\"mtk1\">[</span><span class=\"mtk12\">_index</span><span class=\"mtk1\">].roomaddress,</span><span class=\"mtk12\">_rent</span><span class=\"mtk1\">,now,msg.sender,</span><span class=\"mtk10\">Room_by_No</span><span class=\"mtk1\">[</span><span class=\"mtk12\">_index</span><span class=\"mtk1\">].landlord);</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    }</span></span></code></pre>\n<p>Let's create a function that the landlord will use to mark an agreement complete.</p>\n<p>Before creating <code>agreementCompleted</code> function, remember the following:</p>\n<ul>\n<li>The function will only execute if the user's address and the landlord's address are the same.</li>\n<li>\n<p>The function will only execute if the tenant had signed that agreement more than a year ago.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"ruby\" data-index=\"22\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk1\">function agreementCompleted(uint </span><span class=\"mtk12\">_index</span><span class=\"mtk1\">) </span><span class=\"mtk4\">public</span><span class=\"mtk1\"> payable onlyLandlord(</span><span class=\"mtk12\">_index</span><span class=\"mtk1\">) </span><span class=\"mtk12\">AgreementTimesUp</span><span class=\"mtk1\">(</span><span class=\"mtk12\">_index</span><span class=\"mtk1\">){</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk4\">require</span><span class=\"mtk1\">(msg.sender != address(</span><span class=\"mtk7\">0</span><span class=\"mtk1\">));</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk4\">require</span><span class=\"mtk1\">(</span><span class=\"mtk10\">Room_by_No</span><span class=\"mtk1\">[</span><span class=\"mtk12\">_index</span><span class=\"mtk1\">].vacant == </span><span class=\"mtk4\">false</span><span class=\"mtk1\">, </span><span class=\"mtk8\">&quot;Room is currently Occupied.&quot;</span><span class=\"mtk1\">);</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk10\">Room_by_No</span><span class=\"mtk1\">[</span><span class=\"mtk12\">_index</span><span class=\"mtk1\">].vacant = </span><span class=\"mtk4\">true</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    address payable </span><span class=\"mtk12\">_Tenant</span><span class=\"mtk1\"> = </span><span class=\"mtk10\">Room_by_No</span><span class=\"mtk1\">[</span><span class=\"mtk12\">_index</span><span class=\"mtk1\">].currentTenant;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    uint </span><span class=\"mtk12\">_securitydeposit</span><span class=\"mtk1\"> = </span><span class=\"mtk10\">Room_by_No</span><span class=\"mtk1\">[</span><span class=\"mtk12\">_index</span><span class=\"mtk1\">].securityDeposit;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">_Tenant</span><span class=\"mtk1\">.transfer(</span><span class=\"mtk12\">_securitydeposit</span><span class=\"mtk1\">);</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span></code></pre>\n</li>\n</ul>\n<p>Let's create a function that the landlord will use to terminate an agreement.</p>\n<p>Before creating <code>agreementTerminated</code> function, remember the following:</p>\n<ul>\n<li>The function will only execute if the user's address and the landlord's address are the same.</li>\n<li>The function will only execute if the tenant had signed that agreement less than a year ago.</li>\n</ul>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"ruby\" data-index=\"23\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk1\">    function agreementTerminated(uint </span><span class=\"mtk12\">_index</span><span class=\"mtk1\">) </span><span class=\"mtk4\">public</span><span class=\"mtk1\"> onlyLandlord(</span><span class=\"mtk12\">_index</span><span class=\"mtk1\">) </span><span class=\"mtk12\">AgreementTimesLeft</span><span class=\"mtk1\">(</span><span class=\"mtk12\">_index</span><span class=\"mtk1\">){</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk4\">require</span><span class=\"mtk1\">(msg.sender != address(</span><span class=\"mtk7\">0</span><span class=\"mtk1\">));</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk10\">Room_by_No</span><span class=\"mtk1\">[</span><span class=\"mtk12\">_index</span><span class=\"mtk1\">].vacant = </span><span class=\"mtk4\">true</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    }</span></span></code></pre>\n<h3 id=\"compile\" style=\"position:relative;\"><a href=\"#compile\" aria-label=\"compile permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Compile</h3>\n<p>Now, click on the <code>Solidity Compile</code> option in the left sidebar.</p>\n<ol>\n<li>Select compiler version <code>0.5.16+</code></li>\n<li>Then click on <code>Compile Hostel.sol</code></li>\n</ol>\n<p>Similar to as follows:</p>\n<span class=\"gatsby-resp-image-wrapper\" style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 740px; \">\n      <span class=\"gatsby-resp-image-background-image\" style=\"padding-bottom: 194.6153846153846%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAnCAYAAAAPZ2gOAAAACXBIWXMAABYlAAAWJQFJUiTwAAAGVElEQVRIx4VWV29cRRhdhQASDzyRHm/vvfe1t6+9zWun27FT7JgkpFMcYyfGRIASSAABoUhBESDBAwIB4fcdzj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PJSdRBeVR12YhuZ7fTmS1q6Xqj/q4UTfw2i0hhApEotNIUxP48xpjB5aKfNmemAh1yxyHfCKkLGJrYboIIfDHtrkbiFNzK5xjNmzGKPw6kn6g9YUDjO30goOqXEaRkdGwcRv5r6HqihZ9eHVpfvYdeN7vHztMdxbv8C2+RP2334C/cZT7GU7tv4UBvYPrP2IPatPsOvKN3iJt+brx1ZhNoaHDLo0g7uvfQvd+m94ZeNXuD5/BuODv+D54hnxLw5+8iecj/5RY+tnf3P8B3SrP0O3+TteW9iC2RAeClmOHnM4FqzhcKSOQ+Ep7AtOYi+xJ6BhX7f/RqCGvWz3B6cwxrWHow3o/WVYRnJISFHsTL5DQPW2swA2Jtxu1iD9AcIKFoZpJaRQ8v9IlTW1ETHVBNXCRI/xTjaYYgqKTkKfIWh0Sg6O3nDIMiFHT2SrUDpOGTuprtJi+ThxgsrcIInLSl16EAkLk2LSKvkayWH35ZClXGVylK90E+P5WdUXiPa5GI3IWA/yQJATI/PPHT1NbahxfA14fFrrdImMiZzl1djrFxWisPootkHNyyBfFu5hgyIODhqUA3/85E2cXbqD04trWLm4hTt3v8bGna/wznsPcePWA7y//iWu3rqPhfVPsbi0gQWuO7d8ly+MZfXA6vNQDMp5rE3Jk+MSmu03+Xy7iFPzNzE3f4sbXVc4NXcTR45fRWvxBlqdi1y3gs7MZUzkT2i33naDpcpptdtk/TzfMytoti6ocZv9RmuZBi6o/jQN1RtLal2Da7K5owODoyHfwtnzDPnMGq5c+xh3P3iMrXvf4UNic+sx3l19pNp7H/2A5ZVNzC/eZsib20Ie0sMI3zSJZJu3XItq3eS4wcufLU+D9GOJlvouc6l0RyGdmVEK36eNUuwuDw1kvci9QPoDRNScPEJL5SOQh2o+32HuOigUZ9TbXHs5RKt8V5/o0+b/MHzrWbpCLLkfnBQf71rezT1iv+hG672xNU9DQ16zbwjR88Hcfzu8BX0YIYblAAAAAElFTkSuQmCC'); background-size: cover; display: block;\"></span>\n  <img class=\"gatsby-resp-image-image\" alt=\"Compiler\" title=\"Compiler\" src=\"/static/bc558b256541ec86d2c0eb8e80ec9f12/50383/img1.png\" srcset=\"/static/bc558b256541ec86d2c0eb8e80ec9f12/a6d36/img1.png 650w,\n/static/bc558b256541ec86d2c0eb8e80ec9f12/50383/img1.png 740w\" sizes=\"(max-width: 740px) 100vw, 740px\" style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\" loading=\"lazy\">\n    </span>\n<h3 id=\"deploy\" style=\"position:relative;\"><a href=\"#deploy\" aria-label=\"deploy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Deploy</h3>\n<p>Click on the <code>Deploy &#x26; Run Transactions</code> option in the left sidebar.</p>\n<ol>\n<li>Choose <code>Environment</code> > <code>JavaScript VM (London)</code></li>\n<li>Now click on <code>Deploy</code></li>\n</ol>\n<span class=\"gatsby-resp-image-wrapper\" style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 740px; \">\n      <span class=\"gatsby-resp-image-background-image\" style=\"padding-bottom: 194.6153846153846%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAnCAYAAAAPZ2gOAAAACXBIWXMAABYlAAAWJQFJUiTwAAAFlElEQVRIx41WyXLbRhD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Dx62BeTiysKnGI0JJpPHGFKKeZ0VptNrMvGS/HYpZrOvggMD4Sxh01mfooofAQyCki8NoDtL6M0V9ZlD1GluExdb3lIAAhr1I9ITvUZ6oU0ImCeTM8TDqWVi5VBvsXQsbQPrZgOmZhDpjY8Ses+HHeQoyqWChb/uTPzzq4d//3iKv39b4L9fLPy8sPBl3JIDP8S/LbFDQL5hLmvhdujgx5mLu+MO7uYe3s0cTJ0W4ilLypvyEdkxOYgyVd4CtwTyiT5DrjyWed2cC5U4Qz4fcMPDdLqBDLXTbIZNNGWeIsowVcoUhKjPHky9fUCFNiaJV4k0C23mYkBrbgUMGJSv3ZtFSR8AbojNYOXBNVonb9A5ewvv9A2M49fQ/XNpoTZ1RJfy3G0vRTjnuUtyF2Q+Rkz2t9UmT08SfXwDc3IDZ/oc1eE1VGse5CyVOtuZSr5zf5axGeS0Rin8QFBs1Lnr0SOoRiWtxI8lehjpOtVGeig9ck8R17pIxGvbthDmdTbn7vlwA2hQS+BbuO05GlSJdFo7zSmaziES/iVSlQEU6iH7EQ578w4gf6jTbUzrkHrLUMAZ1GiMhTapgyqBNR6kDDe1927ICgZwW3MCncAiYJP85jSPUCy2Ed809KipYVXnXH7AZIdu0pJamKcayX7hRh7WR+kr5PyStIle0HYJqKj5Ukd5vUMbBuSWKZtIonNVXrO97ZqFAZguKu3nC9wDhvUwbW7NCE2RubKrjxbc996H0YqtfCL5P0fo5TCmt8vFJvXMD+bp50pMo9c79+Ywl3fqW6SKBNHVPyn/A3lb3I+hTik1AAAAAElFTkSuQmCC'); background-size: cover; display: block;\"></span>\n  <img class=\"gatsby-resp-image-image\" alt=\"Deploy\" title=\"Deploy\" src=\"/static/343cc66c27641d6a09263cfdd89f96c6/50383/img2.png\" srcset=\"/static/343cc66c27641d6a09263cfdd89f96c6/a6d36/img2.png 650w,\n/static/343cc66c27641d6a09263cfdd89f96c6/50383/img2.png 740w\" sizes=\"(max-width: 740px) 100vw, 740px\" style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\" loading=\"lazy\">\n    </span>\n<p><strong>🎉 Congratulations, your smart contract has been deployed. 🎉</strong></p>\n<h3 id=\"sample-transactions\" style=\"position:relative;\"><a href=\"#sample-transactions\" aria-label=\"sample transactions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Sample Transactions</h3>\n<p>Remember that whenever a transaction is getting executed, it stores all the details in a unique <code>hash</code> key.</p>\n<p>Now, under <code>Deployed Contract</code> click on <code>> HOSTEL AT ..... (MEMORY)</code></p>\n<ol>\n<li>Click on the <code>V</code> icon (dropdown menu) of <code>addRoom</code> function.</li>\n<li>Fill up the details.</li>\n</ol>\n<p>Similar to as follows:</p>\n<span class=\"gatsby-resp-image-wrapper\" style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 740px; \">\n      <span class=\"gatsby-resp-image-background-image\" style=\"padding-bottom: 101.07692307692308%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAACXBIWXMAABYlAAAWJQFJUiTwAAADY0lEQVQ4y3VUyXLiVhRlmV9I2jbGgBgkxCAkJIEECIMkkACD7XaDux3b2aSrOl1ZZFimF6nKOlVZ5r+ySS/yIyf3PoSCu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QmCC'); background-size: cover; display: block;\"></span>\n  <img class=\"gatsby-resp-image-image\" alt=\"AddRoom\" title=\"AddRoom\" src=\"/static/3bc47cb07ed572c00dd0e0588f8fccea/50383/img3.png\" srcset=\"/static/3bc47cb07ed572c00dd0e0588f8fccea/a6d36/img3.png 650w,\n/static/3bc47cb07ed572c00dd0e0588f8fccea/50383/img3.png 740w\" sizes=\"(max-width: 740px) 100vw, 740px\" style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\" loading=\"lazy\">\n    </span>\n<blockquote>\n<p><strong>Note:</strong> You're entering your details in <code>wei</code> not in <code>ether</code> (1 ether = 1000000000000000000 wei)</p>\n</blockquote>\n<ol start=\"3\">\n<li>\n<p>Then click on <code>transact</code></p>\n<p><strong>🎉 Congratulations, you've successfully added your 1st room in the contract. 🎉</strong></p>\n<p>(You can find the same in the terminal also.)</p>\n<p>Now the landlord of the room is your 1st Ether Address. (The one with 99.99 test ether in wallet.)</p>\n</li>\n<li>Change the <code>Account Address</code> from the dropdown menu. (Choose anyone except the one with 99.99 ether)</li>\n</ol>\n<span class=\"gatsby-resp-image-wrapper\" style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 740px; \">\n      <span class=\"gatsby-resp-image-background-image\" style=\"padding-bottom: 116.15384615384616%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAXCAYAAAALHW+jAAAACXBIWXMAABYlAAAWJQFJUiTwAAAEb0lEQVQ4y22UyXIbVRSGteIJGKoSx7asoTXYltSt1mSp1fPcmiVbNo4pKCjA4DDELFjwBkAVC0IoA96wg0rgBX/OuZKcuIrFX32Hvl+f859zO5XvTfFgcAlJdpHLNqA2PDSbPup1BzXZQl11xZqs2FBp3OA9evJes+XT3EOheET7LrK5JlIPk0u88eQZdjoT5NIK/PAUtjOH6x2jpw3guAsEtHbUTeDRWhAuEcVn0I0xouhM7JX3++jrc6T3VKRKBzpyFQvFUhd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7zbFWQO1VaVzCnpyG/NojJPBDJHhYxpRqs4QcTBDHB6vmpy8LFPKG+C9Km+Aefqr7Odq8BQF53GMi0GCmWni8WiCkZsgMBOKdCaAHGWp2L7fhzTm+T1gJV/BuFHBJ+MQV4shzh0N7ychLsYUrRUhptTZX+5HuWaIiyAammFr8H9dzBVIG9tfBQAAAABJRU5ErkJggg=='); background-size: cover; display: block;\"></span>\n  <img class=\"gatsby-resp-image-image\" alt=\"Change Address\" title=\"Change Address\" src=\"/static/eb47d2dd91d0b7a616503cf0fab97c17/50383/img4.png\" srcset=\"/static/eb47d2dd91d0b7a616503cf0fab97c17/a6d36/img4.png 650w,\n/static/eb47d2dd91d0b7a616503cf0fab97c17/50383/img4.png 740w\" sizes=\"(max-width: 740px) 100vw, 740px\" style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\" loading=\"lazy\">\n    </span>\n<ol start=\"5\">\n<li>Add the total amount you have previously chosen as (rent cost + security deposit)</li>\n<li>And then from the dropdown <code>wei</code>, choose <code>ether</code></li>\n</ol>\n<span class=\"gatsby-resp-image-wrapper\" style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 740px; \">\n      <span class=\"gatsby-resp-image-background-image\" style=\"padding-bottom: 118.92307692307693%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAYCAYAAAD6S912AAAACXBIWXMAABYlAAAWJQFJUiTwAAAD80lEQVQ4y3VU2Y7jVBDNC9/Aosnizp44jpM4duI4sbN2Oquz9TTdUU/PDCAWoUEg8YCExBOMNE888zH8BRKCfzlUVex0Mi0eSnV9fe+pqnOqbiRvL6H09yiUu8hkGtDKHsp6FyXNhVrqkPcCc8Vr5cd/ZVrz2WzOln9puh/5cPMDPvj+DyTMBTLJOparB0ymt5jO9uj21rS+w2J5D9dbyR6vff8Bg8EOS/8FVnReLXnoD26RTFmI5KojKASWK3agXNQRTxiIxatIKAata7J3kTTlm9fh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5Xy+qz1AAAAAElFTkSuQmCC'); background-size: cover; display: block;\"></span>\n  <img class=\"gatsby-resp-image-image\" alt=\"Change Value\" title=\"Change Value\" src=\"/static/d5fd5d1f68f4e5d37d78edf675a163a2/50383/img5.png\" srcset=\"/static/d5fd5d1f68f4e5d37d78edf675a163a2/a6d36/img5.png 650w,\n/static/d5fd5d1f68f4e5d37d78edf675a163a2/50383/img5.png 740w\" sizes=\"(max-width: 740px) 100vw, 740px\" style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\" loading=\"lazy\">\n    </span>\n<ol start=\"7\">\n<li>\n<p>Scroll down and click on <code>signAgreement</code>, enter <code>1</code>, and press <code>signAgreement</code></p>\n<p>You can check the same by entering <code>RoomAgreementNo</code> : <code>1</code></p>\n</li>\n</ol>\n<span class=\"gatsby-resp-image-wrapper\" style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 740px; \">\n      <span class=\"gatsby-resp-image-background-image\" style=\"padding-bottom: 194.3076923076923%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAnCAYAAAAPZ2gOAAAACXBIWXMAABYlAAAWJQFJUiTwAAAE70lEQVRIx41WyW7bVhT1ph9RIEVia54siRI1kiKp0ZYlW0o8JY4TI01XATqiaIN21UXRrtoCXfZfT+955KVpm0GyuLhv4Dvvjudxp9w/xu70GuX6GPl8D/uNAI3mGLW6j+q+h/16IOKjZsY+6rJf25e9mmfGlEJxIGsBcnJ+5/Ptt/js+//wuL9FbreF1eoKi/k5Dg8uMHKPcbA4x3r9EiPvBMujF1gfX+P45BXGk1OjKZWqJ/NL7GU62Ck259jtHKNYdpHJ9VC0DlC2l7GU7CPkqwHyhYHIEDnRheIwHpt1mefy/RCw0Zyg152bjwq1AM5Xv+Hp+3+x+uEvbH/6BwvR7aO3cIbH6PTXIit0epHIuCtrdvcIjdbCGLTTaM0wcFcoiYW5ooOmf4729Aq9xSv0D1/Dnr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655Be2GEd2hHJJoE1GZwrc5tCryazXHnYKfomh66HVKVhUDqrCrtrSNiSH0yKeQLEGpbDeHaJqZDpeP5c6F9+k8dnmMiYMj24MnN+GxOs1Z7j8OgiJlhu8FYtarrNWqN0Bqs4MfqWmB6POibKMl2cpLrMkqCFnljhCfW78qfmjDZwvI3Mn5l5p7c073qp4mB3r43/Ac0kC8Qp6J4RAAAAAElFTkSuQmCC'); background-size: cover; display: block;\"></span>\n  <img class=\"gatsby-resp-image-image\" alt=\"Agreement Details\" title=\"Agreement Details\" src=\"/static/2e78f99488e2d4b996bf69e041b3f2a9/50383/img6.png\" srcset=\"/static/2e78f99488e2d4b996bf69e041b3f2a9/a6d36/img6.png 650w,\n/static/2e78f99488e2d4b996bf69e041b3f2a9/50383/img6.png 740w\" sizes=\"(max-width: 740px) 100vw, 740px\" style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\" loading=\"lazy\">\n    </span>\n<p><strong>🎉 Congratulations, you've successfully signed your 1st agreement. 🎉</strong></p>\n<p>All your transactions are shown in the <code>terminal</code>.</p>\n<span class=\"gatsby-resp-image-wrapper\" style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 768px; \">\n      <span class=\"gatsby-resp-image-background-image\" style=\"padding-bottom: 52.307692307692314%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAKCAYAAAC0VX7mAAAACXBIWXMAABYlAAAWJQFJUiTwAAABTUlEQVQoz41Su3LCMBD0lwTrYVt+AZMBDMZgEXcU1GnSpcr/95e9sxUzCZmh2DnpJO2t9i5y+YnyAijPVNaeUnckhz2vy7qf4JHryKaHh0g46i3ZZE+RyVvKcNm5jjKQ8aGxzR/w5REgAGRt96RBpMyO9OZKOjuCsGjJuqkKLiVSsRWk2RzH9eFu3Yo6IcS7xfBBqvQUcZUMzHzJ5aNKVqT0Btg+BSF9WZNSGyhcdlSsPa1WA5UV/Ko8SDshDwUyF2IofJK1ROwtYnz7Ir0cWGHz40kyGczf4cqx+k/lg3z8KlE8dBU6XPbo9lnAyu59G/0N3h7mPEcIMbAs9u+kix4KQZhjNKr6It8tMD6z0rlZv39wf2aw182NNKyJjMFI8GhMD1iJxhg825CARXrE+DQgtDshCqaHZswNGRsRGhVyIZ/irYIIdf0kXb/RN+QnL80nDgFfAAAAAElFTkSuQmCC'); background-size: cover; display: block;\"></span>\n  <img class=\"gatsby-resp-image-image\" alt=\"Terminal\" title=\"Terminal\" src=\"/static/7ebf72a72c72bbb334e0d52d8ce3cbf8/e5715/img7.png\" srcset=\"/static/7ebf72a72c72bbb334e0d52d8ce3cbf8/a6d36/img7.png 650w,\n/static/7ebf72a72c72bbb334e0d52d8ce3cbf8/e5715/img7.png 768w,\n/static/7ebf72a72c72bbb334e0d52d8ce3cbf8/c27e7/img7.png 2144w\" sizes=\"(max-width: 768px) 100vw, 768px\" style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\" loading=\"lazy\">\n    </span>\n<p>Now, you can cross verify this by checking your <code>ether</code> account address.</p>\n<h2 id=\"advantages-of-smart-contracts\" style=\"position:relative;\"><a href=\"#advantages-of-smart-contracts\" aria-label=\"advantages of smart contracts permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Advantages of Smart Contracts</h2>\n<p>Now you may ask, \"what's the use of smart contracts when there are several centralized methods?\"</p>\n<p>Let me explain some advantages of smart contracts over centralized systems:</p>\n<ol>\n<li>Here data cannot be changed or tampered with. So, it is almost impossible for malicious actors to manipulate data.</li>\n<li>It's completely decentralized.</li>\n<li>Unlike any centralized payment wallet, you don't have to pay any commission percentages to a middle man to transact.</li>\n</ol>\n<h3 id=\"storage--others\" style=\"position:relative;\"><a href=\"#storage--others\" aria-label=\"storage  others permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Storage &#x26; Others</h3>\n<p>You may also ask \"how are all the transactions recorded?\"</p>\n<p>You have to remember that smart contracts store data in a block of the blockchain, and all transactions are stored with a unique <code>hash</code> key.</p>\n<p>In Remix IDE, you can download the complete transactions history as a JSON file. For that, follow these steps:</p>\n<ol>\n<li>Click <code>Deploy &#x26; Run Transaction</code></li>\n<li>Then, expand the <code>Transactions Recorded (..) V</code> dropdown menu.</li>\n<li>Then Click on the <code>Save</code> icon.</li>\n<li>Press <code>ok</code>.</li>\n</ol>\n<h3 id=\"gas-fee\" style=\"position:relative;\"><a href=\"#gas-fee\" aria-label=\"gas fee permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Gas Fee</h3>\n<p>You may have noticed that whenever a transaction is executed, a few <code>wei</code> is getting deducted from your ether wallet.</p>\n<p>It's called <em>gas fee</em>, which is the payment made by users to compensate for the computing energy required to process and validate transactions.</p>\n<p>As more Ethereum miners come up in near future, the <code>gas fee</code> will decrease in an inverse relation.</p>\n<h3 id=\"future-possibilities\" style=\"position:relative;\"><a href=\"#future-possibilities\" aria-label=\"future possibilities permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Future Possibilities</h3>\n<p>After this, if you want to build a fullstack website using React, you can use this smart contract as a backend.</p>\n<p>For that you need to install/download: </p>\n<p><strong>Frontend:</strong></p>\n<ol>\n<li><a href=\"https://nodejs.org/en/\">Node.js</a></li>\n</ol>\n<p><strong>Backend:</strong></p>\n<ol>\n<li><a href=\"https://www.npmjs.com/package/web3\">web3.js</a></li>\n<li><a href=\"https://www.trufflesuite.com/docs/truffle/getting-started/installation\">Truffle</a></li>\n</ol>\n<p><strong>Testing:</strong></p>\n<ol>\n<li><a href=\"https://www.trufflesuite.com/ganache\">Ganache</a></li>\n<li><a href=\"https://metamask.io/\">Metamask</a></li>\n</ol>\n<p>Just follow the <a href=\"https://web3js.readthedocs.io/en/v1.5.2/\">official documentation</a> of Web3.js to connect your smart contract with your React app.</p>\n<h2 id=\"conclusion\" style=\"position:relative;\"><a href=\"#conclusion\" aria-label=\"conclusion permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Conclusion</h2>\n<p>You've successfully understood what Solidity is and how smart contracts work. And you've successfully built and deployed a perfectly working smart contract (where a tenant can pay rent in ether (ETH) directly to the landlord's wallet without paying a single wei to a middle man).</p>\n<p>To download the complete code used in this tutorial, click <a href=\"https://github.com/LoginRadius/engineering-blog-samples/tree/master/Solidity/decentralised-pg-booking-system-using-ethereum-smart-contract\">here</a>.</p>\n<p>Want to quickly add user login and signup functionality to your React apps? <a href=\"https://www.loginradius.com/authentication/\">Use LoginRadius for free.</a></p>\n<style class=\"grvsc-styles\">\n  .grvsc-container {\n    overflow: auto;\n    -webkit-overflow-scrolling: touch;\n    padding-top: 1rem;\n    padding-top: var(--grvsc-padding-top, var(--grvsc-padding-v, 1rem));\n    padding-bottom: 1rem;\n    padding-bottom: var(--grvsc-padding-bottom, var(--grvsc-padding-v, 1rem));\n    border-radius: 8px;\n    border-radius: var(--grvsc-border-radius, 8px);\n    font-feature-settings: normal;\n  }\n  \n  .grvsc-code {\n    display: inline-block;\n    min-width: 100%;\n  }\n  \n  .grvsc-line {\n    display: inline-block;\n    box-sizing: border-box;\n    width: 100%;\n    padding-left: 1.5rem;\n    padding-left: var(--grvsc-padding-left, var(--grvsc-padding-h, 1.5rem));\n    padding-right: 1.5rem;\n    padding-right: var(--grvsc-padding-right, var(--grvsc-padding-h, 1.5rem));\n  }\n  \n  .grvsc-line-highlighted {\n    background-color: var(--grvsc-line-highlighted-background-color, transparent);\n    box-shadow: inset var(--grvsc-line-highlighted-border-width, 4px) 0 0 0 var(--grvsc-line-highlighted-border-color, transparent);\n  }\n  \n  .dark-default-dark {\n    background-color: #1E1E1E;\n    color: #D4D4D4;\n  }\n  .dark-default-dark .mtk1 { color: #D4D4D4; }\n  .dark-default-dark .mtk7 { color: #B5CEA8; }\n  .dark-default-dark .mtk12 { color: #9CDCFE; }\n  .dark-default-dark .mtk4 { color: #569CD6; }\n  .dark-default-dark .mtk10 { color: #4EC9B0; }\n  .dark-default-dark .mtk8 { color: #CE9178; }\n</style>","frontmatter":{"date":"November 24, 2021","updated_date":null,"title":"Build Your First Smart Contract with Ethereum & Solidity","tags":["Blockchain","Ethereum","Solidity"],"coverImage":{"childImageSharp":{"fluid":{"aspectRatio":1.5037593984962405,"src":"/static/32b53a158fcbe237c5223007d8b14857/ee604/coverimage.png","srcSet":"/static/32b53a158fcbe237c5223007d8b14857/69585/coverimage.png 200w,\n/static/32b53a158fcbe237c5223007d8b14857/497c6/coverimage.png 400w,\n/static/32b53a158fcbe237c5223007d8b14857/ee604/coverimage.png 800w,\n/static/32b53a158fcbe237c5223007d8b14857/f3583/coverimage.png 1200w","sizes":"(max-width: 800px) 100vw, 800px"}}},"author":{"id":"Aritra Belel","github":"belelaritra","avatar":null}}}},{"node":{"fields":{"slug":"/engineering/blockchain-the-new-technology-of-security-trust/"},"html":"<p>These days we have all come across one of the coolest buzzwords in the IT industry: <strong>\"The Blockchain\"</strong>. It might seem to be a new magic word in the market that companies spell interest in their businesses. However, the complexity of it is incredibly far-reaching. Blockchain integrates the openness and flexibility of the internet with the security of cryptography to come out with a safer, faster way of verification of information and most importantly establishes trust in this open world.</p>\n<p>Blockchain was first developed by an anonymous programmer or group of programmers known by a name 'Santoshi Nakamoto'.It was an underlying technology for the Bitcoin, which is used for peer-to-peer transactions. Blockchain at its heart is a list of transactions like a distributed ledger open to all in the network. It stores the data in such a way that it seems virtually impossible to add, update or remove any information stored without the notice of other users in a peer-to-peer network.</p>\n<h2 id=\"how-does-blockchain-work\" style=\"position:relative;\"><a href=\"#how-does-blockchain-work\" aria-label=\"how does blockchain work permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>How does blockchain work?</h2>\n<p>Blockchain mainly performs two tasks: collect and order data in blocks- similar to the traditional computer database and then chain them securely using cryptography.</p>\n<p>Let us take a closer look at each block in this enormous chain –</p>\n<ul>\n<li>FILLING  IN THE BLOCK\nData: This is the information which depends on the blockchain if it is a bitcoin block, then it contains information about the sender, receiver of the amount and the amount value.</li>\n<li>SECURING THE CHAIN\nHash: It is quite similar to human fingerprint and is unique to each block, once the information of the block changes, the hash changes and the block no longer remain the same as the previous one.</li>\n<li>LOCKING THE BLOCKS DOWN\nHash of the previous block-the hash of one block gives the data for the next block, and this new block uses this hash function and traces of it is woven into the new hash this continues to build an enormous chain.</li>\n</ul>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 711px; \"\n    >\n      <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 47.69230769230769%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAKCAYAAAC0VX7mAAAACXBIWXMAAA7DAAAOwwHHb6hkAAABIUlEQVQoz5WS306DMBTGeWMvfAnfwMQ3MHFXarzVzIsRbzaXTBMXakoIo5kbjLYgUD6hiGkJ/jvJSdPT9tfva4+DJuq6hjnmRYXwTUApu/6XcExYD7h5oDg6nWFJdnre1s19wzTrjq0QSGWO+csGV66Pgyww5mAY5rqlsFV0twhwO/d1bZvk2r55SAiBJEl0xnEMzrm1/gWM+TuCrcBmx3E9XWJFGI7PXFzOaGf701IURSCEgFIKz/MQhqFtuQemjT3KUqyDPdxVAJ6VuJgSPNF9d6DJsiy1wlZZC2SMQUqJLMtsyz3UZwke19GPb9RCh6mUGgdOGkUn54umZaSeV5X69UOGl1pA95lhcv+Kgyisd+kMj7fMsHWc727/TzOb8QEHNwnuvFCfOAAAAABJRU5ErkJggg=='); background-size: cover; display: block;\"\n  ></span>\n  <img\n        class=\"gatsby-resp-image-image\"\n        alt=\"Blockchain\"\n        title=\"Blockchain\"\n        src=\"/static/2b6fcdadf7aabcd2eaab168dcda107a0/a8e5b/block.png\"\n        srcset=\"/static/2b6fcdadf7aabcd2eaab168dcda107a0/a6d36/block.png 650w,\n/static/2b6fcdadf7aabcd2eaab168dcda107a0/a8e5b/block.png 711w\"\n        sizes=\"(max-width: 711px) 100vw, 711px\"\n        style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n        loading=\"lazy\"\n      />\n    </span></p>\n<h2 id=\"establishing-the-trust\" style=\"position:relative;\"><a href=\"#establishing-the-trust\" aria-label=\"establishing the trust permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Establishing the trust</h2>\n<p>The copy of the complete blockchain is with all the participants so that they can detect tampering if the hash matches across the chain then everyone knows that it is trustworthy.\nBlockchain is an emerging technology but has been evolving ever since its innovation. This technology has the unlimited potential to bring about an upheaval in the way everyone- organisations, governments, individuals work together. It promises a simple, secure, paperless path to establish trust for virtual transactions of money, products and other confidential information worldwide.</p>\n<h2 id=\"blockchain-in-action\" style=\"position:relative;\"><a href=\"#blockchain-in-action\" aria-label=\"blockchain in action permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Blockchain in action</h2>\n<p>Blockchain is one of the technologies that has gained popularity from its very birth, and now it is being used in many fields.</p>\n<h2 id=\"financial-market\" style=\"position:relative;\"><a href=\"#financial-market\" aria-label=\"financial market permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Financial market</h2>\n<p>In financial markets, trade is very dynamic where there is the exchange of money, assets involving multiple banks; this may lead to unexpected errors. To reduce this bottleneck blockchain came up with the idea of smart contracts which is a small computer program that describes the transactions step by step combining multiple blockchains, multiple assets and executes the transactions securely.</p>\n<h2 id=\"digital-id\" style=\"position:relative;\"><a href=\"#digital-id\" aria-label=\"digital id permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Digital ID</h2>\n<p>Blockchain can keep track of many commercial transactions and efficiently hold sensitive information. A digital id via blockchain secures the data stored and can be used worldwide in your fingertips.</p>\n<h2 id=\"supply-chain\" style=\"position:relative;\"><a href=\"#supply-chain\" aria-label=\"supply chain permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Supply chain</h2>\n<p>Blockchain can be very handy in monitoring the supply chain in food and manufacturing industries by removing paper-based trails and also removing intermediaries between producers to customers. Not just the above applications it is used in many more places and has changed, is going to change the world around us.</p>\n<h2 id=\"blockchain-the-next-gen-technology\" style=\"position:relative;\"><a href=\"#blockchain-the-next-gen-technology\" aria-label=\"blockchain the next gen technology permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Blockchain the next-gen technology</h2>\n<p>Though it is a new technology, it has an enormous ability to transform everything existing now. As a coin has its two faces, blockchain technology also has some glitches as it can destroy the middlemen in many of the industries.\nBlockchain has already spread its root firmly in soils of the new world, and the swarm of transformation has already begun. It is the responsibility of all the young generation to make complete usage of this technology as it matures and make it to become a huge money plant.</p>\n<style class=\"grvsc-styles\">\n  .grvsc-container {\n    overflow: auto;\n    -webkit-overflow-scrolling: touch;\n    padding-top: 1rem;\n    padding-top: var(--grvsc-padding-top, var(--grvsc-padding-v, 1rem));\n    padding-bottom: 1rem;\n    padding-bottom: var(--grvsc-padding-bottom, var(--grvsc-padding-v, 1rem));\n    border-radius: 8px;\n    border-radius: var(--grvsc-border-radius, 8px);\n    font-feature-settings: normal;\n  }\n  \n  .grvsc-code {\n    display: inline-block;\n    min-width: 100%;\n  }\n  \n  .grvsc-line {\n    display: inline-block;\n    box-sizing: border-box;\n    width: 100%;\n    padding-left: 1.5rem;\n    padding-left: var(--grvsc-padding-left, var(--grvsc-padding-h, 1.5rem));\n    padding-right: 1.5rem;\n    padding-right: var(--grvsc-padding-right, var(--grvsc-padding-h, 1.5rem));\n  }\n  \n  .grvsc-line-highlighted {\n    background-color: var(--grvsc-line-highlighted-background-color, transparent);\n    box-shadow: inset var(--grvsc-line-highlighted-border-width, 4px) 0 0 0 var(--grvsc-line-highlighted-border-color, transparent);\n  }\n  \n</style>","frontmatter":{"date":"October 08, 2020","updated_date":null,"title":"Blockchain: The new technology of trust","tags":["Blockchain","Cyber Security"],"coverImage":{"childImageSharp":{"fluid":{"aspectRatio":1.6666666666666667,"src":"/static/39f6130fcc45e64f3049c5db8f8a19be/14b42/CoverPage.jpg","srcSet":"/static/39f6130fcc45e64f3049c5db8f8a19be/f836f/CoverPage.jpg 200w,\n/static/39f6130fcc45e64f3049c5db8f8a19be/2244e/CoverPage.jpg 400w,\n/static/39f6130fcc45e64f3049c5db8f8a19be/14b42/CoverPage.jpg 800w,\n/static/39f6130fcc45e64f3049c5db8f8a19be/a6352/CoverPage.jpg 960w","sizes":"(max-width: 800px) 100vw, 800px"}}},"author":{"id":"Shraddha V Prasad","github":"shraddhavp","avatar":null}}}}]}},"pageContext":{"tag":"Blockchain"}},"staticQueryHashes":["1171199041","1384082988","2100481360","23180105","528864852"]}