<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Airesh Bhat on Medium]]></title>
        <description><![CDATA[Stories by Airesh Bhat on Medium]]></description>
        <link>https://medium.com/@asper9?source=rss-8606b329fa8d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*d68GAY2iznKW2hhldhKvgw.jpeg</url>
            <title>Stories by Airesh Bhat on Medium</title>
            <link>https://medium.com/@asper9?source=rss-8606b329fa8d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 05:16:32 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@asper9/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Decoding an NFT]]></title>
            <link>https://medium.com/coinmonks/decoding-an-nft-741dd346026b?source=rss-8606b329fa8d------2</link>
            <guid isPermaLink="false">https://medium.com/p/741dd346026b</guid>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[nft]]></category>
            <category><![CDATA[smart-contract-blockchain]]></category>
            <category><![CDATA[ethereum]]></category>
            <dc:creator><![CDATA[Airesh Bhat]]></dc:creator>
            <pubDate>Sat, 18 Dec 2021 06:27:38 GMT</pubDate>
            <atom:updated>2021-12-18T14:25:40.813Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0PUlUi4qDZGS_LEjfMlzgA.jpeg" /></figure><p>An address is the most crucial identifier on the Blockchain. Everyone’s wallet on Blockchain is nothing but an account linked to an address. You will need to submit many documents to get an account number linked to you to open a bank account on an average day. In Blockchain, it’s as easy as making tea 😄Ok, I would say I’ve found that hard too sometimes! But coming back to the point, it’s effortless to create an account on a Blockchain network. Creating an account on Ethereum for a developer is a one-line command.</p><pre>geth account new</pre><p>For an everyday person, it’s as easy as clicking a “Create account” button on any wallet.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/836/1*jzMlDnvERnK2n-A6K2J7_Q.png" /></figure><p>Doing this gives you something called a key-value pair. Imagine you lock something with a unique key(your private key). But this package can only be opened by another key related to yours, and the latter key is what you give the entire world. From this “public key,” we derive your address. This address can now hold your account balance and a few other properties that help the Blockchain network.</p><p>So far, we have with us:</p><ol><li>A private key,</li><li>A public key,</li><li>An address derived from this public key.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Qf8kJJCv6GT3TjWGDkSJhg.jpeg" /></figure><p>Now let’s add a couple of properties to the account state.</p><ol><li>Storage hash that links to the storage of the account</li><li>Code hash that links to the accounts code.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BWIwkN0kgRvJ8EMhkkaNDA.jpeg" /></figure><p>What do we have here?</p><p><strong>A Smart Contract!</strong></p><p>However, this account is not controlled by any user with a private key. It is governed solely by the code it contains. This code, once deployed, cannot be altered! As you can see here, the Smart Contract is nothing but a wallet that has some code logic that operates that wallet.</p><p>Today you created a work of art. On this day, you drew a cube with such perfect dimensions that this piece of craft felt personal to you. This art was such a masterpiece that all you wanted to do now was treasure this piece of art for eternity(slightly exaggerated, but this should work 😄).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/135/1*PJetkZV2A4ttFaqlkS8N9g.jpeg" /></figure><p>How can you make sure this art is traced back to you? How can you ensure that someone cannot copy this piece of art later and claim it as theirs?</p><p>As a developer, I take the code section of the Smart Contract we created above and add a few attributes to it. Imagine I make a basket that collects cubes: “programmatically.”(In the programming world, this basket is called an array). I take unique cubes created by artists, add them to my basket, and return a number to you. Any artist can later use this number to track their cube.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/428/1*Y0jcfrAVKADWDV_1RN5TBw.jpeg" /></figure><p>Now you and I both know that this code cannot be altered once deployed. Hence before deploying this code, I add a few accessibility functions that any artist can later use to upload their art and get this number.</p><p>So what do we have in our code so far?</p><ul><li>A bucket that stores our cubes</li><li>A Create helper that helps artists upload their cube into the bucket and get a number.</li><li>An “ownerOf” helper.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/354/1*B0C4qwTixVhAHurO91_bYA.jpeg" /></figure><p>Now, what is this ownerOf helper?</p><p>This helper function returns the address of the artist that uploaded the cube! As an artist participating in the blockchain network, you will have your wallet(as shown above) with an address linked to you. To upload your cube into the Smart Contract, in this case, the bucket, you will need to call the Create helper and sign that transaction with your address. The code will now map that number returned to you to your address.</p><p>And now, since no one can alter the code once deployed(as we’ve mentioned a million times by now), you can display to the entire world your piece of art with soundproof evidence that you are the owner of this.</p><p>All this, in a nutshell, is an NFT. You are uploading your piece of art with your address linked to prove to the world that you were the creator.</p><p>We can now start modifying the code to add many more helper functions. I can add a Transfer helper to transfer the ownership of my art to some other address(when sold in an auction, perhaps). I can add some logic that makes the owner of my art continuously transfer money to me, maybe yearly. I can create music instead of art and upload that digitally. I can create a billion pokemon and scatter them around in an Augmented Reality world, and you can catch these Pokemon and prove to the world as a whole that you own this rare species of Pokemon 😄. The possibilities are endless.</p><h3>Conclusion:</h3><ol><li>We saw how easy it is to create a virtual bank account on the Blockchain.</li><li>We saw how Smart Contract is a simple extension to this account and is controlled by its code logic.</li><li>We understood how an artist could immortalize their art and prove to others that it is theirs.</li><li>A brief understanding of how NFTs are created.</li></ol><p>There might be many questions that may arise reading this thread. Please do comment below so that we can answer them in a future article.</p><p>Further reading links:</p><ol><li><a href="https://eips.ethereum.org/EIPS/eip-721">ERC721 specs</a> documentation: The coding standard for a smart contract to be a valid NFT token</li><li><a href="https://docs.openzeppelin.com/contracts/3.x/erc721">Guide to construct ERC721 contract</a></li><li><a href="https://takenobu-hs.github.io/downloads/ethereum_evm_illustrated.pdf">Mental models</a></li></ol><p>This article was originally published in our blog <a href="https://blockchainiseasy.github.io/decoding-an-nft/">BlockchainIsEasy</a>.</p><blockquote>Join Coinmonks <a href="https://t.me/coincodecap">Telegram Channel</a> and <a href="https://www.youtube.com/c/coinmonks/videos">Youtube Channel</a> learn about crypto trading and investing</blockquote><h4>Also Read</h4><ul><li><a href="https://blog.coincodecap.com/best-swap-platforms">Best Crypto Swap Platforms in 2022 | CoinCodeCap</a></li><li><a href="https://medium.com/coinmonks/top-5-crypto-lending-platforms-in-2020-that-you-need-to-know-a1b675cec3fa">6 BEST Crypto Lending Platforms — Crypto Loan Sites</a></li><li><a href="https://medium.com/coinmonks/the-best-cryptocurrency-hardware-wallets-of-2020-e28b1c124069">11 Best Hardware Wallet Reviews &amp; Comparisons 2024</a></li><li><a href="https://medium.com/coinmonks/crypto-trading-bot-c2ffce8acb2a">10 Best FREE Crypto Trading Bots in 2023</a></li><li><a href="https://medium.com/coinmonks/best-crypto-signals-telegram-5785cdbc4b2b">5 Best Crypto Telegram Channels 2024 (Trading Signals)</a></li><li><a href="https://blog.coincodecap.com/bitsgap-review">Bitsgap Review - Trading Bots Crypto Signals and Arbitrage 2022 | CoinCodeCap</a></li><li><a href="https://blog.coincodecap.com/best-telegram-channels">40 Best Telegram Channels For Crypto, Movies, Shows, &amp; Lectures | CoinCodeCap</a></li><li><a href="https://blog.coincodecap.com/best-social-trading-platforms">5 Best Social Trading Platforms [2021] | CoinCodeCap</a></li><li><a href="https://blog.coincodecap.com/blockfi-review">BlockFi Review 2021: Pros, Cons and Interest Rates | CoinCodeCap</a></li><li><a href="https://medium.com/coinmonks/buy-bitcoin-in-india-feb50ddfef94">Top 6 Crypto Trading Apps in India — Best Exchanges</a></li><li><a href="https://medium.com/coinmonks/best-crypto-tax-tool-for-my-money-72d4b430816b">10 Best FREE Crypto Tax Software in 2024</a></li><li><a href="https://blog.coincodecap.com/best-hardware-wallet-bitcoin">Best Crypto Hardware Wallets to Store Bitcoin [2021] | CoinCodeCap</a></li><li><a href="https://medium.com/coinmonks/pionex-review-exchange-with-crypto-trading-bot-1e459d0191ea">Pionex Review 2022 — Free Crypto Trading Bots</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=741dd346026b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/coinmonks/decoding-an-nft-741dd346026b">Decoding an NFT</a> was originally published in <a href="https://medium.com/coinmonks">Coinmonks</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Node and Web3]]></title>
            <link>https://medium.com/coinmonks/node-and-web3-8de60f2152b4?source=rss-8606b329fa8d------2</link>
            <guid isPermaLink="false">https://medium.com/p/8de60f2152b4</guid>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[web3]]></category>
            <category><![CDATA[node]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[smart-contract-blockchain]]></category>
            <dc:creator><![CDATA[Airesh Bhat]]></dc:creator>
            <pubDate>Mon, 22 Nov 2021 04:51:48 GMT</pubDate>
            <atom:updated>2021-12-13T09:59:01.446Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*9DPhWZy3nwt3y4Iw" /><figcaption>Photo by <a href="https://unsplash.com/@11th_wave?utm_source=medium&amp;utm_medium=referral">Eleventh Wave</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>While learning Blockchain and this entire ecosystem in general, I had many questions that I didn’t find the answers to very quickly. With so many terms and jargon being used, it was challenging to wrap my head around some concepts even when it was very easy for others. In this article, I aim to explain some of those terms. Diving right in!</p><p>Let’s start by painting a picture!<br>A decentralized system is, as the term suggests, decentralized — not centralized. Our digital ledger article(attach the link) discussed how each node carries a ledger copy. That means every node on this Blockchain maintains the same data. So let’s say Alice’s laptop has this copy of the chain. Now Bob wants to create a <a href="https://www.cryptokitties.co/">Crypto Kitty</a> baby. Somewhere on this chain lies the function call which Bob has to execute to generate this Kitty.</p><p>You can imagine the Blockchain smart contracts to be a huge ground of Tetris Blocks.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*b4V-KtTlyx4PWDlv5IUK1Q.jpeg" /></figure><p>The image above can be considered to be a smart contract that lies in the address given. Each block here is a function and has a particular structure(determined by parameters and function name). Given the address of this smart contract and the structure(commonly called an ABI), Bob can call the function and execute it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*6ow7Yd16Gotlu9HMkodkIA.png" /></figure><p>Bob broadcasts his function execution as a transaction to all the nodes present on the chain. The miner nodes now receive this transaction and try to mine the next block with this transaction in it. Alice here may be one of two types of nodes. Alice might try to mine this block and obtain some rewards(cryptocurrency) as an incentive. Or, she might try to participate in this Blockchain with a copy of this entire chain on her laptop(which is also equally important). So, in a nutshell:</p><ol><li>The transaction goes out to all nodes.</li><li>The miner nodes get to work.</li><li>The <strong>mined</strong> block gets broadcast to all the nodes again.</li><li>The non-miner nodes record this block. The miner nodes record this block as well and now try to start mining the next block.</li></ol><p>Now you might be thinking of the consequences of this. Every transaction done by every person on this Blockchain is recorded. This complete copy is also present in every node on the Blockchain. So as you can figure, one must be very cautious in deciding what will be stored in the Blockchain. Moreover, one cannot create a function that takes up a lot of computing resources. It could potentially block off the entire functioning of the Blockchain network. Hence there is a limit to each of these values.</p><h3>Data Storage on a smart contract</h3><p>A smart contract has these two primary things, states/variables and functions. States store values and functions do operations on these values. Smart contracts store variables and their values in a key-value format. There are exactly 2²⁵⁶ unique keys available in a smart contract. Each storing 32 bytes (2⁵). Hence a contract can store (2²⁵⁶ * 2⁵) bytes which are 2²⁶¹ bytes. There may be other problems, such as <a href="https://freemanlaw.com/hash-collisions-explained/">hash collision</a> before one can reach this storage level.</p><h3>Importance of efficient code on a smart contract</h3><p>Executing a function on the Ethereum blockchain or any other blockchain with smart contracts mean that you have to use someone else’s computing resources. As you very well know, nothing in this world comes for free 😄. Whenever you want to execute a transaction on the Blockchain, you need to pay a small transaction fee. A miner’s job is to mine the transaction sent into a given block. Bob will pay the miner a small miners fee to do so. But if the transaction executes a function that may run in an infinite loop, Bob is completely wasting the miners’ resources. Hence there are two main concepts introduced here: <strong>Gas limit</strong> and <strong>Gas fees</strong>.</p><h3>Gas limit, Gas fees</h3><p>To run a car, you need gas. You pay the gas station X dollars to get Y amount of gas that runs your vehicle for a certain distance. Similarly, when you execute a transaction, you tell the miner you are willing to pay X Gas fees to complete Y amount of computations. Two cases can occur here. The limit you set is more than what was required or lesser.<br>When the limit is more, the remaining amount is refunded back into your account. But if the limit is less, the transaction is reverted, and you still lose all the money you spent.<br>E.g., to execute a simple transaction of sending money from Alice to Bob requires a minimum of 21,000 Gas units. If Alice decides to pay 200 gwei(<a href="https://en.wikipedia.org/wiki/Wei_Dai">Giga Wei</a>), the miners’ fee spent for this transaction is 21,000 * 200 = 4,200,000 gwei or 0.0042 ETH(each gwei is equal to 0.000000001 ETH/10^-9 ETH). So if Alice wants to pay Bob 1 ETH, she has to spend 1.0042 ETH. 0.0042 ETH here is the total gas price or, in common terms, the miners’ fee.</p><h3>How does Bob send the transaction?</h3><p>We’ve been talking about how Bob sends a transaction to the Ethereum smart contract. But how does Bob go about doing it? <br>In comes Web3!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/833/1*3dOjzBJY7fKB8f4LceJYrw.png" /></figure><p>Web3 is the gateway through which one interacts with the nodes. You might have heard of Metamask. Metamask provides the users with an interface to interact with the Ethereum nodes. Querying data, executing functions, sending Ether to other accounts, Metamask can do all this and more. Metamask also acts as a wallet account through which you can store your cryptocurrencies. Like Metamask, there are innumerable apps available to help everyday users like us interact with the Blockchain nodes.</p><h3>Conclusion</h3><p>To summarise, we have learned how:</p><ol><li>Nodes are responsible for picking transactions and mining them into blocks.</li><li>Nodes store all the data on the Blockchain. All the data is open to everyone to verify. This is what gives Blockchain the security we all know.</li><li>We have seen what a miner’s fee is and why each transaction on the Blockchain requires it.</li><li>We also saw what Web3 is and how it helps us interact with the nodes of the Blockchain.</li></ol><p>A few links for further reading:</p><ol><li><a href="https://takenobu-hs.github.io/downloads/ethereum_evm_illustrated.pdf">Ethereum EVM illustrated</a></li><li><a href="https://ethereum.org/en/developers/docs/gas/">Gas and Fees</a></li><li><a href="https://hudsonjameson.com/2017-06-27-accounts-transactions-gas-ethereum/">Accounts, Transactions, Gas, and Block Gas Limits in Ethereum</a></li><li><a href="https://ethereum.stackexchange.com/questions/986/can-a-contracts-internal-storage-keep-increasing-forever">Contract internal storage size</a></li><li><a href="https://medium.com/scrappy-squirrels/estimating-smart-contract-costs-f65acf818c26">Estimating Smart Contract costs</a></li></ol><p>This article was originally published in the blog, <a href="https://blockchainiseasy.github.io/">blockchainiseasy.github.io</a>.</p><p><a href="https://blockchainiseasy.github.io/Web3-and-node/">https://blockchainiseasy.github.io/Web3-and-node/</a></p><blockquote>Join Coinmonks <a href="https://t.me/coincodecap">Telegram Channel</a> and <a href="https://www.youtube.com/c/coinmonks/videos">Youtube Channel</a> learn about crypto trading and investing</blockquote><h4>Also Read</h4><ul><li><a href="https://medium.com/coinmonks/leveraged-token-3f5257808b22">An ultimate guide to Leveraged Token [Bull Token]</a></li><li><a href="https://blog.coincodecap.com/crypto-exchange">Best Crypto Exchange | Top 10 cryptocurrency exchanges 2022 | CoinCodeCap</a></li><li><a href="https://blog.coincodecap.com/best-swap-platforms">Best Crypto Swap Platforms in 2022 | CoinCodeCap</a></li><li><a href="https://medium.com/coinmonks/best-crypto-tax-tool-for-my-money-72d4b430816b">10 Best FREE Crypto Tax Software in 2024</a></li><li><a href="https://blog.coincodecap.com/best-hardware-wallet-bitcoin">Best Crypto Hardware Wallets to Store Bitcoin [2021] | CoinCodeCap</a></li><li><a href="https://medium.com/coinmonks/pionex-review-exchange-with-crypto-trading-bot-1e459d0191ea">Pionex Review 2022 — Free Crypto Trading Bots</a></li><li><a href="https://blog.coincodecap.com/wonderland-offers-an-83412-apy-on-staking-is-wonderland-a-scam">Wonderland offers an 83,412% APY on Staking: Is Wonderland a Scam? | CoinCodeCap</a></li><li><a href="https://blog.coincodecap.com/libra-currency-a-cryptocurrency-by-facebook">Libra Currency - A Cryptocurrency by Facebook</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8de60f2152b4" width="1" height="1" alt=""><hr><p><a href="https://medium.com/coinmonks/node-and-web3-8de60f2152b4">Node and Web3</a> was originally published in <a href="https://medium.com/coinmonks">Coinmonks</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Blockchain gateway — Oracles]]></title>
            <link>https://medium.com/@asper9/blockchain-gateway-oracles-95167ba6b16b?source=rss-8606b329fa8d------2</link>
            <guid isPermaLink="false">https://medium.com/p/95167ba6b16b</guid>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[oracle]]></category>
            <category><![CDATA[smart-contracts]]></category>
            <dc:creator><![CDATA[Airesh Bhat]]></dc:creator>
            <pubDate>Mon, 08 Nov 2021 02:51:51 GMT</pubDate>
            <atom:updated>2021-12-12T12:26:53.563Z</atom:updated>
            <content:encoded><![CDATA[<h3>Blockchain gateway — Oracles</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*DTFnfJSxH8ojrDIh" /><figcaption>Photo by <a href="https://unsplash.com/@sergio76garcia?utm_source=medium&amp;utm_medium=referral">Sergio García</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>We’ve come a long way in this decentralized world. But let’s spend a couple of minutes talking about why we even have Blockchains in our current time.</p><h3>Trust</h3><p>For quite some time now, we have <strong>trusted</strong> many third parties with our information without realizing it. We’ve been <strong>trusting</strong> Facebook to hold our information personal and not sell it to make profits. We’ve been <strong>trusting</strong> banks with our money, hoping they give us a decent interest rate of return, hoping that our money will stay safe with them. The list goes on. In various aspects of life, we have lent our personal information to third parties only to trust that they will not misuse it. The <a href="https://www.investopedia.com/terms/g/great-recession.asp">great recession</a> around 2007–2009 left a group of anonymous coders/developers giving the world a solution to the various issues that centralized institutions have. Bitcoin became the very first working model of a decentralized financial system. Anyone could join this network, and the rules of this institution remained hardcoded. No one could tamper with them. Trust no longer had to be placed on a person or group of people running a company. Instead, people could now put their trust in software that runs on a set of rules regardless of external circumstances. This software is now called Blockchain!</p><h3>What do we still trust now?</h3><p>In the current day and age, we have countless Blockchains. In our previous articles, we introduced Ethereum and, mainly, Ethereum smart contracts. Ethereum smart contracts allowed us to program rules that run when certain conditions are met, regardless of what happens(You can read more about smart contracts <a href="https://blockchainiseasy.github.io/smart-contracts/">here</a>). Let’s say we have a smart contract that runs a betting game. Let the game be on the outcome of a particular sporting event, let’s say football. Participants A and B bet on the result of a football game played between Manchester United and Chelsea. A bets on Manchester whereas B bets on Chelsea. Both A and B deposit one Ether into a smart contract that automatically transfers the total amount to the winner based on the result of the match. This agreement seems pretty straightforward!</p><figure><img alt="A flow of how betting happens between two participants on the Ethereum network" src="https://cdn-images-1.medium.com/max/1024/1*4vxxN-RtxWywcYhzDikXUQ.jpeg" /></figure><p>However, let’s say participant A here is a hacker ☠️. Regardless of the event’s outcome, participant A here manages to send the wrong information to the smart contract. This smart contract, which has only one source of information, now uses the false result to trigger a transaction that the Blockchain cannot revert. You might think it’s pretty simple to undo this issue. Just ask hacker A here to give back the amount to B. But what happens when millions of participants are betting? What happens if we do not know who participant A(the hacker) is?</p><p><em>This issue is a pretty big concern in Blockchain.</em></p><blockquote>How do we provide the correct data to a smart contract which is about to trigger a transaction?</blockquote><h3>Another view to the off-chain data problem</h3><p>In a previous article, we discussed how all the nodes agree on the state after mining each node in the Ethereum Blockchain. Wait, what? The smart contracts work like this; you enter some data -&gt; some computations ⚙️. -&gt; result of the computations 📝 -&gt; store this result as a transaction 📦 . Like this, each block contains, on average, 70 transactions. So let’s say I call the “add” function of a smart contract I deployed on this chain a few days ago. I pass in the parameters 5 and 10. A node somewhere on this network receives this call, executes the add function, and returns the result 15 in a transaction. Broadcasting this transaction to other nodes, they now arrive at the same result using these two input values 5 and 10 and record the transaction on their node.</p><p>This flow is called a deterministic output. At any later stage, I can arrive at this exact point in the transaction. Any other node can verify this transaction this way(in a more mathematical way — Merkel trees). This determinism is what trust is in this decentralized network. This determinism is what makes the Blockchain what it is.</p><p>Let’s now make one of the variables in this transaction dynamic. Instead of the value 5, let’s make it the value of the Bitcoin price at the transaction time. Now think about it, all the nodes do not execute the transaction at the same time. It’s like a wave that starts at one node and moves out to the other nodes. So when the first node executes the transaction, the value of Bitcoin might be “X + $3.4,” but a second later, it might be “X — $1.5”. So how exactly do all the nodes arrive at a deterministic output if one of the inputs itself isn’t deterministic?</p><p>Introducing Oracles!</p><p>A decentralized system is truly decentralized if every part of it operates in a trustless manner. What do I mean by this? If even one dependency of the Blockchain network is centralized, the entire network is now dependant on that one link. Should that link fail, the whole network fails! One solution to the above problem is to have the data provider decentralized as well! Oracles are just that. “Oracles” help provide information to the Blockchain network in a trustless manner.</p><figure><img alt="Single Point of Failure" src="https://cdn-images-1.medium.com/max/911/1*9sAfksp3w9YxVERLbBW3Nw.jpeg" /></figure><h3>How do Oracles work?</h3><p>Oracles are nothing but Smart Contracts again. Their job is to get data from the external world and provide it to other Smart Contracts. It acts as a layer between the leading blockchain network and the outer world(where most data lie). In this scenario, the Smart Contract does not know where the data is coming from. In the sense, a participant cannot learn from which endpoint the smart contract gets its information. Hence, one cannot manipulate the data the Smart Contract receives.</p><p>It’s just as how one contract would make a call to another contract. You have the contract’s address, and with a couple of initialization lines, you can call the functions defined in the caller contract. Below is one such example of how an Oracle can work:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*90mORzd2G_Mhi9CJxVIz1w.jpeg" /></figure><ol><li>The smart contract calls the “getBitcoinPrice” function defined in the Oracle. Along with the function call, we pass a callback function “f” as well.</li><li>The Oracle calls the external API to get the latest Bitcoin Price.</li><li>The api responds with the latest Bitcoin Price.</li><li>The Oracle now calls the callback function f with the latest Bitcoin Price in the parameter.</li></ol><h3>Limitations</h3><p>Oracles have their fair share of problems that might occur. For instance, if the data providers for a particular Oracle are controlled in the majority by a specific company/individual, they might be able to sway the data to their liking. Let’s say a particular Oracle, which responded with the current weather temperature, reads its data from a specific device. Furthermore, let’s say the majority of these devices were manufactured by a single company that has a way to manipulate the device’s reading. This setup gives the company a way to sway the smart contract execution to their liking. This issue is only one such limitation.</p><h3>Conclusion</h3><p>There’s more to Oracles than meets the eye! Oracles are the solution to help Blockchains reach their true potential. If you want to dive deeper into Oracles, you can peruse through the links attached at the end of this article.</p><ol><li><a href="https://setzeus.medium.com/blockchain-oracles-af3b216bed6b">Blockchain Oracles</a></li><li><a href="https://medium.com/@teexofficial/what-are-oracles-smart-contracts-the-oracle-problem-911f16821b53">What are Oracles? The Oracle Problem</a></li><li><a href="https://medium.com/fabric-ventures/decentralised-oracles-a-comprehensive-overview-d3168b9a8841">Decentralised Oracles</a></li><li><a href="https://101blockchains.com/blockchain-oracles/">Blockchain Oracles fundamentals</a></li><li><a href="https://cryptozombies.io/en/lesson/14/chapter/1">Building an Oracle</a></li><li><a href="https://www.gemini.com/cryptopedia/what-is-chainlink-and-how-does-it-work">Chainlink Oracles. What is Chainlink?</a></li><li><a href="https://chain.link/education/blockchain-oracles">What is a Blockchain Oracle?</a></li></ol><p>This article was originally published in the blog, <a href="https://blockchainiseasy.github.io/">blockchainiseasy.github.io</a>.</p><p><a href="https://blockchainiseasy.github.io/oracles/">https://blockchainiseasy.github.io/oracles/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=95167ba6b16b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Smart Contracts]]></title>
            <link>https://medium.com/@asper9/smart-contracts-a194da695a68?source=rss-8606b329fa8d------2</link>
            <guid isPermaLink="false">https://medium.com/p/a194da695a68</guid>
            <category><![CDATA[smart-contracts]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[blockchain]]></category>
            <dc:creator><![CDATA[Airesh Bhat]]></dc:creator>
            <pubDate>Sun, 10 Oct 2021 14:47:28 GMT</pubDate>
            <atom:updated>2021-10-10T14:50:06.378Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*-zaiq_YP-P_famqJ" /><figcaption>Photo by <a href="https://unsplash.com/@cytonn_photography?utm_source=medium&amp;utm_medium=referral">Cytonn Photography</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>There are a million articles out there explaining what smart contracts are. In short, they all say that a Smart Contract is “A program that runs on the Ethereum blockchain.” How does one make this program run? How does this program even exist on the blockchain? Why are there programs on the blockchain? These are some of the topics we will be covering in this article.</p><p>In the Ethereum blockchain, there are two main entities. Actual people who are interacting with the blockchain and Ethereum smart contracts. However, both these entities have addresses. What do I mean by this? Both smart contracts and people have an address. Both of them can store Ether in their accounts. They can spend Ether as and when they want and however they want to. So what exactly is the difference here?</p><p>Smart Contracts are hardcoded. Once deployed, one cannot alter a Smart Contract. The logic encoded in this smart contract cannot change once it has an address attributed to it. As a person, I can commit to someone that every week, on Monday at 7 AM, I will transfer 1 Ethereum to your address. However, there is no way anyone can enforce this commitment. One Monday, I might forget. The other Monday, I might send 0.5 Ether. A smart contract, however, once coded, cannot break this commitment. If one codes a Smart Contract to send 1 Ether to X address every Monday at 7 AM, it will honor the code as long as the Smart Contract has money in its address. No one can tamper with this. No one can alter this.</p><p>As you might have heard, nothing on the blockchain can be tampered with. Once recorded in the ledger, there is nothing that can alter that data(Maybe not “nothing.” Most of the hacks that are possible are primarily theoretical, not something that anyone can practically achieve quickly. For example, the <a href="https://www.investopedia.com/terms/1/51-attack.asp">51% attack</a>).</p><h3><strong>Programming and deploying the Smart Contract</strong></h3><p>So how does one go about programming these smart contracts? Everything has a programming language. Like websites are built using HTML, CSS and, Javascript, Ethereum Smart Contracts are built using Solidity. Ethereum uses Solidity to write programs(whose syntax is very similar to Javascript). They are then compiled into bytecode (ones and zeroes that computers can understand). This bytecode is sent as a hexadecimal value(a form of representing these ones and zeroes) in the input data field in a transaction. This process of sending the bytecode in the transaction is called the deployment of a smart contract. The Ethereum blockchain understands that a program is being deployed and assigns an address to this smart contract. Anyone can then send money to this Smart Contract or extract money from this Smart Contract using this address. You can find the exact process of how to deploy and interact with a smart contract in <a href="https://docs.openzeppelin.com/learn/deploying-and-interacting">this article</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9QhiZOkBQHluIHOa5DGU0Q.png" /></figure><p>You can check the input data of <a href="https://rinkeby.etherscan.io/tx/0xcf7f88197c1178a1a94fb3ea21682f8e7a3747ba688eb80ffd0d070ce2ef4c27">this transaction</a> which deployed a sample contract onto the Ethereum test chain.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XD3fnjzy7KHj3dIT-6Y80w.png" /></figure><h3>Different kinds of Smart Contracts</h3><p>Let us now talk about why there are programs on the Ethereum blockchain. From the above explanation, it should be pretty obvious. You might have heard of a term called DApps(we will be covering this in a future article). These are Distributed Applications that have a Smart Contract encoded in them. These apps provide ways to interact with a smart contract, display the current state of a smart contract, and mainly execute some logic. Some of the famous DApps are, Uniswap, MakerDAO, CryptoKitties. Each of these apps aims to code some agreement in a smart contract. This agreement is always kept regardless of external circumstances. If you want to read more about Uniswap and MakerDAO, click on the links below.<br>1. <a href="https://blockchainiseasy.github.io/decentralised-exchange-part-1/">Uniswap</a><br>2. <a href="https://blockchainiseasy.github.io/MakersDAI/">MakerDAO</a></p><h3>State of a Smart Contract</h3><p>In the previous paragraph, I mentioned something called the state of a Smart Contract. What exactly does this mean? Each smart contract can hold data. This data is stored in variables which can be numbers, strings, addresses, and so on. Even more complicated variable types are mappings which map addresses to string or integer or even to addresses. These are just a few examples. After mining a block, that block holds the current state of all the smart contracts in the Ethereum blockchain. The current state is the current value of all the variables, the amount of Ether stored in the Smart Contract addresses, and other normal addresses.</p><p>Apart from variables, Smart Contracts contain functions as well. They execute when certain conditions are satisfied. One can run a function on the Smart Contract by sending a transaction with the required parameters in the data field of the transaction. For example, if I want to enter a competition that has an entry fee of 0.01 Ether. I would interact with the host’s Smart Contract(mostly done via a DApp) and send 0.01 Ether to their address. Then the host’s Smart Contract will give my address a pass. Later, when I want to enter the competition, I would need to verify my address and, once approved, can join in successfully.</p><p>Thus, with Solidity’s variables, functions, and many more APIs, one can build various features on the Ethereum blockchain. You might have heard of the term NFT(Non Fungible Token). These are nothing but Smart Contracts with certain logic in them. Each NFT is a Smart Contract which has a variable that stores the owner’s address of the NFT. It also has specific functions that help transfer the ownership of the NFT to someone else. They have particular modifiers that help prevent attackers from gaining unwarranted control of the NFT. The technical term for an NFT Smart Contract is called ERC721. We’ll dive into what this means in a future article! For now, all you need to know is that ERC721 defines a set of functions that need to be implemented to make a Smart Contract into an NFT.</p><h3>Summary</h3><p>To summarise, we have seen:<br>Smart Contracts are nothing but Solidity programs compiled and stored on the blockchain network with a specific address attached.<br>* How an agreement once encoded and deployed cannot be altered with.<br>* We can interact with a Smart Contract by sending a transaction with some data along with it.<br>* Some use cases of Smart Contracts and how they are in use today.</p><p>This article was originally published in the blog, blockchainiseasy.github.io.</p><p><a href="https://blockchainiseasy.github.io/smart-contracts/">https://blockchainiseasy.github.io/smart-contracts/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a194da695a68" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>