<?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 Alvin Mutebi on Medium]]></title>
        <description><![CDATA[Stories by Alvin Mutebi on Medium]]></description>
        <link>https://medium.com/@alvinmutebi?source=rss-c471d65e6949------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*LVWucn7FtcdhBzI8f_g3Pg.jpeg</url>
            <title>Stories by Alvin Mutebi on Medium</title>
            <link>https://medium.com/@alvinmutebi?source=rss-c471d65e6949------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 07:46:19 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@alvinmutebi/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[Crypto Airdrops]]></title>
            <link>https://medium.com/@alvinmutebi/crypto-airdrops-89b98291794b?source=rss-c471d65e6949------2</link>
            <guid isPermaLink="false">https://medium.com/p/89b98291794b</guid>
            <category><![CDATA[airdrop]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[bitcoin]]></category>
            <category><![CDATA[cryptocurrency]]></category>
            <dc:creator><![CDATA[Alvin Mutebi]]></dc:creator>
            <pubDate>Sat, 01 Apr 2023 13:05:20 GMT</pubDate>
            <atom:updated>2023-04-01T14:33:14.352Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eIyf0rOmwkT-lPPk5aiHSA.png" /></figure><p>Airdrops in the cryptocurrency industry are popular and have been helping different crypto projects and coins in different ways, In this article, we shall explore airdrops, their history, why they happen and the types of airdrops.</p><h4>What are Crypto AirDrops?</h4><p>Crypto Airdrops are an initiative by crypto projects with native coins or tokens that involves the distribution of a certain amount of the token for free to users into their wallets. Users provide their public wallet addresses (or keys) to receive the token or coin. A criterion is set by the project owners for one to qualify for the airdrop and after it is met, the users decide what to use the tokens for.</p><h4>History of Air Drops</h4><p>The first airdrop was in Iceland in 2014 for the project Auroracoin which was to be a national cryptocurrency where 50% of the total supply of the Arora Coin was given to citizens of Iceland who registered and everyone was entitled to 31.8 AUR. This was followed by other airdrops like the Lumens (XLM) where 19% of the initial supply was given to Bitcoin holders of value (19 Billion XLM ) in 2016.</p><h4>Types of Airdrops</h4><p><strong>Standard Airdrops</strong></p><p>These are the most common type of airdrops where tokens or coins are distributed for free to a large group of users. Users typically need to meet certain eligibility requirements such as holding a certain amount of a specific cryptocurrency to receive the airdrop.</p><p><strong>Bounty Airdrops</strong></p><p>Bounty airdrops are similar to standard airdrops but users need to complete specific tasks such as joining the project’s social media channels or creating content, to receive the airdrop.</p><p><strong>Exclusive Airdrops</strong></p><p>An exclusive airdrop sends crypto coins out to a group of people who follow an airdrop aggregator. These third-party sites share news about promising crypto projects and their upcoming airdrop events.</p><p><strong>Holder Airdrops</strong></p><p>Holder airdrops go to people who have some amount of another cryptocurrency in their wallets. Usually, the crypto project takes a snapshot of crypto holdings on a specific date then lets people claim an airdrop based on their ownership at that time for example the (XLM) airdrop of 2016</p><h4>Why do Crypto Airdrops Happen?</h4><p>Airdrops happen for different reasons and most airdrops have these reasons in common :</p><p>The main reason behind airdrops is to promote a cryptocurrency project and to attract new users. Airdrops are a marketing strategy used by cryptocurrency projects to increase the visibility and awareness of their tokens or coins. By distributing tokens or coins for free, a project can generate interest among potential users, which can lead to increased adoption and usage of the project’s cryptocurrency.</p><p>Airdrops can also help to distribute tokens more widely, which can increase liquidity and trading volume on cryptocurrency exchanges. This can be particularly important for new cryptocurrency projects trying to gain traction in a competitive market.</p><p>Additionally, airdrops can be used as a way to reward current users or holders of a particular cryptocurrency. This can help to incentivize users to hold or use a cryptocurrency, which can contribute to the project’s overall success.</p><p>Airdrops have become a popular marketing tool in the cryptocurrency industry and can have a significant impact on the success of a project or coin. While airdrops can be used to increase the visibility and adoption of a cryptocurrency, they must be executed carefully to avoid negative consequences such as dilution of token value or legal and compliance issues. With careful planning and execution, airdrops can be an effective strategy for promoting and growing cryptocurrency projects.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=89b98291794b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Centralized or Decentralized Exchanges the choice is yours]]></title>
            <link>https://medium.com/@alvinmutebi/centralized-or-decentralized-exchanges-the-choice-is-yours-8421108bac6f?source=rss-c471d65e6949------2</link>
            <guid isPermaLink="false">https://medium.com/p/8421108bac6f</guid>
            <category><![CDATA[pancakeswap]]></category>
            <category><![CDATA[blockchain-technology]]></category>
            <category><![CDATA[uniswap]]></category>
            <category><![CDATA[coinbase]]></category>
            <category><![CDATA[binance]]></category>
            <dc:creator><![CDATA[Alvin Mutebi]]></dc:creator>
            <pubDate>Sat, 25 Mar 2023 08:47:29 GMT</pubDate>
            <atom:updated>2023-03-25T08:47:29.085Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EiK3T6khNcWzpzbCkY4R0g.png" /></figure><p>In this article, we shall explore crypto exchanges where one can trade their fiat currency to get tokens or vice versa. The crypto scene has had its ups and downs, faced with multiple fraud and hacking incidences, some of which have originated from the exchanges. Let&#39;s understand exchanges in detail and the judgment will be upon you on which to use while buying or selling crypto.</p><h4>What is an exchange in regard to crypto?</h4><p>An exchange is a platform where users can buy, sell or trade currencies or digital assets. It creates a marketplace where sellers and buyers come together to exchange one cryptocurrency for another or fiat currency for cryptocurrencies.</p><h4>What are the types of crypto exchanges?</h4><p><strong>Centralized Exchanges (CEXs)</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-g46ltinwhDaHHIo2dmXKg.png" /></figure><p>Centralized exchanges are the most common type of cryptocurrency exchange. As the name suggests, they are centralized, which means that they are controlled by a central authority, usually a company or organization. The central authority is the custodian of all user&#39;s private keys and they sign transactions on behalf of the users. Examples include Binance, Coinbase, and Bybit.</p><p><strong>Advantages</strong></p><ol><li>High liquidity: Centralized exchanges often have high liquidity, which means more buyers and sellers are available for trade.</li><li>Wide selection of trading pairs: Centralized exchanges often have a wider selection of trading pairs compared to DEXs, which can make it easier for traders to find the right trade.</li><li>Advanced trading tools: Centralized exchanges often offer advanced trading tools and functionalities, such as margin trading, stop-loss orders, and more.</li><li>User-friendly interfaces: Centralized exchanges often have user-friendly interfaces and customer support, which can be a benefit for less experienced traders.</li><li>Better integration with fiat currencies: Centralized exchanges often have better integration with fiat currencies, which can make it easier for users to deposit and withdraw funds in their local currency.</li></ol><p><strong>Disadvantages</strong></p><ol><li>Lack of privacy: Centralized exchanges require users to go through a KYC (know-your-customer) process, which means that users must reveal their personal information to the exchange. This can be a concern for users who value privacy, as their personal information is stored on the exchange’s servers.</li><li>Security risks: Centralized exchanges are more vulnerable to hacks and security breaches, as they are a single point of failure. If a centralized exchange is hacked, users’ funds and personal information can be at risk.</li><li>Lack of transparency: Centralized exchanges often do not provide a clear picture of their operations and may not disclose information about their trading volume, liquidity, or other key metrics.</li><li>Centralized control: Centralized exchanges are often controlled by a single entity, making them vulnerable to censorship or regulatory pressure. This can result in limitations on which cryptocurrencies are listed on the exchange, or restrictions on the types of trades that can be executed.</li><li>Slow transactions and high fees: Centralized exchanges can be slow to process transactions and may charge high fees, which can be a disadvantage for users who value speed and low costs.</li></ol><h4>Decentralised Exchanges (DEX)</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Wkn3qvcTbg5ReTAgcR43Iw.png" /></figure><p>Decentralized exchanges are a relatively new type of cryptocurrency exchange that has gained popularity in recent years. DEXs are decentralized, which means that they are not controlled by any central authority. Instead, they are built on a blockchain, which is a distributed ledger that records all transactions. Here users have access to their private keys and they sign their transactions, unlike centralized exchanges. Examples include Uniswap, SushiSwap and PancakeSwap</p><p><strong>Advantages</strong></p><ol><li>Greater security: DEXs are built on a blockchain, which makes them more secure and less vulnerable to hacks and security breaches.</li><li>No central point of failure: DEXs operate in a decentralized manner, which means there is no central point of failure. This makes them less vulnerable to regulatory pressure or censorship.</li><li>More privacy: DEXs often do not require users to go through a KYC (know-your-customer) process, which means users can retain their privacy.</li><li>Faster transactions: DEXs can offer faster transactions compared to centralized exchanges, as they do not require a central authority to process trades.</li><li>Lower fees: DEXs often charge lower fees compared to centralized exchanges, as they do not require the same level of infrastructure and resources.</li></ol><p><strong>Disadvantages</strong></p><ol><li>Less liquidity: DEXs often have lower liquidity compared to centralized exchanges, which can result in higher price volatility and lower trading volumes.</li><li>Limited trading pairs: DEXs often have limited trading pairs compared to centralized exchanges, which can make it more difficult to find the right trade.</li><li>Limited functionality: DEXs often have limited trading tools and functionalities compared to centralized exchanges, which can be a disadvantage for advanced traders.</li><li>Higher complexity: DEXs can be more complex to use compared to centralized exchanges, which can be a disadvantage for less experienced users.</li><li>No customer support: DEXs often do not offer customer support, which can be a disadvantage for users who need assistance with their trades.</li></ol><p>Choosing between centralized and decentralized exchanges ultimately depends on your personal preferences and priorities. Centralized exchanges offer more liquidity and trading options, but can be vulnerable to hacks and lack transparency. Decentralized exchanges provide greater security and privacy, faster transactions, and lower fees, but can be less user-friendly and have limited trading options. Consider your priorities and do your research before making a decision.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8421108bac6f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Ethereum Virtual Machine(EVM)]]></title>
            <link>https://medium.com/@alvinmutebi/the-ethereum-virtual-machine-evm-17f3fce1f543?source=rss-c471d65e6949------2</link>
            <guid isPermaLink="false">https://medium.com/p/17f3fce1f543</guid>
            <category><![CDATA[tokens-no-fungibles]]></category>
            <category><![CDATA[smart-contracts]]></category>
            <category><![CDATA[ethereum-blockchain]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[defi]]></category>
            <dc:creator><![CDATA[Alvin Mutebi]]></dc:creator>
            <pubDate>Sat, 18 Mar 2023 04:37:35 GMT</pubDate>
            <atom:updated>2023-03-18T04:38:33.301Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Sk5H_N8AtGysH7kK1wACbA.png" /><figcaption>EVM</figcaption></figure><p>Technology has evolved to the point one isn’t restricted to running one operating system on their computer. This is possible with the use of virtual machines. All you need is to install your desired Operating system on a virtual machine and you will be able to define the RAM, processors and disk space for your new Virtual Machine or Computer. This concept has been pushed further through decentralization in the Ethereum network where a virtual machine has been created to run all activities on the Ethereum network with ease. The software responsible for this is the Ethereum Virtual Machine <em>(EVM)</em>.</p><h4>What is the Ethereum Virtual Machine?</h4><p>The Ethereum Virtual machine is a piece of software that runs on multiple computers, which are decentralized in nature, and computes the state of each node in the network when a new block is mined and added to the network. The <em>EVM</em> is Turing-complete i.e anything that can be programmed can be executed on the <em>EVM</em>.<em> </em>The most popular programing language on the <em>EVM</em> is <a href="https://docs.soliditylang.org/en/v0.8.19/">Solidity</a> and it&#39;s used for writing smart contracts.</p><p>Here is a visual illustration of the <em>EVM</em> and how it works</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xDAPe2g1bWucGQpweuFB-A.png" /><figcaption>EVM</figcaption></figure><h4>Features of the EVM</h4><p><strong>Opcodes</strong></p><p><em>EVM</em> opcodes assist in executing specific tasks of smart contracts or transactions; you can find a list of opcodes in Ethereum <a href="https://ethereum.org/en/developers/docs/evm/opcodes/">here</a>. Aiming for efficiency, The <em>EVM</em> converts the compiled solidity code to bytecode to opcode, where each opcode is assigned one byte in bytecode. Each opcode operation requires a certain amount of gas to be executed by the <em>EVM</em>. This determines the amount of gas to be used to add the smart contract on the Ethereum Network.</p><p><strong>Gas</strong></p><p>Gas is used as the fee for computing the operations of a smart contract done by each node in the Ethereum network. The computation fees prevent an attacker from deploying many complex contracts that will require long computation times to halt the network. These fees make DDoS (Distributed Denial-of-Service) attacks too expensive to be executed.</p><p><strong>Smart Contacts</strong></p><p>In reference to my previous article <a href="https://medium.com/@alvinmutebi/smart-contracts-simplified-7978b824e4bc"><em>Smart Contracts simplified</em></a>, Smart contracts are simply self-executing programs which are deployed on the <a href="https://ethereum.org/en/developers/">Ethereum network</a> and can only be executed when a certain set condition is met. These contracts aren’t governed by anyone and are confirmed and verified by miners. They are coded in a language known as <a href="https://docs.soliditylang.org/en/v0.8.19/">Solidity</a>. The <em>EVM</em> aids in the deployment of smart contracts which makes it so flexible to run smart contracts for a different purposes.</p><h4>How can we use the EVM?</h4><p>The Ethereum Virtual Machine (<em>EVM</em>) has many use cases, as it is designed to execute smart contracts and power decentralized applications on the Ethereum blockchain</p><p><a href="https://medium.com/@alvinmutebi/a-beginners-guide-to-crypto-tokens-3e281475a1d1"><strong>Creating ERC 20 Tokens</strong></a></p><p>Tokens are created on the <em>EVM</em> that can be sent between addresses and have a fixed amount, their values are the same across the Ethereum network. Smart contracts that follow a specified data structure on the <em>EVM</em> are used to create these tokens. The data structure is responsible for controlling the naming, distributions, supply amount, and monitoring of the token.</p><p><strong>Decentralized Finance (DeFi)</strong></p><p>The EVM is widely used to create <em>DeFi</em> applications such as decentralized exchanges <em>(DEXs),</em> lending platforms, stablecoins, yield farming, and more. Smart contracts built on the <em>EVM</em> enable trustless and transparent financial transactions without intermediaries.</p><p><a href="https://medium.com/@alvinmutebi/a-beginners-guide-to-crypto-tokens-3e281475a1d1"><strong>Creating ERC 721 Tokens (Non-Fungible Tokens)</strong></a></p><p><em>NFTs (Non-Fungible Tokens) </em>are unique digital assets stored on the Ethereum blockchain. The <em>EVM</em> is used to create smart contracts that enable the creation, transfer, and ownership of <em>NFTs</em>, which can be used for digital art, collectables, gaming items, and more.</p><p><strong>Voting and Governance</strong></p><p>The <em>EVM</em> is used to create decentralized voting and governance systems that enable communities to make collective decisions in a transparent and secure way. Smart contracts built on the <em>EVM</em> can be used to create voting rules, store votes, and execute decisions automatically.</p><p><strong>Gaming</strong></p><p>The <em>EVM</em> is used to create blockchain-based games that offer true ownership of in-game assets and enable players to earn cryptocurrency rewards. Smart contracts built on the <em>EVM</em> can be used to create game logic, store player data, and handle in-game transactions.</p><p>In conclusion, the Ethereum Virtual Machine is a critical piece of software that enables developers to create decentralized applications and smart contracts on the Ethereum blockchain. With its features such as opcodes, gas, and smart contracts, the EVM is a powerful tool for creating new decentralized solutions for various use cases. As technology continues to evolve, it’s exciting to see how the EVM will continue to enable innovation and transform the way we live and do business.</p><p><strong>References</strong></p><p><strong><em>Smart Contracts Simplified</em></strong>: <a href="https://medium.com/@alvinmutebi/smart-contracts-simplified-7978b824e4bc">https://medium.com/@alvinmutebi/smart-contracts-simplified-7978b824e4bc</a></p><p><strong><em>Beginners guide to crypto tokens</em>:</strong> <a href="https://medium.com/@alvinmutebi/smart-contracts-simplified-7978b824e4bc">https://medium.com/@alvinmutebi/smart-contracts-simplified-7978b824e4bc</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=17f3fce1f543" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Interact with the Ethereum blockchain in a few steps]]></title>
            <link>https://medium.com/@alvinmutebi/interact-with-the-ethereum-blockchain-in-a-few-steps-8560dce9d253?source=rss-c471d65e6949------2</link>
            <guid isPermaLink="false">https://medium.com/p/8560dce9d253</guid>
            <category><![CDATA[metamask]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[etherscan]]></category>
            <category><![CDATA[ethereum-blockchain]]></category>
            <category><![CDATA[ethersjs]]></category>
            <dc:creator><![CDATA[Alvin Mutebi]]></dc:creator>
            <pubDate>Sat, 11 Mar 2023 10:46:52 GMT</pubDate>
            <atom:updated>2023-03-11T10:46:52.625Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*w9SH6P42saD4vdkaWo_lig.png" /></figure><p><a href="https://ethereum.org/en/">Ethereum</a> is one of the most popular blockchains supporting different applications using the <a href="https://ethereum.org/en/developers/docs/evm/">Ethereum Virtual Machine (EVM).</a> There are many ways to interact with the mainnet and testnet for developers, and today we shall do a few interactions with the blockchain.</p><p>In this article, we shall use node js, ethers js and Alchemy as our node providers.</p><h4>Prerequisites</h4><ol><li><a href="https://nodejs.org/en/download/">Nodejs</a></li><li><a href="https://metamask.io/">Metamask Wallet</a></li><li><a href="https://docs.ethers.org/v5/">Ethers js</a></li><li><a href="https://www.npmjs.com/package/dotenv">Dotenv</a></li></ol><p>Let us dig into our project</p><p>We shall be using node js to show our meta mask wallet balance, get gas estimations and more.</p><p>Let us start by creating a folder on our Desktop with a folder named Eth-Interactions.</p><pre>mkdir Eth-Intractions &amp;&amp; cd Eth-Intractions</pre><p>We then initiate a new node project using yarn.</p><pre>yarn init</pre><p>We now create a meta mask wallet for those without one here is a <a href="https://myterablock.medium.com/how-to-create-or-import-a-metamask-wallet-a551fc2f5a6b#:~:text=Go%20to%20https%3A%2F%2Fmetamask,Brave%20and%20Edge%20browser%20extensions.&amp;text=Click%20on%20the%20MetaMask%20extension%20and%20click%20on%20%E2%80%9CGet%20Started%E2%80%9D.">guide</a> and make sure to get some test Ethereum into your wallet. <a href="https://medium.com/@ethvalidator/a-quick-guide-on-how-to-get-test-eth-in-the-goerli-network-7066dc915989">Guide</a></p><p>Your meta mask should look like this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/360/1*pubattgETuJa59uviOT-Mw.png" /></figure><p>Next, we now install <strong><em>ethers js</em></strong> into our project with this simple command and <strong><em>dotenv.</em></strong></p><pre>yarn add ethers@5 dotenv</pre><p>We can now create a <strong><em>.env</em></strong> file in our project directory.</p><pre>touch .env</pre><p>Inside the <strong><em>.env</em></strong> add the following code.</p><pre>PRIVATE-KEY=&#39;YOUR METAMASK PRIVATE KEY&#39;<br>PROVIDER=&#39;YOUR ALCHEMY PROVIDER&#39;</pre><p>We now navigate to <a href="https://www.alchemy.com/">alchemy</a> and create an account and a project after we are verified and we are given access to a WebSocket URL which we place in the provider in our .env.</p><p>Next, we create an <strong><em>index.js </em></strong>file in our project where we start writing our code.</p><pre>import ethers from &#39;ethers&#39;<br><br>const provider = new ethers.providers.JsonRpcProvider(process.env.PROVIDER)<br><br>const wallet = new ethers.Wallet(process.env.PRIVATE-KEY, provider);<br><br>// we now create our get blanace function <br><br>async function getBalance() {<br>    const balance = await wallet.getBalance();<br>    output_balance = ethers.utils.formatEther(balance);<br>    console.log(output_balance, &quot;ETH&quot;);<br>}<br><br>getBalance();</pre><p>This returns the balance of tokens for this case <strong>ETH</strong> in our meta mask wallet.</p><pre>run node index.js</pre><p>The output in the terminal should look like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/329/1*_7iC8gutjx4UZXMJnwyCeg.png" /></figure><p>Hooray, you just interacted with the Ethereum blockchain and got your wallet balance.</p><p>Next, we fetch our gas prices data.</p><p>Create a new file named <strong><em>gas.js </em></strong>and add the following code.</p><pre>import ethers from &#39;ethers&#39;<br><br>const provider = new ethers.providers.JsonRpcProvider(process.env.PROVIDER)<br><br><br>// we now create a get gas data function<br><br>async function getGas() {<br>    try {<br>        const feeData = await provider.getFeeData();<br>        console.log(feeData)<br>       <br>    } catch (error) {<br>        console.log(`Error: ${error.message}`);<br>    }<br>}</pre><p>We then run this command.</p><pre>node gas.js</pre><p>Our output will be like this in the terminal</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/814/1*1e4mV_wE-0GB3YerwT_VXw.png" /><figcaption>Gas Data in Terminal</figcaption></figure><p>Excellent work, you have been able to write functions programmatically and interacted with the Ethereum blockchain and got back wallet balance and gas data. There is a lot that can be done with the blockchain, feel free to explore on your own. Thanks for reading, don&#39;t forget to subscribe to my weekly articles about blockchain technology.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8560dce9d253" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Smart Contracts simplified]]></title>
            <link>https://medium.com/@alvinmutebi/smart-contracts-simplified-7978b824e4bc?source=rss-c471d65e6949------2</link>
            <guid isPermaLink="false">https://medium.com/p/7978b824e4bc</guid>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[smart-contracts]]></category>
            <category><![CDATA[solidity]]></category>
            <category><![CDATA[defi]]></category>
            <dc:creator><![CDATA[Alvin Mutebi]]></dc:creator>
            <pubDate>Sat, 04 Mar 2023 10:49:43 GMT</pubDate>
            <atom:updated>2023-03-04T10:49:43.498Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/850/1*9WQgMZdO403OeRycNyKk6g.png" /></figure><p>By now you at some point heard of the <a href="https://ethereum.org/en/developers/">Ethereum blockchain</a>, and if yes, you encountered at some point a term known as <em>Smart contracts.</em> Today we shall focus on an in-depth understanding of smart contracts and let&#39;s dive into it.</p><h4>What are smart contracts?</h4><p>Smart contracts are simply self-executing programs which are deployed on the <a href="https://ethereum.org/en/developers/">Ethereum network</a> and can only be executed when a certain set condition is met. These contracts aren&#39;t governed by anyone and are confirmed and verified by miners. They are coded in a language known as <a href="https://docs.soliditylang.org/en/v0.8.19/">Solidity</a>.</p><h4>Benefits of Smart Contracts</h4><p><strong>Speed, efficiency and accuracy</strong></p><p>Once a condition is met, the contract is executed immediately. Because smart contracts are digital and automated, there’s no paperwork to process and no time spent reconciling errors that often result from manually filling in documents.</p><p><strong>Trust and Transaparcey</strong></p><p>Because there’s no third party involved, and because encrypted records of transactions are shared across participants, there’s no need to question whether information has been altered for personal benefit.</p><p><strong>Security</strong></p><p>Blockchain transaction records are encrypted, which makes them very hard to hack. Moreover, because each record is connected to the previous records on a distributed ledger, hackers would have to alter the entire chain to change a single record.</p><p><strong>Cost Saving</strong></p><p>Smart contracts remove the need for intermediaries to handle transactions and, by extension, their associated time delays and fees.</p><h4>Types of Smart Contracts</h4><p><strong>Token Contracts</strong></p><p>Token contracts aid in the creation of new crypto tokens on the other Ethereum network. These define the rules or nature of how a token should be created, transferred and destroyed for example <a href="https://ethereum.org/en/developers/docs/standards/tokens/erc-20/">ERC-20</a> contacts tokens are mostly used for tokens, <a href="https://ethereum.org/en/developers/docs/standards/tokens/erc-721/#:~:text=What%20is%20ERC%2D721%3F,something%20else%20like%20its%20visual.">ERC-721</a> contracts for None-Fungible tokens (NFT)s and ERC-1155 contracts for both fungible and non-fungible tokens.</p><p><strong>Decentralized Finance Contracts (DeFi)</strong></p><p>These contacts are used to create decentralized financial applications on the Ethereum network. These contacts enable the users to trade, borrow, lend, add liquidity to some tokens, and earn interest without middlemen, for example, <a href="https://uniswap.org/">Uniswap</a> a decentralized exchange, <a href="https://www.investopedia.com/what-is-aave-6823617">Aave</a> a decentralized lending platform, and Compound a decentralized borrowing platform.</p><p><strong>Governance Contracts</strong></p><p>These are contacts that are used in decentralized autonomous organizations (<a href="https://www.investopedia.com/tech/what-dao/">DAO</a>)s on the Ethereum network. These define the rules of how decision-making will be in the organization such as voting, and how proposals are submitted for example, <a href="https://makerdao.com/en/">MakerDAO</a> is a decentralized organization which controls DAI and <a href="https://aragon.org/">Aragon</a> is a platform for creating DAOs.</p><p><strong>Identity Contracts</strong></p><p>These contracts aid in the creation of digital identities on the Ethereum network and allow users to prove their identity without the need for a central authority. for example, <a href="https://www.serto.id/">Serto</a> which is used to create and manage decentralized identifiers (<em>DIDs</em>) and Civic.</p><p>Here is a simple code snippet of a smart contract for a vending machine and how the entire logic would flow.</p><h4>Note: Solidity Code.</h4><pre>pragma solidity 0.8.7;<br><br>contract VendingMachine {<br><br>    // Declare state variables of the contract<br>    address public owner;<br>    mapping (address =&gt; uint) public cupcakeBalances;<br><br>    // When &#39;VendingMachine&#39; contract is deployed:<br>    // 1. set the deploying address as the owner of the contract<br>    // 2. set the deployed smart contract&#39;s cupcake balance to 100<br>    constructor() {<br>        owner = msg.sender;<br>        cupcakeBalances[address(this)] = 100;<br>    }<br><br>    // Allow the owner to increase the smart contract&#39;s cupcake balance<br>    function refill(uint amount) public {<br>        require(msg.sender == owner, &quot;Only the owner can refill.&quot;);<br>        cupcakeBalances[address(this)] += amount;<br>    }<br><br>    // Allow anyone to purchase cupcakes<br>    function purchase(uint amount) public payable {<br>        require(msg.value &gt;= amount * 1 ether, &quot;You must pay at least 1 ETH per cupcake&quot;);<br>        require(cupcakeBalances[address(this)] &gt;= amount, &quot;Not enough cupcakes in stock to complete this purchase&quot;);<br>        cupcakeBalances[address(this)] -= amount;<br>        cupcakeBalances[msg.sender] += amount;<br>    }<br>}</pre><p>In conclusion, smart contracts are an exciting application of blockchain technology that has the potential to revolutionize many industries. They provide speed, efficiency, accuracy, security, transparency, and cost savings.</p><h4>References</h4><p><strong>Blochain For Everyone</strong>:<a href="https://medium.com/@alvinmutebi/blockchain-for-everyone-2a9d88ba97bb">https://medium.com/@alvinmutebi/blockchain-for-everyone-2a9d88ba97bb</a></p><p><strong>Common terms on the Ethereum</strong> blockchain:<a href="https://medium.com/@shammahbenjamin/common-terms-on-the-ethereum-blockchain-9c3d40afa28d">https://medium.com/@shammahbenjamin/common-terms-on-the-ethereum-blockchain-9c3d40afa28d</a></p><p><a href="https://ethereum.org/en/developers/docs/smart-contracts/"><strong>Introduction to smart contracts</strong></a><strong>: </strong><a href="https://ethereum.org/en/developers/docs/smart-contracts/">https://ethereum.org/en/developers/docs/smart-contracts/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7978b824e4bc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A beginner’s guide to crypto tokens]]></title>
            <link>https://medium.com/@alvinmutebi/a-beginners-guide-to-crypto-tokens-3e281475a1d1?source=rss-c471d65e6949------2</link>
            <guid isPermaLink="false">https://medium.com/p/3e281475a1d1</guid>
            <category><![CDATA[cryptocurrency-news]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[cryptocurrency]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[ethereum-blockchain]]></category>
            <dc:creator><![CDATA[Alvin Mutebi]]></dc:creator>
            <pubDate>Fri, 24 Feb 2023 15:41:03 GMT</pubDate>
            <atom:updated>2023-02-24T15:43:36.150Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*YKHK1ynS7UeIfukgHUXbiA.png" /></figure><p>You might have realized the increased use of the term crypto tokens in the blockchain communities, Let’s understand what they are and how they come to be identified in the simplest way</p><h3>What is a crypto token?</h3><p>A crypto token is a digital value unit representing an asset or utility. Crypto tokens are built on existing Layer one blockchains like Bitcoin, Ethereum and other altcoins like Ripple and Litecoin protocols.</p><p>Tokens can be used for purposes like making Decentralized Finance Possible (DEFi). They can be used to raise funds or to give access to particular services. Some tokens can even represent coins on a different network. Such tokens are called “wrapped tokens” and follow the price of the underlying asset.</p><h4>Examples of tokens</h4><ol><li>Tether</li><li>USD Coin</li><li>Binance USD</li><li>Wrapped Bitcoin</li><li>Shiba Inu</li><li>Chainlink</li></ol><h4>Token Standards</h4><p>Token standards refer to what a token should contain in its smart contract to be referred to as a token take it as the rules governing the creation of tokens, we shall focus on tokens created on Ethereum which is ERC <strong><em>(Ethereum Request for Comment)</em></strong></p><h4>ERC-20</h4><p>This is a standard for fungible tokens and it means all tokens are the same in type, for instance, ChainLink has <strong><em>LINK</em></strong> token which is an ERC-20 token on the Ethereum network and servers as a currency for the chainlink network, each issued token is always equal to any other LINK token.</p><h4>ERC-721</h4><p>This is a standard for non-fungible tokens (<strong><em>NFT</em></strong>), which means this can’t be exchanged for other tokens of the same type. They are unique and cannot be replaced by another token. They have unique identifiers or token IDs, and their own set of metadata. This metadata can include information such as the name of the token, the creator, the date of creation, and any other relevant information. They represent digital assets like collectables, art, music albums and game items. This provides province of ownership easy since they can’t be duplicated.</p><h3>Types of Tokens</h3><h4>Payment Tokens</h4><p>These are tokens designed in a way they can be used as a medium of exchange for goods and services. For example, <strong><em>a USDT</em></strong> token that’s is designed to be stable in value with each token backed by the US dollar.</p><h4>Utility Tokens</h4><p>These tokens are designed to provide access to a service or product to their holders and their value is derived from the demand for that service. They can be used to incentives users to participate in a network and can be traded on exchanges. for example <strong><em>BNB</em></strong> on the Binace Smart Chain which is used to pay for trading fees and transactions on Binace.</p><h4>Governance Tokens</h4><p>These tokens are designed to permit holders to participate in the decision-making process for a blockchain project. Holders can vote on proposals or changes to the network and are often incentivised. For example, <strong><em>COMP</em></strong> is used for governance of the Compound protocol.</p><h4>Security Tokens</h4><p>Security tokens are digital tokens that represent ownership of a particular asset, such as equity or debt in a company. They are subject to securities laws and regulations and require registration with regulatory authorities. For example, <strong><em>TZEROP</em></strong> was launched by an e-commerce firm that used to pay owners dividends.</p><p>Crypto tokens are digital representations of interest in an asset or used to facilitate transactions on a blockchain. They are often confused with cryptocurrency because they are also tradeable and exchangeable. Don’t forget to follow and subscribe for more articles about blockchain weekly.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3e281475a1d1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A telegram bot to place an order]]></title>
            <link>https://medium.com/@alvinmutebi/a-telegram-bot-to-place-an-order-on-bybit-f2eecb04b0ae?source=rss-c471d65e6949------2</link>
            <guid isPermaLink="false">https://medium.com/p/f2eecb04b0ae</guid>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[telegram-bot]]></category>
            <category><![CDATA[usdt]]></category>
            <category><![CDATA[expressjs]]></category>
            <category><![CDATA[bybit]]></category>
            <dc:creator><![CDATA[Alvin Mutebi]]></dc:creator>
            <pubDate>Sat, 18 Feb 2023 12:33:53 GMT</pubDate>
            <atom:updated>2023-02-18T13:26:40.890Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bERKaZcZV3JvoP3300MFgA.png" /></figure><p>Here we shall be continuing with our previous <a href="https://medium.com/@alvinmutebi/how-to-place-a-trading-order-on-bybit-programmatically-32f48e25978e"><strong>article</strong></a>, we shall integrate a telegram bot to help us make an order and display the results in the telegram bot.</p><p>Requirements: <a href="https://www.npmjs.com/package/telegraf">telegraf</a>, <a href="https://nodejs.org/en/download/">nodejs</a>, <a href="https://www.typescriptlang.org/">typescript</a>, <a href="https://testnet.bybit.com/en-US/">bybitAPI</a></p><p>Previous Article: <a href="https://medium.com/@alvinmutebi/how-to-place-a-trading-order-on-bybit-programmatically-32f48e25978e">https://medium.com/@alvinmutebi/how-to-place-a-trading-order-on-bybit-programmatically-32f48e25978e</a></p><p>telegram Bot API token:<a href="https://core.telegram.org/bots/tutorial">https://core.telegram.org/bots/tutorial</a></p><p>This will be a quick one and I hope you went through the last article <a href="https://medium.com/@alvinmutebi/how-to-place-a-trading-order-on-bybit-programmatically-32f48e25978"><strong>Placing an Order on Bybit Programmatically.</strong></a><strong> </strong>This is a stepping stone to understanding what we shall be doing today</p><p>Let&#39;s dive into our project for now</p><p>We shall have to install telegraf into our development environment</p><pre>yarn add telegraf or npm i telegraf</pre><p>We now head to telegram and search for Botfather and select the verified one</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/327/1*B6LiixFYZRl-L7nmviUrZA.png" /></figure><p>Go ahead and create a new telegram bot in seconds and get access to your bot&#39;s API key.</p><p>We now create a folder in our src <strong>folder</strong> and name it bot with files <strong><em>bot.ts</em></strong> and <strong><em>index.ts</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*eWJTF9Yqd5uAOGbOOyRJWA.png" /></figure><p>In our bot.ts, we start by importing telegraf, our configs, our bybitExchange helper</p><p>We now edit our b<strong><em>ot.ts</em></strong> to include this code</p><pre>import { Markup, Telegraf } from &quot;telegraf&quot;<br>import { ConfigParams } from &quot;../config&quot;<br>import { BybitExchange } from &quot;../exchange&quot;<br>import { normalizeeMessage } from &quot;../utils/telegram&quot;<br><br><br><br>//create a new telegraph instance form the telegraf class<br><br>const bot = new Telegraf(ConfigParams.TOKEN)<br><br>//creat a start command for our telgram bot and pass a message<br>bot.start((ctx) =&gt; {<br><br>    ctx.replyWithDice()<br>    ctx.reply(`Welcome ${ctx.message.from.first_name} lets Buy USDT\n Use thisfor guidence:\n<br>Buy: /buy\n`)<br>})<br><br>// get the parameters and create a function for use <br><br>const getOptions = () =&gt; {<br>    return {<br>        key: ConfigParams.API_KEY,<br>        secret: ConfigParams.API_SECRET,<br>        baseUrl: ConfigParams.MAIN_URL,<br>        testnet: true<br>    }<br>}</pre><p>Here we create a telegram instance from the telegram Class called bot which accepts an API key or token that we got from the bot father</p><p>Next, we create a start command which returns our user&#39;s first name and later we create an option&#39;s function to return our config parameters.</p><p>Now we modify our server.ts to look like this</p><pre>import express from &#39;express&#39;<br>import { bot } from &#39;./bot&#39;;<br>import { configureMiddlewares } from &#39;./middlewares/config&#39;;<br>import { ConfigureRoutes } from &#39;./routes&#39;;<br><br>const app = express()<br>configureMiddlewares(app)<br>ConfigureRoutes(app)<br><br>const start = async () =&gt; {<br>    console.log(`---`.repeat(10))<br>    console.log(`starting bot  🤖 `)<br>    console.log(`---`.repeat(10))<br>    bot.launch().then(() =&gt; {<br><br>    }).catch(() =&gt; {<br><br>    })<br><br>}<br>start()<br>app.listen(3000, () =&gt; {<br>    console.log(&#39;Welcome to Medium Order Tutorial at http://localhost:3000&#39;);<br>});</pre><p>Here we are starting the bot simultaneously with our express app and it should log the above in your console if successful.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-WFID4cYt3NAhDWrFUHgMQ.png" /></figure><p>In your telegram when u type<strong> /start</strong> you will see such a response</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/385/1*8Io9As_xwh03UcENAE0tIg.png" /></figure><p>Congs you made your first telegram bot with rolling dice and displaying your name,</p><p>Here we created a buy command so that when you type <strong>/buy </strong>in your telegram bot a buy order is placed on bybit and you will be able to see details in your bot like this</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/385/1*8eQfjG59KMDvtwz73G90GA.png" /></figure><p>Congrats you have made an order on bybit using a bot in just seconds, there are multiple actions you can achieve using the telegram bot but for now, we can say we were successful in placing an order.</p><p>Happy coding, Don&#39;t forget to subscribe and share.</p><p><strong>Useful Links</strong></p><p><strong>Telegraf</strong>:<a href="https://www.npmjs.com/package/telegraf">https://www.npmjs.com/package/telegraf</a></p><p><strong>Telegram</strong>:<a href="https://core.telegram.org/bots#3-how-do-i-create-a-bot">https://core.telegram.org/bots#3-how-do-i-create-a-bot</a></p><p><strong>Last Article</strong>: <a href="https://medium.com/@alvinmutebi/how-to-place-a-trading-order-on-bybit-programmatically-32f48e25978e">https://medium.com/@alvinmutebi/how-to-place-a-trading-order-on-bybit-programmatically-32f48e25978</a></p><p>Article: <a href="https://medium.com/block-magnates/how-to-create-a-telegram-bot-that-buys-and-sells-tokens-that-have-liquidity-added-part-1-a002b9c6aca">https://medium.com/block-magnates/how-to-create-a-telegram-bot-that-buys-and-sells-tokens-that-have-liquidity-added-part-1-a002b9c6aca</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f2eecb04b0ae" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to place a trading order on Bybit programmatically]]></title>
            <link>https://medium.com/@alvinmutebi/how-to-place-a-trading-order-on-bybit-programmatically-32f48e25978e?source=rss-c471d65e6949------2</link>
            <guid isPermaLink="false">https://medium.com/p/32f48e25978e</guid>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[expressjs]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[bybit]]></category>
            <dc:creator><![CDATA[Alvin Mutebi]]></dc:creator>
            <pubDate>Sat, 11 Feb 2023 14:57:53 GMT</pubDate>
            <atom:updated>2023-02-18T13:02:27.784Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DpoV1gBzrjIvgri_-VrzQg.png" /><figcaption>Bybit Test net</figcaption></figure><p>We shall go through a detailed chronology where we shall learn how to make a Limit order using <strong><em>node js, express typescript, and the Bybit API.</em></strong></p><p>First, what is an <strong>order</strong> in regard to crypto trading, we shall talk about <strong>Limit</strong> and <strong>Market</strong> Orders;</p><p><strong>Limit orders</strong></p><p>A limit order is an agreement to buy or sell an asset at a specific price.</p><p><strong>Market Orders</strong></p><p>A market order is an instant buy or sell of an asset for the best available price at that time.</p><p>In this case, we shall be trading <strong><em>BTCUSDT</em></strong>, on <a href="https://www.bybit.com/"><strong><em>Bybit</em></strong></a> without wasting time, let&#39;s dive into the development of our simple app</p><p><strong>Requirements</strong></p><p>We assume before you proceed you have node js installed globally in your system or development environment</p><p><a href="https://nodejs.org/en/download/"><strong><em>Nodejs</em></strong></a><strong><em>, </em></strong><a href="https://expressjs.com/"><strong><em>Express</em></strong></a><strong><em>, </em></strong><a href="https://www.typescriptlang.org/"><strong><em>Typescript</em></strong></a><strong><em>, </em></strong><a href="https://www.npmjs.com/package/cors"><strong><em>Cors</em></strong></a><strong><em>, </em></strong><a href="https://www.npmjs.com/package/dotenv"><strong><em>dotenv</em></strong></a><strong><em>, </em></strong><a href="https://www.npmjs.com/package/bybit-api"><strong><em>bybit-api</em></strong></a><strong><em>,</em></strong></p><p><strong>Project folder setup</strong></p><p>Here we create a folder and navigate to it</p><pre>mkdir place_order_bybit &amp;&amp; cd palce_order_bybit</pre><p>We now initiate our node js project with either npm or yarn</p><pre>npm init -y    or yarn init </pre><p>Next, we install the dependencies for our project</p><pre>yarn add typescript express cors dotenv bybit-api node</pre><p>We shall now install the types versions of our dependencies since we are using typescript</p><pre>yarn add @type/node @types/typescript @types/express @types/cors @types/dotenv</pre><p>We shall now create our folders in our application folder as shown below</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*z8x6S2h2SQizUHtm54ax9A.png" /><figcaption>Folder structure</figcaption></figure><p>We now create our <strong><em>.env</em></strong><em> </em>configuration and it should look like this:</p><pre>API_KEY=&#39;&#39;   // your bybit api key<br>API_SECRET=&#39;&#39;  // your bybit api secret<br>MAIN_URL=&#39;https://api-testnet.bybit.com&#39;<br><br></pre><p>Head to the <a href="https://testnet.bybit.com/en-US/"><strong><em>bybit testnet</em></strong></a><strong><em> </em></strong>and create an account and thereafter create an <strong>API</strong> <strong>KEY</strong> and <strong>SECRET</strong> for your project.</p><p>In the <strong>config</strong> <strong>folder</strong>, create a new file called <strong><em>config.ts</em> </strong>and add this code, where we call our variables from the <em>.</em><strong><em>env</em></strong><em>.</em></p><pre>import &#39;dotenv/config&#39;<br><br>export const ConfigParams = {<br>    API_KEY: process.env.API_KEY || &quot;&quot;,<br>    API_SECRET: process.env.API_SECRET || &quot;&quot;,<br>    TEST_NET: true,<br>    MAIN_URL: process.env.MAIN_URL || &quot;&quot;<br>}</pre><p>Next, we create our <strong>server.ts</strong> file and it should look like this for the first time</p><pre>import express from &#39;express&#39;<br>import { configureMiddlewares } from &#39;./middlewares/config&#39;;<br>import { ConfigureRoutes } from &#39;./routes&#39;;<br><br>const app = express()<br>configureMiddlewares(app)<br>ConfigureRoutes(app)<br>app.listen(3000, () =&gt; {<br>    console.log(&#39;Server listening on port 3000! We are Good to go&#39;);<br>});</pre><p>In the exchange folder, we create a <strong><em>bybitHelper.ts filer </em></strong>which should look like this</p><pre>import { LinearClient, LinearOrder, LinearPositionIdx } from &quot;bybit-api&quot;;<br><br>export class BybitExchange {<br> //call our client <br> private linear: LinearClient<br><br> //create a constructor with the required keys<br><br> constructor(options: { key: string, secret: string, testnet: boolean, baseUrl: string }) {<br> this.linear = new LinearClient(options)<br><br> }<br><br> //we crate an async function to create and order or make an order<br> //every async function should return a promsie<br><br> async makeOrder(params: {<br> symbol: string, side: any, qty: number, order_type: any,<br> time_in_force: any, reduce_only: boolean, close_on_trigger: boolean, price: number, position_idx: LinearPositionIdx<br> }): Promise&lt;LinearOrder | null&gt; {<br> console.log(params)<br> let { result, ret_code, ret_msg } = await this.linear.placeActiveOrder(params)<br> if (ret_code === 0) {<br> console.log(result)<br> return result<br> } else {<br> console.log(ret_code, ret_msg)<br> throw new Error(ret_msg);<br><br> }<br> return null<br><br> }<br><br> //get Current price Helper<br><br> async getCurrentPrice(symbol: string): Promise&lt;number | null&gt; {<br> try {<br> const { result, ret_code, ret_msg } = await this.linear.getTickers({ symbol })<br> let _result = result.find((item: { symbol: string }) =&gt; item.symbol === symbol)<br> if (ret_code === 0) {<br> return _result.last_price<br> }<br> console.log(result)<br> if (ret_code === 0 &amp;&amp; _result[0]) {<br> return _result[0]?.symbol.last_price<br> } else {<br> throw new Error(ret_msg)<br> }<br><br> } catch (error) {<br><br> }<br> return null<br><br> }<br><br>}</pre><p>In the above code, we import <strong>Linear Client</strong> from the <strong>bybit</strong> <strong>API</strong> and create a class which can be exported to other files. Here we create helper functions that get a reference from the <strong>bybit API</strong> like <strong><em>makeOrder </em></strong>and <strong><em>getCurrentPrice</em></strong></p><p>Next, we create a file called <strong><em>placeOrder.ts</em> </strong>which should reside in the <strong>controller&#39;s</strong> folder and it should look like this</p><pre><br>import { Request, Response } from &quot;express&quot;;<br>import { ConfigParams } from &quot;../config/config&quot;;<br>import { BybitExchange } from &quot;../exchange/bybitHelper&quot;;<br><br>const bybitExchange = new BybitExchange({<br>    key: ConfigParams.API_KEY,<br>    secret: ConfigParams.API_SECRET,<br>    baseUrl: ConfigParams.MAIN_URL,<br>    testnet: true<br><br>})<br><br>async function makeOrder(req: Request, res: Response) {<br>    try {<br>        console.log(&quot;Hello Place Order Controller&quot;)<br>        if (req.body) {<br>            let { symbol, side, order_type, qty, time_in_force, price, reduce_only, close_on_trigger } = req.body<br>            //we find the current price with the help of our bybitexchange helper<br>            const currentPrice: any = await bybitExchange.getCurrentPrice(symbol)<br>            //we check if our price is greater than 0.07 or greater than 0.07 depending on our needs<br>            reduce_only = side === &#39;Buy&#39; ? false : true<br>            price = side === &#39;Buy&#39; ? currentPrice - 0.07 : currentPrice + 0.07<br>            //our result to the body<br>            const result = await bybitExchange.makeOrder({ symbol, side, order_type: &quot;Limit&quot;, qty: parseFloat((qty / currentPrice).toFixed(3)), time_in_force, reduce_only, close_on_trigger, price, position_idx: 0 })<br>            //we log the price we bought at or sold at <br>            price = side === &#39;Buy&#39; ? console.log(&quot;Bought at this Price&quot;, price) : console.log(&quot;Sold at this Price&quot;, price)<br>            //we log the json resposne<br>            res.status(200).json({ result: result })<br><br><br>        } else {<br>            console.log(&quot;Request wasnt Sent check for an error&quot;)<br>            res.status(502).json({ error: true })<br>        }<br><br>    } catch (error) {<br>        console.log(&quot;Failed to request&quot;, error)<br><br>    }<br><br><br>}<br><br>export { makeOrder }</pre><p>In the above code of the <strong><em>makeOrder</em></strong> controller we see we import our <strong><em>config.ts </em></strong>file and our <strong><em>bybitExchange</em></strong> <strong><em>class</em></strong>, we then create an instance of the <strong><em>bybitExchange</em></strong> as seen above.</p><p>This is helping us buy <strong><em>BTCUSDT</em></strong> considering the price which is lower than <strong>-0.07 </strong>from the live price or last traded price(live price) and selling when the price is greater than <strong>0.07</strong> the lasted traded price (live price)</p><p>Next, we create a folder named <strong>api</strong> in routes and create a new file named <strong><em>routes.ts</em></strong>, it should look like this</p><pre>import { Router } from &quot;express&quot;;<br>import { makeOrder } from &quot;../../controllers/placeOrder&quot;;<br>makeOrder<br><br><br>const router = Router()<br><br>router.post(&#39;/make-order&#39;, makeOrder)<br><br>export { router as makeOrderRoute }</pre><p>Here we import the Router function to help us with routes</p><p>We then create an <strong><em>index.ts</em></strong> in the <strong><em>api</em></strong> folder still</p><pre>import { Application } from &quot;express&quot;<br>import { makeOrderRoute } from &quot;./api/routes&quot;<br><br><br>export const ConfigureRoutes = (app: Application) =&gt; {<br>    app.get(&#39;/ping&#39;, (req, res) =&gt; {<br>        res.send(&quot;Welcome to Crazy Bot&quot;)<br>    })<br>    app.use([makeOrderRoute])<br>}</pre><p>Here we created a <strong><em>configureRoutes</em></strong> function to handle all our routes as shown above which passes the <strong><em>makeOrderRoute</em></strong>.</p><p>if all is setup, we should be able to type the following command in your terminal and have our app running</p><pre>yarn start or npm start</pre><p>Your terminal should look like this</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N1CUAysSQXEuGcxNCrWilA.png" /><figcaption>Server running in the terminal</figcaption></figure><p>Next, we open a client like Postman and pass our URL <a href="http://localhost:3000/make-order">http://localhost:3000/make-order</a> like below to make a post request with the set parameters in the body more about the parameters visit <a href="https://bybit-exchange.github.io/docs/v5/order/create-order">bybit place order documentation</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6gMx7y51zpH21eDOr_ZSDg.png" /><figcaption>Request</figcaption></figure><p>Send the request and the output will look like this</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BxZwDva5Vk1vS2ucY8y56Q.png" /><figcaption>Response</figcaption></figure><p>Hooray we just made a limit buy order programmatically, when you check your bybit account, u will see an order placed with the same amount specified in the request in Postman</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7MI7HddzE5Hdz786ixIn9w.png" /><figcaption>An order made shown in bybit</figcaption></figure><p><strong>Resources</strong></p><p>ByBitAPI docs:<a href="https://bybit-exchange.github.io/docs/v5/intro">https://bybit-exchange.github.io/docs/v5/intro</a></p><p>We are able to do a lot with the <strong><em>Bybit AP</em>I </strong>and this is just one of the possibilities, watch out for more interesting articles on this topic and all about blockchain and crypto trading using code and please follow me for more updates.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=32f48e25978e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Blockchain in our daily routines]]></title>
            <link>https://medium.com/@alvinmutebi/blockchain-in-our-daily-routines-97fffeb60951?source=rss-c471d65e6949------2</link>
            <guid isPermaLink="false">https://medium.com/p/97fffeb60951</guid>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[blockchain-technology]]></category>
            <category><![CDATA[education]]></category>
            <category><![CDATA[supply-chain-solutions]]></category>
            <category><![CDATA[voting]]></category>
            <dc:creator><![CDATA[Alvin Mutebi]]></dc:creator>
            <pubDate>Sat, 04 Feb 2023 09:35:03 GMT</pubDate>
            <atom:updated>2023-02-04T09:35:03.471Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8cadeLUhOunZ0tf1ieWBSQ.png" /></figure><p>In a previous article, <a href="https://medium.com/@alvinmutebi/blockchain-for-everyone-2a9d88ba97bb">Blockchain for everyone,</a> we discussed what blockchain is, its types and the consensus algorithms the most popular blockchains use i.e Bitcoin and Ethereum. Today we shall talk about the practical applications in our daily activities and how blockchain technology could impact our lives if used correctly.</p><p><strong>Voting</strong></p><p>In democratic activities that involve voting, there is often a concern about voter fraud due to mistrust in the current technology and centralized institutions. With blockchain, all votes can be registered on a public ledger, making it possible to verify the results without exposing the voters’ information to a central authority. Blockchain voting provides a secure, transparent, and auditable system that can help to prevent fraud and increase trust in the electoral process. For example in the recent <a href="https://www.forbes.com/sites/rufaskamau/2022/08/11/bitcoin-blockchain-inspires-kenyan-electoral-board-to-implement-a-transparent-voting-system/?utm_campaign=socialflowForbesMainTwitter&amp;utm_medium=social&amp;utm_source=ForbesMainTwitter&amp;sh=3acfbf777eb3">National elections in Kenya</a>.</p><p><strong>Education</strong></p><p>The education sector often faces challenges in verifying students’ certifications, which can take days or even longer in some countries. Blockchain technology can provide a secure and efficient solution by recording all student performance and achievements on a<em> decentralized</em> ledger. This can make it faster and easier to verify educational certificates and help prevent fraud in the education sector.</p><p><strong>Digital Records</strong></p><p>The alteration and theft of records is a common occurrence, making it difficult to prove ownership of certain assets. Blockchain technology can help to create <em>immutable</em> digital records, such as property deeds, financial transactions, insurance records, and birth and death certificates. These records can be stored on a <em>decentralized ledger</em>, providing a secure and transparent system for tracking and verifying ownership.</p><p><strong>Intellectual Property</strong></p><p>Blockchain technology can be used to deter theft and fraud in the intellectual and creative property sector. It can establish proof of ownership by creating digital records of patents, fashion and entertainment, and other forms of intellectual property. For example, blockchain-based digital rights management tools can help artists and creators of <em>digital art</em>, such as <em>NFTs</em>, to protect their work.</p><p><strong>Supply Chain Management</strong></p><p>Blockchain technology can be used to track the movement of goods and services from production to delivery in a secure and transparent manner. The <em>decentralized ledger</em> provided by blockchain makes it possible to identify any failures in the supply chain and to ensure that all actions are recorded in an <em>immutable</em> manner. This can help to prevent fraud and improve the efficiency of supply chain management.</p><p>In conclusion, blockchain technology has the potential to provide secure, transparent, and efficient solutions to various challenges in our daily lives. By using blockchain technology, we can create a more secure, trustworthy, and efficient world for everyone.</p><p>Follow me for more information about blockchain, next we shall be digging deeper into the Ethereum blockchain.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=97fffeb60951" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Blockchain For Everyone.]]></title>
            <link>https://medium.com/@alvinmutebi/blockchain-for-everyone-2a9d88ba97bb?source=rss-c471d65e6949------2</link>
            <guid isPermaLink="false">https://medium.com/p/2a9d88ba97bb</guid>
            <category><![CDATA[ethereum-blockchain]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[blockchain-technology]]></category>
            <category><![CDATA[vitalik-buterin]]></category>
            <category><![CDATA[satoshi-nakamoto]]></category>
            <dc:creator><![CDATA[Alvin Mutebi]]></dc:creator>
            <pubDate>Sat, 28 Jan 2023 07:09:39 GMT</pubDate>
            <atom:updated>2023-01-28T07:09:39.428Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*JoVzDl6mTO-vq3zabYs73Q.png" /></figure><p>In this article, we will delve deeper into the concept of blockchain and explore the different types of blockchains, including public and private. We will also discuss the two largest public blockchain networks, Bitcoin and Ethereum, and their respective consensus algorithms. This article will provide a comprehensive overview of blockchain technology for readers who want to learn more about this revolutionary technology.</p><p><strong>What is blockchain?</strong></p><p>Blockchain is a continuous <strong><em>decentralized</em></strong>, <strong><em>immutable</em></strong>, and <strong><em>distributed</em></strong> digital ledger that is composed of blocks linked using a <strong><em>cryptographic</em></strong> hash.</p><p><strong>What are the types of blockchains?</strong></p><p>There are many types of blockchains, <strong><em>Public, Private, Consortium, Hybrid …</em>etc</strong> but the most commonly used are <strong><em>Public and Private</em></strong> blockchains.</p><p><strong>Public Blockchains</strong></p><p>These are blockchains which are open for anyone to participate in as they have no central authority to choose participants so they are decentralized and mostly referred to as <strong><em>permissionless</em></strong> for example the <strong><em>Bitcoin Network,</em></strong> and <strong><em>Ethereum Network</em></strong>.</p><p><strong>Private Blockchains</strong></p><p>These blockchains are not open to the general public, and a single organization holds the central authority over the network. They are commonly referred to as permissioned, with examples including <strong><em>Ripple, Hyperledger, and Corda</em></strong></p><p><strong>Let&#39;s talk about the largest Public Blockchain Networks</strong></p><p>As it is said, everything has an origin, there are two blockchain networks which are referred to as the genesis of public blockchain networks i.e Bitcoin Network started by<a href="https://en.wikipedia.org/wiki/Satoshi_Nakamoto"> <strong>Satoshi Nakamoto</strong> </a>(2009) and the Ethereum Network started by <a href="https://en.wikipedia.org/wiki/Vitalik_Buterin"><strong>Vitalik Buterin</strong></a>(2013) these two are the disruptors of the financial world, let&#39;s dig deeper into each.</p><p><strong>Bitcoin</strong></p><p>Bitcoin is a network which is the first decentralized currency some call it digital currency which relies on a<strong><em> P2P </em></strong>network and is denoted by a symbol <strong><em>BTC</em></strong>. Bitcoin has the highest market capitalization and the highest trading volume among all cryptocurrencies. It was created by <a href="https://en.wikipedia.org/wiki/Satoshi_Nakamoto"><strong>Satoshi Nakamoto</strong></a><strong> </strong>with a limited supply of 21 million Bitcoins to be mined. This makes it a deflationary currency as with time its value increases compared to fiat currencies. Bitcoin relies on a consensus algorithm known as <strong><em>Proof Of Work(POW)</em></strong> where different nodes on the network compete to solve a cryptographic puzzle to confirm transactions and add them to the public ledger, Here nodes with the highest computing power are rewarded for the work done in <strong><em>Bitcoins</em></strong>.</p><p><strong>Ethereum</strong></p><p>Ethereum is an open-source decentralized blockchain platform that aids in the creation of Smart contracts and decentralized applications <strong><em>(Dapps). </em></strong>It has its own cryptocurrency known as <strong><em>Ethereum</em></strong> denoted by <strong><em>ETH</em></strong>. It was created by <a href="https://en.wikipedia.org/wiki/Vitalik_Buterin"><strong>Vitalik Buterin</strong></a><strong> </strong>as an alternative to Bitcoin. In the Ethereum white papers where he describes how Ethereum would work, it was initially using the Proof Of Work consensus algorithm and in 2022 they switched to <strong><em>Proof of Stake (PoS</em></strong>) where validators or nodes have to stake Ethereum and the nodes with the highest stakes are allowed to mine a block and confirm the transactions unlike <strong><em>POS (Proof Of Work)</em></strong> which relied on compute power hence a reduction in <a href="https://ethereum.org/en/developers/docs/gas/#what-is-gas"><strong><em>gas</em></strong></a> fees (transaction fees) and transaction times.</p><p>In conclusion, this article discussed the basics of blockchain technology, including its decentralized and immutable nature. Its created for everyone to understand the basics of this technology</p><p><strong><em>Be on the lookout for the second instalment of this series where we will delve into the practical applications of blockchain technology in everyday life. Stay updated by following me for more informative content. I hope you found this article informative and engaging</em></strong>.</p><p><strong>References</strong></p><p><a href="https://bitcoinwhitepaper.co/"><strong><em>Bitcoin White Papers</em></strong></a></p><p><a href="https://ethereum.org/en/whitepaper/"><strong><em>Etherium White papers</em></strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2a9d88ba97bb" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>