<?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 Samuel Onyinyechukwu Okafor on Medium]]></title>
        <description><![CDATA[Stories by Samuel Onyinyechukwu Okafor on Medium]]></description>
        <link>https://medium.com/@samuelgift09?source=rss-9bce9c91516b------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*4Be59oM9QBBDy-frK-y3fg@2x.jpeg</url>
            <title>Stories by Samuel Onyinyechukwu Okafor on Medium</title>
            <link>https://medium.com/@samuelgift09?source=rss-9bce9c91516b------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 14:09:05 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@samuelgift09/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[THE JOURNEY TO BECOMING A WORLD-CLASS RUSTACEAN-1]]></title>
            <link>https://medium.com/@samuelgift09/the-journey-to-becoming-a-world-class-rustacean-1-27d4451221ba?source=rss-9bce9c91516b------2</link>
            <guid isPermaLink="false">https://medium.com/p/27d4451221ba</guid>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[rust]]></category>
            <category><![CDATA[decentralization]]></category>
            <category><![CDATA[smart-contracts]]></category>
            <category><![CDATA[solana-network]]></category>
            <dc:creator><![CDATA[Samuel Onyinyechukwu Okafor]]></dc:creator>
            <pubDate>Wed, 05 Nov 2025 12:24:28 GMT</pubDate>
            <atom:updated>2025-11-05T12:24:28.683Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*s0FGpE9DT4mDdjj9USspUQ.jpeg" /></figure><p>I went the route of ignoring Rust, while being vocal about the EVM being sufficient, and even got into fiery arguments regarding EVM vs SVM and CosmWasm. Despite the inherent flaws the Ethereum Virtual Machine possesses, I believe — and still do — that a system built specifically for an ecosystem will remain the top platform in the long run, the platform of choice for any tangible protocol built in the space. Given how intensely I defended the EVM and Solidity, its partner in crime, you might think I was somehow related to Vitalik Buterin or a major shareholder in the Ethereum Foundation. But this love was cultivated during the lockdown in 2020, and the amazement I felt the first time I looked at a cluster of Solidity codes. To me, that was the most beautiful thing I had ever seen at the time, and in no time, I made a smooth transition from my Web2 background to writing Solidity code seamlessly. A reason that can&#39;t be overstated was the similarity between this new, shiny programming language and the JavaScript I was already accustomed to at the time. The transition seemed natural and was a massive factor for me, as well as for many others who would join the wave over the next couple of years. Love is a beautiful thing, as they say, and it is even better at first sight. Unfortunately, that was not the case when I first looked at the lines of code written in Rust, the primary language for Solana development. Unlike Solidity, it just seemed like a whole lot was going on, and it didn’t seem as readable as other languages I had prior experience in.</p><p>So, as much as I like to disagree, one of the factors that fueled my passionate defence of the EVM during those arguments was the reminder of how confused and dazed I was when I actually met Mr Rust. A proper WTF moment. I said to myself, Naa, there’s still a lot to learn about in Solidity: Account Abstraction, which I will be writing about soon, Assembly using Yul, and also Auditing. It’s not all doom and gloom, though, because to justify my flight from Rust, I actually went and learnt all these and got a level of mastery in each. But I always knew my flight from Rust was a case of me avoiding the inevitable. Given the meteoric rise of the language and its importance in not just Solana Virtual Machine development, but also as one of the two key languages in Ethereum Core Development, alongside Go, avoiding Rust was shaping up to be an unwise decision in the long run. Ethereum Core Development? What is that, and is it the same as the Ethereum Virtual Machine? Isn’t Solidity the language of choice for this? How does Rust come into this? Yes, these are questions I asked myself at a point in my journey, and I’ll break it down in the way I would have liked it to be explained to me then.</p><p>The Ethereum Virtual Machine is a protocol that facilitates the development of decentralised applications on the Ethereum Blockchain. Most cryptocurrencies, Decentralised Finance exchanges, and Decentralised Autonomous Organisations are built on top of this using Solidity and, in recent times, Vyper. Now, Ethereum Core Development involves the process of creating this virtual machine that the Ethereum Blockchain runs on, this same machine that serves as a launchpad for the various dApps in existence today. It involves defining consensus using codes, execution techniques, and the gas structure. In simpler terms, the EVM is the ground floor of a bungalow, which contains TVs, a Sofa, a Bed, Wardrobes, which we can liken to dApps. Then, the foundation of this lovely house is the ETH Core Protocol. The two primary programming languages used in this field are Go (also known as Golang) and Rust. The primary reason for this is its memory management and the way ownership is handled in both.</p><p>The EVM remains popular and the leading Web3 ecosystem, and I understand why some people might feel that there seems to be no reason actually to delve into Rust. There’s still a lot to build on the EVM, and a lot more to secure for those in the Security Research path. Well, I wouldn’t be so sure. Vitalik has proposed a seismic shift from EVM to a system with very high resemblance to the SVM by 2030, and there is a massive chance that this migration will demand the use of Rust for its programs. While he has stated that existing smart contracts written in Solidity will still be compatible, it signals a massive recalibration in the future of the Ethereum Blockchain. Why will Vitalik champion this move despite being one of the leading figures for the genesis of Solidity? Well, the answer lies in the limitations of Solidity and how these limitations compound vulnerabilities and reduce throughput. For example, the Ethereum Virtual Machine operates in a sequential mode of execution, meaning that a transaction must be executed before another. In contrast, the Solana Virtual Machine runs a parallel execution mode, which means that there is no such wait.</p><p>Rust isn’t perfect, but there are built-in features that make it secure and fast. The way the concepts of ownership, borrowing, and references work makes it ideal for use in building complex systems that require high throughput. This makes it suitable for building complex systems and execution clients that are crucial for Blockchain performance and speed. Admittedly, this results in a significant tradeoff that can make the learning curve steeper than that of most programming languages; the effects of this tradeoff were what struck fear into me during our first encounter. That’s the reason why a widespread belief exists about its high barrier to entry, especially among new developers. This is also a belief that I held onto during my EVM vs. COS-Wasm argument days. There might be some truth to this, but if there is anything that can contribute to the acceleration of learning and mastering tools in this ecosystem, it’s well-structured documentation that is free of overblown jargon. Luckily, the best documentation in the entire software engineering happens to be the one written to acclimatise new engineers to the Rust language. I’m talking about the <a href="https://doc.rust-lang.org/book"><strong>Rust Book</strong></a>, and finding this resource tore down the wall I had put up regarding this path and demystified this language. The Rust Book not only educated me on Rust, but it also taught me important things that happened behind the scenes with other programming languages that I had previously claimed mastery of, things that I had no prior knowledge of. Examples included how memory is allocated and deallocated, Error handling, and also how some languages check for errors during <strong>Runtime</strong>, while some do this during <strong>Compilation</strong>.</p><p>Rust is a statically typed language, which means that it expects the variable type to be defined at compile time. This enhances speed and ensures that the compiler doesn’t have to manually check and identify the data type of variables fed to it. Some other examples of statically typed languages include Solidity, Go, Typescript, C, C++, and Java, amongst others. In contrast to statically typed languages, there exists another group of languages known as dynamically typed languages. These languages ensure that type checking takes place during runtime, and they include JavaScript, PHP, Python, and others. Rust uniquely handles memory allocation, and different data types are stored in distinct locations according to their nature. Fixed-size variables are stored on the Stack, while variables that can have their size increased are stored on the Heap. The last storage destination is the Static memory, and this is usually reserved for String Literals. Variables are handled based on where they are stored, and this is a crucial element of Rust that serves as the foundation for all other aspects of the language. And we’ll be looking into this in depth in the following chapters. Rust can be very strict in enforcing its rules and ensuring that invariants are not broken, which can hinder functionalities in exceptional cases and protocols. To address this, an alternative called Unsafe Rust is available. In this case, the developer agrees to bypass the safety features of Rust and take full responsibility for any issues that might arise as a result of this. To fully understand what Unsafe Rust entails, it is important to understand why the Standard Rust is considered Safe, so we will delve into Unsafe after gaining a measure of comprehension about the basics of Safe Rust.</p><p>This is the first entry in a series of in-depth insights into this language. I&#39;ll be sharing my findings and the intricacies that set this language apart from the rest. I’ll be comparing the data types and components that exist in the languages I’m previously familiar with, and how similar or different they are in Rust. After a certain degree of mastery in the Fundamentals of Rust, I will explore the world of the SVM and how Rust is utilised to write smart contracts that run on Solana. Finally, to conclude this introductory Chapter, it is only proper that we adhere to the law and showcase how the infamous “Hello World” would be written in Rust.</p><pre>fn main() {<br>    println!(&quot;Hello World&quot;);<br>}</pre><p><em>Enjoyed this read? Do not hesitate to leave some claps. You’re also welcome to leave a comment if you have any questions.</em></p><p><a href="https://x.com/SwizzSamuel16"><strong><em>Follow me on Twitter</em></strong></a>.</p><p><strong><em>&amp;</em></strong></p><p><a href="https://www.linkedin.com/in/samuel-okafor-a64503182"><strong><em>Let’s Connect on LinkedIn</em></strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=27d4451221ba" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[THE GENIUS ACT: A BILL WORTHY OF ITS NAME?]]></title>
            <link>https://medium.com/thecapital/the-genius-act-a-bill-worthy-of-its-name-701cc5e33a10?source=rss-9bce9c91516b------2</link>
            <guid isPermaLink="false">https://medium.com/p/701cc5e33a10</guid>
            <category><![CDATA[government]]></category>
            <category><![CDATA[stable-coin]]></category>
            <category><![CDATA[finance]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[technology]]></category>
            <dc:creator><![CDATA[Samuel Onyinyechukwu Okafor]]></dc:creator>
            <pubDate>Mon, 04 Aug 2025 16:08:09 GMT</pubDate>
            <atom:updated>2025-08-07T19:19:12.217Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-gerxy586Op3Nnosmd3gSA.jpeg" /></figure><p>It has been just a few months since my <a href="https://medium.com/thecapital/the-beauty-of-stablecoins-and-what-you-ought-to-know-about-them-02bfc329c22f">lengthy exposé</a> on stablecoins, but events of a decade&#39;s worth have transpired in the Blockchain world. The path to widespread adoption of Blockchain technology has been debated, and in recent years, concepts like Non-Fungible Tokens (NFTs) and DeFi platforms have all staked a claim to this. However, it’s now undeniable that stablecoins will achieve this and herald a new dawn for the ecosystem. It is only right that this phenomenon carries the torch; it has an uncanny similarity to existing systems but also provides a massive advancement in terms of security, speed, and transparency. Stablecoins are at a point where it’d be utter foolishness for the suits parading along the White House, Kremlin, Downing Street and the likes to ignore outright and just as the battle for Artificial Intelligence supremacy rages on, another battle is being fought with regards to dominating the stablecoin ecosystem and the biggest bullet so far just got fired by the ever-polarizing President Trump with the GENIUS Act. This acronym, which stands for the <strong>Guiding and Establishing National Innovation for U.S. Stablecoins Act</strong>, is a bill that utterly reshapes the digital currency framework in the world&#39;s strongest economy while also positioning the United States Dollar as the long-term strategic reserve for stablecoins around the globe. With regards to this vision, it can be clearly seen that there is an existing advantage, given the dominance of USD-backed stablecoins at the moment. The USDT minted by Tether and USDC from Circle are the two dominant stablecoins in circulation, and they share a few things in common: first is the fact that a proven USD reserve in form of either treasury bills or cash backs them and the second which we will investigate down the line given its crucial importance regarding the GENIUS act is the fact that they are FIAT pegged and not algorithmic in any form.</p><p>In Southeast Asia, the Hong Kong stablecoin bill, which is viewed in some circles as an extension of the Chinese Belt and Road Initiative, was also passed successfully, and this act offers a strategic alternative to the Genius Act and its vision, which is a pathway to sustained US Dollar dominance. The hegemony of the US dollar has been under fire in recent times, with the BRICS nations attempting to dissolve this and usher in a new financial system that is not solely dependent on the currency and the SWIFT network. The emergence of the stablecoin system, which is faster, more secure and operational without the downtime limitations occasionally associated with SWIFT, provides a launchpad for this ambition. The GENIUS Act is the United States showing its hand and making it clear that it will not be idle and watch as this well-thought-out plan comes into fruition. Given its existing dominance, you won’t be wrong to conclude that the US is well placed to win this war, but it could be too early to call.</p><p>After a series of coordinated attacks on the feasibility of a decentralized framework powering the financial system, most especially from existing juggernauts, the writing on the wall has been made clear, and firms opposing the revolution face the risk of being left behind. As a result, the race that has been run in the shadows is now in the light due to the GENIUS Act. Big Finance companies are now expressing their desire to fully integrate stablecoins, with some open to using existing ones, while some are exploring pathways to create their unique stablecoins. Regardless of the path taken, the delusion that came with their initial stance of maintaining the predated system of money as it was, is now unravelling. Unbeknownst to all involved, the landscape of finance changed the very day that Satoshi Nakamoto published the Bitcoin White Paper, which was the spark that lit the fire. The GENIUS Act makes a provision at its core that enables the United States to exert, to a degree, influence on the flow of stablecoins while ensuring the continuation of the US dollar&#39;s dominance. This aim is disguised as an attempt to ensure compliance and regulation, but behind the veil is a well-defined strategy centred on ensuring financial domination. How? You may ask. How does a misstep with stablecoins possess the power to alter the fortunes of the almighty Dollar? Well, at the moment, there are billions of USDT and USDC in circulation, with each single digital dollar backed by an equivalent physical dollar of the same value. With the inevitable rise of stablecoins as a means of payment, settlements, and cross-border transfers, there is undoubtedly going to be more digital currencies funnelled into this network and making the US dollar the cornerstone ensures an increase in demand. This establishes the dominance of USD-pegged stablecoins and, in turn, maximises the need for the US dollar.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N4NduzfJmIq1vTwk3D5tDw.png" /></figure><p>Stablecoins can help lift bottlenecks associated with the present traditional way of sending payments, both within a nation and cross-border payments. The current issues plaguing international payments include the long wait for settlement using the SWIFT network, as well as the charges associated with this. It is not a rarity for cross-border payments to take a couple of days without settling, in contrast to the few seconds that it would when using the stablecoin payment rails. This is an intriguing proposition because, for all the clamour about boosting the speed, eliminating the charges is not something gargantuan financial institutions are likely to cherish. This is a big question we’re likely to see unfold over time after the executive recognition of stablecoins. It is expected that existing finance giants will adjust to the new reality, but it will be very interesting to see this play out in real time.</p><p>The GENIUS Act aims to ensure that stablecoins can only be issued by financial firms designated as a Permitted Payment Stablecoin Issuer (PPSI). This allows banks and credit unions to integrate existing systems or chart their course, but most importantly, it provides a legal framework for oversight. From a certain lens, it can easily be deduced that this has no immediate impact on the normal user who has engaged in the normal transfer or receipt of stablecoins, irrespective of jurisdiction or region. Regardless, it is a huge breakthrough for nations to finally acknowledge the elephant in the room, which is the fact that the revolution can only be delayed and not denied. The GENIUS Act is truly genius, not because it causes a drastic change or that it makes cryptocurrency activities smoother, but it is a genius stroke because it comes off as an act to secure and strengthen regulatory statutes while shielding its intention, albeit poorly, which is a long-term domination of the United States Dollar in the far ranging worldwide financial landscape.</p><p><em>Enjoyed this read? Do not hesitate to leave some claps. You’re also welcome to leave a comment if you have any questions.</em></p><p><a href="https://x.com/SwizzSamuel16"><strong><em>Follow me on Twitter</em></strong></a></p><p><strong><em>&amp;</em></strong></p><p><a href="https://www.linkedin.com/in/samuel-okafor-a64503182"><strong><em>Let’s Connect on LinkedIn</em></strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=701cc5e33a10" width="1" height="1" alt=""><hr><p><a href="https://medium.com/thecapital/the-genius-act-a-bill-worthy-of-its-name-701cc5e33a10">THE GENIUS ACT: A BILL WORTHY OF ITS NAME?</a> was originally published in <a href="https://medium.com/thecapital">The Capital</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Beauty of Stablecoins and What You Ought to Know about Them.]]></title>
            <link>https://medium.com/thecapital/the-beauty-of-stablecoins-and-what-you-ought-to-know-about-them-02bfc329c22f?source=rss-9bce9c91516b------2</link>
            <guid isPermaLink="false">https://medium.com/p/02bfc329c22f</guid>
            <category><![CDATA[finance]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[cyrptocurrency]]></category>
            <category><![CDATA[stablecoin-cryptocurrency]]></category>
            <category><![CDATA[technology]]></category>
            <dc:creator><![CDATA[Samuel Onyinyechukwu Okafor]]></dc:creator>
            <pubDate>Mon, 07 Oct 2024 14:25:34 GMT</pubDate>
            <atom:updated>2025-06-26T11:26:21.107Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*78cBEpRNNBTfH_LewhUBXA.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@coinwire?utm_content=creditCopyText&amp;utm_medium=referral&amp;utm_source=unsplash">CoinWire Japan</a> on <a href="https://unsplash.com/photos/a-group-of-numbers-iNOavZh6dQ8?utm_content=creditCopyText&amp;utm_medium=referral&amp;utm_source=unsplash">Unsplash</a></figcaption></figure><p>Stablecoins have become a very core feature of the Blockchain ecosystem. Although behind the scenes, some stablecoins go about their architecture in some way that seems very unblockchainlike, they provide an essential escape for people who are wary of the volatile nature of other cryptocurrencies. Being unblockchainlike is something we can, however, forgive, after all, when the Ethereum network was hard forked after the infamous DAO attack, that was as unblockchainlike as it could get. “<strong><em>Code is the law!”</em></strong> is a common saying in the Blockchain world and a phrase the bad actor responsible for the DAO attack would reiterate, albeit on deaf ears. The number of losses incurred from this attack was so significant at the time that the Ethereum foundation deemed it necessary to restart the network, which is crazy to look back on because, in recent times, we have seen losses from hacks that have dwarfed that of the infamous DAO. Some purists disagreed with the idea of rewriting the entire blockchain to return the stolen funds to the owners, and they chose to remain, forging ahead with the <strong><em>Ethereum Classic</em></strong> that is still in existence today. I wrote an in-depth expository about this in another article of mine titled <strong><em>“Security Issues Plaguing the Web3 Ecosystem,”</em></strong> so at this junction, I will be rerouting back to stablecoins.</p><p>Stablecoins are huge at the moment and provide an ideal entry point for people aiming to know what the buzzword “Blockchain” is all about. Its utility can’t be overstated and stretches from cross-border payments, investments of various natures, lending pools, and even common purchases in recent times. Despite its relatively high adoption, most of its users or holders still struggle to understand how it works and what goes on behind the scenes to keep these tokens pegged to the USD at a 1:1 rate. Not that it matters to most, though, as long as stables equal 1 USD, that&#39;s good enough. Most people think this can’t be altered, or, I will say, thought rather, because, after the disaster with the widely publicised TerraUSD (UST) crash, more questions were asked about what holds stablecoins together. What&#39;s the tipping point? When does the Ivory Tower collapse? What happened to the UST? The case of UST is a classic example of one of the several complexities under the hood going completely wrong and, in the process, destroying an entire ecosystem. Please, this is not intended in any way to create panic for readers holding stablecoin, but I do hope by the end of the long read, you will grasp how the stablecoin works and also why your current holding will most definitely not end up like UST, well, hopefully.</p><p>Stablecoins are unique and can be classified under different categories based on how they’re developed and the assets backing them, but they all share a similarity in the burning and minting process. There are a series of operations that work together in tandem to ensure that the price of the stablecoin remains stable, and upon taking a closer look, it is surreal to see how these operations, which can be complex or basic depending on who’s examining, actually sustains tokens with market cap running into billions worth of the US Dollar. Some popular stablecoins in existence include Tether USD (USDT), Circle USD (USDC), Binance USD (BUSD), DAI, and GHO.</p><blockquote>Several yardsticks can be used to classify stablecoins. On a different day, a simple Google search on the types of stablecoins can provide something different from what you’ve been told. Still, I would like to make it clear that regardless of what type, classification, or categorization of stablecoin, they all share the same fundamental principle that keeps them stable, and these processes are: <strong>Minting</strong> and <strong>Burning</strong>. <strong>Minting</strong> is simply the process by which a unit of stablecoin is issued, while <strong>Burning,</strong> which is the reverse, entails the removal of a stablecoin unit from circulation. This process keeps the stablecoin relatively pegged to any currency of choice.</blockquote><p>While there are different ways that stablecoins have been classified over time, I think that the best way of doing this with the knowledge we have now is by categorizing it into two:</p><ol><li><strong><em>Pegged</em></strong></li><li><strong><em>Floating</em></strong></li></ol><p>These provide a simplified overview of the stablecoins in existence. While most stablecoins listed fall into the first category, ignoring the groundbreaking advancement the team at Reflexer has made in changing everything we have learned about stablecoins would be a disservice. Pegged stablecoins are the status quo, and most stablecoins operate in this manner, but then the idea of a floating type changes everything. Firstly, there is a need to examine what a pegged stablecoin is all about before it’s possible to put the nature of the RAI token in perspective. A pegged stablecoin is pegged to a currency, which is the US Dollar in the case of most stablecoins. They are collateralized by a form of assets, which can either be a Fiat reserve, cryptocurrency, treasury bonds, or something of value. The collaterals provide support that holds the stablecoin against its peg. The Reflexer team opted against this and went about the process in an entirely different way, highlighting that the popular system was flawed and didn’t meet the requirements for decentralization, which is the supposed backbone of the stablecoins. With the use of unique algorithms, they proposed a floating system where the stablecoin wasn’t pegged but rather had its price influenced by current market factors and dynamics. Instead of seeking a 1 stablecoin = 1 USD like pegged stablecoins do, the price of RAI, which is the premier floating stablecoin, floats depending on market conditions, and price stability is achieved by incentives. While this has been lauded as innovative and transformational, more risks are associated with this than you would get with your traditional stablecoins. I will elaborate more on the RAI stablecoin later because just like the existence of the pegged stablecoins highlighted the demand for it, it is of equal importance to see the intricacies of the pegged stablecoin to understand the problem that the floating stablecoin hopes to solve.</p><h3><strong>Pegged Stablecoins</strong></h3><p>At this point, a lot has been said already about this category of stablecoins, but I will still go ahead and say that, in most layman&#39;s terms, a pegged stablecoin simply represents a stablecoin that is pegged to something of known value. In more popular cases, the US Dollar has been the norm, but in its place, it could be the Japanese Yen, the Nigerian Naira, the Pound Sterling, or any other currency. One thing remains true: the peg aims to ensure that a unit of the stablecoin is always of the same value as a unit of the currency it’s pegged to, and behind the scenes is a series of processes that ensure that this remains the case.</p><blockquote>Contrary to what some might think, the near-constant value of the stablecoin is not hard coded as an immutable digit on the Blockchain. If you ever felt this way about stablecoins, you are forgiven because I was equally guilty of the same upon my first encounter with stablecoins.</blockquote><p>Regardless, please know that I feel devastated to lay waste to such a pure and serene concept you had. The value of the stablecoin is determined and maintained by its underlying collateral. The 1: 1 USD peg is possible because of the collaterals backing the stablecoin, coupled with the burning and minting process. At this point, we can further categorize pegged stablecoins based on their type of collateral, and as such, we have:</p><ol><li><strong>Fiat collateralized Stablecoin</strong></li><li><strong>Crypto collateralized Stablecoi</strong>n</li></ol><h4>Fiat Collateralized Stablecoin</h4><p>The Fiat collateralized stablecoin represents two of the biggest stablecoins in existence, USDC and USDT, and I will be placing great emphasis on both to highlight the features, advantages, and drawbacks of this type of pegged stablecoin. Fiat is simply a government-issued currency that is not backed by a commodity. In simpler terms, the legal tender of a nation is what you would consider Fiat. When a stablecoin is said to be backed by fiat reserves, it simply means that there is a large amount of fiat currency stored somewhere, in most cases, that helps the stablecoin maintain its peg against Fiat. At this point, you can see why there can be cases made against this type of stablecoin, as the elements of centralization present seem inherently overwhelming. In the case of USDT and USDC, for every stablecoin in circulation, there is an equivalent amount of US Dollars stored in a bank account managed by the centralized governing body. These reserves are the reason why 1 USDT or 1 USDC is equal to 1 US Dollar. Earlier, I mentioned how <strong><em>Burning</em></strong> and <strong><em>Minting</em></strong>, regardless of the category of stablecoin, provide an overview of its working mechanism, and it’s important to highlight how this crucial process is handled in a typical Fiat Collateralized Stablecoin.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/612/1*gzxqLgWquq-98qOYIz2SQA.jpeg" /></figure><p>Before I proceed, it&#39;s important to note that <em>Minting</em> provides all the stablecoin in circulation, unlike a cryptocurrency like Bitcoin, where <em>Mining</em> takes on that responsibility. To mint a typical Fiat collateralized stablecoin, the person will need to send the equivalent amount in Fiat to a bank account number provided by the governing body after all proper KYC(Know Your Customer) and AML(Anti Money Laundering) procedures have been duly satisfied. Taking the USDT as our case study, an individual trying to mint $1,000,000 worth of USDT will have to make a transfer of the same amount in US Dollars to the bank account provided by Tether Limited Inc., the governing body for USDT. As I previously mentioned, this is after necessary checks are passed and the governing body is convinced that the individual can proceed. KYC? AML? With all these rigorous processes, why not just buy USDT on a CEX like Binance or Coinbase? That’s a valid question that has multiple valid answers. First, most times, such individuals do buy a very large amount of USDT, and onboarding such an amount to a CEX to be able to make a trade can be a hassle. And even when you can find a way to do this, liquidity can also be an issue. Another reason is that such individuals fancy getting the stablecoin at a fixed 1 USDT: 1 USD rate, unlike exchanges where stablecoin does float at times to 0.99 USD or $1.01. $0.99? How does that happen? Isn’t a unit of the stablecoin always supposed to be equal to a unit of its fiat reserve? The answer to this is yes, but on some occasions, the value of the stablecoin can float below or above the pegged price and become $0.99 or $1.01. Yes, this happens, and the system has a way of correcting it, and this process involves Minting and Burning. Now, let’s go in-depth on the latter. While Minting in the case of USDT involves getting stablecoin as a result of depositing US Dollars, Burning, by contrast, entails the process of getting back US Dollars by sending USDT and also taking the USDT off circulation. So, in the case of a stablecoin being valued at $0.99, a user that had in the past minted tokens can buy a huge amount of USDT at this perceived discount rate, then redeem the amount by having them burnt at the rate of $1.00 and then having the equivalent amount send to his Fiat bank account. In the case of the stablecoin trading for $1.01, the user can initiate a reverse process, this time minting a huge amount from Tether Limited Inc. at a rate of 1 USDT: 1 USD after making a transfer to Tether’s bank. After receiving the USDT, the user can proceed to sell the USDT at the value of $1.0. In both cases, the individual makes a great profit, and this process is also known as arbitrage trading.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/612/1*ykxhrsf8GdPyGR69FIAxTA.jpeg" /></figure><p>Despite the criticism of the Fiat collateralized stablecoin, I assure you that this system works, and having USDT and USDC as the top dogs in this ecosystem is a testament to this. Regardless, issues are being continually raised about it not being decentralized enough for a platform that runs on the Blockchain. The presence of a centralized system that controls minting, coupled with the hesitance to provide a clear picture of actual reserves, has led to raised eyebrows. Also, the governing body possesses the ability to freeze USDT and blacklist addresses. While this can be commended as it can aid in combating fraud on the network, it goes against the ideal Blockchain core values. Uncannily, this situation bears a resemblance to the DAO attack and the arguments the hacker made. Despite Tether’s good standing, some parts of the decentralized community insist, albeit without proof, that there is some shady activity being hidden from the public eye and that the whole project is a ticking bomb. Regardless of its flaws, the system of Fiat collateralized stablecoins offers a certain degree of stability that its counterpart falls short of.</p><h4>Crypto Collateralized Stablecoin</h4><p>There are no free points for guessing the collateral used in this subcategory of pegged stablecoins. Just wanted to get that out of the way before proceeding. In this category, we encounter a group of stablecoins that are backed by cryptocurrencies instead of Fiat. At first glance, it’s undeniable that this brings forth a more decentralized feel than its counterpart. For starters, no cash reserves are sitting in a bank somewhere, managed by a centralized entity that preaches about the importance and usefulness of a decentralized token, a finely tuned oxymoron. The use of a cryptocurrency as collateral while introducing stronger elements of decentralization also introduces a problem of volatility. Yes, as ironic as it sounds, this category of stablecoins involves an attempt to ensure a peg is maintained to the US Dollar while backing it using cryptocurrencies famed for their volatility. You might be thinking that if they’re so keen on using cryptocurrencies for their collateral, why not use existing stablecoins, then? That’s a smart question, and that option has been made available by some crypto-collateralized stablecoin. While this option can be offered alongside other crypto collateral options, which are mainly ETH and BTC, making a stablecoin the sole collateral for a crypto-backed stablecoin is a risky venture, which ties the fate of a stablecoin to another.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IeeyyHGdVn8Hi7C6oQGcQg.png" /></figure><p>The issue of volatility creates a delicate problem, and as such, a smart solution is needed to address this. This solution involves two important parts: Overcollaterization and the use of Pricefeeds. Overcollaterization is simply a cushion to absorb the impact of crypto volatility, and it’s usually set at a 1:1.50 ratio. This simply means that, in contrast to a Fiat collateralized stablecoin where you’d have to deposit $1,000,000 to mint 1,000,000 worth of USDT, here you’d have to deposit collateral worth $1,500,000 to be able to mint $1,000,000 worth of the stablecoin. This process is known as over-collateralization and aids in ensuring a peg for a crypto-collateralized stablecoin. Overcollateralization must be ensured by any means, and in the case that a user runs the risk of being undercollateralized, he is liquidated to keep the system healthy. The most popular crypto-collateralized stablecoins at present are DAI, which is issued by MakerDAO, and GHO, which was recently introduced by the AAVE team. Just like the USDT and USDC pair, they are also very similar, with the major difference existing in the fee system, with interest rates being charged for GHO instead of the stability fee on DAI. They can be considered the poster boys for crypto-collateralized stablecoins, and as such, it is only right that I emphasize them to paint a clearer picture of the technicalities of this type of stablecoin.</p><p>At this point, it is easy to see how complex this is when compared to USDT or USDC, which are backed simply by Fiat reserves. But, from a decentralized point of view, it is a necessary trade-off that favours greater compliance with the core values of Blockchain technology. They both accept ETH, wBTC, which stands for wrapped BTC, USDC, and LINK for collaterals. Wrapped BTC or any wrapped token simply refers to a token that represents another asset that originates from a different Blockchain. Therefore, wBTC is a tokenized version of the famous Bitcoin cryptocurrency that is compatible with the Ethereum network in the form of a fungible token. To ensure over-collateralization, any collateral of choice must be deposited at a 1DAI:$1.50 rate, so this entails that to mint 1,000 DAI, a user must deposit $1,500 worth of ETH, wBTC, or LINK. This applies to all collaterals except for USDC, which is a Fiat stablecoin. Due to the lack of volatility associated with this token, the mint ratio is reduced instead to 1DAI:1.01USDC. It is still partially over-collateralized to ensure stability in periods of float, as I mentioned earlier.</p><p>There is a common theme here, and it is the fact that all the collaterals used in backing the DAI are not native to its ecosystem. ETH, wBTC, LINK, and USDC all originate outside the DAI protocol, and this is what we term an <strong><em>Exogenous</em></strong> stablecoin. A lot of categorization has been done, but I will need to go deeper into a further layer. Assume it to be similar to the multiple levels of dream state in Christopher Nolan’s Inception movie. Existing alongside the <strong><em>Exogenous</em></strong> stablecoins that I just mentioned are <strong><em>Endogenous</em></strong> stablecoins, and they both make up the two categories of crypto-collateralized stablecoins. Endogenous stablecoins are backed by cryptocurrencies that are native to their ecosystem, and a prime example of such is the UST, which has become infamous as a result of its disastrous end. The TerraUSD (UST) was a stablecoin that was collateralized by another cryptocurrency, LUNA, which was developed by the same team and existed on the same network. So, unlike the other stablecoins we have come across, everything was kept internal, and this played a huge part in its doom. UST utilized a system vastly different from other stablecoins that we have seen to maintain its peg, which revolved around the burning and minting mechanism with LUNA. To mint UST, users burned LUNA, and to redeem their UST, they had to, in turn, burn UST. This, coupled with an algorithmic mechanism that was leveraged on people taking advantage of UST float to make a profit through arbitrage, constituted the backbone of the stablecoin.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*oTCSMOlvIdbPNTseWmt6FA.jpeg" /></figure><p>This is the case for all the stablecoins we have explored, but the difference was that the collateral backing them wasn’t limited to a certain network. By being of Endogenous nature, options were truly limited, and the fate of the stablecoin was tied to that of LUNA, and when market conditions became grim, it paid the price. That was the killer blow for the promising ecosystem, and it all began to unravel in May of 2022. The UST lost its peg to the Dollar, and this led to huge withdrawals of the stablecoin. While arbitrage trading was expected to help re-establish the peg, there wasn’t enough liquidity in the market, and this led to a further downward spiral. The ensuing panic led to people burning their UST for LUNA with the hope of salvaging value before it dwindled further, but this, in turn, led to a huge influx of LUNA into the market. As expected, this led to a dilution in the value of LUNA, the collateral token for UST. So, that was how it transpired, one of the greatest disasters known to the Web 3 ecosystem, and the major reason was the absence of a diversified collateral system that could have successfully held the peg and reinforced much-needed stability.</p><p>We can dive into different utility and use cases for stablecoins, ranging from loans, yields, and any finance term we can conjure up, but for the most part, the goal of the stablecoin is simple: to remain stable. Stability here means being anti-volatile and maintaining a peg with the Fiat it is pegged to. When it loses this ability and fails to reestablish it promptly, that’s when the panic starts. For this reason, despite constant reminders about Fiat collateralized stablecoins decentralized enough, it is noteworthy that their system is less likely to be prone collapse regardless. Audits are performed on these reserves to ensure that for every stablecoin in circulation, there is an equal amount of US dollars in the banks. For exogenous crypto collateralized stablecoins, the challenge lies in ensuring that the amount of stablecoin in existence is overcollateralized, and a very important process in ensuring this is called <strong><em>Liquidation</em></strong>. <strong><em>Liquidation</em></strong> is crucial to maintaining the peg of such a stablecoin and takes effect when the value of the collateral deposited by a user falls, causing it to go below the fixed over-collateralization ratio. As I mentioned earlier, in DAI, there is a fixed collateralization ratio of 1 DAI: $1.50. This means that for every stablecoin minted, collateral that could be ETH or wBTC worth $1.50 should be deposited. But then, what happens when the value of the collateral deposited by the user goes below the 1:1.50 ratio? This is where liquidation comes in, and the goal is always to ensure the stablecoin does not ever get close to being undercollateralized. GHO and DAI both handle liquidation a bit differently, but with the same underlying principles. While the trigger for DAI is when the collateralization ratio drops below 1:1.50, GHO instead checks for when a user’s health factor is below 1. It’s quite simple: a user is expected to always check to ensure that the value of deposited collateral doesn’t go below the liquidation threshold concerning the stablecoin amount. To avoid this situation and the penalties that come with it, the user can deposit more collateral to maintain a healthy status. In DAI, when a user is marked for liquidation, his collateral is auctioned off, and liquidators are allowed to bid for the collateral using DAI. They are incentivized to buy the collateral at a discount, and the proceeds from the sale are used to repay the user’s debt and also the liquidation penalty, which stands at 13% of the auctioned collateral. Any remaining collateral is returned to the user. With regards to GHO, this process is handled a bit differently. When the health factor goes below a defined threshold, liquidators seek to restore the user’s health standing to the expected level by paying off the debt, and in return, they receive a portion of the collateral at a discount. But notably, no penalty is imposed on the defaulting user.</p><h3>Floating Stablecoins</h3><p>A few kicks, and we’re now back to the first level of the dream state, back to our first categorization, which was Pegged and Floating. I promised to get back to Floating stablecoins, and here I am. RAI by Reflexer Labs is the prime example of this and ushered in a new type of stablecoin that doesn’t aim to set a 1:1 peg with the US Dollar. Rather, it favours the use of advanced algorithms coupled with market conditions and external factors. With these, it sets a redemption price that the value of the stablecoin hovers around. Sounds cool, right? Sure, it is. RAI introduces a new system for stablecoins and provides an entry point into the development of stablecoins with little dependence on external forces and a greater level of decentralization. However, it’s important to note that RAI is still a crypto-collateralized stablecoin that’s solely backed by ETH, and just like we’ve seen in previous stablecoins, RAI is minted by depositing ETH. Despite the promise shown by this stablecoin, some drawbacks have been highlighted, and the first is the sole use of ETH for its collateral. Unlike stablecoins like DAI and GHO, which utilise multiple cryptocurrencies for collateral, the sole use of ETH can make it prone to issues in a similar manner to the UST. But then it should be noted that the difference in use volume and liquidity between ETH and LUNA makes it very unlikely. Also, despite how cool and novel the idea of floating is, at present, most people would prefer a stablecoin that is pegged to the US Dollar, and this is further exacerbated by the fact that the RAI is still not widely integrated into exchanges like other stablecoins.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*258fhkSae4T_TskED5gncg.png" /></figure><h4>Overview</h4><blockquote>USDT: Pegged, Fiat Collateralized</blockquote><blockquote>USDC: Pegged, Fiat Collateralized</blockquote><blockquote>BUSD: Pegged, Fiat Collateralized</blockquote><blockquote>GHO: Pegged, Crypto Collateralized, Exogenous</blockquote><blockquote>DAI: Pegged, Crypto Collateralized, Exogenous</blockquote><blockquote>UST: Pegged, Crypto Collateralized, Endogenous</blockquote><blockquote>RAI: Floating, Crypto Collateralized, Exogenous</blockquote><p>Stablecoins are unique and represent a huge breakthrough in the Blockchain ecosystem. Blockchain, Web 3, and other related terms can sound cool and, at times, luxurious, but the most important factor is making an impact on people, bridging the divide, and making it accessible en masse. Stablecoins, in general, have helped usher in and onboard millions of users to the onchain economy and continue to do so. If it&#39;s not broken, don&#39;t fix it. That’s a popular saying, but further improvements can be made to better the existing protocols and also educate people more. At this point, I hope that I have done enough to ignite your interest in the ever-evolving world of stablecoins while showing you a quite clear view of its inner workings. It might sound cliche now, but I assure you that this is the future, and that future is now. You do not need to look beyond the acknowledgement of Blockchain technology and cryptocurrency by both candidates for the upcoming United States Presidential Election to see the handwriting on the wall. I encourage you to remain keen and informed, and you’ll be grateful that you did. I developed an exogenous crypto collateralized stablecoin modelled closely to the GHO. I utilized Solidity and Foundry for this wonderful project that pushed me to the limit, and I can&#39;t wait to share a walkthrough on the codebase and thought process.</p><p><strong><em>Be assured that you’ll be the first to know.</em></strong></p><p><em>Enjoyed this read? Do not hesitate to leave some claps. You’re also welcome to leave a comment if you have any questions.</em></p><p><a href="https://x.com/SwizzSamuel16"><strong><em>Follow me on Twitter</em></strong></a></p><p><strong><em>&amp;</em></strong></p><p><a href="https://www.linkedin.com/in/samuel-okafor-a64503182"><strong><em>Let&#39;s Connect on Linkedin</em></strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=02bfc329c22f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/thecapital/the-beauty-of-stablecoins-and-what-you-ought-to-know-about-them-02bfc329c22f">The Beauty of Stablecoins and What You Ought to Know about Them.</a> was originally published in <a href="https://medium.com/thecapital">The Capital</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Security Issues Plaguing the Web3 Ecosystem]]></title>
            <link>https://medium.com/better-programming/security-issues-plaguing-the-web3-ecosystem-a927a1f4852a?source=rss-9bce9c91516b------2</link>
            <guid isPermaLink="false">https://medium.com/p/a927a1f4852a</guid>
            <category><![CDATA[bitcoin]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[web3]]></category>
            <category><![CDATA[smart-contracts]]></category>
            <category><![CDATA[blockchain]]></category>
            <dc:creator><![CDATA[Samuel Onyinyechukwu Okafor]]></dc:creator>
            <pubDate>Wed, 02 Mar 2022 13:20:57 GMT</pubDate>
            <atom:updated>2022-03-06T08:57:09.953Z</atom:updated>
            <content:encoded><![CDATA[<h4>Delving deep into these errors and their best prevention techniques</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2VuXTApY6Vb3lc8y3gKoMA.jpeg" /></figure><p>Losses as a result of a security breach in the Web3 universe can be overwhelming. I mean, it is always crazy when the financial losses are made public due to the huge amount involved almost every time. While this speaks volumes about the widespread adoption of blockchain technology, it also exposes its vulnerability. The technology is built on the tenets of immutability, decentralization, and transparency but has proven several times over the years to be vulnerable to attacks. Contrary to popular opinions, most of these attacks are barely sophisticated but rather a result of an error in the smart contracts. Most of these attacks are made on the smart contracts, either by finding loopholes or exploiting errors on the solidity code. Errors irrespective of their size or complexity can be fatal while writing smart contracts, and for this reason, security is a huge topic for budding blockchain engineers. Unlike the Web2 industry where an error will most likely lead to an application crash, errors in Web3 tend to be of more devastating financial consequences.</p><p>There has been a lot of security issues and instances involving the Web3 ecosystem but it&#39;s only right that we take a trip down memory lane to the very first one that gained huge traction which is none other than the famed DAO attack. The DAO was a venture capital fund instantiated on the Ethereum blockchain. DAO is an acronym for Decentralized Autonomous Organization, and as the name implies, the affairs of this organization were not controlled and dictated by a single entity. The objective was to create a transparent and decentralized platform where investors could pool funds together for both commercial and non-profit enterprises. It sought to eradicate the issue of fund mismanagement by a single entity which has been a widespread issue with existing venture capitals by giving powers directly to each investor. Investors received voting rights which they exercised when deciding on projects to invest in. As you would expect a Blockchain-enabled organization to be, everything about the organization was transparent. The codes that enforced its rules and regulations were made public for all to see and in turn led to a system where everyone had a clear idea of everything that was going on. This was revolutionary and a huge revelation at the time which influenced countless more that came after it but as it usually is with new projects, there were always going to be gaps and holes that would have been definitely corrected with time. I can assure you that this was the case with Facebook, Twitter, and the rest of the huge Web2 firms around today. Errors would have just caused their platforms to go down, and their engineers will go on a marathon to get everything back up and running. Unfortunately, this is not a luxury that Web3 firms can afford. When this unfortunate event happened, 3.6 million Ether worth around $50 million at the time was illegally transferred out to a child DAO by the attackers. At this point in time, the Ethereum platform was relatively still on the come up, and the DAO contained roughly 14% of all the Ethereum in circulation. The attacker was able to pull off the heist by discovering a <strong><em>split</em></strong> function in the contract which enabled him to siphon funds to a child DAO. He called it recursively till he amassed a third of all the Ethers held in the parent DAO. It is important to note that the Parent DAO had a constraint that prevented Ether to be moved till after 28 days, therefore this same constraint was inherited by the child DAO which rendered the attacker unable to access the funds right away. This situation bought time for the Ethereum community to decide on the right move to make in order to counter this attack. Due to the scale of this attack and the perceived impact it could have on the platform, Ethereum’s founder Vitalik Butherin deemed it necessary that the platform had to get involved. Two options were suggested, the first being a soft fork and the second being a hard fork of the Ethereum network. The soft fork basically involved adding snippets of code that effectively blacklisted the attacker and as a result prohibited him from moving out the stolen Ether. Before the foundation could proceed with this, a bug was discovered in the code which rendered the option inoperative. So, the hard fork appeared to be the last resort, this process involved reversing the Ethereum network to a time just before the hack occurred, so that the money held in the DAO can be safely transferred out and handed back to the investors. This caused an uproar in the Blockchain community and was considered hypocritical given what Blockchain was expected to stand for, which was immutability and decentralization. Talks about implementing the hard fork triggered a response from the attacker, who wrote a letter threatening the Ethereum foundation and claiming that he did no wrong whatsoever. His letter is attached below.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/333f17121826a877f7654766ee488693/href">https://medium.com/media/333f17121826a877f7654766ee488693/href</a></iframe><p>Despite the heavy backlash, the Ethereum foundation went ahead with the hard fork and in the process recovered the stolen funds. This hard fork resulted in a new Ethereum network that had undergone a form of alteration but the old network was still active and was as a result called the Ethereum Classic. Some staunch believers of the core principles of Blockchain technology stuck with the original network and decided not to get involved with the perceived defiled network. Fast forward years later, despite the uproar from the core blockchain community, it is safe to say that Vitalik and the team made the right decision.</p><p>It definitely wasn’t my intention to spend that much time on the DAO attack, as I wanted to highlight as many Web3 security failings as possible but it is a situation we have to make do with given the impact and notoriety of the attack. It won’t be wrong to say that its success gave rise to similar attacks that would happen in the future. We have seen the Web3 attack that arguably had the greatest impact and influence on the future of the ecosystem, it is now time we talk about the biggest heist of all time whose losses dwarfed that of the DAO. The Poly Network hack happened in August 2021 and led to a loss of cryptocurrency worth roughly $610 million. However, after appeals from Poly Network, a promise of $500,000 as a gesture for finding vulnerabilities in their system, and the offer of a role of chief security adviser, the hacker returned the proceeds of his attack. The hacker who was now referred to as “Mr. White Hat” claimed the attack was just intended to reveal the vulnerabilities of Poly Network and to help secure it. The Poly Network was a protocol that enabled the interaction of different blockchain networks. It facilitated the exchange of tokens from one ledger to another. From its inception to the time of the attack, it has successfully transferred $10 billion worth of digital assets between several blockchain networks. To fully comprehend this hack in its entirety, it is paramount that we understand the concepts of function visibility. Functions in solidity can have their visibilities set as private, public, internal, or external. When nothing is specified, it is automatically declared public. So, let’s take a deeper look into the various forms of visibility.</p><blockquote>Private functions: Private functions can only be called in the contracts where they are declared. Even inherited contracts are incapable of calling this function. This type of function visibility is always advised because it greatly minimizes the risk of attacks and security issues. This visibility prohibits external access and modification of information stored on the smart contract.</blockquote><blockquote>Public functions: Just like the name suggests, these functions are public and can be called from anywhere. They are either called internally or using messages.</blockquote><blockquote>Internal functions: Due to its similarities with private functions, this has been a subject of confusion in the past. But the main difference between both is that unlike private functions that can’t be inherited by derived contracts, internal functions are.</blockquote><blockquote>External functions: External functions can be accessed by other contracts and transactions but can’t be called internally without the use of “this”, and this separated it from its public counterpart. After deployment, they are part of the contract interface and the vitality of this information is the reason why I had to explain the types of functions to get it across. Errors involving external functions has led to severe losses in the ecosystem, so it is important that engineers are fully aware of such functions and their implementation in the smart contract.</blockquote><p>In layman&#39;s terms, external functions can be called outside its parent contract, so it makes perfect sense that attackers tend to look up such functions. Earlier, I mentioned that some attacks are successful not as a result of their sophistication, but it is fair to say that the Poly Network exploit was as sophisticated as it can get. In a nutshell, the attacker was able to call an external function in the EthCrossChainManager contract that enabled them to override the public keys.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5757cfaf2e31906fa9ba10b61768ab82/href">https://medium.com/media/5757cfaf2e31906fa9ba10b61768ab82/href</a></iframe><p>The external function highlighted above in the code snippet triggered a series of responses that the attacker capitalized on. He was able to pass the public keys to his Ethereum wallet as a parameter. This was done on the “EthCrossChainData” contract which didn’t object due to the fact that this call came from its parent contract. These public keys had the privilege of approving transfers and withdrawals, therefore once the attacker had added his, he went on a withdrawal spree to his address. Attached below are links to the full solidity codes for both smart contracts.</p><blockquote><a href="https://github.com/polynetwork/eth-contracts/blob/d16252b2b857eecf8e558bd3e1f3bb14cff30e9b/contracts/core/cross_chain_manager/logic/EthCrossChainManager.sol"><em>EthCrossChainManager.sol</em></a><em> and </em><a href="https://github.com/polynetwork/eth-contracts/blob/master/contracts/core/cross_chain_manager/data/EthCrossChainData.sol"><em>EthCrossChainData.sol</em></a></blockquote><p>With the intention of making sure this article doesn’t get voluminous, I will not be going into details for other attacks. On the bright side, the cause of these attacks is all similar and borne out of similar vulnerabilities. These exploits stem from common errors that enable them to thrive. Some examples of equally popular attacks are the Wormhole attack, Mt. Gox, Coincheck, KuCoin, Bitmart among others. So, I will be going ahead by delving deep into these errors and their best prevention techniques.</p><h3><strong><em>1. Re-entrancy</em></strong></h3><p>This is one of the most devastating attacks in smart contracts. This attack has been responsible for some large-scale theft in the Web3 ecosystem, most notably the DAO attack. This attack takes place when an external call is made to a malicious contract which allows the malicious contract to make recursive calls to the original contract with the sole objective of draining funds stored in the contract. Despite the basic nature of this attack, its consequences over the years have been proven to be of a grave impact. State change after external calls have been made has proven to be a reoccurrence in contracts that have fallen victim to this attack. This enables the exploiters to make repeated calls to the withdrawal function till funds are completely drained or a stack is reached. The state change is intended to halt funds withdrawals and update balances therefore in cases where this is erroneously set after the withdrawal function, the withdrawal function can be called recursively ensuring that this state change is never effected. Below is a code snippet that highlights a state change coming after the external call.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1be69f0402084aa7599f8907442027d9/href">https://medium.com/media/1be69f0402084aa7599f8907442027d9/href</a></iframe><p>The state change as specified above entails emptying the balance of the caller and in the process ensuring that there are no funds left to withdraw. This is the right thing to do but the position of the state change leaves the smart contract vulnerable to reentrancy attacks. Therefore, the solution would be to ensure that the state is updated before the external call is made.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/36370e416c0c3317890c190e7f47806c/href">https://medium.com/media/36370e416c0c3317890c190e7f47806c/href</a></iframe><p>So we have made the required alterations that will ensure the failure of any sort of reentrancy attack.</p><h3><strong><em>2. Integer Underflow and Overflow</em></strong></h3><p>This is another issue that can lead to security risks in a smart contract. Unlike others, this flaw is often overlooked but can be equally devastating. Numbers in solidity are declared using UINT(unsigned integers). UINT comes in different sizes, and some examples are uint8, uint16, uint64, uint256. Using smaller uint sizes like the uint8 saves storage and processing cost but also exposes us to the risk of integer overflow. The number of bits an unsigned integer can have is defined by its size, and this basically means that the largest number we can store in an uint8 is 255. We get this by doing (2 ^ 8 - 1). Now if we were to add 1 to 255 in uint8, it will give us 0. This is an integer overflow in a nutshell. In the case of underflow, subtracting 1 from 0 will return 255, and I think it is now clear to see why this could be a huge security concern. Let’s take a look at a smart contract with this issue.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/25cd1afc53e7be0982e569b9744e632c/href">https://medium.com/media/25cd1afc53e7be0982e569b9744e632c/href</a></iframe><p>One thing to point out from the code above is that I am using a version of solidity different from other snippets I have included. I had to use v0.7.0 to illustrate this security issue because v0.8.0 upwards has been secured from this security risk. Therefore, the most obvious prevention tip for this issue would be to use the latest version of Solidity because you would have nothing to worry about. But if you fancy older versions of Solidity then using bigger sizes of uint would be the right way to go. It’s also important to know that uint256 is automatically declared when we don&#39;t specify the size of the unsigned integer.</p><h3><strong><em>3. Self-Destruct</em></strong></h3><p>This is a function in Solidity that takes an address as an input. When this function is called, it deletes the bytecode of the contract and deposits the entire Ether in the contract to the specified address. We will be taking a look at a solidity code that gives room for this exploit. This is gotten from the solidity-by-example website, and I will try to break it down to its simplest bit. This contract defines the rules and regulations for a game on the blockchain. In this game, there is a target amount, and players are mandated to send just 1 ether to the contract. When a player sends 1 Ether and the contract balance is equal to the target amount, the entire ether in the contract is withdrawn to his address.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/bc3f718f8d496a61cc4a17751aa08bcc/href">https://medium.com/media/bc3f718f8d496a61cc4a17751aa08bcc/href</a></iframe><p>It is clearly specified in the code snippet above that a player can only send 1 Ether at a time with the hope of getting the balance to equal the targetAmount.</p><p>But using the selfdestruct function, it is possible to forcefully send Ether to the contract address and cause the balance to exceed the targetAmount. This will cause the rewards in the contract to be locked forever because there is no defined handling for a situation whereby the balance exceeds the targetAmount as this is not expected to happen.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/bfa061ca3903eb1757c1d27af9e2194e/href">https://medium.com/media/bfa061ca3903eb1757c1d27af9e2194e/href</a></iframe><p>Just as I mentioned earlier, the selfdestruct function deletes the bytecodes of a contract and withdraws the total Ether left in the contract to the address passed through the function.</p><p>By getting the contract address for the game, the attacker just has to pass it through the selfdestruct function to forcefully send Ether.</p><p>In Solidity, only address cast as payable are given the privilege of receiving Ether, so it is mandatory that the attacker casts the game contract address as payable. So with all this in place, executing the attack function sends Ether to the game contract, causing the balance to exceed the target, and then renders the reward permanently inaccessible.</p><p>Just like other attacks, we can take measures to ensure that we leave no room for the occurrence. But it is important to understand the vulnerability of the smart contract that made this attack possible before exploring its preventive measures.</p><p>Its vulnerability is a result of the misuse of this.balance. As a result of this, the contract is reliant on total value of Ether contained in the balance. This caused a direct interaction with the contract balance which makes for manipulation.</p><p>When the selfdestruct function is called, Ether is sent to the contract address, therefore a situation where the balance in the game is instantiated away from this.balance, renders the actions of selfdestruct ineffective. So, basically, the Ethers sent to the contract address don&#39;t add to the balance and have no effect on the outcome of the game. Therefore an attack attempt will basically mean we are taking receipt of free Ethers from our admirers somewhere in the world.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/61c1b08f8840d01d9e449c8014140efe/href">https://medium.com/media/61c1b08f8840d01d9e449c8014140efe/href</a></iframe><h3><strong><em>4. Default Visibilities</em></strong></h3><p>We surfed over this earlier but didn’t get to fully delve in. As I said, errors connected to this have been a recipe for disaster in the past. Function visibilities can be set as public, private, external, or internal and is automatically declared as public if we fail to specify. This determines whether a function can be called externally by users, derived by other contracts, or strictly internally. Incorrect use of visibilities exposes the function to the threat of external unauthorized access which can possibly spell doom for the Web3 project. This issue comes to life when smart contract developers make the mistake of ignoring visibility specifiers on functions that should be private. We will be seeing a contract that has this flaw to help us understand better.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e8d278dbbbe4b187d31066f88db0e59d/href">https://medium.com/media/e8d278dbbbe4b187d31066f88db0e59d/href</a></iframe><p>The contract above is designed to govern an address bounty guessing game and a player must generate an Ethereum address where the last 8 hexes are zero to win. From what we can see, the visibilities for the function above are not specified and therefore set as public. As a result, an attacker can exploit this flaw by calling the public sendWinnings function and stealing the bounty. A popular example of an attack that was a result of this error was the first Parity Multi-sig hack that led to a loss of Ether worth $31M. Making it a habit to always specify the visibility of functions even if it’s a public function is the first step in eradicating attacks that stem from this error. Also, recent versions of Solidity show warnings during compilation for functions that have no specified visibility.</p><p>It may seem like we have covered a whole lot but trust me we have barely scratched the surface. The beauty of the Web3 ecosystem is its uncanny ability to remind you that you know nothing every now and then. One message that is evident throughout our journey is how disastrous security issues in Web3 are. The community keeps on exploring and seeking new ways to improve security and avoid heavy losses that have become widespread over the years. Best believe that despite the security failings and losses, Web3 is a revolution that is going to change everything for the better. Like I always say, it’s still the early stages and the best time to start taking part is now. There are various ways to engage and contribute to the Web3 ecosystem, and aside from the accompanying thrill and excitement, it gives us chance to be a part of something special. But despite the widespread adoption, promises, and potentials of the ecosystem, it is undeniable that it has been struck a fair share of attacks that have left an indelible mark and there are no signs that we have seen the last of them.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a927a1f4852a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/better-programming/security-issues-plaguing-the-web3-ecosystem-a927a1f4852a">Security Issues Plaguing the Web3 Ecosystem</a> was originally published in <a href="https://betterprogramming.pub/">Better Programming</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Creating a Crowdsale for an ERC-20 Standard Token Using Truffle, and Deploying With Infura]]></title>
            <link>https://medium.com/better-programming/creating-a-crowdsale-for-an-erc-20-standard-token-using-truffle-and-deploying-with-infura-8d3b73eabb7?source=rss-9bce9c91516b------2</link>
            <guid isPermaLink="false">https://medium.com/p/8d3b73eabb7</guid>
            <category><![CDATA[solidity]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[web3]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[smart-contracts]]></category>
            <dc:creator><![CDATA[Samuel Onyinyechukwu Okafor]]></dc:creator>
            <pubDate>Fri, 28 Jan 2022 22:34:49 GMT</pubDate>
            <atom:updated>2022-02-02T16:45:58.311Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Create a Crowdsale for an ERC-20 Standard Token Using Truffle, and Deploy With Infura</strong></h3><h4>A hands-on web3 development tutorial</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZspH1p1Sexq0gNrVaR57jg.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@theshubhamdhage?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Shubham Dhage</a> on <a href="https://unsplash.com/@theshubhamdhage?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>The Metaverse has been a huge buzzword in recent times. It is not a no-brainer that its peak in popularity coincided with the Facebook name change and the company’s public intentions of doing great exploits in the space.</p><p>Not to be outdone by their fellow tech giant, Microsoft also made public of its desire to make immediate strides in the Metaverse. From all we have seen, it is quite obvious that we are in the early stages of a multi-billion race between the big tech firms to gain a strong foothold in the next big thing.</p><p>Alongside the Metaverse, NFT is another trending topic that has managed to capture the curiosity of most people. Several cases of celebrities taking out their personal pictures on their social media profiles and replacing them with pictures of apes have gone a long way in creating awareness for this phenomenon which is an abbreviation for “Non Fungible Tokens”.</p><p>The already stirred interest is only further escalated when one discovers how much it cost to own the pictures of the Apes. The buzz around NFTs makes for a very curious discussion but staying true to the title of this article I will be taking us through the creating of a crowd-sale for an ERC-20 standard token for now.</p><h3>What is a crowd sale?</h3><p>A crowd sale is a public offering and sale of a relatively new cryptocurrency or digital asset.</p><p>So, we can rephrase it as early offerings to the public with the promise of making them initial owners of the cryptocurrency or asset.</p><p>ERC-20 standard tokens are fungible tokens built using the ERC-20 smart contracts. They account for the majority of the altcoins in existence. Like I mentioned earlier, they are fungible tokens which are in contrast to the buzzing NFTs that are renowned for being non-fungible.</p><p>The major difference between the two asides that fact that they use two different ERC standards is the fact that fungible tokens are interchangeable and can be exchanged, unlike their non-fungible counterparts.</p><p>The very first step I took to start this project was installing truffle globally on my system using the NPM command.</p><p>I needed a Truffle box with a pre-existing frontend so I decided to go with the Truffle React box. This choice was influenced by my past experience creating client-side codes with the JavaScript framework.</p><p>There are some differences between ReactJs on Web2 and on Web3 but its structure and foundations are still the same. One feature that sets apart the Web3 version of ReactJs writing is the need to be able to call smart contracts and their in-built functions.</p><pre>npm install truffle -g</pre><pre>npx truffle unbox react</pre><p>A correctly unboxed Truffle React box should automatically set up the directories as shown below</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/405/1*hpz42nESM7KaLe24qqeXVw.png" /></figure><p>The truffle-config.js is an important file that contains the necessary configurations that enable the compilation and deployment of smart contracts.</p><p>We specify the exact solidity version that would be used in the compilation of our smart contracts and also the details of the Ethereum network that we are trying to connect to.</p><p>As we are all aware, deploying smart contracts cost real money, so it is very important that tests are done on the Ethereum testnets or on a private ethereum node.</p><p>Therefore we can ensure that we have made every necessary adjustment before deploying to the mainnet which requires real money to cover the gas fees. Attached below is a sample of what our truffle-config.js is meant to look like:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0333177c345e4df413ba24d32eb65adf/href">https://medium.com/media/0333177c345e4df413ba24d32eb65adf/href</a></iframe><p>As I mentioned earlier, we will be creating ERC-20 tokens for our crowd sale project. ERC is an abbreviation for ETHEREUM REQUESTING FOR COMMENTS.</p><p>Creating ERC-20 tokens from scratch can be an exhausting and complicated task and we owe it to the good people at Openzeppelin that provides ERC standard smart contracts we can work with because they make our work a whole lot easier.</p><p>These smart contracts are regularly updated and improved to ensure their capabilities are up to date. All we have to do is import the ERC contract we want into our project directory and we can start creating our ERC-20 token.</p><pre>npm install @openzeppelin/contracts</pre><p>Older versions of the Openzeppelin smart contracts have the crowd sale smart contract but over time, this solidity file has been phased out. The use of this contract gives us the luxury of focusing more on some extra logic behind the crowd sale knowing fully well that the Crowdsale smart contract has us covered.</p><p>Therefore to take advantage of the availability of pre-existing Crowdsale smart contracts, we will have to make use of an older version of the Openzeppelin contract.</p><p>To install specific versions of an npm package, we just add the version at the end of the install command.</p><pre>npm install @openzeppelin/contracts@2.5.0</pre><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5d17bd97d77ac25ae74d4341d476e700/href">https://medium.com/media/5d17bd97d77ac25ae74d4341d476e700/href</a></iframe><p>The unboxed truffle react box comes with pre-existing files in the contract and test folders.</p><p>These files are not related to our project, so it is advised that they be deleted.</p><p>We will need to create our token contract that will interact with the already imported Openzeppelin contract to create our ERC-20 token.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3474a8b3ac0454b90f18725414913f8f/href">https://medium.com/media/3474a8b3ac0454b90f18725414913f8f/href</a></iframe><p>Above is a template from Openzeppelin for creating our token contract that interacts and inherits the already imported ERC20 standard contracts.</p><p>In solidity, we can access functions of external contracts using inheritance. We do this using the “is” keyword. Therefore, we can modify the above contract to create our token. We can add our preferred token name, its symbol, and the total number of tokens available at its inception.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/90e21989fdae8ddb700261a63ed9e672/href">https://medium.com/media/90e21989fdae8ddb700261a63ed9e672/href</a></iframe><p>One noticeable difference between my final token contract code and the original template provided by Openzeppelin is the version of solidity that I used.</p><p>This is necessary because having access to the Crowdsale contract means that I had to use an older version of Openzeppelin. It is necessary to ensure that all the files are running on the same version of solidity.</p><p>As I mentioned earlier, we specified a version of solidity in our truffle-config.js file, therefore it is paramount that every solidity file in our project is running on the same version. This is an error that a lot of people encounter when building their decentralized projects.</p><p>The Crowdsale.sol file alone doesn’t have everything required to enable our token sale, so to complete this it is required that we create another file to define the logic and enforce more conditions regarding purchasing tokens.</p><p>The beauty of smart contracts is how it provides an avenue for developers and creators to set and enforce rules that can’t be tampered with. A great example of a rule that I got to enforce working on this project is a demand that every purchaser of the ERC-20 token has to go through a verification process of some sort.</p><p>To do this, I wrote a KYC smart contract that ensured that only addresses that have passed the verification process can partake in the crowd sale for my token.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8877fe89187bb581f9890a389d9a80ac/href">https://medium.com/media/8877fe89187bb581f9890a389d9a80ac/href</a></iframe><p>In the KycContract, we inherit the Ownable contract. The Ownable contract is provided by Openzeppelin and it contains functions that ensure that only the owner of the contract can call desired contracts. These functions are known as modifiers and their duty is to ensure that certain conditions are met before some functions are executed. When we are done with the KycContract, we can move forward to importing it to our TokenSale contract to ensure that the KYC conditions are met before a token purchase can be executed.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/352d1b0f91e9395fa15ee3e13992fbb5/href">https://medium.com/media/352d1b0f91e9395fa15ee3e13992fbb5/href</a></iframe><p>At this point, we are done with our smart contracts, and we have to move to the next junction which is ensuring that our migration files are perfectly set up.</p><p>On observation, you would find a Migrations sub-folder, and this houses two files: 1_initial_migration.js and 2_deploy_contracts.js. We do not get to make alterations to the first as it comes automatically set but we have to make changes to the latter to accommodate our solidity files and make sure that the contracts are deployed in the correct way.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9ba015448a4c33df16d5dddabe0f7662/href">https://medium.com/media/9ba015448a4c33df16d5dddabe0f7662/href</a></iframe><p>After we are done with the migration files, our next stop is a very important one. The concept of Web3 transactions charging real money for gas is not new, so it is very important that the codes that we write are carefully verified and inspected before we push them onto the mainnet.</p><p>To ensure the efficiency and accuracy of our smart contracts, we write unit tests to make sure they work as they should under certain conditions. Testing on solidity is also done using some popular Test libraries like Chai, Mocha.</p><pre>npm install chai chai-as-promised chai-bn</pre><p>We have to write tests for our ERC-20 token smart contract and our token sale contract. This is to ensure that they are both working in the manner expected before we can deploy to the Ethereum network. Then we run the truffle test in the terminal.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9310d8f05035dc1376a114eb22ed966b/href">https://medium.com/media/9310d8f05035dc1376a114eb22ed966b/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/62feff706e20c8a7593802d675cd912a/href">https://medium.com/media/62feff706e20c8a7593802d675cd912a/href</a></iframe><p>Our tests run successfully, therefore it is time to cross over and make the required adjustments to our React codes for our frontend.</p><p>The Truffle React Box comes along with pre-existing React codes that we have to alter to be able to connect with our smart contracts in order to have a functional decentralized application.</p><p>Before I go any further, it is important that I highlight that after our smart contracts are successfully compiled and migrated, they are stored as artifacts on the client-side of our projects.</p><p>So instead of importing the contracts directly into our ReactJs files, we rather import the artifacts. These artifacts contain the contract ABI which enables us to access the contract functions in our React files. ABI is an acronym for Application Binary Interface.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/db262d4d873dc5b321388f6d3f308236/href">https://medium.com/media/db262d4d873dc5b321388f6d3f308236/href</a></iframe><p>We are set to deploy our decentralized app to the ethereum main net and like the whole blockchain ecosystem, that comes with some hurdles of its own.</p><p>However, a standout feature of the ecosystem is a huge plethora of apps or software at our disposal aimed at making every step relatively easy. The subject of deploying is where Infura comes in.</p><p>What is Infura? Quoting the creators, “<em>Infura provides the tools and infrastructure that allow developers to easily take their blockchain application from testing to scaled deployment — with simple, reliable access to Ethereum and IPFS.</em>”</p><p>To get started with Infura, it is required that we create an account. When we are done registering, we are then redirected to the dashboard where we can create a new project.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vKjqYJ-VYR1D4M-uffb8OA.png" /></figure><p>Ethereum is selected as our product type because we are creating an Ethereum product. ETH2 is another option on the dropdown but it is currently still in its early stages.</p><p>ETH2 is an upgrade to the current version of the Ethereum blockchain that is aimed to battle the biggest issue plaguing the platform which is the crazy gas fees. It will also mark the transition from the Proof Of Work(POW) to the Proof of Stake(POS) consensus mechanism.</p><p>After we have created a new project, we will be given a unique Project ID and Project Key that is required for making connections to the Infura endpoints. Infura gives us the option of making our choice of endpoint, it could be the mainnet or the testnets.</p><p>The most renowned testnets are available and they are Ropsten, Goerli, Kovan, and Rinkeby. As I have mentioned several times, deploying to the Mainnnet costs real cash, so it won’t hurt to deploy to the Testnet to ensure the smooth running of our project before deploying to the mainnet.</p><p>To deploy on the testnet, we will be needing testnet tokens instead of ether, and we can easily get these from faucet sites for no charge. Below are faucet websites for the Testnets.</p><pre>Ropsten: <a href="https://faucet.ropsten.be/">https://faucet.ropsten.be/</a><br>Goerli: <a href="https://goerli-faucet.slock.it/">https://goerli-faucet.slock.it/</a><br>Rinkeby: <a href="https://faucet.rinkeby.io/">https://faucet.rinkeby.io/</a></pre><p>With the Project ID and Key provided by Infura, we head back to our truffle-config.js file where we can make a few modifications that will enable the project to connect to our preferred Infura endpoint.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/086c256079e574c48ca199ac6eb49b2b/href">https://medium.com/media/086c256079e574c48ca199ac6eb49b2b/href</a></iframe><p>That’s it!!</p><p>At this point, we have done everything necessary to deploy our project to the Ethereum blockchain.</p><p>It is a fulfilling feeling, getting to deploy a contract and interacting with the blockchain knowing that you are very early to a technology that is going to change the whole world.</p><p>We have barely scratched the surface with regards to Blockchain/Web, and it is amazing what has been achieved already. Most tokens out there, both fungible and non-fungible were created using the same standards and steps that we have gone through, and when we take into consideration the impact that they have had then we can realize the opportunity that we have been given on a platter to make an impact on the world with just a couple line of codes.</p><pre>For a look at the complete codebase for my project, here is the link to its <a href="https://github.com/SwizzSamuel/GFD-Token">Github repository</a>.</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8d3b73eabb7" width="1" height="1" alt=""><hr><p><a href="https://medium.com/better-programming/creating-a-crowdsale-for-an-erc-20-standard-token-using-truffle-and-deploying-with-infura-8d3b73eabb7">Creating a Crowdsale for an ERC-20 Standard Token Using Truffle, and Deploying With Infura</a> was originally published in <a href="https://betterprogramming.pub/">Better Programming</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Blockchain: An Immersive Walkthrough]]></title>
            <link>https://medium.com/thecapital/blockchain-an-immersive-walkthrough-a16672c86c76?source=rss-9bce9c91516b------2</link>
            <guid isPermaLink="false">https://medium.com/p/a16672c86c76</guid>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[bitcoin]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Samuel Onyinyechukwu Okafor]]></dc:creator>
            <pubDate>Sat, 23 May 2020 09:16:00 GMT</pubDate>
            <atom:updated>2020-05-29T01:27:26.850Z</atom:updated>
            <content:encoded><![CDATA[<h4>By <a href="https://medium.com/u/9bce9c91516b">Samuel Swizz</a> on The Capital</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xkJwCV5-QoU3PwddumV-GQ.jpeg" /></figure><p>Blockchain? Did you say blockchain? In 2018, Glassdoor reported that there was a 300% increase in blockchain job openings in the United States alone, excited right? Okay, let me walk you through what it is. Ever gotten a strange debit alert over nothing? Sure you have, it is one of the perks of being a Nigerian. Ever been worried about the safety and privacy of your data and posts on social media? Again, you have. After all, we all witnessed the United States Congress tear Mark Zuckerberg apart over the Cambridge Analytica scandal. Situations like this are what the blockchain technology seeks to reduce and gradually erase. Blockchain as a technology is deeply rooted in the idea of a decentralized, immutable, and secure architecture. Decentralized, in the sense that there is no one responsible for controlling data and the general process of a system. In stark contrast to the current state of the internet, each individual has autonomous control over information and personal details shared. In this case, the privacy of every user is maintained and personal data is secure. Blockchain being immutable means that it can not be altered or changed. Any data that is registered into a blockchain is unable to undergo any form of alteration or modification. This feature acts as the gateway into the last feature which is security. Since data in the blockchain can’t be manipulated or altered, the threat posed by hackers and criminals with ulterior motives is extinguished. So a simple definition would be that it is a public ledger that holds together transactions in the form of blocks to ensure its immutability, transparency, and security without the need for a central authority.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/289/1*CMnHL2Vowsj_e5ospb_9Bw.jpeg" /></figure><p>For most, the term blockchain is synonymous with bitcoin. The presence of the huge cryptocurrency exchange website: blockchain.com all but promotes the faux school of thought. It is necessary to note that the blockchain is the foundation on which the bitcoin amongst other cryptocurrencies like ethereum is built on. Bitcoin was its first major use and it was created by a mystery name who went by the alias Satoshi Nakamoto. He sought to put an end to the crafty ways of existing financial institutions and give each individual the power to have total control of one’s wealth and bypass middlemen when engaging in transactions. Looking around today, we can all attest to the fact that his dreams became a reality. He succeeded in creating a digital currency that is not just secure but can be easily transferred. Each transaction performed with the currency is hashed and entered onto a block. Hashing is a process in which the contents of the transaction are converted from a readable format into a secure and incomprehensible format. To ensure the immutability of this chain of blocks, every block is linked to each other in such a way that any alteration to a block renders succeeding blocks invalid. To achieve consensus, Satoshi opted for the Proof of Work. A system where entries of transactions into the chain are handled by members who have performed a series of complex actions. This is also referred to as the Mining process. Incomplete transaction hashes are pushed out by the bitcoin platform and miners are required to perform highly complex algorithms to find the missing symbols in the hash. Such calculations can only be performed using a special type of computer and also require a tremendous consumption of electricity. At the end of such calculations, a certain amount of cryptocurrency is given off as a reward. This heralded a new era in the financial ecosphere and the whole process was lauded by people at the time. The strengths of this new technology were used extensively in the financial world but many people believed it could be applied with maximum effectiveness outside that world and in other spheres of life. This ambition led to the introduction of the Ethereum platform. The ethereum platform while providing similar features like its older counterpart also provided an avenue where people could develop their blockchain application in any area whatsoever and enforce rules and constraints using Smart Contracts.</p><p>As mentioned earlier, this new and growing tech seeks to provide solutions and hugely enhance efficiency in various aspects like security, transparency, accountability, and lots more. Certain fields can benefit immensely from tapping into the power of the blockchain. Such fields include real estate, education, election systems, healthcare amongst others. Taking the real estate industry as an example, assets like lands, houses, and related documents can be safely stored and be accounted for. Cases of missing documents and illegally owned properties are not rare and with the aid of this technology, this can be addressed. There is also the prospect of the voting system being revamped completely. This overhaul is being explored and would involve the storage of votes onto a secure blockchain where they are shielded from the threat of modification and alteration. If fully implemented, this would mark a revolution and a major turning point in the electoral system. Files can also be stored digitally in a way that enhances its security. The applications of the blockchain technology are not just limited to the option mentioned above, it can be employed in all walks of life because security and transparency is an issue that requires addressing in practically everything.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/271/1*8eEXIBEgZyI4YUiQApzL2w.png" /></figure><p>Most times, the ledger is public and permissionless. This is the foundation for the Ethereum platform where we can develop DApps. DApps is an acronym that stands for Decentralized Applications. We enforce the standards and constraints with which the app works with using smart contracts. Smart contracts can be simply said to be a computer protocol that is intended to verify, facilitate, and enforce the standards which an Ethereum DApp is to run. It is written with Solidity on the Ethereum platform. While the Ethereum platform was public and permissionless, some felt it was not suited to the needs of businesses. It was believed that for the blockchain to be implemented with great success in that area, it should be private and its permission regulated. This is how the Hyperledger platform came into play, its major features are the fact that it is private and permission. This means that access to this ledger can be restricted to just organization personnel. It also employs the use of smart contracts but opts for Chaincode in place of Solidity to develop theirs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/340/1*Iw9QHfAi-VIbGXGtfrO7sw.jpeg" /></figure><p>Currently, there is a severe need for skilled personnel and experts in this field. It is relatively a new career path and not many people have ventured down its road. Due to this current situation, the few blockchain engineers in existence are in demand and command huge salaries all over the world. This trend is just the start as many industries and companies are waking up to the realization that blockchain can take their outputs to a whole new level. It is now a no brainer why there was a huge 300% increase in opportunities and this was in the US alone. It is just sad that most of these openings are still left unfilled because there are few blockchain engineers at the moment. Blockchain engineers average a salary between $150,000 and $175,000 per annum. To put that in the Nigerian perspective that’s equivalent to being in the range of N58,575,000 and N68,337,500. So this is the perfect time to capitalize on the extraordinary industry demands and become skilled in this field.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*_mi9D93z16ckAW0bVfzJcw.jpeg" /></figure><p>We are nearly at the end of our immersive walkthrough. I find it very exciting to expose people to the potential and capabilities of this unique platform and even more exciting when I think about the revolutionary effects it could have on life. It is still pretty much the genesis and there is an unlimited ceiling to what we can achieve with the power of the blockchain. Just like the great technologies of old, this is an opportunity to become a part of a movement that will alter the landscape of technology, businesses, and life. Opportunities in this field are not limited to writing codes, this is just a piece of the puzzle. One can become a blockchain product manager, create content relating to the technology or become a blockchain legal consultant amongst lots more. It is the start of something great and with this walkthrough, I hope I’ve enlightened you on the beauty and potentials of this phenomenon called the Blockchain.</p><p><a href="https://twitter.com/thecapital_io">JavaScript is not available.</a></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fupscri.be%2Ff%2F3c1144%3Fas_embed%3Dtrue&amp;dntp=1&amp;display_name=Upscribe&amp;url=https%3A%2F%2Fupscri.be%2F3c1144&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;type=text%2Fhtml&amp;schema=upscri" width="800" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/3b6b127891c5c8711ad105e61d6cc81f/href">https://medium.com/media/3b6b127891c5c8711ad105e61d6cc81f/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a16672c86c76" width="1" height="1" alt=""><hr><p><a href="https://medium.com/thecapital/blockchain-an-immersive-walkthrough-a16672c86c76">Blockchain: An Immersive Walkthrough</a> was originally published in <a href="https://medium.com/thecapital">The Capital</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Mystery That Goes By The Name of Nigeria.]]></title>
            <link>https://medium.com/@samuelgift09/the-mystery-that-goes-by-the-name-of-nigeria-38e1645942fa?source=rss-9bce9c91516b------2</link>
            <guid isPermaLink="false">https://medium.com/p/38e1645942fa</guid>
            <category><![CDATA[religion]]></category>
            <category><![CDATA[africa]]></category>
            <category><![CDATA[change]]></category>
            <category><![CDATA[nigeria]]></category>
            <category><![CDATA[naija]]></category>
            <dc:creator><![CDATA[Samuel Onyinyechukwu Okafor]]></dc:creator>
            <pubDate>Sun, 15 Dec 2019 12:40:59 GMT</pubDate>
            <atom:updated>2019-12-15T14:35:34.679Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/250/1*r3yQDg8MUoQidOvPqQE3Yg.jpeg" /></figure><blockquote><strong><em>“I pledge to Nigeria my country, to be faithful, loyal and honest…”</em></strong> If only, we kept our promise to our dear country. Words we all exclaimed at a point in our lives. It’s funny that for a country with such a passionate and thought-provoking pledge that we have nothing to show for this luxury. We live in a country clustered with several issues that encompass politics, the economy, tribe, and religion. We have to make do with a system that is flawed in all its aspects and gives off little hope about its redemption. A clear reflection of the severity of our plight is the surprise and shock a Nigerian would feel when he encounters a list of underperforming countries without Nigeria ranked high.</blockquote><p>If it wasn’t for the presence of American movies in our society, I would have thought that sirens only served to notify the masses on when the wealthy were navigating past in their majestic convoys. We definitely can’t relate to scenes of blaring sirens indicating the pursuit of lawbreakers or aid in a health-related emergency situation. Looking to the brighter side, we actually do possess fire trucks that are technologically advanced to the extent that they don’t require water to function. They are wired to shoot out spiritual materials to quench the fire. That is not shocking since we Nigerians prefer sitting down and praying for solutions to our problems instead of getting off our asses and solving them ourselves. It’s a no brainer that less religion inclined nations are far ahead in all aspects because they get things done rather than resorting to prayers to do it for them. I am definitely not against prayers but all the same, everything shouldn’t be left solely to prayers. Sitting down, doing nothing and shouting prayers out loud hasn’t and won’t solve any problem.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/225/1*JlP2CveokuBEhG6tqFunlg.jpeg" /></figure><p>There was a huge shout nearby. I stepped out of the house to determine the reason for such majestic uproar and on approaching the source of the noise, I was told that the woman who lived there just put to birth. “Wow!”, I screamed. The gift of a new life is a priceless thing so I felt extremely happy for the couple. This is also their eighth child, probably in their tenth year of marriage. But then, this young woman hawks fruits around and the husband is a bus conductor and from clear observations over time, it’s obvious that the previous seven didn’t have much going around for them. “Didn’t have much going around for them”, is actually a very poor effort from me to paint a better picture of the living standard of this family. With no disrespect to that lovely boy that was just introduced into this wonderful world, I paused for a moment and thought about how convenient and more beneficial it would’ve been for this struggling family if they engaged in an appropriate family plan taking into consideration the resources available to the family. This family is a reflection of countless others. Studies have proven that this issue is most rampant in third world nations. It is very interesting and ironic that nations that can actually cater to a football team of kids tend to appreciate the need for a well-planned home in contrast to third world nations. With maximum respect to all families with a huge number of children, I’m not trying to lead a campaign against having a church of kids rather I am just giving voice to a school of thought that postulates that the number of children a couple has should be with respect to the availability of resources. Growing up, I was always reminded of the enviable standard of life I lived by my peers but little did they know of how different things could’ve been if another child was added to our numbers.</p><p>I think we do lead every other nation in one certain category though. That category goes by the title <strong><em>“MISPLACED PRIORITIES”</em></strong>. I do not associate this solely with the government, this tolls from the leaders down to the citizens. From flooding peaceful southern motorways with the police and army officials and neglecting northern roads notorious for being the den of bandits. Setting up checkpoints every here and there while the continuous robbery and extortion takes place regularly on the Kaduna-Abuja expressway. It’s also clear for all to see when much energy and valor is directed towards the capture and victimization of activists like Mr. Omoyele Sowore, Mr. Nnamdi Kanu and the likes while seeking to provide settlements for herdsmen. It’s probably what we all deserve when many citizens go to their polling units hoping to cash in with their valid voter’s card. The main priority for the electorate should be to cast their votes for candidates who can lead properly and effect positive changes but it seems that most citizens do not hesitate to get momentarily benefits in place of one that can span across four years. The same can be said of many Nigerian lecturers who actually think that having lots of students failing their courses is a sign of magnificence. These are personnel whose primary function or priority is to impart knowledge but rather they take more pleasure in making student’s lives miserable, make them look incompetent and distribute grades in return for sex. I, therefore, present to you <strong><em>“MISPLACED PRIORITIES”.</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/249/1*4X37IbonXEbHg-0nlZl0Qg.jpeg" /></figure><blockquote>IT’S UP TO US TO MAKE SOME CHANGES. It is the duty of every single Nigerian to be good and responsible citizens. This entails making decisions and taking actions in a way that propels the country forward and elevates her worth. It’s up to the citizens of the country, not just restricted to the leaders to make decisions in the best interest of the nation. Decisions like this, no matter how little we rate them go a long way in making the country better. The fact that countless bad has been done, but instead of just trying to continue the trend nonchalantly, it is up to all to start making some changes. From the people’s representatives in government, the civil servants, lecturers, doctors, students and whatever the category we fall in. The loss of quality and capable personnel to the western world in mass is a result of a failed, broken and inefficient system filled with all manner of flaws. A system where we all are divided by lines of tribe, religion, and politics. A system soo bad that our leaders send their wards out of the country to avoid them being entangled in a mess they helped create. It’s left to us to make things right. No one is expecting it to be a quick fix, it might span across past our present generation but we owe it to ourselves to help make things better.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=38e1645942fa" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Coding, the unsung solution to cyber-crime.]]></title>
            <link>https://medium.com/@samuelgift09/coding-the-unsung-solution-to-cyber-crime-192f9cb55d4d?source=rss-9bce9c91516b------2</link>
            <guid isPermaLink="false">https://medium.com/p/192f9cb55d4d</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[nigeria]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[Samuel Onyinyechukwu Okafor]]></dc:creator>
            <pubDate>Tue, 01 Oct 2019 07:01:43 GMT</pubDate>
            <atom:updated>2019-10-01T07:01:43.021Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HL-kNNC1XPUbMU_p4GVpHQ.jpeg" /></figure><p>As I write, a Nigerian somewhere is being embarrassed or bullied because of the devious act of soo many that he probably knows nothing of. As I write, a highly qualified Nigerian is being denied the chance to get to work on the project of his dreams on freelancing sites like Upwork, Fiverr and much more just because the international community at large is scared of even engaging with the so-called fraudsters. Money transfer mediums like Paypal have blacklisted the nation, therefore, making it near impossible to receive payments through freelancing or make payments online.</p><p>The biggest excuse given by the perpetrators is the hardships and financial instability in the country. Trust me, this actually exists but then engaging in the acts does not eradicate the hardships in the society but rather pushing it to another through the repercussions of your act. A never-ending loop is all this creates, a loop where hardworking people are made to see their potentials fade away and end up unfulfilled. A loop where the name of a whole nation is scarred and every citizen marked out as a potential criminal if not one already.</p><blockquote>How then can this loop be broken? How can the integrity of the nation be restored? Are we actually doing enough to curb this act that is welcoming freshers by the day? Or do we rather leave the future of our nation in the hands of crooked cops and SARS operatives who just want their share of the dough?</blockquote><p>Believe me, some if not most of the people engaged in the act are actually geniuses. It is truly amazing how regardless of how tight and secure things are, they still find a way to make things work out for them. I often engage myself in deep thoughts about how exceptional and top-class some of them would have been if they actually chose a different life path and wandered into the developer’s life. We could be having some top-notch developers and programmers on our hands.</p><p>How then do we effect this? It is an exciting time for the Nigerian tech industry. Just like oil boomed back in the 50s, it is safe to say that we are currently in what I would refer to as “The Tech Revolution”. We are in a period where there are several opportunities for developers irrespective of experience or level. The industry is witnessing a staggering number of investments everyday especially in the financial sector. This right here can turn out to be the perfect weapon needed to fight off this epidemic. It is time to show off the capabilities of technology and the amazing life it has in store. Exposure to the exciting world of tech where one can work and live without constant fear and lookout for enforcement agencies like EFCC and SARS can prove to be the ultimate lure and distraction from the evil thoughts of internet fraud and cyber-terrorism.</p><p>Definitely, not everybody will respond positively to the new and offered avenue to contribute to personal, collective and national growth. A large number of people will not even give it thought probably due to the amount of money they&#39;ve been able to acquire in a short period of time and how easy it was to make it. It will never be an easy ride because the roots of this evil have been deeply sown into the mind of almost all young Nigerians. We live in a society where they are lavished with praise and are hailed for how much they squander. Club owners will also be disgusted at the idea because of the perceived threat to their businesses. It is a fact that the majority of the heavy spenders in the clubs are the participants in the fraus cycle. Therefore, it won&#39;t be an easy ride but it can definitely be achieved by imbibing these values into the young ones and introducing them to a world of boundless opportunities where they can live free.</p><p>Tech shouldn&#39;t be kept in the dark. There are lots of people making amazing efforts to make sure that tools needed for software development are easily accessible for all in society. A certain <a href="https://twitter.com/unicodeveloper">Mr. Prosper Otemuyiwa</a> that is doing great things through his provision of free courses for the tech community. There is also <a href="https://twitter.com/hackSultan">HackSultan</a> who is aggressively pursuing his mission of free laptops for developers. There are many more out there making great strides to ensure that the tech field is in a wonderful state. All these actions go a long way in inciting a desire to code in the minds of young people. This desire is what is required to eradicate the disease that continues to spread by the day. I do hope that everyone in the tech world comes to a realization that we hold the key to end this and start making moves no matter how little it may seem to effect radical changes in the Nigerian way of living.</p><h4>Imagine a world where Nigerians would not be harassed and termed criminals. A world where we can get those opportunities that we are qualified for. A world that we can walk with our heads up high. A world where we are quick to show off the national symbols on our passports. That is a world that the Tech world has the ability to bring about but it requires the contribution of every single person. I firmly believe in the possibility of this and I once again say that we all can make the dream of “TECH BEING THE NEW YAHOO” a reality.</h4><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=192f9cb55d4d" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>