<?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 Akshat Mishra on Medium]]></title>
        <description><![CDATA[Stories by Akshat Mishra on Medium]]></description>
        <link>https://medium.com/@_akshat?source=rss-94bf047334a9------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*4YUhQSc1gVBW76VeOHAkmQ.jpeg</url>
            <title>Stories by Akshat Mishra on Medium</title>
            <link>https://medium.com/@_akshat?source=rss-94bf047334a9------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 06:09:50 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@_akshat/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[Introduction to OpenDAX — A Fast, Secure & Highly-Scalable Open-Source Crypto Exchange Engine]]></title>
            <link>https://medium.com/yellow-blog/introduction-to-opendax-a-fast-secure-highly-scalable-open-source-crypto-exchange-engine-2b9f0dae1523?source=rss-94bf047334a9------2</link>
            <guid isPermaLink="false">https://medium.com/p/2b9f0dae1523</guid>
            <category><![CDATA[fintech]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[blockchain-development]]></category>
            <category><![CDATA[blockchain-technology]]></category>
            <category><![CDATA[blockchain-startup]]></category>
            <dc:creator><![CDATA[Akshat Mishra]]></dc:creator>
            <pubDate>Tue, 17 Jan 2023 08:21:06 GMT</pubDate>
            <atom:updated>2023-01-17T11:06:30.261Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Introduction to OpenDAX — A Fast, Secure &amp; Highly-Scalable Open-Source Crypto Exchange Engine</strong></h3><h4>OpenDAX is a modular platform for building, deploying and managing crypto exchange services. It is fast, cost-efficient, and has a built-in liquidity solution that can scale to demand. This article aims to understand the OpenDAX platform and learn how it solves problems of the Fintech exchange ecosystem.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AnbY_ig8e9huvupLlmAOLw.jpeg" /></figure><p>Starting a crypto exchange platform is a difficult &amp; risky business endeavor, primarily due to two reasons. First is the cost required for developing and maintaining the software infrastructure, and second is obtaining the crypto liquidity to make the exchange functional. It only gets more difficult when you realize the crypto exchange landscape is highly-competitive and the major chunk of market share lies with the big exchanges who fight for slivers of user share and liquidity.</p><p>This situation has siloed the entire crypto space and has kept new exchanges or brokers from entering this space. OpenDAX is a unique white-label exchange software built to resolve this problem. It is a self-managed cloud-native solution that cuts down the cost and resources required in building, managing, and bringing liquidity to exchanges. OpenDAX takes care of everything under the hood so that you can focus on the growth of your business.</p><p>Let’s dive deeper to understand how the OpenDAX platform can help you achieve your business goals and what business problems it solves.</p><h3>About OpenDAX &amp; Yellow Network</h3><p><a href="https://www.openware.com/product/opendax">OpenDAX</a> is a crypto brokerage engine platform you can use to build your cryptocurrency exchange. It includes a self-hosted solution for enterprises, a managed crypto exchange platform on the cloud, and a free solution for developers with complete access to <a href="https://github.com/openware/opendax">public repositories</a>.</p><p>The UI components of OpenDAX are freely available as part of the <a href="https://www.npmjs.com/package/@openware/opendax-web-sdk">WebSDK</a> — which can be used to create custom design configurations for the platform. Additionally, most of the OpenDAX stack is highly open-source and is based on technologies like Supabase, Next.js, and React. All these things together make OpenDAX super extensible and customizable (to be covered in later articles).</p><p>OpenDAX is still a product in development, and would soon come with built-in shared liquidity with the support of <a href="https://www.yellow.org/">Yellow Network</a>. The Yellow Network is a peer-to-peer mesh overlay that interconnects multiple blockchains through state channels. In doing so, it unlocks the liquidity of isolated networks and provides lightning-fast trading speeds. After the public release of the Yellow Network, brokers would be able to harness this deep cross-chain liquidity on their OpenDAX nodes.</p><p>Together, OpenDAX &amp; Yellow Network will provide a strong self-managed &amp; supportive ecosystem for crypto exchange businesses to work on, so they only have to focus on their business growth and ideas.</p><h3>What Makes OpenDAX Special?</h3><p>OpenDAX abstracts away the complexities of handling &amp; operating a crypto exchange by providing handy and user-friendly tools. Here’s everything that makes OpenDAX special as a crypto brokerage platform.</p><ul><li><strong>Quick Setup</strong></li></ul><p>OpenDAX is available on AWS, GCP, Azure &amp; Digital Ocean as a pre-configured image you can launch in about 15 minutes. The setup requires only the basic knowledge of cloud platforms, while the OpenDAX interactive installation package takes care of the rest.</p><ul><li><strong>Hybrid Model</strong></li></ul><p>OpenDAX is hybrid in design, as it provides the security and transparency of decentralized exchanges with the speed and immense liquidity pools of centralized exchanges. For brokers OpenDAX provides the same easy user-interface as any CEX, while giving users the advantage of the extra security. It is the best of both worlds.</p><ul><li><strong>State Channels</strong></li></ul><p><a href="https://statechannels.org/">State Channel</a> is a cutting-edge virtualization method that takes data and processing off-chain to facilitate fast transaction speeds and cross-chain support. This technology would allow OpenDAX to fill orders while allowing precise high-frequency trading.</p><ul><li><strong>Aggregated Liquidity</strong></li></ul><p>By becoming a part of the Yellow Network as a broker, you can aggregate deep liquidity for your crypto exchange, saving you from investing any capital in market makers or other solutions.</p><ul><li><strong>Hassle-Free Maintenance</strong></li></ul><p>Maintaining cryptocurrency exchanges is difficult as it requires the maintenance of individual blockchain nodes. OpenDAX cloud is a managed solution that takes care of everything under the hood so that you can focus on the business side.</p><ul><li><strong>High-Performance</strong></li></ul><p>OpenDAX was designed with performance in mind. Its matching engine can quickly and accurately fills trade orders. OpenDAX Kubernetes pods can also scale with your business as the demand grows.</p><h3>OpenDAX’s Tech Stack</h3><p>OpenDAXv4’s tech stack is highly modular, and the entire exchange engine is based on the microservice architecture. Individual components are loosely coupled, and there’s no risk of accidentally breaking the software should you try to extend it.</p><p>It also means that the system is fault-resistant and self-healing — since microservices don’t rely on each other, and there’s no hard linking.</p><figure><img alt="an image showing the complete opendax stack" src="https://cdn-images-1.medium.com/max/1024/0*BKx_rhpjCkHDAxIl" /><figcaption>OpenDAX follows the microservice architecture.</figcaption></figure><h3>Customizable Frontend &amp; Backend</h3><p>The front end consists of the trading UI, wallet management service, and administration interface for low-level control over the exchange. The UI components used by OpenDAX are the same as those present in the WebSDK. These components are coded in React and can easily be customized or extended with other components.</p><p>The backend consists of the Finex trading engine, which performs order matching at lightning speeds, and smart contracts that take care of the user fund deposits and withdrawals. The front end and back end are tied together through <a href="https://nextjs.org/">Next.js</a>, a full-stack react framework where you can create your APIs, pages, and endpoints, giving you complete control over the customization of your exchange.</p><p>The benefit of using Next.js over plain React and Node.js is SSR or Server-side rendering. Your exchange is going to perform well, even on low-spec client devices. It also means your exchange would benefit from search engine optimization (SEO) as SSR renders pages in a static-like manner that is friendly to the Google spider bots.</p><h3>Authentication, APIs, and Key Management</h3><p>For secure key management, OpenDAX comes integrated with <a href="https://cloud.hashicorp.com/products/vault">Vault</a> — an industry standard for securing keys and other secrets. <a href="https://github.com/supabase/gotrue">GoTrue</a> is used to authenticate all APIs, while <a href="https://konghq.com/">Kong</a> serves as a gateway and helps in scaling those APIs.</p><p>OpenDAX also comes integrated with <a href="https://supabase.com/">Supabase</a> — an open-source Firebase alternative. It is a BaaS (backend as a service) tool that helps you create and manage your software’s APIs.</p><h3>Maintenance &amp; Scaling Infrastructure</h3><p><a href="https://www.docker.com/">Docker</a> is a DevOps containerization service that separates your code from the infrastructure it depends on. Docker is often coupled with <a href="https://kubernetes.io/">Kubernetes</a>, which helps you rapidly deploy, scale and manage your containers. Together, they administer rapid software delivery and take care of its scaling.</p><p>OpenDAX comes pre-configured with these tools, and they take care of the scaling as the demand for your software grows. It also means you can create production-grade workflows for your development team if you plan to extend the software stack.</p><h3>Cloud Native</h3><p>Hosting an exchange on bare-metal servers is cost and resource-intensive, so OpenDAXv4 has been developed as a cloud-native solution. OpenDAX is available as a free image on AWS, Azure, and GCP, and you are only required to pay as you use the hosting. It also means you don’t have to worry about scaling, downtimes, or other security threats, as these cloud services take care of protection and reliability.</p><p>If you want to try the installation immediately, check out the step-by-step video guide for the OpenDAX v4 mainnet installation:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.loom.com%2Fembed%2Fa86701c5141044b89258c6e17a596302&amp;display_name=Loom&amp;url=https%3A%2F%2Fwww.loom.com%2Fshare%2Fa86701c5141044b89258c6e17a596302&amp;image=https%3A%2F%2Fcdn.loom.com%2Fsessions%2Fthumbnails%2Fa86701c5141044b89258c6e17a596302-1670199578811.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=loom" width="1670" height="1252" frameborder="0" scrolling="no"><a href="https://medium.com/media/81b4aea796d488823c1158d47b9889ed/href">https://medium.com/media/81b4aea796d488823c1158d47b9889ed/href</a></iframe><h3>Key Benefits of OpenDAX</h3><p>The crypto exchange ecosystem is plagued with many technical problems that have made launching and operating crypto exchanges difficult. OpenDAX aims to resolve these issues.</p><p>If you like it visual, here’s an OpenDAX v4 video webinar by Openware CEO &amp; Founder Louis Bellet:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FbuQ42PNqxVc%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DbuQ42PNqxVc&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FbuQ42PNqxVc%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/d26986a794e19756ae0af29b903e8503/href">https://medium.com/media/d26986a794e19756ae0af29b903e8503/href</a></iframe><h3>KYC &amp; AML Compliant</h3><p>Even now, compliance remains a huge problem in the crypto exchange space. And although KYC and AML solutions exist, standards vary across countries. OpenDAX comes with a KYC integration protocol using which you can easily use a KYC supplier service with your exchange.</p><p>You can also customize these solutions to suit your own needs.</p><h3>Cutting Down Business Costs</h3><p>Because of the other benefits of OpenDAX in infrastructure, development, security, and liquidity, it can massively cut down the cost required to launch and operate a cryptocurrency exchange business. That includes minimizing OPEX &amp; CAPEX costs, making OpenDAX stand out from other similar solutions.</p><h3>Perfect For Businesses of All Sizes</h3><p>Whether your exchange is operating globally or is serving a small area, OpenDAX can scale to serve audiences of all sizes. OpenDAX can be operated by small and large teams, making it easier to start a crypto exchange business.</p><h3>Final Thoughts</h3><p>This article sums up the OpenDAX crypto exchange platform and its technical and business benefits. If you have any doubts or queries regarding the engine, feel free to reach out to the extensive <a href="https://t.me/peatio">OpenDAX community</a>. In the upcoming articles, we will explain how you can deploy, manage and extend an OpenDAXv4 mainnet instance on the cloud of your choice.</p><p>Feel free to experiment with the installation, ask your questions to the community, and let’s build the Web3 Internet of Finance together!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2b9f0dae1523" width="1" height="1" alt=""><hr><p><a href="https://medium.com/yellow-blog/introduction-to-opendax-a-fast-secure-highly-scalable-open-source-crypto-exchange-engine-2b9f0dae1523">Introduction to OpenDAX — A Fast, Secure &amp; Highly-Scalable Open-Source Crypto Exchange Engine</a> was originally published in <a href="https://medium.com/yellow-blog">The Yellow Network Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Developer’s Guide To Web3 Security]]></title>
            <link>https://medium.com/yellow-blog/developers-guide-to-web3-security-6836f75e9bc9?source=rss-94bf047334a9------2</link>
            <guid isPermaLink="false">https://medium.com/p/6836f75e9bc9</guid>
            <category><![CDATA[web3]]></category>
            <category><![CDATA[developer]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[smart-contracts]]></category>
            <dc:creator><![CDATA[Akshat Mishra]]></dc:creator>
            <pubDate>Thu, 03 Nov 2022 12:26:30 GMT</pubDate>
            <atom:updated>2023-05-13T09:19:07.285Z</atom:updated>
            <content:encoded><![CDATA[<h4><strong>Learn About The Industry’s Best Practices, Security Roles, And How To Approach Web3 Security As a Developer</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gCYh9lmP-fA_B-nmIqql5w.jpeg" /><figcaption>Understanding Web3 Security From The Ground-up</figcaption></figure><p>Web3 has finally entered the mainstream consumer space, and its effect is undeniably strong. Even the big tech realizes this, as it has started <a href="https://bigthink.com/the-present/google-amazon-others-entering-blockchain/">building the supporting infrastructure</a>. This moment also marks a major shift in the tech landscape as we transition from the company-owned Web2, to the user-owned Web3 model.</p><p>But as with any new technology, Web3 comes with a whole new set of challenges, and security remains a big issue. According to <a href="https://www.certik.com/resources/blog/7fuXtbfo4CXEXcwy5Pqijp-hack3d-the-web3-security-quarterly-report-q2-2022">Certik</a> — a leading Web3 security firm, DeFi has lost more than $2 billion in the first two quarters of 2022 alone, which just goes to show how bad the situation is.</p><p>Cyber attacks have become increasingly common and there has been a parallel surge in demand for security professionals in the industry. Since Web3 is still in its nascency, this presents itself as a perfect opportunity for people who are looking to get a headstart in this space.</p><h3>How Secure is Web3?</h3><p>Security in Web3 revolves around two central ideas, decentralization and strong encryption. These features are native to the blockchain technology, which is a self-protecting database that resists mutation due to its design. But unlike traditional databases, a blockchain has several layers of protection.</p><p>Every piece of data on a blockchain is a transaction, and to verify its authenticity a blockchain uses a ‘<strong>Consensus Mechanism</strong>’. This algorithm requires all the miner nodes on a blockchain to reach a common ground for a transaction before it can get recorded. Additionally, every transaction is <a href="https://www.techtarget.com/searchsecurity/definition/asymmetric-cryptography">asymmetrically encrypted</a>, and its ownership can be justified.</p><p>The security of a blockchain is established on one simple fact; that the computing power required to create fake transactions has to be greater than the combined processing power of all participating miner nodes. As the blockchain gets bigger and computers naturally get faster, the cost of brute-force or data corruption attacks on a blockchain becomes impossibly high.</p><p>But even with this security, Web3 systems are still constantly at the receiving end of cyber attacks. So much so, that it has painted an overall grim picture for some people in the community. And this raises the question, is Web3 really more secure than Web2? The short answer is <strong>Yes</strong>.</p><p>The reasoning behind this is quite simple; as most of the security breaches that we see in the blockchain world today (with the exception of some) are not related to the functioning of the blockchains themselves. These attacks mostly occur on application layer, or from newer technologies built around the blockchain that facilitate cross-chain communication.</p><h3>Web3 Security Vectors</h3><p>The list of attack vectors in Web3 is long and constantly growing; and for the sake of this article, we’ll limit the scope to only those pathways which depend upon the functioning of Decentralized Applications.</p><h4><strong>Smart Contract Vulnerabilities</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4tVYnWpi31KLUkNN4SYk4Q.jpeg" /><figcaption>Understanding Smart Contract Vulnerabilities</figcaption></figure><p>Although Web3 has been around for a while now, the ecosystem for writing smart contracts is immature. Writing blockchain apps requires a deep understanding of smart contract programming languages, and an in-depth knowledge of blockchain networks. And due to the absence of a mature ecosystem, developing enterprise-grade blockchain apps is quite difficult.</p><p>The EVM is still experimental in nature, and bugs are easier to induce than they are to detect. A good example of this would be the re-entrancy attack which only takes the programmers to incorrectly structure the sequence of operation for the vulnerability to take effect. <a href="https://swcregistry.io/">SWC registry</a> records some of the most common vulnerabilities which we’ll cover in a little detail later.</p><p>Programming vulnerabilities are the leading security concern even today. Smart Contracts ideally need to go through several stages of security audits, before they are considered ready for production.</p><h4><strong>DeFi Semantics</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ECEFU4gze_F9RoXPf6Nd6A.jpeg" /><figcaption>Semantic-Based Attacks Are Hard to Detect</figcaption></figure><p>Web3 provides a native ecosystem for finance as cryptocurrencies are embedded right into its framework. However, this has also created problems for developers and businesses as now attackers have an easier, and more direct access to it. Additionally, the functioning of a DApp is directly dependent upon the liquidity of the environment; which, as of today, is quite poor.</p><p>This allows more sophisticated, semantic-based attacks to occur. One of the simplest forms of this attack is market manipulation in DEXs to create artificial pumps and dumps. Attackers can make use of features of DeFi like lending, borrowing, flash-loans and combine them together in ways to attack the entire system.</p><p>The price oracle manipulation attack also comes under this category, where attackers use the weakness of on-chain oracles to manipulate prices either through flash-loans or borrows. This is now used to artificially increase the prices which leads to liquidations and a steep fall in the price of the token.</p><p>Compared to smart contract weakness based attacks, these are harder to detect. And to fully understand and assess risk, businesses need to hire experts who understand the high-level semantics of a DeFi application.</p><h4><strong>Blockchain Trilemma</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9DuZz4u73ZZ1wmRAqRgpyg.jpeg" /><figcaption>Blockchain Trilemma</figcaption></figure><p>Unlike the other two weaknesses, Blockchain Trilemma is related to the weakness of blockchain and its surrounding technologies. And it refers to the notion that blockchain systems cannot simultaneously be highly scalable, secure and decentralized. Until recent innovations, this has more or less held true especially in the case of Layer–1 networks.</p><p>The idea originates from the CAP theorem, which was formulated in the 1980s. And according to the theorem, amongst security, scalability and decentralization; a distributed system can only provide two of the features at once. Blockchain being a distributed system, follows this theorem.</p><p>Centralization of resources improves speed, but it also puts all responsibility on a single entity which reduces security. On the other hand, decentralization improves security, but slows down a network considerably. Most of the high TPS Layer–1 networks still suffer from this problem. The trilemma is further proven right in the case of CEXs and DEXs, where each have their benefits over the other.</p><p>However, recent innovations in the blockchain space have created a pathway for Layer–1 networks to scale while keeping their decentralization and security intact. Layer–2 scaling solutions like state-channels, sidechains and nested chains have been able to greatly improve the scalability of Layer–1 networks without harming their security.</p><h3><strong>Ensuring Security in An Unstable Environment</strong></h3><p>Web3 gets attacked often because it is still in its elementary phase, and these attacks are more like growing pains. Opposed to Web2 applications, which follow the conventional client-server architecture, the rules and frameworks concerning the security of Web3 apps, are still under development.</p><p>Moreover, since there’s no formal Web3 consortium or a central standards organization, a lot of development around the security of Web3 applications is scattered and distributed amongst several independent organizations. As such, securing Web3 applications currently is more challenging than Web2</p><p>Even some of the most popular products like Binance, Uniswap, tornado, and Harmony face regular attacks. While ensuring complete security in this environment is unrealistic, we can get close to it by following simple rules; Given below are the steps you can take as a developer to secure your Decentralized Apps.</p><h3>Following The Design Standards</h3><p>Web3 companies have different solutions for a single problem, and a lot of them are new, and largely untested in real world environments. This is bad from a security standpoint and puts the business and its customers at risk.</p><p>However the risk can be reduced significantly by adhering to the coding standards, and following some rules. Colloquially speaking, design pattern is a general reusable solution to a given problem; whose security is well established.</p><p>When it comes to writing smart contracts, there are design patterns which deal with different aspects of a DeFi application such as, optimizing gas costs, safely handling transactions and securely managing storage. Smart Contract developers can make use of the SWC registry as their go-to handbook for writing coherent, and secure code. We’ve discussed a few of those below.</p><h4><strong>Withdrawal Pattern</strong></h4><p>Handling transactions is one of the most trivial but sensitive tasks, and there are several ways to do it. Solidity provides send, transfer and call functions for transferring ether through a smart contract.</p><p>Although all three of these functions are secure and can be used for making transfers, in practice, there are certain quirks about making transactions. We’ll use the smart contract below (taken from <a href="https://docs.soliditylang.org/en/v0.8.15/common-patterns.html#withdrawal-from-contracts">Solidity Docs</a>) to serve our example.</p><pre><strong>pragma solidity</strong> ^<strong>0.8.4</strong>;<br><strong>contract</strong> <strong>SendContract</strong> {</pre><pre>address payable public richest;<br>uint <strong>public </strong>mostSent;<br>error NotEnoughEther();</pre><pre>constructor() payable {<br>richest = payable(<strong>msg.sender</strong>);<br>mostSent = <strong>msg.value</strong>;<br>}</pre><pre>function becomeRichest() public payable {<br>if (<strong>msg.value</strong> &lt;= mostSent) revert NotEnoughEther();<em><br></em>richest.transfer(<strong>msg.value</strong>);<br>richest = payable(<strong>msg.sender</strong>);<br>mostSent = <strong>msg.value</strong>;<br>}<br>}</pre><p><strong>Source : Solidity Docs — </strong><a href="https://docs.soliditylang.org/en/v0.8.15/common-patterns.html#withdrawal-from-contracts">Withdrawal Pattern (Become The Richest Contract)</a></p><p>The following contract makes a direct transfer to the receiver, and this puts the entire burden of transaction on the sender. Which means, if the transaction fails, it would stop the functioning of our contract, and if any of the other users have their funds in this DApp, they would forever be locked.</p><p>Luckily for us, the fix is quite simple, our goal here is to not bear the responsibility of the transaction.</p><pre>function becomeRichest() public payable {<br>if (<strong>msg.value</strong> &lt;= mostSent) revert NotEnoughEther();<br>pendingWithdrawals[richest] += <strong>msg.value</strong>;<br>richest = <strong>msg.sender</strong>;<br>mostSent = <strong>msg.value</strong>;<br>}</pre><pre>function withdraw() public {<br>uint amount = pendingWithdrawals[<strong>msg.sender</strong>];<br>pendingWithdrawals[<strong>msg.sender</strong>] = 0;<br>payable(<strong>msg.sender</strong>).transfer(amount);<br>}</pre><p>As can be seen above, the simplest fix is creating a function which allows the fund receiver to withdraw their amount from a mapping which holds the information of their withdrawal. Withdrawal Pattern provides a safe way to transfer ether so that it does not block the functioning of a smart contract in-case of a failure.</p><h4><strong>Avoiding Re-entrancy</strong></h4><p>Re-entrancy is a vulnerability that arises from the way we structure code in a smart contract. It works by stopping the execution of a payable function by trapping it inside a recursive call. It can be better understood using the example below.</p><pre>// INSECURE<br>mapping (address =&gt; uint) private userBalances;</pre><pre>function withdrawBalance() public {<br>uint amountToWithdraw = userBalances[msg.sender];<br>(bool success, ) = msg.sender.call.value(amountToWithdraw)(“”); <br>require(success);<br>userBalances[msg.sender] = 0;<br>}</pre><p><strong>Source: Consensys.org — Reentrancy</strong></p><p>The <em>withdrawBalance</em> function allows the users to withdraw their funds, however, it updates the user fund allocation after making the transfer. This means a user can drain this contract of all its funds by trapping eth transfer inside a recursive call. And this is done through a fallback function which calls the <em>withdrawBalance</em> method recursively.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vXH1QIUTcusv2_U8MEv8YA.jpeg" /><figcaption>Re-entrancy Explained</figcaption></figure><p>This vulnerability can drain a contract of all its funds, and is a classic example of how smart contract programming is different from Web2 development and design. A simple fix would be to update the state variable before the transfer takes place, as in the example we’ve provided below.</p><pre>function withdrawBalance() public {<br>uint amountToWithdraw = userBalances[msg.sender];<br>userBalances[msg.sender] = 0;<br>require(amountToWithdraw &gt; 0);<br>msg.sender.call.value(amountToWithdraw)(“”); <br>}</pre><h4><strong>Locking Unlocked or Floating Pragma</strong></h4><p>Pragma is a compiler directive which tells EVM about the versions of Solidity our smart contract can execute on. Unlocking the pragma means the smart contract is open to execute on untested as well as experimental versions of solidity. And this can introduce fatal bugs to our application.</p><pre>pragma solidity ^0.8.0;<br>// Should be written as<br>pragma solidity 0.8.25;</pre><p>The first line suggests that all the versions of the solidity compiler starting from version 8, can be used for executing this contract. This has been fixed in the third line, where the pragma is locked. At the time of writing this article, Solidity version eight remains the standard.</p><h4><strong>Unencrypted Data on-chain</strong></h4><p>A common misconception amongst beginner blockchain developers is that the contents of a private marked variable are hidden, however, that’s not the case. Private in the context of blockchains and smart contracts means that the variable is inaccessible to other contracts.</p><p>The data of all the variables of a contract is stored on the blockchain and can be viewed by anyone. Although data storage contracts exist, they’re not generally built for storing sensitive information. And the developers must ensure that any sensitive data stored on a blockchain is encrypted.</p><h3>Preparing For Failure</h3><p>Blockchain technology is experimental, and it is bound to fail. Even flawlessly written code is susceptible to vulnerabilities and underlying architecture problems — which surface up from time to time. In the world of Web2, such situations would usually be handled through patches or hot-fixes; but since a blockchain works differently, security needs to be implemented by design.</p><p>What this means is that we need to make our smart contracts tolerant of failures. And this is important because a blockchain is an immutable database, and a smart contract that has once been deployed, cannot be deleted. There are three aspects to failure control which a smart contract needs to follow to gracefully deal with such issues.</p><ul><li><strong>Pausing the contract —</strong> This works like a circuit breaker for when security has been breached. It freezes the functioning of the application and ensures no further exploitation takes place.</li><li><strong>Rate limiting —</strong> As the name suggests, it means limiting the maximum usage of the different metrics in our app. This includes fund withdrawals, cooldown time, and successive withdrawals.</li><li><strong>Upgrade path — </strong>Designing the smart contracts to be upgradable is an absolute must. This also means having an effective upgrade plan and a procedure for introducing improvements or bug-fixes.</li></ul><p>Failure control protocols are built into all apps before they are rolled out for production, and it is a life saver in situations where there is a catastrophic failure or vulnerability in the system. The recent Binance bridge attack and the handling of the situation goes to show how important a failure control procedure can be.</p><p>On October 6th, the Binance bridge was drained for as much as $500 million. These funds were then moved across wallets on the smart chain network to disperse and make it hard to track. Binance prevented any further exploitation of their bridge, firstly by pausing their smart chain network, and then introducing new changes with the fork which solved the previous vulnerabilities.</p><h3>Designing Apps on Layer–3 Blockchains</h3><p>Layer–1 represents the first layer of blockchain and it manages all the essential tasks of the network. Because of the many operations that this tier has to manage, it faces issues regarding scalability. These problems are mitigated through Layer–2 scaling solutions such as state-channels, sidechains and plasma-networks.</p><p>Layer–2 networks work by forming an arrangement which decouples acknowledgement and settlement of data. This boosts the network speed and also introduces interoperability. But despite offering higher speeds Layer–2 networks have failed to gain mainstream popularity, as they do not inherit the liquidity of their parent chains. Good liquidity triumphs over gains in speed and apps continue to be developed on Layer–1 networks.</p><p>Over the years, this has created many problems for businesses. The absence of a mature ecosystem has made the development of blockchains apps complex and expensive. On one end, developers can reap the benefits of high liquidity, and on the other they can make use of high scalability and interoperability to offer smoother user experiences.</p><p>These problems are now solved by Layer–3 networks, which perform the task of connecting, pooling liquidity of Layer–1 &amp; 2 networks. And in doing so, Layer–3 networks get rid of the redundancy that plague blockchain development. Layer–3 acts as an application layer and it simplifies the development of decentralized apps.</p><p>Layer–3 protocols like the <a href="https://www.yellow.org/"><strong>Yellow Network</strong></a> bring the much needed reliability and security to Web3. By providing deep liquidity, high interoperability and scalability, Layer–3 creates an ideal working environment for DApps. Deep liquidity offers protections from price manipulations while the SDK provides a simpler interface for making apps interoperable.</p><h3>The Web3 Security Stack</h3><p>Security is a broad field and it requires knowledge of a diverse set of skills. Although there are many languages and tools to cover, you can get started using just a few of these. And depending on your goals and area of interest, your tech stack can have different variations of the one we have mentioned here.</p><h3>Blockchain Programming Languages</h3><p>Based on their use, blockchain programming languages can be divided into two categories. Application programming languages are used for writing smart contracts and developing decentralized apps. Whereas Low-Level languages are used for the development of blockchain networks.</p><p><strong>Go —</strong> Imagine C, but with a modern syntax, memory safety, structured typing and garbage collection; well that’s exactly what Go is. Go was developed at Google as a “modern C” . It is used for building fast and reliable modern blockchain systems.</p><p>Go’s low level capabilities allow the developers to have fine-grain hardware control, while its modern syntax and features boost productivity and make long term maintenance of blockchain products easy.</p><p><strong>Rust — </strong>Rust was developed by the Mozilla corporation to be the modern C++. It is a popular contender to Go for blockchain development as it offers similar features and is in use in major chains such as Solana and PolkaDot.</p><p>But unlike Go, Rust has controllable memory management. Developers can harness this feature to make extremely fast and efficient blockchain systems. Additionally, Rust is also in popular use as a smart contract programming language due to its easy to learn syntax.</p><p><strong>Python — </strong>Unless you’re living under a rock, Python should be no stranger. It is a general purpose programming language with a simple syntax, which has been designed keeping code readability in mind.</p><p>It has tons of libraries and can be used to write smart contracts for blockchains like AlgoRand. It is also heavily used in smart contract vulnerability tools such as Mythril and Slither which we’ve discussed in the coming sections.</p><p><strong>JavaScript — </strong>JavaScript is the native language of the internet, and it is here to keep that title. JavaScript offers first class support for blockchain development and has been a direct inspiration for languages like solidity.</p><p>It has a small learning curve and by far the best support for blockchain app development. Together with npm and the NodeJs ecosystem, JavaScript is a powerhouse of tools which you can use to easily bootstrap a blockchain app in seconds.</p><p><strong>Solidity </strong>— When it comes to writing smart contracts, Solidity is arguably the most popular programming language. It is native to the Ethereum ecosystem and is supported by other major blockchains such as Avalanche and Binance.</p><p>It bears many similarities with the curly-bracket languages like Java and JavaScript and is fairly easy to grasp. Another thing to note, is that amongst all smart contract programming languages, Solidity has the best support and the most mature ecosystem of libraries and frameworks.</p><p><strong>Vyper — </strong>Vyper is a relatively new pythonic language which has recently gained traction. It has an easy syntax and its compilation targets the EVM. Vyper was developed to make blockchain programming less complex, and to eliminate the bugs that arise because of the code structures in Solidity.</p><p><strong>Motoko </strong>— Although less popular, Motoko is used for application development for the ICP blockchain. The Internet Computer is a blockchain that aims to reform the centralized internet. It is a decentralized cloud computing platform where motoko is used to “model” protocols and apps.</p><p><strong>Yul — </strong>Yul is an Intermediate EVM based language which was designed to make optimisations on Solidity code. Its primary purpose is to improve the gas experience and produce more efficient target bytecode which executes on the EVM.</p><h3>Security Analysis Tools</h3><p>Security analysis tools are the swiss army knife in the world of infosec, and are of great help to security engineers and developers alike. Unlike programming languages, these tools have a smaller learning curve and are fairly easy to use.</p><p><a href="https://github.com/crytic/slither"><strong>Slither</strong></a><strong> </strong>— Developed by Crytic, it is the most popular free tool used for static analysis of solidity code. It’s written completely in python and features a vast array of vulnerability detectors. Slither also has its own API which the developers can use to write custom vulnerability analysers.</p><p><a href="https://github.com/ConsenSys/mythril"><strong>Mythril</strong></a><strong> — </strong>It is a part of the Mythx tool suite provided by Consensys for enterprises. But unlike Mythx, it is completely free of use. It supports symbolic analysis and SMT solving for smart contracts. Mythril works on bytecode and supports multiple EVM compatible blockchains.</p><p><a href="https://github.com/crytic/echidna"><strong>Echidna</strong></a><strong> </strong>— Echidna is another famous tool developed by Crytic. It is written in Haskell and is used for Fuzz-testing Solidity contracts. It runs a series of tests against smart contracts to test their security in real-world scenarios. Echidna is modular in nature and can be extended with custom tests.</p><p><a href="https://github.com/trailofbits/manticore"><strong>Manticore</strong></a><strong> — </strong>Manticore is strictly a symbolic execution tool which is used to explore all the possible states a smart contract can reach within the range of its capacity. It also records inputs which lead a contract to a given state in case of errors.</p><p>All these tools are a part of the Ethereum security toolbox, which presents them in a singular docker image. This makes it all the more convenient to set up and work with them collectively rather than installing them as separate packages.</p><h3>Blockchain Development Frameworks</h3><p>Outside the realm of Web3, blockchain systems have a ton of uses and have been in popular use by the industry for over a decade. Since developing a blockchain system from scratch takes time and is quite expensive, the industry has collaborated and come up with solutions for developing custom blockchains using pre-existing tools and frameworks.</p><p><a href="https://www.hyperledger.org/use/fabric"><strong>Hyperledger Fabric</strong></a> — Hosted by the Linux Foundation, Hyperledger Fabric is a permissioned blockchain platform built for the enterprise. It has a modular plug-and-play architecture and is in use by companies such as Walmart and Sony. It offers a ton of pre-built consensus mechanisms and configurations, along with the ability to add custom features on the go.</p><p><a href="https://ethereum.org/en/"><strong>Ethereum</strong></a><strong> </strong>— Ethereum is the world’s first and arguably also the most popular blockchain development framework. It offers the most advanced set of features, and a Turing complete bytecode interpreter called the EVM. Ethereum forms the basis of modern blockchain networks today and has a thriving community.</p><p><a href="https://eos.io/"><strong>EOSIO</strong></a><strong> — </strong>EOSIA is a blockchain development framework that’s been developed to meet high demands. It is a developer-friendly and highly configurable platform which is used for developing high-throughput permissioned blockchain networks. EOSIA uses C++ for smart contracts and has great community support.</p><h3>Web3 Security Roles</h3><p>Security is about connecting the dots, protecting systems and creating dependable recovery plans. Compared to development, security roles are more serious, and given the current scarcity of talent in Web3, the demand is high. A lot of these roles have overlapping responsibilities and this makes transitioning from one role to another quite easy.</p><ul><li><strong>Smart Contract Auditor </strong>— As the name suggests, your job is to analyze smart contracts, detect vulnerabilities and bullet-proof the code before it goes for production. Additionally, some companies might also require you to mentor fellow engineers over the best security practices.</li><li><strong>Blockchain Security Engineer </strong>— As a security engineer your job is to secure the entire end to end blockchain. This includes auditing smart contracts, securing blockchain infrastructure, creating custom security tools as well as conducting in-depth research on the latest attacks.</li><li><strong>Security Lead </strong>— Similar to the security engineer role, your job is to secure the entire blockchain infrastructure. But this goes well beyond that, as you are also required to create custom infosec plans, and make important decisions related to the security of the business and its clients.</li></ul><h3>Resources To Learn And Practice Web3 Security</h3><p>Creating a portfolio for security roles is slightly tricky as this area requires a lot of experience, and is usually not very beginner friendly. Luckily for us, there are plenty of resources online where we can practice and testify our skills for free. Moreover, a lot of these platforms offer bug-bounty programs to incentivise learning and boost participation</p><ul><li><a href="https://www.damnvulnerabledefi.xyz/"><strong>Damn Vulnerable DeFi</strong></a><strong> — </strong>It is a hacking war-game where users/participants go through a series of smart contracts (equivalent of levels) with the purpose to either stop their functioning, drain them of funds or cause other anomalies.</li><li><a href="https://ethernaut.openzeppelin.com/"><strong>Ethernaut</strong></a><strong> — </strong>Similar to Damn Vulnerable DeFi, Ethernaut is a hacking wargame inspired by <a href="https://overthewire.org/wargames/">overthewire</a>. It also has a historical catalog of some of the biggest attacks which appear as levels.</li><li><a href="https://immunefi.com/"><strong>Immunefy</strong></a><strong> — </strong>Backed by Chainlink and Sushiswap, Immunefy is a Web3 bug bounty program founded in 2020. It offers some of the biggest bounties from major Web3 orgs that are updated frequently.</li><li><a href="https://hackenproof.com/"><strong>HackenProof </strong></a><strong>— </strong>Hackenproof is Hacken’s bug hunting program. Hacken is a leading name in Web3 security, and just like Immunefy, Hackenproof offers huge bounties and is associated with big orgs like FTX and CoinGecko.</li></ul><p>If you prefer a structured way of learning then there are plenty of DAOs and Web3 cohorts which offer tutored sessions. They also have an active community which will help you along the way at every step.</p><ul><li><a href="https://buildspace.so/"><strong>Buildspace</strong></a><strong> — </strong>Buildspace is perhaps one of the most famous DAOs. Whether you’re experienced, just starting out or have cool ideas to work on, Buildspace is the perfect place to start with Web3 as quickly as possible.</li><li><a href="https://learnweb3.io/"><strong>Learn Web3</strong></a><strong> — </strong>With an active community of over 50k members (and growing), Learn Web3 is the fastest growing DAO. It offers curated learning paths and sponsored tracks to help accelerate your learning.</li><li><a href="https://znsrc.com/c/mjlxcvsawc"><strong>Alchemy University</strong></a><strong> —</strong> Whether you’re a beginner or an intermediate developer, Alchemy university will help you get started and advance your skills in Web3. Their Discord community has close to 30k members and you can find mentors or fellow developers to help you out.</li></ul><h3>Closing Thoughts</h3><p>Security is of paramount importance to every business and in order to become truly disruptive and viable, Web3 needs to become more mature. Ultimately, the success of Web3 is tied to how secure it is. And just like the internet, our requirements have to evolve and adapt to this new decentralized and transparent web.</p><p>Since Web3 is extremely fast paced, to keep ourselves secure we need to stay ahead of the curve. As a security professional, you need an abstract understanding as well as nuts-and-bolts knowledge of the technology at hand. And while there’s no secret sauce to achieving complete security, an appetite for learning definitely helps.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6836f75e9bc9" width="1" height="1" alt=""><hr><p><a href="https://medium.com/yellow-blog/developers-guide-to-web3-security-6836f75e9bc9">Developer’s Guide To Web3 Security</a> was originally published in <a href="https://medium.com/yellow-blog">The Yellow Network Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Let’s Customize OpenDAX White Label Crypto Exchange Branding and Landing Page]]></title>
            <link>https://medium.com/openware/how-to-opendax-customizing-our-crypto-exchange-branding-and-landing-page-6887e4011ec?source=rss-94bf047334a9------2</link>
            <guid isPermaLink="false">https://medium.com/p/6887e4011ec</guid>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[cryptocurrency]]></category>
            <category><![CDATA[blockchain-development]]></category>
            <category><![CDATA[nextjs]]></category>
            <category><![CDATA[open-source]]></category>
            <dc:creator><![CDATA[Akshat Mishra]]></dc:creator>
            <pubDate>Fri, 03 Jun 2022 12:55:03 GMT</pubDate>
            <atom:updated>2022-06-06T10:15:16.779Z</atom:updated>
            <content:encoded><![CDATA[<h4><strong>Exploring The Exchange, Changing The Look And Feel</strong></h4><figure><img alt="A Man Typing On A Computer — Kept On A Desk" src="https://cdn-images-1.medium.com/max/1000/1*npdCzjpC_UUTP53E1nwKBw.jpeg" /><figcaption>Buckle Up For The Next Ride, As We Customize Our Exchange Together</figcaption></figure><p>In the previous article on launching our own <a href="https://medium.com/openware/lets-launch-a-crypto-exchange-brokerage-using-open-source-opendax-with-yellow-network-liquidity-225430727084">white-label crypto exchange brokerage</a>, we discussed the problems that are faced when launching a crypto exchange platform, and how <a href="https://www.openware.com/product/opendax">OpenDAX</a> and <a href="https://www.yellow.org/">Yellow Network</a> solve the software and liquidity. We went as far as generating a Frontend using the <a href="https://www.npmjs.com/package/@openware/create-opendax-web-app">OpenDAX NextJs</a> template. Today’s article is about customizing that front-end and taking a closer look at the software.</p><p>Now, this article assumes that you’ve been following along with our series. And while we recommend that you do so, feel free to follow along as we walk you through our exchange software. With that out of the way, let’s begin customizing our OpenDAX NextJs template and give it some personality.</p><h3>Exploring Our Exchange</h3><p>For better clarity, I’ve broken down our exchange’s trading interface into a set of components and labeled them with numbers. Think of them as lego pieces that you can join in different ways to create cool stuff.</p><p>Now If you’ve ever used an exchange, you will find this interface to be very familiar.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*8jJn6m-JyMtTNUBf" /><figcaption>Understanding The Interface</figcaption></figure><h4><strong>Sidebar</strong></h4><p>It has routes for our settings page, the trading interface and a button to connect our wallet. On connecting the wallet, you can also see added options for the order history as well as deposit and withdraw buttons.</p><p>While this component isn’t exactly essential to our exchange, it’s a convenient UI/UX design pattern. We can navigate to any screen from anywhere and this works even better on mobile as we’ll see later.</p><h4><strong>Chart</strong></h4><p>At the bottom of our screen, we have the trading chart. Our chart is the star of the show, OpenDAX makes use of Trading View’s charting library to provide you with all the good features of trading view without compromise.</p><p>By default, it supports all common chart patterns and indicators; tools like Fibonacci retracement and moving averages are built into it. You can also add your own indicators to this chart.</p><h4><strong>Orderbook</strong></h4><p>An exchange works by connecting buyers and sellers, and the Orderbook represents just that. In the orderbook, you can see all the buy and sell orders placed at different amounts for our currency.</p><p>For now though, those are all just mock orders that are populated through the mockserver.</p><h4><strong>Order Creation Panel</strong></h4><p>Lastly, we have the panel to create orders. Orders direct exchanges when and how to buy an asset for your account based on a given set of conditions.</p><p>Our exchange supports the market and limit orders, in both the buy and sell directions. Market orders execute at the market rate, and the limit orders execute when our currency value reaches the limit price.</p><h3>Connecting The Wallet</h3><p>To explore the UI even more, we need to connect our wallets. This will give us the option to deposit and withdraw Crypto to our wallet address and several other added features to our exchange.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*bAvOJWL-5SvQH0RA" /><figcaption>Connecting The Wallet</figcaption></figure><p>Since OpenDAX is a Decentralized Exchange, the wallet is non-custodial and to work with it you need to link your existing wallet to the exchange. As of now, it supports Metamask and WalletConnect.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/325/0*qs-Xm1ep20DHdZ6s" /><figcaption>Sidebar After Connecting The Wallet</figcaption></figure><p>On expanding the sidebar, we can now see our wallet’s address as well as an option to deposit and withdraw crypto at the bottom. However, the placeholder for our logo currently sits blank as we haven’t chosen any logo yet.</p><p>It’s time to change that, so let’s head over to our exchange’s settings panel to see all the available customization options.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*uebWMQ1sQjfoaEWO" /><figcaption>Tinkering With The Settings</figcaption></figure><p>Here, we have an option to choose our exchange’s languages, currently it supports English and Russian–both of which can be toggled at the settings. We also have an option to toggle dark and light themes followed by<strong><em> customization</em></strong> and the <strong><em>connection type</em></strong>.</p><p>We’ll leave the <strong><em>connection type</em></strong> as it is, and enable <strong>customization</strong> for our exchange. Now this is where the fun begins, after enabling customization you can see an icon in the shape of a color tray at the bottom-right portion of your screen; this is the menu which will help us in customizing our exchange.</p><h3>Customizing Our Exchange</h3><p>Currently, our exchange looks quite bland and only has light and dark themes. It also lacks a logo and landing page, all of which are essential to any exchange. On clicking the color tray you can now see the different options to customize your exchange.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*6nMsw-rJCwiJSwaS" /><figcaption>Customizing Our Exchange</figcaption></figure><h3>Playing With The Color Palette</h3><p>Let’s begin by changing the colors of our exchange. We’ll set the primary CTA, secondary CTA and Sidebar to <strong>#31d35c</strong>, <strong>#2d314d </strong>and <strong>#2bb7da</strong> hex codes respectively. These are the colors that I’ll be using for our landing page and the logo.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ywQHmBLAuP9tipnX" /><figcaption>Changed Colors</figcaption></figure><h3>Adding A Logo</h3><p>To add a logo, head over to the logo tab in the customization menu and select a logo for the light and dark modes for your exchange. For now, let’s just select a logo for the light mode, make sure your logo is <strong>115x30</strong> pixels in size.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/398/0*HUq_1Hx88coLhd0Q" /><figcaption>Selecting The Logo</figcaption></figure><p>After uploading your logo, hit save, and now we have a logo, which you can see in the sidebar.</p><h3>Naming Our Exchange</h3><p>It’s finally time to name our exchange, let’s head over to the <strong>‘Platform Name’</strong> tab and set up our exchange’s name.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*c1Q4lTJoOG_JoB_s" /><figcaption>Naming Our Platform</figcaption></figure><p>And there we have it, with this we’ve finished the basic customization for our exchange. It now has a theme, a logo, and a name. But our exchange still lacks a landing page, which takes us to our last and final part.</p><h3>Setting Up A Landing Page</h3><p>Our app, by default, redirects to the trading screen and that’s because it lacks a landing page. The developers at <a href="https://www.openware.com/">OpenWare</a> have given us full freedom in choosing our own theme and design with control over every visual aspect of our exchange.</p><p>However, to set up our landing page we need to get our hands dirty with a little coding. It’s time to pop open the hood and configure our landing page internally. To make it easier, I’ve provided the code snippets which you can directly copy and paste into your exchange’s folder to make it look the same.</p><p>The first step is cloning or downloading the code from my <a href="https://github.com/Akshat-Mishra101/OpenDAX-Landing-Page"><strong>repository</strong></a>. After unpacking the contents of the zip file, you can see we now have the following folders.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/802/0*DmSG74fqM-17SMdU" /><figcaption>Contents of The Repo</figcaption></figure><p>After unpacking the zip file, copy <strong><em>index.tsx</em></strong> present in our<strong><em> pages</em></strong> folder, and replace it with the<strong><em> index.tsx</em></strong> file in our exchange’s <strong><em>pages </em></strong>folder. Next, we need to copy all the images present in our<strong> <em>images</em></strong> folder, and paste them into the <strong><em>images</em></strong> folder located in <strong><em>public/images</em> </strong>of our exchange’s directory.</p><p>The last thing we need to do is to copy the <strong><em>Landing</em></strong> folder and paste it in the <strong><em>components </em></strong>folder of our exchange. Remember to save all the files after every change and wait for <strong>NextJs</strong> to compile the files. After they are compiled, we can go to<strong> localhost:3001</strong> to check out our exchange’s landing page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*I1_jznXzdhfV-o8r" /><figcaption>The Landing Page</figcaption></figure><p>And there it is, the landing page complete with our logo and the buttons to access our trading panel; you can now click on the different buttons to access all parts of our website.</p><h3>Conclusion</h3><p>We are done with both the setup and customization of our exchange, it is now time to finally connect our frontend to the real OpenDAX backend with liquidity from the Yellow network. This is where we’ll deploy our exchange which you can use to perform real trades.</p><p>We’ll also go through our exchange’s source code to see how NextJs works in the background, and understand all the magic that happened in setting up our landing page. See you in the next article where we’ll plug the liquidity from the <a href="https://www.yellow.org/">Yellow Network</a>. And as always, if you have any doubts, feel free to reach out.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6887e4011ec" width="1" height="1" alt=""><hr><p><a href="https://medium.com/openware/how-to-opendax-customizing-our-crypto-exchange-branding-and-landing-page-6887e4011ec">Let’s Customize OpenDAX White Label Crypto Exchange Branding and Landing Page</a> was originally published in <a href="https://medium.com/openware">Openware</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Let's Launch a Crypto Exchange Brokerage Using Open-Source OpenDAX with Yellow Network Liquidity]]></title>
            <link>https://medium.com/openware/lets-launch-a-crypto-exchange-brokerage-using-open-source-opendax-with-yellow-network-liquidity-225430727084?source=rss-94bf047334a9------2</link>
            <guid isPermaLink="false">https://medium.com/p/225430727084</guid>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[blockchain-development]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[cryptocurrency]]></category>
            <category><![CDATA[nextjs]]></category>
            <dc:creator><![CDATA[Akshat Mishra]]></dc:creator>
            <pubDate>Fri, 20 May 2022 05:03:38 GMT</pubDate>
            <atom:updated>2022-06-06T07:59:26.193Z</atom:updated>
            <content:encoded><![CDATA[<h4>Build Your Own Crypto Exchange Using OpenDAX</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*b55qUp5zt_CK46OUrx_12g.jpeg" /><figcaption>Ready, Set, Go! Let’s deploy an open-source crypto brokerage on Yellow Network.</figcaption></figure><p>If you’ve ever attempted or at least thought of creating your own crypto exchange, it takes little research to realize that it’s not easy. This is majorly because of two reasons, one is obtaining liquidity, and the other is having an experienced developer team.</p><p>Crypto exchanges are quite scarce, and their tech stack is mostly proprietary. This leaves us with two options, the first is making use of third-party libraries and components, which are often unmaintained, and the other is building your own exchange completely from scratch, which is a daunting task if you ask any developer.</p><p>But an even bigger problem is obtaining liquidity, and with Crypto, it is a “Chicken and the Egg” story. An Exchange is called liquid if it has an ample amount of buyers and sellers, and this means we need users to start with to get liquidity. But to get those initial users, we need liquidity, and this is where we are stuck in an endless loop.</p><h3>Welcome, Yellow Network and OpenDAX</h3><p>As we discussed earlier, we are dealing with two major problems here, the problem with liquidity and the problem with infrastructure; Yellow Network and OpenDAX solve exactly that. But how?</p><p>To start, <a href="https://www.yellow.org/">Yellow Network</a> is a Layer-3 decentralized overlay P2P network, which connects brokers together to form a giant Liquidity pool with shared order books, and solves the problem of getting liquidity to our crypto exchange altogether; other than that, it also brings in ultra-high-speed trading, which the crypto world has never seen before.</p><p><a href="https://www.openware.com/product/opendax">OpenDAX</a> is short for Open-Source Decentralized Asset Exchange, and it is open-source software with a host of libraries to build literally any crypto trading application, and we will use it to create a Crypto exchange brokerage website. It has a customizable self-hosted platform, several templates, as well as an open-source <a href="https://www.npmjs.com/package/@openware/opendax-web-sdk">OpenDAX WebSDK</a>, which you can use to build some crypto projects of your own.</p><p>If all this sounds too good to be true, well, because it is. Yellow Network and OpenDAX together are taking web3 to a whole new level where starting your own Crypto brokerage is easy as cake. Gone are the days when you needed a huge capital and network to start your own exchange.</p><p>So, in short, Yellow Network provides liquidity, and OpenDAX provides the infrastructure. In this series of articles, we’ll learn how to set up our very own Crypto exchange using the OpenDAX platform and connect it with the Yellow Network to obtain liquidity.</p><h3>Before We Begin</h3><p>To properly follow along with this tutorial, at the least, you need</p><ol><li>NodeJs on your computer.</li><li>VS Code or an equivalent code editor.</li><li>Basic understanding of JavaScript.</li></ol><h3>Starting Visual Studio Code</h3><p>To launch VS Code, select a directory of your choice and open the terminal in that directory. If you’re on Mac, then in the terminal, type ‘code’ and hit enter — this should open up VS Code with the chosen directory.</p><p>But If you’re on a windows system, then press shift and right-click together; this will open up the right-click menu with an ‘Open PowerShell window here’ option. After opening PowerShell, type ‘code .’ and this should launch VS Code for the selected directory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*KSk8yNwT94gew3nr" /><figcaption>Launching Visual Studio Code</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*XmiYwC01gIZdDn9V" /><figcaption>Visual Studio Code with the selected directory</figcaption></figure><p>Now, we need to launch the in-built terminal for VS Code, it provides all the features of our regular terminal plus the added convenience as you can launch as many terminals as you want, and you don’t need to switch between windows to write commands anymore.</p><p>To open a terminal in VS Code, go to ‘Terminal’ in the menu bar and click on ‘New Terminal’; this should open up a terminal window at the bottom. From here on, we can start writing our commands.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*LC0hq0t72LEsuqwr" /><figcaption>Opening VS Code terminal</figcaption></figure><h3>Bootstrapping An OpenDAX Project</h3><p>OpenDAX is available as separate tools and as a complete SDK. In the following series, we’ll make use of the OpenDAX NextJs template to set up our exchange. It is a Lego-like system and gives you complete freedom of customization.</p><p>To create an OpenDAX NextJs project, type the following command in the VSCode terminal, and hit enter.</p><p>npx @openware/create-opendax-web-app@latest</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*USn7sYZi0uJC6mT7" /><figcaption>Starting the OpenDAX package</figcaption></figure><p>This will execute our package and will set up the template for us. After executing this command, NPM will prompt you for the project template; here, we’ll keep the default option which is typescript. We are also asked for the name of our project; you can name it however you like. For the sake of this tutorial, we’ll call it ‘Crypto_Exchange.’</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*sjQnVFMqUSvaBhL8" /><figcaption>The Starter crypto exchange template</figcaption></figure><p>This process takes a while to complete, and by the end, we are left with our project’s folder. And while all these files may seem overwhelming, we don’t have to deal with them all.</p><h3>Starting The MockServer</h3><p>Our OpenDAX template is just the frontend interface. To actually make it functional, we need to have some sort of backend server to feed the data. That said, the OpenDAX backend is a heavy software and requires time and a lot of resources to set up.</p><p>Luckily for us, though, we have something called a ‘mock-server,’ which, as the name suggests, is an imitation of a real server. It will help populate our exchange with fake data so that we can conveniently work on customizing the front end without having to start a complete platform.</p><p>To start a mockserver, open a new terminal in VSCode for the project directory and type:</p><p>npm explore @openware/opendax-web-sdk -- npm run mockserver</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*0G7EYswYPlNIsJmY" /><figcaption>Starting OpenDAX backend</figcaption></figure><p>This spins up a mock-server at the given addresses. Notice how on the right side of this image, we have two terminals now. We have used the second terminal for spinning up our mockserver, and the first terminal is now going to be used to start the frontend.</p><h3>Starting The OpenDAX Frontend</h3><p>With our mockserver in place, it is finally time to start our frontend to visualize our app. To start the frontend, switch back to the first terminal and execute the command:</p><p>cd Crypto_Exchange</p><p>This will change the directory to our project’s directory, where we can finally run the command to start the frontend.</p><p>To start the frontend, enter the command:</p><p>npm run dev</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*fJCftHFh93QlZYZ8" /><figcaption>Launching the OpenDAX frontend</figcaption></figure><p>It will start the process of spinning up our frontend, which can take a couple of minutes to complete. At the end of this process, we will have our project running at localhost:3001 which we can navigate to see our project live.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*1vK8wFGHv8wVXW7s" /><figcaption>The Interface</figcaption></figure><p>And there we have it, a trading interface complete with an orderbook and an extensive chart similar to the Trading View’s chart. Here you can create your own indicator or choose from a library of indicators.</p><h3>Conclusion</h3><p>We’ve come to the end of this tutorial and have successfully set up our exchange’s frontend using the OpenDAX NextJS template, complete with dummy data from a mockserver.</p><p>I will keep going through the OpenDAX software stack. The next few articles will be majorly focused on <a href="https://medium.com/openware/how-to-opendax-customizing-our-crypto-exchange-branding-and-landing-page-6887e4011ec">customizing OpenDAX frontend</a>, understanding NextJs, and finally connecting it to a real backend to make a complete Crypto brokerage software.</p><p>I hope you enjoyed this tutorial. If you have any questions or have trouble sleeping — feel free to reach out :) See you in the next article where we customize our new cool crypto exchange!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=225430727084" width="1" height="1" alt=""><hr><p><a href="https://medium.com/openware/lets-launch-a-crypto-exchange-brokerage-using-open-source-opendax-with-yellow-network-liquidity-225430727084">Let&#39;s Launch a Crypto Exchange Brokerage Using Open-Source OpenDAX with Yellow Network Liquidity</a> was originally published in <a href="https://medium.com/openware">Openware</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How To Get Free Test Ether On Your Crypto Wallet]]></title>
            <link>https://medium.com/coinmonks/how-to-get-free-test-ether-on-your-crypto-wallet-675ee44813ef?source=rss-94bf047334a9------2</link>
            <guid isPermaLink="false">https://medium.com/p/675ee44813ef</guid>
            <category><![CDATA[metamask]]></category>
            <category><![CDATA[cryptocurrency]]></category>
            <category><![CDATA[smart-contracts]]></category>
            <category><![CDATA[web3]]></category>
            <category><![CDATA[ethereum]]></category>
            <dc:creator><![CDATA[Akshat Mishra]]></dc:creator>
            <pubDate>Wed, 13 Apr 2022 05:43:57 GMT</pubDate>
            <atom:updated>2022-04-13T07:09:47.485Z</atom:updated>
            <content:encoded><![CDATA[<h4>Get Free Test Ether From Chainlink Rinkeby Faucet On Your Metamask Wallet</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*NZlkA544HWVjehXA" /><figcaption>Photo by <a href="https://unsplash.com/@kanchanara?utm_source=medium&amp;utm_medium=referral">Kanchanara</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Before we begin, let’s make it clear that this article in not about getting Cryptocurrencies for free, or well, at least not something that holds real value. This article is about getting <strong>Test Ether</strong> from the <a href="https://faucets.chain.link/">chainlink faucet</a> so that you can use it later.</p><p>Now with that put aside, let’s dive straight into the task.</p><h4>What Is Test Ether And Why Would Someone Need It?</h4><p>As the name suggests, Test Ether is Ether that’s used for testing smart contracts before they are deployed to the Ethereum mainnet. Real Ether is quite expensive and there’s no way a company is willing to spend millions on just testing code.</p><p>For this reason, we have something called testnets. Test networks simulate real networks and it helps the entire crypto community in a ton of ways. People can experiment and play with the network without the fear of any loss.</p><p>For us developers, it’s quite convenient as we can test and deploy our smart contracts to these networks for free which would otherwise be unfeasible.</p><h4>Unhiding The Test Networks On Metamask</h4><p>Our <a href="https://chrome.google.com/webstore/detail/metamask/nkbihfbeogaeaoehlefnkodbefgpgknn?hl=en">Metamask</a> wallets support testnets by default and all we need to do, is to enable them.</p><p>To enable the<strong> Rinkeby testnet</strong> in your wallet, open the Metamask wallet tab on your browser and click on the dropdown which selects the network. In my case, it is set to Ethereum Mainnet by default.</p><figure><img alt="Picture Of The Metamask Extension" src="https://cdn-images-1.medium.com/max/445/1*gmYLegcNcNBndPMENP-MBA.png" /><figcaption>MetaMask Window</figcaption></figure><p>On Clicking the dropdown, you’ll see a list of networks and an option to <strong>show and hide testnetworks</strong>. In case, you don’t see the rinkeby testnet you need unhide the test networks in your wallet.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/432/1*9By1vrz5Jf2O_Xr2xT1TSA.png" /></figure><p>After clicking on the <strong>show/hide</strong> button, you’ll be taken to the settings from where you can enable the visibility of the test networks.</p><figure><img alt="Image of the settings menu of metamask wallet" src="https://cdn-images-1.medium.com/max/421/1*KEJEdkWE7ASovxe6g_OREA.png" /><figcaption>Enabling Test Networks</figcaption></figure><p>This enables all the test networks, we can now see Rinkeby test network in the networks dropdown. From there we can select the Rinkeby test network.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/407/1*-1rhTnfhEMpYZ30fnCwUMA.png" /><figcaption>Selecting The Rinkeby Test Network</figcaption></figure><p>With this, we have successfully enabled the rinkeby testnet and can now avail free test Ether from the Chainlink faucet.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/372/1*iLATrhA5TqJI2zgspoEbyQ.png" /><figcaption>Rinkeby Testnet On Metamask</figcaption></figure><h4>Getting Free Test Ether From Chainlink Rinkeby Faucet</h4><p>To get free test Ether for your account, head over to <a href="https://faucets.chain.link/rinkeby">faucets.chain.link </a>and look for the <strong>Connect Wallet</strong> button to connect your metamask wallet to the faucet.</p><p>(Make sure you have selected the rinkeby test network before connecting)</p><figure><img alt="Screenshot of the rinkeby faucet homepage" src="https://cdn-images-1.medium.com/max/1024/1*IOkyX6TDZMpqHyora8GVPw.png" /><figcaption>Connecting Metamask</figcaption></figure><p>Select Metamask, this will prompt a confirmation window</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/426/1*6lUTflhH0gp9SDmhboGb4g.jpeg" /></figure><p>After connecting the wallet, we can now request for the free test Ether. After confirming the captcha click on send request, this will initiate the transfer process at the end of which you will have test Ether in your metamask wallet.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/931/1*5lyzCe66EUGo4NJAyb-mng.png" /></figure><p>At the end of the process, you can check your wallet for free test Ether. Sometimes it can take longer depending on the network traffic ( keep in mind that the Ethereum’s blocktime is 13s).</p><p>We can now use this test Ether in testing our smart contracts.</p><p><strong>If you liked this article, or found it helpful by any chance, be sure to checkout my list </strong><a href="https://medium.com/@akshatm408/list/solidity-for-developers-d604c4fd1e2a"><strong>Solidity For Developers</strong></a><strong>.</strong></p><h3>Other Articles</h3><p><a href="https://coinsbench.com/automate-crypto-trading-with-python-1e2bcd6e7031"><strong>Creating A Crypto Trading Bot With Python</strong></a></p><p><a href="https://medium.com/@akshatm408/generating-passwords-with-python-2ed088d5f1"><strong>Generating Passwords With Python</strong></a></p><blockquote>Join Coinmonks<a href="https://t.me/coincodecap"> Telegram Channel</a> and<a href="https://www.youtube.com/c/coinmonks/videos"> Youtube Channel</a> learn about crypto trading and investing</blockquote><h3>Also, Read</h3><ul><li><a href="https://coincodecap.com/buy-monero">How to buy Monero</a> |<a href="https://coincodecap.com/idex-review"> IDEX Review</a> |<a href="https://coincodecap.com/bitkan-trading-bot"> BitKan Trading Bot</a></li><li><a href="https://medium.com/coinmonks/coindcx-review-8444db3621a2">CoinDCX Review</a> |<a href="https://coincodecap.com/crypto-margin-trading-exchanges"> Crypto Margin Trading Exchanges</a></li><li><a href="https://coincodecap.com/red-dog-casino-review">Red Dog Casino Review</a> |<a href="https://coincodecap.com/swyftx-review"> Swyftx Review</a> |<a href="https://coincodecap.com/coingate-review"> CoinGate Review</a></li><li><a href="https://coincodecap.com/bookmap-review-2021-best-trading-software">Bookmap Review</a> |<a href="https://coincodecap.com/crypto-exchange-usa"> 5 Best Crypto Exchanges in the USA</a></li><li><a href="https://coincodecap.com/ftx-futures-trading">How to trade Futures on FTX Exchange</a> |<a href="https://coincodecap.com/okex-vs-binance"> OKEx vs Binance</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=675ee44813ef" width="1" height="1" alt=""><hr><p><a href="https://medium.com/coinmonks/how-to-get-free-test-ether-on-your-crypto-wallet-675ee44813ef">How To Get Free Test Ether On Your Crypto Wallet</a> was originally published in <a href="https://medium.com/coinmonks">Coinmonks</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Solidity For Developers: Libraries In Solidity]]></title>
            <link>https://medium.com/coinmonks/solidity-for-developers-libraries-in-solidity-f8c7e348dc24?source=rss-94bf047334a9------2</link>
            <guid isPermaLink="false">https://medium.com/p/f8c7e348dc24</guid>
            <category><![CDATA[solidity]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[web3]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Akshat Mishra]]></dc:creator>
            <pubDate>Tue, 08 Mar 2022 14:19:50 GMT</pubDate>
            <atom:updated>2022-03-09T04:14:06.856Z</atom:updated>
            <content:encoded><![CDATA[<h4>Understand The Fundamentals of Libraries In Solidity, And Learn To Make Your Own</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*RlnSHtKFzujKD_7G" /><figcaption>Photo by <a href="https://unsplash.com/@theshubhamdhage?utm_source=medium&amp;utm_medium=referral">Shubham Dhage</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>As a programming language, Solidity has many similarities to some of the more common languages like Java, JavaScript and Cpp. However, there are a lot of features that are unique to just Solidity, and libraries happen to be one of them.</p><blockquote><em>This article is a part of my series </em><a href="https://medium.com/@akshatm408/list/solidity-for-developers-d604c4fd1e2a"><strong><em>Solidity for Developers</em></strong></a><em>, where I explain Solidity in a way that’s easy and also not boring for developers.</em></blockquote><h4>What Are Libraries?</h4><p>Libraries are a boiled-down version of Smart contracts. Just like smart contracts, you can use a library’s functions in other contracts. But unlike smart contracts, libraries cannot have any state variables, neither can they inherit other contracts.</p><p>The purpose of the library is simple, the libraries sit on the blockchain and contain code that can be used by other contracts.</p><h3>Creating A Library in Solidity</h3><p>For the entirety of this article, we’ll be using the <a href="https://remix.ethereum.org/">Remix IDE </a>since it makes the deployment, execution and debugging of the entire contract very easy.</p><h4>Creating A File</h4><p>To create a new file, open the Remix navigation tab and click on the <strong><em>new file</em></strong> button. For our purpose, we are going to name the file as <strong><em>example.sol.</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/463/1*GJn8LszzkffFRPCpRPkjzA.png" /><figcaption>Creating The File</figcaption></figure><h4>Defining The Pragma</h4><p>The first step to writing any solidity code, is defining the pragma. Solidity has changed considerably over the years and the pragma defines the versions of EVM compiler for which our Solidity code is valid.</p><figure><img alt="Picture of A Code Snippet" src="https://cdn-images-1.medium.com/max/337/1*YO9ZJK6O0PS99JvDHdMTIA.png" /><figcaption>Defining The Pragma</figcaption></figure><h4>Library Declaration</h4><p>Just like with smart contracts, we declare the library with the <strong><em>library</em></strong> keyword, followed by the identifier. We are going to name our library <strong><em>adder</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*MPNx92cjbPLN4BErKnBWPw.png" /></figure><h4>Library Method</h4><p>Our Library is going to contain a function which performs the sum of all numbers of a uint array.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/751/1*mH7c7WqTeVrpMOFnBkNHJQ.png" /></figure><h4>Defining The Function</h4><p>Just like in JavaScript, functions in Solidity are declared using the<strong><em> function</em></strong> keyword. The function takes a single argument which is a uint array, with the modifier of memory.</p><h4>The ‘Pure’ Modifier</h4><p>The memory modifier tells the compiler that our variable is going to access the blockchain’s memory, pure is a modifier which essentially means that this function does not read, or write to any of the state variables.</p><h4>Defining The Return Type</h4><p>The last keyword <strong><em>returns(uint) </em></strong>describes the type of value this function returns, in our case we are returning the sum of all integers of an array so we return a variable of type uint.</p><h4>The Final Look</h4><p>Here’s a final look at our completed Library.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/21049450c27462bb9a50638352d86cd5/href">https://medium.com/media/21049450c27462bb9a50638352d86cd5/href</a></iframe><h3>Using The Library In A Smart Contract</h3><p>With our library complete, we can now use it in a smart contract. If the library exists in the same file as the contract, there’s no need for making any import.</p><h4>Accessing The Library in The Same File</h4><p>Accessing a library in a contract, which exists in the same file requires so import statement of any sort.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ScQG5EmzZfVyjJJdyII_YQ.png" /></figure><p>To access the library, we have created a simple smart contract which contains a function that calls our library’s add function. Because the library and the contract exist in the same file, there’s no need for any import statement.</p><h4>Understanding The Contract</h4><p>The given contract only has one function, the <strong><em>give_sum</em></strong> function takes a single argument of type integer array an uses the library method <strong><em>add</em></strong>, to produce the sum.</p><p>external is an access specifier, which declares that this method function can only be called from outside of the current contract.</p><h4>Accessing From A Different File</h4><p>To access the library from a different contract, we need to use the <strong><em>‘import’</em></strong> statement. In Solidity, we can import URLs and Filepaths alike.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/89ce26317c1aa0900712dac8ee9fa3f8/href">https://medium.com/media/89ce26317c1aa0900712dac8ee9fa3f8/href</a></iframe><p>In the import statement, we import the library which exists in the same folder as our current contract and for that we use the relative path.</p><h3>Running The Smart Contract</h3><p>To run our Smart Contract, we have to deploy the <strong><em>adder</em></strong> library followed by the contract.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/453/1*h3E1Rsk-23D8rId-lE1Yyg.png" /></figure><p>After deploying both of these files, we can see that we have both these contracts deployed in the<strong><em> Deployed Contracts</em></strong> section.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/650/1*T8FUtLqlPk8fd0R0qsgtiQ.png" /></figure><p>We can now test our smart contract by passing an integer array.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/463/1*xXcO3Q04qf8CWEivHZys1Q.png" /></figure><p>And indeed, that works. This means that our library has executed successfully from a different contract.</p><h3>Conclusion</h3><p>This pretty much sums up what libraries are, and how you can make your own. As mentioned earlier, they are just a boiled-down version of smart contracts and one big benefit of using Libraries instead of inheriting smart contracts is that they save the gas costs.</p><p><strong>If you liked this article, or found it helpful by any chance, be sure to checkout my list </strong><a href="https://medium.com/@akshatm408/list/solidity-for-developers-d604c4fd1e2a"><strong>Solidity For Developers</strong></a><strong>.</strong></p><h3>Other Articles</h3><p><a href="https://coinsbench.com/automate-crypto-trading-with-python-1e2bcd6e7031"><strong>Creating A Crypto Trading Bot With Python</strong></a></p><p><a href="https://medium.com/@akshatm408/generating-passwords-with-python-2ed088d5f1"><strong>Generating Passwords With Python</strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f8c7e348dc24" width="1" height="1" alt=""><hr><p><a href="https://medium.com/coinmonks/solidity-for-developers-libraries-in-solidity-f8c7e348dc24">Solidity For Developers: Libraries In Solidity</a> was originally published in <a href="https://medium.com/coinmonks">Coinmonks</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Solidity For Developers: Decentralized Auctions-Part II]]></title>
            <link>https://coinsbench.com/solidity-for-developers-decentralized-auctions-part-ii-208dea759f9b?source=rss-94bf047334a9------2</link>
            <guid isPermaLink="false">https://medium.com/p/208dea759f9b</guid>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[solidity]]></category>
            <category><![CDATA[smart-contracts]]></category>
            <category><![CDATA[decentralized-finance]]></category>
            <category><![CDATA[decentralization]]></category>
            <dc:creator><![CDATA[Akshat Mishra]]></dc:creator>
            <pubDate>Fri, 18 Feb 2022 09:33:29 GMT</pubDate>
            <atom:updated>2022-02-21T06:21:58.666Z</atom:updated>
            <content:encoded><![CDATA[<h4>Write A Smart Contract To Conduct A Decentralized Auction</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Mo6l1q0oRw_QghaE" /><figcaption><strong>Photo by </strong><a href="https://unsplash.com/@fabioha?utm_source=medium&amp;utm_medium=referral"><strong>fabio</strong></a><strong> on </strong><a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral"><strong>Unsplash</strong></a></figcaption></figure><p>This article is a follow-up to my<strong> </strong><a href="https://medium.com/coinsbench/solidity-for-developers-decentralized-auctions-abb1be8fe72"><strong>previous article</strong></a>,<strong> </strong>where I demonstrated creating a smart contract to conduct auctions. However as mentioned earlier, there were a few problems with our implementation which made it impractical for real world use.</p><p>In this article we are going to address those issues and fix the problems to create an updated auction contract, and while I strongly suggest you to read my previous article, feel free to follow along.</p><h3>Fixing The ‘Unnatural’ Bidding System</h3><p>To understand the problem with our bidding system, let’s take a closer look at our bid function.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/352a23a1870548d420f36036fd1bdf0c/href">https://medium.com/media/352a23a1870548d420f36036fd1bdf0c/href</a></iframe><p>If you haven’t already noticed, in our <strong><em>pendingReturns</em></strong> mapping we add all the ether that the user bids using the bid function. Well that, is exactly what’s wrong with our bid function.</p><p>To understand better, let’s say user <strong><em>A</em></strong> puts in an amount of 200 ether, the next user, user <strong><em>B</em></strong> puts an amount of 201 ether. Now for user<em> </em><strong><em>A</em></strong>, to again make a bid, they’d have to put 202 new ether from their wallet, and there lies the problem.</p><p>The <strong><em>pendingReturns</em></strong> map stores and locks the user’s ether, so if the user has to make a new bid, they’d have to put in fresh 202 ether from their wallet when they are already short of 200 ether.</p><p>Meaning in two bids, the user has submitted 400 ether, when the highest bid value is only 202(increased by 2). This is a huge flaw as it makes the whole auction process unfair and our users can get liquidated very soon.</p><h4>The Fix</h4><p>Luckily for us, the fix is simple. To prevent the bids from adding up on every function call, we can instead check if the user has made a bid already.</p><p>If they have already made a bid, we transfer them back their previous bid amount and assign the new bid to their address in our<strong><em> pendingReturns</em></strong> mapping.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2e773315242f797e2e3777f2b9d692df/href">https://medium.com/media/2e773315242f797e2e3777f2b9d692df/href</a></iframe><h3>Fixing The Withdrawal Mechanism</h3><p>The only problem left with our smart contract now, is the withdrawal mechanism.</p><p>Our current withdrawal system allows the users to withdraw their ether anytime during the entire auction process. This is problematic since this can trick the program into thinking that we still have the highest bid amount stored in our <strong><em>pendingReturns</em></strong> mapping, when in fact the amount has been withdrawn.</p><p>There are two approaches in fixing this problem</p><ol><li>Enabling withdrawal only when the auction has ended.</li><li>Re-computing the highest bid and the highest bidder every time a withdrawal happens.</li></ol><p>The first approach requires us to create either, a function modifier or a requirement that checks for the <strong>ended </strong>variable being true.</p><p>To implement the second approach, we need to loop through an array that stores all the addresses and their respective bids in order. But this creates a huge gas overhead which can very easily surpass our gas limit and end the contract.</p><p>It’s clear that the first approach is more feasible, since it costs far less gas.</p><h4>Creating A Requirement</h4><p>To create a requirement we call the require function, which takes two parameters. The first parameter takes a boolean variable, and the second parameter is a string.</p><p>The require function checks if the provided boolean expression or variable is true. If not, it reverts the transaction with the provided message.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c1720a8d1305f656ad0697b9861759e0/href">https://medium.com/media/c1720a8d1305f656ad0697b9861759e0/href</a></iframe><h3>The Final Contract</h3><p>Here’s the final look of our updated contract, feel free in copy pasting this code.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9c071d014428913470f878071374023b/href">https://medium.com/media/9c071d014428913470f878071374023b/href</a></iframe><p>This completes our auction smart contract. With the current contract, the bids don’t add up and the users can only withdraw when the auction has ended.</p><h3>Deploying Our Updated Contract</h3><p>To test our smart contract, let’s compile and deploy the smart contract on the JavaScript VM.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1BcKqziByQAotQcxnsetCg.png" /><figcaption>The Final Contract</figcaption></figure><p>Copy the address of the first account on your remix deployment panel, we will use this as the beneficiary’s address.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/362/1*tZO_B_msewEr32REW4dv5w.png" /><figcaption>Deploying The Contract</figcaption></figure><p>To deploy the contract, set the bidding time(in seconds) to be 200. This means in about 200 seconds from now the auction will end. Paste the bidding address of your first account next to the bidding time, and click on deploy.</p><p>This should deploy your contract and you should see all the methods listed for the given contract. We now have 200 seconds to place bids before our auction time ends.</p><h3>Placing The First Bid</h3><p>To test our bidding mechanism we can change the account address to the second account.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/531/1*SH_0RMlWGJuDTGuAysGRbg.png" /><figcaption>Changing The Account</figcaption></figure><p>To set the bid amount, we need to change the <strong><em>value</em></strong> parameter. By default, the bid amount is set to 0 <strong><em>Wei</em></strong>, where <strong><em>Wei</em></strong> is the smallest denomination of the <strong><em>Ether</em></strong> token.</p><blockquote><strong>1 Ether = 10¹⁸ Wei</strong></blockquote><p>To avoid any confusion, we are going to change our denomination from Wei to Ether.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/456/1*Klnk1HnDynaS5gUCqwp5wA.png" /><figcaption>Changing the Bid Amount</figcaption></figure><p>To finally place the bid from your account, click on the bid button of your auction contract. This will place a bid of 20 Ethers from your account and your current account will now be short of 20 Ether.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/443/1*X6_ZPQTvchgyMkkz98L8YQ.jpeg" /><figcaption>Placing The Bid</figcaption></figure><p>We can try placing our bids from a couple of different test accounts on the navigation panel until the the auction time gets over. With our new bidding mechanism, our account gets refunded of the previous bid whenever we make a new bid.</p><p>We can also try testing our withdrawal function by attempting to withdraw our bid before the auction has ended.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3Xa32KPguTvCb7yAxd9DvA.png" /><figcaption>Attempting To Withdraw Before The Auction Has Ended</figcaption></figure><p>This obviously returns an error and confirms that our withdrawal mechanism is working fine.</p><p>If we place a bid when the auction time is up, we should see something like-</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*S-iXQZ8ko-VoOhEXdSZPOw.png" /><figcaption>Placing Bids When The Auction Time is Over</figcaption></figure><h3>Conclusion</h3><p>This completes our two part series on creating a smart contract to conduct decentralized auctions. By replacing the auctioneer with our smart contract, we have successfully managed to implement a very common service on the blockchain.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=208dea759f9b" width="1" height="1" alt=""><hr><p><a href="https://coinsbench.com/solidity-for-developers-decentralized-auctions-part-ii-208dea759f9b">Solidity For Developers: Decentralized Auctions-Part II</a> was originally published in <a href="https://coinsbench.com/">CoinsBench</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Solidity For Developers: Decentralized Auctions]]></title>
            <link>https://coinsbench.com/solidity-for-developers-decentralized-auctions-abb1be8fe72?source=rss-94bf047334a9------2</link>
            <guid isPermaLink="false">https://medium.com/p/abb1be8fe72</guid>
            <category><![CDATA[solidity]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[decentralized-apps]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[smart-contracts]]></category>
            <dc:creator><![CDATA[Akshat Mishra]]></dc:creator>
            <pubDate>Sun, 13 Feb 2022 15:26:54 GMT</pubDate>
            <atom:updated>2022-03-08T15:38:15.904Z</atom:updated>
            <content:encoded><![CDATA[<h4>Write A Smart Contract To Conduct A Decentralized Auction</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*yqSsAPwQvVIqDN7D" /><figcaption>Photo by <a href="https://unsplash.com/@theshubhamdhage?utm_source=medium&amp;utm_medium=referral">Shubham Dhage</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>There’s absolutely no doubt that the future of web lies in the blockchain. Services built on top of blockchains are more reliable, have greater trust and have absolute data transparency.</p><p>Perhaps the greatest advantage of blockchain, is the removal of any intermediary. We can use this fact to our benefit by writing a smart contract to conduct an auction.</p><h3>Understanding How Auctions Work</h3><p>A typical auction, consists of an auctioneer — who conducts the auction and the participants, who place their bids.</p><p>In an auction, items are set for sale and the participants begin their bidding in order. For a participant to make a bid, their bid must be higher than last bid. This process continues until there are no higher bids or the auction is called to an end by the auctioneer.</p><p>At the end of the auction, the funds are transferred to the beneficiary. Our goal is to implement the entire auction process as a smart contract and remove the need of the auctioneer (who happens to be the intermediary)</p><h3>Creating A Smart Contract In Remix</h3><p>To start, head over to <a href="https://remix.ethereum.org/">https://remix.ethereum.org</a>, which is the official IDE for the Solidity language and makes working with language a lot easier.</p><p>To create a contract, click on the ‘create file’ button, name the file as Auction.sol</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/777/1*y7kBA5ikTfylvWSqypZ3SQ.png" /></figure><p>This creates a file in which we can begin writing our smart contract.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2YMFoai59bRm7oAP2Lh1kQ.png" /></figure><h4>Defining The Pragma And Contract</h4><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0a3062815730f337a48d22a52cded419/href">https://medium.com/media/0a3062815730f337a48d22a52cded419/href</a></iframe><p>We start our code by defining the Solidity Pragma, and then writing the contract definition.</p><p>Pragma tells our compiler the version of Solidity we are using for our file. In our case, it is all versions of solidity which are greater than or equal to 0.7, but less than 0.9.</p><h3>The State Variables</h3><p>The next step is creating state variables which will store a mapping of our participant’s addresses and their respective bids. We also need the address of our beneficiary and two other state variables that will store the information about our highest bidder.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/27c315bdd806befbe8b499766badef74/href">https://medium.com/media/27c315bdd806befbe8b499766badef74/href</a></iframe><p>The address of our beneficiary is of the type <strong><em>payable,</em></strong> this enables us to transfer funds to their address when the auction has ended. The <strong><em>auctionEndTime </em></strong>variable as the name suggests, stores the time after which the auction can end.</p><p>The next three variables store the information about the highest bidder, the value of their bid, and value for the auction state.</p><p>The <strong><em>pendingReturns </em></strong>variable stores a mapping of addresses and their bids. It is very similar to a Python dictionary or a JavaScript object where the values are stored in key-value pairs.</p><p>Finally, the next two variables are events which will be emitted each time the highest bid increases, or when the auction ends.</p><h3>The Constructor</h3><p>In Solidity a constructor is called at the time of deployment of a contract, and so it is generally used to store data that remains constant.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e86303397b4dbe6100901877b70ec0ff/href">https://medium.com/media/e86303397b4dbe6100901877b70ec0ff/href</a></iframe><p>In our constructor the bidding time and the beneficiary address are two constants. These values once defined, are not supposed to change.</p><p>We set our auction ending time, to be the current time (which is accessed by calling the global variable block.timestamp) plus the time we have defined. This means if we set the value of _biddingTime variable to be 10 minutes, the auction will run for 10 minutes starting from the time of deployment of this contract.</p><h3>The Bid Function</h3><p>To implement a bidding functionality, we’ll create a function with the name <strong><em>bid </em></strong>which is public and payable. The bid function will run several assertions to make sure the auction rules are being followed correctly.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/352a23a1870548d420f36036fd1bdf0c/href">https://medium.com/media/352a23a1870548d420f36036fd1bdf0c/href</a></iframe><p>Let’s understand each process in detail</p><h4>Validating The Auction Time</h4><p>On calling the bid function, we check if the Auction is still valid. We do that by creating a requirement which compares the current block time with the auction end time. If the current block time is less than the auction end time, the bid is valid and we proceed to the next step.</p><p>If the requirement fails to satisfy, the contract state is reverted with a message log which says “The Auction Has Ended, No Bids Allowed”.</p><h4>Current Bid Vs Previous Bid</h4><p>To allow the bid to execute, there’s one final step. Which is to check that the current bid is not less than the previous bid. If it is, we revert the contract.</p><p>If the current bid is higher than the highest bid, the participant successfully places the bid. The bid function then records the bidders address, and their bid value to store in the pendingReturns.</p><p>We also store the highest bid information in our highestBidder and highestbid variables and emit an event which declares that the highest bid has increased.</p><h3>Implementing Withdrawal Pattern</h3><p>At the end of the auction, we are left with two responsibilities.</p><ol><li>Transferring the funds to the beneficiary</li><li>Allowing the users to withdraw their bids</li></ol><h4>Transferring The Funds</h4><p>To transfer the funds to our beneficiary and to end the auction successfully, we have created the function <strong><em>auctionEnd.</em></strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c204678478b5e1fa8fa860c4969ffea7/href">https://medium.com/media/c204678478b5e1fa8fa860c4969ffea7/href</a></iframe><p>To allow a user to end this auction, we must perform two checks. The first check is to ensure that the auction time has ended, the second check ensures if someone already closed the auction.</p><p>If the auction has already been ended, we must stop the execution of this function since it can result in our beneficiary getting the ether twice.</p><p>On passing those steps, we set the <strong><em>ended</em></strong> state variable to true, transfer the funds to our beneficiary and emit a log to declare that our auction has come to a close.</p><h4>The Withdrawal Pattern</h4><p>The withdrawal pattern in Solidity ensures that the funds are safely transferred, and that no attacker can interfere and stop the contract from execution.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9a0f3abcae6367c714cbcdfb81d04932/href">https://medium.com/media/9a0f3abcae6367c714cbcdfb81d04932/href</a></iframe><p>To implement a withdrawal pattern, we have created a function with the name <strong><em>withdraw.</em></strong> The withdraw function begins by extracting the amount information about the caller, from our pendingReturns map.</p><p>If the user has participated in the auction, it is certain that their amount value is greater than zero — In which case we clear their contribution from pending returns and transfer them back the entire amount.</p><h3>Compiling The Contract</h3><p>You can copy paste this entire code.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/cb97ad50fb7c952a03070b74f063fed8/href">https://medium.com/media/cb97ad50fb7c952a03070b74f063fed8/href</a></iframe><p>Once your smart contract is complete you can compile it by pressing Ctrl + S on your PC (Cmd + S on the mac). If that does not compile your contract, head over to the ‘Solidity Compiler’ Tab in your remix navigation panel to compile your contract.</p><h3>Conclusion</h3><p>Though not complete, this contract is very close to completion. You can now test it by deploying it on the JavaScript VM in Remix. With this contract you can start your own auction, place bids and allow users to withdraw their bids using the infamous withdrawal pattern.</p><p>However, this contract has several flaws. The bid placing mechanism isn’t exactly natural and the users can withdraw their balances before the auction ends, thus breaking the contract. This is something we can fix in another article.</p><h4><a href="https://coinsbench.com/solidity-for-developers-decentralized-auctions-part-ii-208dea759f9b">Decentralized Auctions — Part II</a></h4><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=abb1be8fe72" width="1" height="1" alt=""><hr><p><a href="https://coinsbench.com/solidity-for-developers-decentralized-auctions-abb1be8fe72">Solidity For Developers: Decentralized Auctions</a> was originally published in <a href="https://coinsbench.com/">CoinsBench</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Generating Passwords With Python]]></title>
            <link>https://medium.com/@_akshat/generating-passwords-with-python-2ed088d5f1?source=rss-94bf047334a9------2</link>
            <guid isPermaLink="false">https://medium.com/p/2ed088d5f1</guid>
            <category><![CDATA[bots]]></category>
            <category><![CDATA[100daysofcode]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[script]]></category>
            <dc:creator><![CDATA[Akshat Mishra]]></dc:creator>
            <pubDate>Thu, 10 Feb 2022 13:00:19 GMT</pubDate>
            <atom:updated>2022-02-10T13:08:25.207Z</atom:updated>
            <content:encoded><![CDATA[<h4>Create A Random Password Generator With Python</h4><figure><img alt="Image of a laptop screen with VSCode window open" src="https://cdn-images-1.medium.com/max/1024/0*H5AH7vcPRcQvwB9F" /><figcaption>Photo by <a href="https://unsplash.com/@cdr6934?utm_source=medium&amp;utm_medium=referral">Chris Ried</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>With the present day <a href="https://www.intel.com/content/www/us/en/products/docs/processors/what-is-a-gpu.html">GPUs</a> and modern hardware, it has become increasingly easy for hackers to simply <a href="https://www.kaspersky.com/resource-center/definitions/brute-force-attack">brute-force</a> your password. Passwords that have a small range of characters and less overall length are more susceptible to such kind of attacks.</p><p>This has resulted in companies coming up with ridiculous password requirements, and fulfilling those requirements has become a challenge of its own.</p><h3>The Solution</h3><p>Instead of complaining, we can build ourselves a python bot to help us in this situation. Our goal is to make a bot that generates for us a password which fulfills all the site requirements.</p><h3>Creating Lists of Valid Characters</h3><p>Though different websites have different password requirements, there are some features that are common to all. We can safely assume that our website must contain at least one uppercase character, one lowercase character, a number and a special character.</p><p>Feel free in copy pasting all the code.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8b37f69633377f79e98f19562f4a6b5d/href">https://medium.com/media/8b37f69633377f79e98f19562f4a6b5d/href</a></iframe><h3>Choosing The Password Length</h3><p>The next step is to decide the length for our password. Since most websites are opinionated about password length requirements, we can consider the password length as a variable and take it as an input from the user.</p><p>But here’s the catch, since we have four types of characters which must be a part of our generated password. We must ensure that our password is not less than 4 characters in length, ensuring that all our characters occur at least once in our password</p><h4>Password Length Function</h4><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/66aa55420679ffe5f3bf002e998bdde5/href">https://medium.com/media/66aa55420679ffe5f3bf002e998bdde5/href</a></iframe><p>To ensure that the user inputs a value not less than four, we have a while loop which runs infinitely as long as the value of <strong><em>password_length</em></strong> variable is less than four. If the inputted value is less than 4, we prompt the user to input a value which has a minimum length of four.</p><h3>Creating A Function To Generate Password</h3><p>To avoid any code clutter, we can divide each process into its own function. This is really helpful when it comes to code readability and debugging.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b8076be2b26c181e0e2140bd2f11939c/href">https://medium.com/media/b8076be2b26c181e0e2140bd2f11939c/href</a></iframe><p>In the given function, we have referenced our character lists as global variables, this means our function can now access these global variables.</p><h4>Generating The Password</h4><p>The variable <strong><em>c,</em></strong> is a counter which iterates through each of the character lists to randomly select a character from a given sequence. Since we have four lists, for each of the four values of variable c (0, 1, 2 and 3), we pick a random character from each of the character lists.</p><p>When our variable c reaches 3, we reset the value of our variable to be -1, outside of the ‘if’ statement we add 1 to c, which makes it 0 again and the process continues until we have reached the length for our password.</p><h3>Bringing It all Together</h3><p>With all our components complete, we can finally stitch it all together in a single python script.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/208fd29c62e016c081bdaa83e41ad71d/href">https://medium.com/media/208fd29c62e016c081bdaa83e41ad71d/href</a></iframe><p>The only module that this script requires, is the random module. It helps us in randomly choosing a character from any given <a href="https://techvidvan.com/tutorials/python-sequences/#:~:text=In%20Python%20programming%2C%20sequences%20are,byte%20arrays%2C%20and%20range%20objects.">Python sequence</a>.</p><p>To take the input, we call the function <strong><em>getPasswordLength()</em></strong> and assign it to the variable <strong><em>length</em></strong>. We pass this length to our function <strong><em>CreatePassword(length)</em></strong>, which gives us a password of our desired length.</p><p>Since our code is complete, we can execute it on the terminal or on the IDLE. To test our bot, I have chosen a password length of 8.</p><figure><img alt="Picture of The Python Terminal" src="https://cdn-images-1.medium.com/max/875/1*6o71CuPwC6HuFhj7vU4oQA.png" /><figcaption>Executing The Script</figcaption></figure><p>And this results in a password of our desired length. To secure our password even further, we can convert our password to a list and shuffle it. This will provide additional randomisation and make our passwords more secure.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/dc543e08ceb7f3cf58a91f0e12373226/href">https://medium.com/media/dc543e08ceb7f3cf58a91f0e12373226/href</a></iframe><p>The <strong><em>Convert(string)</em></strong> function takes a string as an input, and returns a list as an output. With our password randomized and shuffled, our bot is complete and secure.</p><h3>Conclusion</h3><p>With this we have solved a part of the problem, which was coming up with a password that fulfills the password requirements. But only a part of the problem, this creates another challenge which is remembering these crazy passwords for each of our different services. But that’s something we can save for another article.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2ed088d5f1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Solidity For Developers: The Ethereum Blockchain]]></title>
            <link>https://coinsbench.com/solidity-for-developers-the-ethereum-blockchain-7b6c8a18c93e?source=rss-94bf047334a9------2</link>
            <guid isPermaLink="false">https://medium.com/p/7b6c8a18c93e</guid>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[solidity]]></category>
            <category><![CDATA[web3]]></category>
            <category><![CDATA[ethereum]]></category>
            <dc:creator><![CDATA[Akshat Mishra]]></dc:creator>
            <pubDate>Mon, 07 Feb 2022 12:24:52 GMT</pubDate>
            <atom:updated>2022-02-10T13:49:05.409Z</atom:updated>
            <content:encoded><![CDATA[<h4>Understand The Fundamentals of Blockchain and The Solidity Language</h4><figure><img alt="Featured Image" src="https://cdn-images-1.medium.com/max/1024/0*EvoNoSRJaM5I-DPt" /><figcaption>Photo by <a href="https://unsplash.com/@zoltantasi?utm_source=medium&amp;utm_medium=referral">Zoltan Tasi</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Solidity is a language that’s meant for interacting with the Ethereum blockchain. It lacks the freedom of our run of the mill, general purpose programming languages like JavaScript, Python and Java. There’s no way to log to a console and it is not designed for heavy computations.</p><p>That said, Solidity serves a totally different purpose. The purpose to remove any intermediary by means of smart contracts and building apps that can interact easily and efficiently with the Ethereum blockchain.</p><p>If you are new to Solidity, chances are you have heard of terms like ‘Ether’, ‘Gas Fee’ and ‘Gas Limit’. If you don’t know any of these terms or find them confusing, you have come to the right place. This article breaks down the complete idea behind the Ethereum blockchain and the Solidity language.</p><h3>What Is A Blockchain</h3><p>A Blockchain can be considered a public database which contains the list of all transactions that have ever occurred on it, and by nature it resists any change or mutation.</p><h3>The Block</h3><figure><img alt="Image of a Block" src="https://cdn-images-1.medium.com/max/212/1*XiRuzmmzhaKruJoy72O3iA.png" /><figcaption>Data Stored In A Block</figcaption></figure><p>A Block, is a data structure that permanently stores transactional data in itself. In the Ethereum blockchain, every block stores the data and the transaction number. The address of the block is produced by a <a href="https://blog.jscrambler.com/hashing-algorithms">hashing algorithm</a> which produces a hashcode by combining the total transaction count (called <strong><em>nonce</em></strong>) and the block data.</p><h3>The Blockchain</h3><figure><img alt="Diagram of A Blockchain" src="https://cdn-images-1.medium.com/max/833/1*7UWEc8SwiTV3VMdrgE53wg.png" /><figcaption>Each Block Contains The Address of The Previous Block</figcaption></figure><p>A Blockchain is simply a collection of these blocks where each block contains its own data, its own address, and the address (the <strong>Hashcode</strong>) of the previous block in the chain, thus forming a <strong><em>Blockchain</em></strong>.</p><p>If this sounds confusing to you, watch this <a href="https://youtu.be/_160oMzblY8">visual demonstration of a blockchain by Anders Brownworth</a>, which explains the complete working of a blockchain in detail.</p><h3>The Mining Process</h3><p>Every Block in the Blockchain has an address, which is the result of the block data and the <a href="https://www.investopedia.com/terms/n/nonce.asp"><strong><em>Nonce</em></strong></a>. Whenever some data is added to the block, it results in a new address (hashcode).</p><p>In the Ethereum blockchain, the Ethereum network decides a hash target. The goal of the mining algorithm is to find such a nonce, which when combined with the data, results in a hash which is lesser than the target. This process can take anywhere from 10–15 seconds to complete.</p><p>The smaller the target value, the longer our algorithm takes to find the suitable nonce. The value of this target nonce is adjusted dynamically by the Ethereum blockchain network.</p><p>But the mining process doesn’t end here. Since the address of our current block is no longer what it used to be, we have to mine all the consequent blocks to validate the blockchain. This is a very computationally expensive process and can take a long time to complete, depending on the strength of the network.</p><h3>Block Time</h3><p>As we know by now, the mining process is computationally expensive and takes time to complete. The Ethereum blockchain adjusts the mining difficulty dynamically based on the number of miners available at any given moment.</p><p>As the blockchain grows bigger in size and the miners increase, the time to validate and process a blockchain decreases. The Block time can be visualized at <a href="https://etherscan.io/chart/blocktime">https://etherscan.io/chart/blocktime</a></p><h3>How Does Solidity Work</h3><p>Though it may not seem like it, every single computation in Solidity, is a transaction and takes time to complete because of the mining process. This process is done by the miners, who mine your smart contracts and are rewarded with ether based on the energy consumption.</p><h3>Storing Values vs Reading Values</h3><p>As mentioned before already, every single calculation costs some gas fee and some operations cost more gas fee than others. However there are two types of operations which greatly differ on how they are processed by the blockchain</p><h4>Storing Values</h4><p>Every operation that accesses blockchain storage or changes stored values, takes some time to process. These operations also cost a lot of gas fee since storing values in a blockchain is expensive.</p><p>Furthermore, If we access memory in our smart contract and store something in it. The process can take anywhere from 10–15 seconds to complete and is not instantaneous.</p><h4>Reading Values</h4><p>Reading values that are already stored on a blockchain is absolutely free, and instantaneous. It takes zero gas fee, example of such an operation would be reading a stored value of a smart contract state variable.</p><h3>The Mining Process</h3><p>Mining is a complex process which requires finding a hash that falls under the target defined by the Ethereum network. This process changes the block address and as a result all subsequent blocks are mined. This process is computationally expensive and the miners are rewarded with Ether upon completing this process.</p><h3>Gas Fee</h3><p>Gas fee or the Gas price, is the amount of ether you are willing to pay per unit gas that’s consumed for every bit of computation. Things like addition, subtraction and other operations have a fixed gas. The complete gas chart can be found on <a href="https://wiki.learnblockchain.cn/OPCODE_Gas.pdf">Gas Costs From Yellow Paper</a>.</p><p>To understand better, let’s say the gas fee is 10 ether. This means for every unit gas spent you will spend 10 ether. The ADD function in solidity has a gas of 3, this means if our gas price is 10 ether, we spend 10 x 3 = 30 ether, for the addition operation.</p><h3>Gas Limit</h3><p>Though gas fee is fairly easy to calculate, it is not always so simple to pre-calculate the total amount of ether our contract will spend. To keep it in check we adjust the gas limit. Gas limit is the maximum amount of gas, our smart contract can use.</p><p>It’s a safety measure to prevent our smart contracts from overspending. The moment our smart contracts reach the maximum allowed limit, the contract is stopped and the contract state is reverted.</p><h3>Conclusion</h3><p>It is pretty evident that the scope of products and services that can be built completely on the Ethereum blockchain is quite small. Though building a Fullstack Ethereum social media app would be quite expensive, we can make apps that harness the true power of the blockchain and work on transactions, which comes in a class of apps called <a href="https://www.investopedia.com/decentralized-finance-defi-5113835"><strong>Defi</strong></a><strong>.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7b6c8a18c93e" width="1" height="1" alt=""><hr><p><a href="https://coinsbench.com/solidity-for-developers-the-ethereum-blockchain-7b6c8a18c93e">Solidity For Developers: The Ethereum Blockchain</a> was originally published in <a href="https://coinsbench.com/">CoinsBench</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>