TSM - A crash intro into the world of Ethereum Blockchain, DeFi and Web3 Dapps

Dan Sabadis - Team Lead @ SDL

Our story begins in the seventeen century with Netherlands, the most advanced country of Europe at the time. Because of the adoption of Reformation in the preceding century (specifically the Calvinist ideology) and the proximity of the Atlantic Ocean, the Dutch people went through unprecedented developments. They were at the forefront of the geographical discoveries and fared brilliantly against Spain, the most powerful state at the moment, winning their formal independence from them after a struggle that lasted 80 years. But their most important discoveries with lasting impact even today were in the economic realm. They implemented the first modern stock-exchange and discovered first that a company could be split in tiny tranches called shares (societate pe actiuni in Romanian) which could be traded freely by all people, who thus became owners and sellers of small parts of a company. That company was the first mega-corporation, the Dutch East India Company.

All this could have ended in the mist of history if the English ruling elite would not have had their Glorious Revolution in 1688. They got rid of their local catholic Stuart dynasty and imported a foreign prince, a Dutch named William 3 of Orange (Vilhelm de Orania). The new king introduced to the English all the financial innovations that the Dutch created and used in the last century. The most important was the institution of National Bank and of bonds (Romanian: titluri de stat). With these innovations the English could mint money instantly (the money represented the debt of the future generation who had to return them plus interest through various taxation policies). With the instant money in circulation the English could finally wage successfully the continental wars against France, who still gathered its resources in the classic, harvest-based, feudal way. Between 1688 and 1720, the world trade dominance shifted from the Dutch Republic to Britain. A few dozen years later, due to the technical discoveries, the industrial revolution started (the steam engine and the textile industry) and this coupled with the institutional reality of the National Bank gave birth to the capitalism and made London the center of the world up until the Second World War.

For all its superiority when compared to the previous social order, the new era has one obvious disadvantage: the instability! The cornerstone of the capitalism is the entrepreneur who is constantly trying to peek into the future (Romanian: sa ghiceasca viitorul) and then to decide if is worth borrowing money to be invested in a business idea. But the mankind is notoriously bad at guessing the future, so this highly risky nature of capitalism gave rise to many speculative bubbles, the first being the Tulip Mania (1636-1637) in Netherlands.

We digressed so much into the past because we have the conviction that a new financial order arose in the last year and this new order will be recorded as impactful as the Glorious Revolution of 1688. It is the Brave New World (Romanian: minunata lume noua) of Decentralized Finance and Block-chain (Romanian: Blockchain nu poate fi tradus). Many call this world Capitalism 2.0 because compared with it, the "normal" banking system looks almost feudal in its stability and its conservative way of tackling financial risks. We will try to explain the main theoretical concepts that gave rise to the Blockchain based financial world and we will lay out some useful information that can get you up to speed in this new realm and some principles to be followed in order to have a successful financial experience.

The main communication interface between the established banking system and the blockchain Defi (Decentralized Finance) are the centralized exchanges (RO: bursele centralizate) like Kraken, Poloniex, Binance or Coinbase. Anyone can make an account on these sites with an identity card or a passport, the process usually takes minutes. At the end of the registration the user has a running banking account with the exchange where they can freely exchange the money with the regular banking accounts (like Revolut, or the Romanian Banks). The Fiat money received at the account opened with a particular crypto-exchange (RO: bursa pentru cripto-monede) can then be used to buy various crypto-coins. Usually the operations of buying and selling cryptos are happening on the Spot account, that meaning you are doing regular trading where you own what you are buying. There are also some high-risk financial options like Margin Trading, Vanilla options or Futures trading where you can short or long many cryptos (Ro: short = vanzare in lipsa, long = cumparare in lipsa) with leverages (RO: parghia de ajustare a sumei imprumutate) going up to 125x, where just a tiny oscillation of the market price can liquidate your bet (meaning you lose all the invested money) or give you hefty returns. We won't insist on these exotic options as they are way too risky for laypeople (over 90% of those who bet on the futures lose money) and do not constitute the main purpose of this article. So, now that you have some cryptos bought at these exchanges, how do you move them on the truly decentralized realm which is the blockchain? The answer is that all these exchanges have the option to withdraw your funds. You can withdraw fiat money, meaning you send some euros to your desired banking account, or you can withdraw your crypto, meaning you select your crypto-coin and send it to a particular address belonging to a particular block-chain!

Before discussing what you can do with the crypto-money on the blockchain of your preference, let's first do a recap of the much shorter history of cryptos! We all know the first crypto-currency powering the first blockchain and the most famous one is Bitcoin. It was invented in 2008-2009 and since then grew into a business with a market capitalization (at the time of writing) of no less than 1.1 trillion dollars. The market capitalization is the sum of all coins currently in circulation (there are about 18 millions bitcoins, where one bitcoin has a market price of 60k US dollars). The money are printed by the miner node who wins (finds first) the mathematical contest of verifying the validity of the financial transactions of the moment. With Bitcoin leading the way, lots of alternative coins (altcoins) appeared, all building on Bitcoin's experience and proposing an adjusted experience: faster, or cheaper transactions, or more privacy-respecting, or more open, accessible etc. The second most famous crypto-coin is Ethereum. Bitcoin has a 60% share of all crypto-coins capitalization, and Ethereum with a market capitalization of almost 250 billion dollars has the second place (about 12% share). The main creator of Ethereum is a Canadian-Russian named Vitalik Buterin, who in 2013-2014 laid out the main principles of Ethereum in a white-paper and then together with a team of co-creators implemented those principles in a new block-chain. The biggest difference from Bitcoin is that in Ethereum there are 2 types of accounts: normal, also called externally controlled accounts, and smart contracts! An address could represent one person (or a group), like in Bitcoin's blockchain, or it could represent a smart contract which is deployed on the blockchain (the bytecode of the smart contract is physically deployed on every node of the Ethereum network). A contract cannot initiate a transaction, only a person (externally controlled) account can. Contrary to Bitcoin, the Smart Contract language is Turing Complete (meaning it has besides the branching instructions "if-else" also loop instructions "for-while"), so it can solve theoretically any problem given enough memory and resources. The implication is that it can take a very long time to finish a particular processing. Because a popular Smart Contract can be invoked and evaluated at any given second by all full (mining) nodes, and because the execution of any contract should not take more than a few milliseconds, every instruction will consume "ether gas", which is the crypto-money that powers the Ethereum network. Any user that initiates any transaction will specify the maximum amount of money (ether gas) that he is willing to spend. The more complex the transaction and the smart contract is involved with, the more money (gas) he will be spending. That gas (or transaction fee) will go to the miner who will win the Proof-Of-Work contest, and whose block-of transactions will be added at the top of the block-chain.

For any block-chain, its defining features constitute the strongest as well as the weakest points. For Bitcoin its transaction scripting language is very simple (Not Turing Complete, it lacks loops) so is virtually un-hackable and the transaction speed is blazingly fast. But the transaction options are very limited, so you cannot do much with the bitcoin besides passing it from one address to another (with the additional option of adding some time-constraints, if you want to complicate the transaction a little). So in order to add support for micro-transactions that are resolved in real time (the famous problem of buying instantly a coffee with bitcoin), the developers are forced to create other micro-block-chains on top of the original Bitcoin block-chain. One such solution, which for quite a few years is still in prototyping/experimental stage is the Lightning Network build on top of Bitcoin. For Ethereum the strongest point is the concept of Smart Contract deployed on the Blockchain (identified by its address). This gives everyone the flexibility of entering and leaving a business which as we emphasized before can be as impactful as the birth of the capitalism 300 years ago. But the weakest point is that the smart contracts are notoriously buggy, so you could end up buying some crypto-coin (backed by a smart contract) where the invested value drops in half "by weak design". In our opinion the bugs are the biggest challenge and impediment for the healthy grow of Ethereum-based block-chains.

Once Ethereum showed the way to do business, a lot of Ethereum clones appeared and are still appearing by the day as we speak. Just for the sake of enumeration, we interacted with TRON (TRX), Fantom (FTM) and Binance Smart Chain (BNB) blockchains. In parenthesis we included the crypto-coins that power their corresponding blockchain networks. For the future examples we will use the third most popular network, the Binance Smart Chain called short BSC, which has a market capitalization of 73 billion US dollars and is the most populat Ethereum clone. We chose this network because it has an interesting history. It was founded by a Chinese called Changpeng Zhao (known in the community as CZ) who previously developed high-frequency trading software. Binance had to move from China to Japan and Taiwan due to the Chinese government ban on cryptocurrency trading. From there he had to further move one of the corporate headquarters to Malta because of the strict regulatory policy of the Japanese government. In Malta is benefiting from the tacit acceptance of the Central European Bank and the SEPA policies. Binance also seems to have a fallout with the US government because by law the US citizens cannot perform futures trading with a company that is not registered in US. These shady details aside, Binance and the BSC blockchain solved one of the ongoing problems that plague the Ethereum network: the very high fees! Because of its smashing success, the Ethereum network became pretty congested so now it can happen very frequently to pay even a 40\$ fee to move money around (from a contract to your own wallet address, or vice versa). If you move an important amount of money, let's say 100k, that might not be an issue, but if you are a small investor, who wants to invest just a few hundred dollars' worth of coins, it can be a show stopper! The answer is to move away from a "proof of work" way of validating transactions towards a "proof of stake" policy. In proof of work every computer node in the network contributes to the never-ending validation of transactions, and the probability of winning the contest is directly proportional to the computing power of your computer. In proof of Stake, besides the raw computing power, the validating nodes also have to contribute with a sum of money in order to be accepted as a validator of transactions, and the probability of winning will take in consideration besides the raw computing power also the sum of money invested and locked in the network block chain. It is (and may sound) as less democratic, but it is the only way to achieving the same performance as the Visa Credit Card processing business (which processes about 20k transactions per second, compared with just 7 transactions per second achieved by Bitcoin). When instead of millions of computers the validation is done by only a few dozen or hundreds, then a block can be processed and accepted in just a few seconds (3 in the case of BSC) instead of the usual 10 minutes of Bitcoin, and the average transaction fees can be in the order of cents or tens of cents, not tens of dollars. This is a tradeoff that the next iteration of Ethereum aims at and most of the new Ethereum clones have already implemented. As usual, there also can be disadvantages to this approach of Proof of Stake: the blockchain is as powerful as the weakest validator. If one of the validators will fail to respond to too many requests, the burden will fall on the remaining validators, which increases the pressure on them and the probability that they will fail too. This happened in the Fantom network a few weeks ago and subsequently their coin FTM fell from a high of 0.8 US dollars to as low as 0.3 US dollars.

An aspect which can be frowned upon by the people using the blockchain is the fact that all transactions are open and anybody can know how much a person owns and with what contract interacted, with how much money and what are the expected outcomes! On one hand this makes the traffic with illicit things almost impossible on Ethereum-like blockchains, but on the other we lose completely any semblance of privacy. For this aspect of respect of the privacy there are a few crypto-coins with their respective blockchains, the most famous being Monero (XMR), and its siblings Dash and ZCash. When the inevitable government crackdown will start we can expect that these 3 coins will be the first to be targeted.

An interesting concept in the Ethereum-like blockchains is that of stable coins. These are cryptos (so digital money) that are pegged to the dollar! Quite a few companies deposited US dollars in special treasuries and issued the corresponding amount of stable coins on the blockchain, so these coins are redeemable for US dollars! This way we can have a semblance of stability given the fact that the crypto-coin prices are notoriously volatile. The most successful in the business of stable coins is USDT (Tether) with a market cap of 44 billion dollars and with a volume of transactions in the last 24 hours of 67 billion[^8]. Other stable coins are: DAI, USDC or BUSD. BUSD is the stable coin created by Binance and which can be used with the Visa debit card issued by Binance in partnership with the Israeli payment-processor Simplex. The important thing to remember is that such stable coins have the value pegged to 1 US dollar.

Another interesting and fundamental financial aspect of Ethereum (like) Defi is that of Automated Market Maker (or AMM). In a normal exchange you buy or sell some coins and "on the other side" is a person like you who is interested in selling or buying what interests you. The high frequency Trading software only assists you in making the deal easier (with a nice interface, or eventually by splitting what you have to sell to two different persons without letting you realize this detail). In decentralized Exchanges (AMMs) the things are completely different. There you supply a pair of coins of equal value to a so called liquidity pool (or LP) where they can be freely exchanged. Let's say that you buy with 500 US dollars a stable coin, for instance USDT. You buy also with another 500 US dollars the corresponding fraction of a bitcoin (BTC). Then you deposit in the liquidity pool the pair: 500 USDT and the corresponding fraction of BTC. The people will start trading USDT for BTC or vice versa using this liquidity pool and the depositors will earn additional money from the transaction fees! There will appear discrepancies in the liquidity pool when one of the coins appreciates sensibly compared with its pair. For instance, let's say you deposited the pair USDT-BTC when Bitcoin was valued at 40k US dollars. Now the price is 60k so a lot of people bought BTC with USDT, so in the Liquidity Pool (LP) now there are many more dollars than BTC, let's say 75% USDT and only 25% BTC. When you remove your liquidity you'll get many more dollars and much less Bitcoin and if you would want to sell the BTC you'll realize you lost real money! This is the famous Impermanent Loss. It is impermanent because should you choose not to sell, but to hold the new percentage of the pair of coins, later it might evolve the price in your favor.

With all these concepts explained, now is time to do your own research! Before this, you need to obtain a wallet software where you have a public address that identifies you to the world and you also own the private key which will help you sign the transactions and let the miner nodes verify that your transactions really correspond to the public address that you expose. The most famous Ethereum-compatible wallet is the Metamask browser add-on. Download it for your browser of preference and follow the steps of configuring it to connect to any blockchain you like. We will use in this series the BSC blockchain so I included in the footnotes the instructions on how to connect Metamask to the BSC blockchain. There are also many wallet software solutions for Mobile devices, such as Trust Wallet. The process of configuring it with the blockchain of preference is similar. We will return in the next article to the steps outlined in this paragraph as they will be needed in order to connect to the Test Network (contrary to the Main Network, where we use the "real" money, the Test Network, or Testnet is used by developers to deploy the applications in a testing environment where they use "fake" money, or fawcets).

So you have now the crypto-coins transferred from the centralized exchange to your public address, as exposed by Metamask. What happens next? Well, you have to start to Do Your Own Research (DYOR in the crypto-enthusiast' parlance). You can use an application/site like DappRadar or DeFi Station to obtain a high-level overview of the most popular Web3 Financial WebSites. The DeFi Station shows us a list with the DeFi sites ordered descendent by their Total Value Locked (TVL).

As you can see (at the time of writing this article) the site that gathered most of the capital is Venus, a lending platform with 8.6 Billion dollars. Its business is to attract liquidity from the lenders who will get a commission from borrowers and to offer this liquidity to the borrowers who will pay a sensibly bigger commission; Venus will cash in the difference in commission.

The second website is PancakeSwap with 7.4 Billion dollars. This Dapp provides the Automated Market Marking functionality of Decentralized Exchanges. Here you can exchange freely any coin, contribute to any liquidity pool and earn transaction fees, participate in the internal lottery, or stake your coins for further interest earning.

On the third spot there is Ellipsis Finance. This site is best used for exchanging stable coins with minimal fees, for instance USDT with BUSD or DAI. It is a clone of Curve Finance from Ethereum. In the third week from its launch this Dapp succeeding in attracting an impressive 2.4 Billion dollars in capital.

As we go lower down the table, the risk of investing raises. For instance on the 18th spot there is a Dapp called bDollar Protocol. If you access its presentation page from DeFi Station you can see that a few weeks ago they had locked 300+ million dollars but now they have access to only 100 million. That implies they must have done something wrong, otherwise the 200 million in capital would not have migrated away from their smart contracts! You can further check their documentation (medium docs), Github Developers page, or social media (twitter and telegram channels). You will see that they provide a so called algorithmic stable coin, which at the time of writing has a price of 0.66 US dollars (this is not stable at all). It is very important to study the tokenomics (Token Economics) of a particular coin, to know how it is minted (how it generates inflation), how it is burned in order to make it scarcer (some coins are periodically burned, that means sent to the address 0), whether it has an owner, who is the owner, or if the owner who deployed the contract renounced his ownership, etc. We will get down to these technical details in the second article where we cover Solidity, the language of choice for programming Smart Contracts on Ethereum-like blockchains.

By the way, in this world of Blockchain, the interest one gets to his staked stable coins starts from 20% annually. For instance, a site like BELT Finance (seventh place with an honorable 1.2 billion value locked) offers a 72% annual return. You can only contrast this with what your bank has to offer at this moment.

Our travel into the fascinating world of DeFi is coming to a close so I will indulge into a last philosophical and economic analysis. For those of you old enough to remember communism (specifically the seventies and eighties) you'll certainly recall that there was a special category of people who regularly gathered in the local post office: the philatelist enthusiasts who wanted to trade or boast with their stamp collections. Also there was another category of people, the boys between 8 and 14 years, who gathered in the local marketplaces to buy and trade their soccer player stickers. There were deals made, not honored promises, tragedies, scams, euphoria and quite some money involved. Whenever I enter into this DeFi world I remember those 2 categories of people from the eighties, because I feel the same sensations as those experienced 30+ years ago. For whoever has the spirit of a trader (RO: cine-i animat de spiritual negotului), there is no better place in the world than the DeFi and the Blockchain! There are also some downsides! You will have to write down to a piece of paper the 12 word mnemonic code that is associated with your private and public keys that Metamask application generated for you. You will need to have this in case your computer/phone breaks down, so you can restore those keys based on the 12 words list. Also in the unfortunate case where some bad event happens to you, you might consider that the above mentioned piece of paper should be available to your loved ones. On Blockchain you truly are on your own! You have complete ownership of your security, so if some strange computer virus gets access to your Metamask Add-On, you are toast! Many crypto-enthusiast peers told me they had the recurring nightmare where someone gets access to their Metamask addon and steals all their money! Also most of the crypto-peers have the tendency to spend too much time looking at the price charts (the famous candle-stick charts) and the constant price analysis is a drain on anyone's mental state. With all these dramatic changes introduced by the adoption of the blockchain and smart contracts in your life, you might feel that you sold your soul to the Devil!

Another slight regret that I feel is that we in Cluj have the local pride of being called the "Sillicon Valley of the East", but still did not produce a significant business in this domain of Web3 and Dapps. The City of Sibiu gave us the ELROND blockchain powered by the EGLD crypto-coin, which with a market cap of 4.1 billion US dollars occupies a commendable place 33 on the crypto-ranking. I'm still hoping Cluj will step into this untapped potential.

Before wrapping the article I would like to mention some advices received from people more experienced than me in the world of trading. Do not enter a deal where you are not open to the idea that you can lose the invested coins. Do not invest more than a minor fraction of your coins (some are comfortable with 1/10, other 1/7 at most, the idea is not to bet everything, or most of your money on one single idea). We are still in a bull market (Ro: piata in crestere), so do not underestimate the power of just holding (hold => HODL) your coins. Good luck and avoid getting REKT (Wrecked)!

Final notes: Due to the extremely dynamic nature of BSC blockchain, most of the market statistics mentioned above will almost surely be obsolete by the time you are reading this article, as it was originally written in the week of 5-9 April 2021. Also any donation is greatly appreciated (to our public address: 0x831349500dC4EcD88De0386F6e0f3Ba52a51c470) and will enable us to write more high quality articles on this topic. We accept any ERC20 compatible tokens on the Ethereum/Fantom blockchains, or BEP20 tokens on the BSC blockchain.