<?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 Krzysztof Cywiński on Medium]]></title>
        <description><![CDATA[Stories by Krzysztof Cywiński on Medium]]></description>
        <link>https://medium.com/@_kcyw?source=rss-a63f9acd061------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*xg5lABNP0od3_er-0cCP1Q.jpeg</url>
            <title>Stories by Krzysztof Cywiński on Medium</title>
            <link>https://medium.com/@_kcyw?source=rss-a63f9acd061------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 00:38:46 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@_kcyw/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[Radiant Capital hack explained]]></title>
            <link>https://medium.com/@_kcyw/radiant-capital-hack-explained-1633289be150?source=rss-a63f9acd061------2</link>
            <guid isPermaLink="false">https://medium.com/p/1633289be150</guid>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[defi]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[analysis]]></category>
            <dc:creator><![CDATA[Krzysztof Cywiński]]></dc:creator>
            <pubDate>Wed, 03 Jan 2024 22:52:23 GMT</pubDate>
            <atom:updated>2024-01-04T09:47:35.710Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cno5uqfQ5Nwtp8dCA1X3vw.png" /><figcaption>Image borrowed from rekt’s report <a href="https://rekt.news/radiant-capital-rekt">https://rekt.news/radiant-capital-rekt</a></figcaption></figure><p>Radiant Capital was hacked on Jan 2 just before 7 pm UTC for something close to 1900 ETH worth around $4.5 million. This is going to be a deep dive into how this happened.</p><p>The transaction that started it is available <a href="https://arbiscan.io/tx/0x1ce7e9a9e3b6dd3293c9067221ac3260858ce119ecb7ca860eac28b2474c7c9b">here</a> if you want to follow along.</p><h3>Overview</h3><p>The hack consisted of three main steps:</p><ol><li>pumping of the liquidity index of the USDC reserve through flash loans</li><li>borrowing WETH against deposited funds</li><li>exploiting a rounding error to extract the original deposit</li></ol><h3>Step by step</h3><p>The attack started with a 3 million USDC flash loan from AAVE. The attacker then deposited 2 million USDC into Radiant. Nothing fishy so far.</p><h4>Step one</h4><p>The next thing is the first key component of the hack. The attacker took a 2 million USDC flash loan from Radiant, transferred 2 million USDC back into Radiant and withdrawn 2 million minus one-millionth USDC, leaving 1 USDC wei as the deposit.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qNb3RurFaNt936MZRViDBQ.png" /><figcaption>The attacker withdraws 1999999999999 USDC wei</figcaption></figure><p>They then repaid the flash loan with a 1800 USDC fee. Repayment makes a <a href="https://github.com/radiant-capital/v2/blob/cd618877151896415705468f1b2a43c4b75b3c5b/contracts/lending/lendingpool/LendingPool.sol#L524C49-L524C49">call to ReserveLogic::cumulateToLiquidityIndex</a> which makes the liquidity index explode.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*n43PGZ4hSXwlJZ9i_Qez2w.png" /><figcaption>New liquidity index computation</figcaption></figure><p>New liquidity index becomes (1800 * 1e6 + 1) * 1e27 = 1800000001000000000000000000000000000</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Jq2bS5UYsz13SRiRzH3zmg.png" /><figcaption>New liquidity index in ReserveDataUpdated event</figcaption></figure><p>The clever thing here is that the attacker transferred the flash loaned USDC from Radiant back into the LendingPool to be able to withdraw all of it minus one wei and trigger the liquidity index bloat.</p><p>So the current state at this point is:</p><ol><li>the attacker has close to 1 million USDC (minus the deposited wei and the 1800 USDC flash loan fee)</li><li>the LendingPool contract has a little over 2 million USDC</li><li>total liquidity of the USDC reserve is still 1 USDC wei</li></ol><p>The attacker loops flash loaning 2 million USDC and repaying 2 million + 1800 USDC causing further expansion of the liquidity index.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FBCRqePeonfzsv3SUtPMPg.png" /><figcaption>Second iteration of the liquidity index expansion</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Kd9-FuFQjyQU7p2Qshf9sw.png" /><figcaption>Third iteration of the liquidity index expansion</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tCf6Qieitg1OeEb9Yg9tBQ.png" /><figcaption>150th (final) iteration of the liquidity index expansion</figcaption></figure><p>This concludes the first step of the attack. The state at this point is as follows:</p><ol><li>the attacker still has close to 700k USDC from the 3 million USDC AAVE flash loan</li><li>the attacker paid over 270 000 USDC in flash loan fees</li><li>the LendingPool contract has around 2.27 million USDC</li><li>the initial 1 wei deposit of the attacker is now worth a little over 270 000 USDC due to paid fees</li></ol><h4>Step two</h4><p>Since the attackers deposit is worth over $270k they’re allowed to borrow against it. They borrow a bit over 90.69 WETH from the LendingPool which at the time of the attack was worth a little under $214k. They maxed out the LTV, which makes sense.</p><h4>Step three</h4><p>The attacker now deposits a little over 543k USDC (543600000002 USDC wei which is exactly 2 * 271800000001, which will be important later).</p><p>Now the attacker repeatedly withdraws 407 700 USDC and deposits 271 800 USDC (+ 1 wei) back. This doesn’t sound right, now does it? They deposited 543k, withdrawn 407k and deposited back 271k, so after the first withdraw and deposit they have only around 407k and there can be no third iteration, right? Wrong.</p><p>Due to the inflated liquidity index the attacker receives 2 wei of the USDC aToken when they deposit the initial 543k USDC. When they withdraw the 407 700 (which “happens to be” precisely 1.5 * 271 800) the rayDiv rounding causes them to only burn 1 wei of the aToken. When they deposit back the 271 800 they gain that 1 wei back.</p><p>I wrote a quick foundry test to make sure the math is correct here.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FxDwJjd6-ica0xN2FjaMxw.png" /><figcaption>A foundry test for the third step of the attack</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yOgvNni5-2_8ccx2NnfFsw.png" /><figcaption>Test output</figcaption></figure><p>The relevant piece of code can be found in the <a href="https://github.com/radiant-capital/v2/blob/cd618877151896415705468f1b2a43c4b75b3c5b/contracts/lending/tokenization/AToken.sol#L121">AToken::burn function</a>. In the burn function, amountScaled (equal to 1 wei) is being burned and the original amount (407 700) of the _underlyingAsset (USDC) is being transferred to the attacker.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*G_MbvT2UjCLN6WZOBO4nqA.png" /><figcaption>The annotated burn function</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N3GagK-j_z_VxL7tgcUpUA.png" /><figcaption>USDC being withdrawn</figcaption></figure><p>Next, the attacker deposits back 271 800 USDC (+ 1 wei). The added wei makes the rayDiv amount to 1 wei instead of zero. Depositing 271 800 USDC adds 1 wei of the USDC aToken back to the attacker and makes repeating the withdraw and re-deposit loop possible. The attacker needs to recover the 2 million USDC transferred into the contract in step one plus the 271k paid in flash loan fees plus the 543k deposited at the start of step three, for a total of around 2.8 million USDC. The recovery happens at a rate of 135 900 USDC (407k — 271k) per iteration. There are 18 iterations netting 2 446 200 USDC and a final withdraw of 369 200 USDC for a total of 2 815 400 USDC, so close to 2.8 million which was the initial ballpark.</p><h4>Cleanup</h4><p>The attacker swaps some of the stolen WETH to USDC to cover the 1500 USDC AAVE flash loan fee and repay the AAVE flash loan.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ULyL-8C6MHIz7qw6LyI1Yg.png" /><figcaption>AAVE flash loan repayment transfer</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WaXafnuG3N6rmAFdnBhqAw.png" /><figcaption>AAVE flash loan closing event</figcaption></figure><p>Finally, the attacker unwraps the remaining WETH into native ETH.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RvFZrA5B3TGrolf92olCZA.png" /><figcaption>Unwrap WETH into ETH</figcaption></figure><h4>Post-hack state</h4><ol><li>the attacker got away with the borrowed 90+ WETH</li><li>the attacker recovered all deposited USDC and repaid the AAVE flash loan</li><li>Radiant has a 1 USDC wei deposit “worth” over $270k due to liquidity index bloat</li><li>the Radiant LendingPool contract has no USDC to cover the deposit so they essentially accumulated 90 WETH bad debt with no collateral to cover it</li></ol><h4>Rinse &amp; repeat</h4><p>Steps two and three of the hack are repeated in two following transactions (<a href="https://arbiscan.io/tx/0x2af556386c023f7ebe7c662fd5d1c6cc5ed7fba4723cbd75e00faaa98cd14243">here</a> and <a href="https://arbiscan.io/tx/0xc5c4bbddec70edb58efba60c1f27bce6515a45ffcab4236026a5eeb3e877fc6d">here</a>) with larger amounts (906 WETH extraction each) for a total of over 1900 WETH stolen.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1633289be150" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Updates to DREX — the Brazilian CBDC pilot]]></title>
            <link>https://medium.com/@_kcyw/updates-to-drex-the-brazilian-cbdc-pilot-8f5cba1def57?source=rss-a63f9acd061------2</link>
            <guid isPermaLink="false">https://medium.com/p/8f5cba1def57</guid>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[cbdc]]></category>
            <category><![CDATA[central-bank]]></category>
            <category><![CDATA[finance]]></category>
            <category><![CDATA[brazil]]></category>
            <dc:creator><![CDATA[Krzysztof Cywiński]]></dc:creator>
            <pubDate>Thu, 07 Sep 2023 19:46:42 GMT</pubDate>
            <atom:updated>2023-09-07T19:46:42.663Z</atom:updated>
            <content:encoded><![CDATA[<h3>Updates to DREX — the Brazilian CBDC pilot</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/770/1*Tj8WVS-6iH-K1fl4R-2KmA.jpeg" /></figure><p>The Central Bank of Brazil pushed an update to their upcoming CBDC pilot specification. It introduces a couple of significant changes which I’ll briefly describe in this article.</p><h3>Bonds are going to be a part of the pilot</h3><p>As it appears, the CBDC pilot is going to include tokenized federal debt (TPFt — Título Público Federal tokenizado). The TPFts are based on the <a href="https://ethereum.org/en/developers/docs/standards/tokens/erc-1155/">ERC-1155 Multi-Token Standard</a> with some additional access controls (more on that after a deep dive and reverse engineered implementation).</p><p><a href="https://github.com/bacen/pilotord-kit-onboarding/commit/fef77593254744e8c975ca548d8a9f7f8731efd1#diff-51b54786c12ace1c2305b11a6ae6a49fe4fe403e7b0a5b4a6868c1c449d4df70">A commit from September 1.</a> introduces two contract interfaces related to TPFt:</p><ul><li><strong>ITPFtOperation1002</strong> which defines the public offering settlement. The contract allows the transfer of whole quantities of TPFt from the STN’s (Secretaria Nacional do Tesouro) default wallet to the default wallet of a registered participant through the auctionPlacement method. The settlement of the operation is carried out with delivery versus payment (DvP), and only the Central Bank of Brazil can transmit the seller&#39;s command of this operation.</li><li><strong>ITPFtOperation1052</strong> which defines the interface for the bond aftermarket. The contract allows the transfer of fractional quantities of TPFt between wallets of registered participants and/or clients through the trade method. The settlement of the operation is executed with delivery versus payment (DvP).</li></ul><h3>Major change to access control of RealTokenizado</h3><p>RealTokenizado is the <a href="https://ethereum.org/en/developers/docs/standards/tokens/erc-20/">ERC-20</a> that DREX participants (commercial banks and other financial institutions) are going to use for inter- and intra- bank payments. These are going to be the tokens that the end customers are going to be using.</p><p>The access control change was introduced in <a href="https://github.com/bacen/pilotord-kit-onboarding/commit/63ad25776285e203f102ecc99a26c1b15f1552ac#diff-daff856170ef192244878eca8ea72cb708a867563c9caf03d66c6892e42e5fd8">a commit from August 30.</a> Previously, the docs stated that the _authority wallet is going to be controlled by the BCB. This has now been changed and this role will be held by the participants wallet.</p><h4>Why is this a major change?</h4><p>If my understanding is correct, the general idea is that each RealTokenizado is backed by the reserve token (RealDigital), which is issued directly and exclusively by the Central Bank. When the Central Bank was also the authority for each RealTokenizado, they could ensure that the issuance of new RealTokenizado is always backed by an equivalent amount of RealDigital.</p><p>With this change, the authority role is now held by the participant, which means the participant (your local bank for example) can issue new tokens through the ROLE_MINTER access role of the authority and the mint function of the RealTokenizado contract. There are no defined controls or limits to how many tokens the participant can mint.</p><p>Moreover, this gives the participant access to fund freezing and burning functions, which were previously only invokable by the Central Bank.</p><h3>Minor changes to RealDigitalDefaultAccount</h3><p>RealDigitalDefaultAccount got a constructor update in the ABI, but this was already included in the docs.</p><p>An access control was also added to the updateDefaultWallet function. It can now be called only by the current default wallet of the participant. This only confirms what I assumed earlier and our implementation already included that.</p><h3>Updated code and English docs</h3><p>The current state of our reverse engineering can be checked out <a href="https://github.com/ioralabs/realdigital_smartcontracts">here</a>.</p><p>The English translations of the official documentation are available <a href="https://github.com/krzysztof-cywinski/pilotord-kit-onboarding/tree/english-translations">here</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8f5cba1def57" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Controversial Digital Real CBDC features explained]]></title>
            <link>https://medium.com/@_kcyw/controversial-digital-real-cbdc-features-explained-9b5ad817eb06?source=rss-a63f9acd061------2</link>
            <guid isPermaLink="false">https://medium.com/p/9b5ad817eb06</guid>
            <category><![CDATA[cbdc]]></category>
            <category><![CDATA[finance]]></category>
            <category><![CDATA[crypto]]></category>
            <category><![CDATA[banking]]></category>
            <category><![CDATA[brazil]]></category>
            <dc:creator><![CDATA[Krzysztof Cywiński]]></dc:creator>
            <pubDate>Fri, 11 Aug 2023 15:59:30 GMT</pubDate>
            <atom:updated>2023-08-11T15:59:30.395Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*3atSsbw3_rjlfPPZ" /><figcaption>Photo by <a href="https://unsplash.com/@matheussox?utm_source=medium&amp;utm_medium=referral">Matheus Câmara da Silva</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p><strong>Banco Central do Brasil</strong> recently published the documentation and a set of ABIs of the planned pilot of Brazil’s CBDC, the Digital Real. I got in touch with <a href="https://www.linkedin.com/in/pemagalhaes/">Pedro Magalhães</a>, who first started reverse engineering the smart contracts and discovered the controversial features, and we started implementing the contracts according to the published specification to try and understand how the CBDC is supposed to work.</p><p>This documentation raised some concerns, because it contains functions that could potentially allow the freezing of funds, arbitrary fund transfers and burning funds from other wallets. These features, while seemingly dystopian, are required by the architecture of the swap system and are not explicitly malicious (with the exception of the authority account). Unfortunately, as I’ll explain later, the architecture is built so that an actor with sufficient clearance (the central bank) could use the existing architecture to use those features in a malicious way even if BCB removes the privileged authority account.</p><h3>The general architecture of the CBDC</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*s1yIzkLVW166eTOiPASDcQ.png" /><figcaption>SwapOneStep documentation-compliant implementation</figcaption></figure><p>The original published documentation is in Portugese, but I’ve translated it into English to reach a wider audience for comments and discussion. The English translations are available <a href="https://github.com/krzysztof-cywinski/pilotord-kit-onboarding/blob/english-translations/README.md">here</a>.</p><h4>Tokens</h4><p>After some analysis and discussion we arrived at the conclusion that the whole CBDC system consists of several ERC-20 tokens. The main token is the RealDigital token that is controlled by the central bank (BCB). Each participant of the system (which we assume are the financial institutions such as commercial banks) control their own token (RealTokenizado — “Tokenized Real”), whose contract extends the RealDigital contract and all its features.</p><h4>Swap contracts</h4><p>There are two swap contracts that will be necessary to explain the features. Since each institution has its own token, there can be no direct swapping between them. Moreover, the RealDigital that is used as a reserve for all participant tokens probably can’t be moved directly.</p><p><a href="https://github.com/krzysztof-cywinski/pilotord-kit-onboarding/blob/english-translations/SwapOneStep.md">The documentation</a> for both swap contracts states that:</p><blockquote><em>The exchange destroys Real Tokenizado from the paying client, transfers Real Digital from the paying participant to the receiving participant and emits Real Tokenizado to the receiving client.</em></blockquote><p>There are two kinds of swap contracts:</p><ol><li><strong>SwapOneStep</strong> is a contract that allows sending of value from a customer of commercial bank A to a customer of commercial bank B. This is pretty straightforward and can be completed in a single transaction, provided that the sender approved the swap contract for the sent amount.</li><li><strong>SwapTwoSteps</strong> is a contract that does a swap, but requires an additional confirmation step. The intent here is not clear to me. It would make sense for it to be used in a similar fashion as a Lightning Network invoice. The recipient would create a payment proposal and the payer would accept the proposal to send funds. This doesn’t seem to be the case here, because the <a href="https://github.com/krzysztof-cywinski/pilotord-kit-onboarding/blob/english-translations/SwapTwoSteps.md#startswap">startSwap function</a> would have to take the sender as an argument instead of the recipient. It seems that the sender initiates the swap and it’s undocumented who confirms the swap.</li></ol><h3>System actors and roles</h3><p>Both RealTokenizado and RealDigital contracts have four defined actors and six defined access roles.</p><p>The actors are:</p><ol><li><strong>authority </strong>— the authority is the BCB account that is documented as <em>“Wallet responsible for issuing, redeeming, moving and freezing funds (BCB)”</em>. This is what caused the controversy. Luckily, the authority account could be removed without breaking the system. It’s enough to grant certain privileged roles to the swap contracts to make the authority account not functionally required. If it’s left as it is then the authority account will be able to freeze anyones funds or move them to another account.</li><li><strong>admin</strong> — the admin is set in the constructor during deployment. According to the docs of RealDigital, the admin can assign roles in the system (“<em>Wallet responsible for managing access control (BCB)”)</em>. According to the docs of CBDCAccessControl, which is a parent contract of RealDigital, the admin can change the <strong>authority</strong> account (“<em>Contract administrator, can change the authority of the contract if necessary</em>”), but the authority change function has not been exposed in the ABIs, so it might have been removed in BCBs implementation or it might have not been implemented yet.</li><li><strong>participant</strong> — the participant manages their RealTokenizado, but are not able to mint or burn tokens. The participant acts through a defined default account that is set by the BCB (<a href="https://github.com/krzysztof-cywinski/pilotord-kit-onboarding/blob/english-translations/RealDigitalDefaultAccount.md">RealDigitalDefaultAccount contract</a>) or through enabled accounts (<a href="https://github.com/krzysztof-cywinski/pilotord-kit-onboarding/blob/english-translations/RealDigitalEnableAccount.md">RealDigitalEnableAccount contract</a>).</li><li><strong>client </strong>— the client accounts can transfer RealTokenizado between one another and send tokens to customers of other participants using the swap contracts.</li></ol><p>The roles (documented <a href="https://github.com/krzysztof-cywinski/pilotord-kit-onboarding/blob/english-translations/CBDCAccessControl.md">here</a>) are:</p><ol><li><strong>PAUSER_ROLE </strong>— this role allows pausing the contract, which disables all transfers, mints and burns. It’s undocumented which account has this role, but it would make sense to grant it to either authority or admin.</li><li><strong>MINTER_ROLE</strong> — this role is granted to the authority account. It allows the creation of new tokens. The authority can create RealDigital as well as each RealTokenizado. It’s not documented, but it would also make sense for the swap contracts to have this role only on the RealTokenizado contracts, because the SwapOneStep contract needs to mint RealTokenizado of the recipient to complete the swap.</li><li><strong>ACCESS_ROLE </strong>—this is the basic access role that allows transfers. Both the sender and the recipient of a transfer need to have <strong>ACCESS_ROLE</strong> to be able to make the transfer.</li><li><strong>MOVER_ROLE</strong> — this role grants access to the move function that allows arbitrary transfers from one account to the other. It is documented that the authority account has that role for RealDigital and by extension for all RealTokenizado accounts, which is controversial. It would also make sense for the swap contracts to have this role on RealDigital (but not any of the RealTokenizado) to complete the swap. Any account with <strong>MOVER_ROLE</strong> also has access to the <a href="https://github.com/krzysztof-cywinski/pilotord-kit-onboarding/blob/english-translations/RealDigital.md#moveandburn">moveAndBurn</a> function that allows to burn tokens from any wallet.</li><li><strong>BURNER_ROLE — </strong>this role allows the caller to burn tokens. The <em>burn</em> function allows burning of the tokens from the caller’s account. The <em>burnFrom</em> function allows burning of tokens from any account, but requires the owner of the tokens to set an allowance for the burner first. This doesn’t really matter as the <strong>MOVER_ROLE</strong> can seemingly burn tokens without any allowance.</li><li><strong>FREEZER_ROLE</strong> — this role freezes a certain amount of funds from in the users account. Frozen funds can’t be transferred. The docs in CBDCAccessControl state that this role “<em>(…) allows freezing a wallet’s balance, for example for the two-step swap</em>”, which implies that the SwapTwoSteps contract also has this role and uses it to secure the funds for the duration of a SwapProposal.</li></ol><h3>Why are these roles currently necessary?</h3><p>The answer lies in the swap contracts. Let’s go back to the definition of a swap:</p><blockquote><em>The exchange destroys Real Tokenizado from the paying client, transfers Real Digital from the paying participant to the receiving participant and emits Real Tokenizado to the receiving client.</em></blockquote><p>This implies that the swap contract needs to have:</p><ol><li><strong>BURNER_ROLE</strong> on the senders RealTokenizado (this implies all RealTokenizado, because each can be the sender).</li><li><strong>MOVER_ROLE</strong> on the reserve RealDigital</li><li><strong>MINTER_ROLE</strong> on the recipients RealTokenizado (this implies all RealTokenizado, because each can be the recipient).</li></ol><p>SwapTwoSteps also needs <strong>FREEZER_ROLE</strong>, because it needs to freeze the amount declared in the SwapProposal until the swap is either completed or cancelled.</p><h3>Controversial implications of this architecture</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ZuMoni79vNiRpFW8" /><figcaption>Photo by <a href="https://unsplash.com/@markusspiske?utm_source=medium&amp;utm_medium=referral">Markus Spiske</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h4>Authority account</h4><p>The authority account is a major red flag. It can freeze anyone’s funds, move them without consent from one account to the other and burn them without consent from any account (using the <em>moveAndBurn</em> function). This account is everything that the crypto community has been warning against and should be removed or restricted as granting these privileges to the authority account is not needed for the correct operations of the system.</p><h4>Admin account</h4><p>The problem with the admin account is that it can assign any role to any account. Even if we removed or restricted the authority account, the admin account could grant the powerful <strong>MOVER_ROLE</strong> to any account to move or burn anyones funds or grant the <strong>FREEZER_ROLE</strong> to freeze any amount on anyones account.</p><h3>Alternative solutions</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*jqiHn7Vh9XAxrFiu" /><figcaption>Photo by <a href="https://unsplash.com/@rosiekerr?utm_source=medium&amp;utm_medium=referral">Rosie Kerr</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Problems with both the authority and the admin account could be avoided without breaking other parts of the system. We will detail some improvement proposals once we discuss and evaluate the alternatives and publish them in a followup article.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9b5ad817eb06" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How I fixed my Ledger Nano S for $5]]></title>
            <link>https://medium.com/@_kcyw/how-i-fixed-my-ledger-nano-s-for-5-9b005de6acc6?source=rss-a63f9acd061------2</link>
            <guid isPermaLink="false">https://medium.com/p/9b005de6acc6</guid>
            <category><![CDATA[diy]]></category>
            <category><![CDATA[hardware-wallet]]></category>
            <category><![CDATA[ledger]]></category>
            <dc:creator><![CDATA[Krzysztof Cywiński]]></dc:creator>
            <pubDate>Fri, 04 Nov 2022 20:09:22 GMT</pubDate>
            <atom:updated>2022-11-04T20:09:22.567Z</atom:updated>
            <content:encoded><![CDATA[<h3>How I even got here</h3><p>I bought my Nano S in early 2020. Since I’m a HODLer, it spent most of the time locked in a desk drawer. Recently, I wanted to rebalance my portfolio, so I connected my Ledger only to find out that it was dead. Or so I thought.</p><figure><img alt="Nano S plugged in. Nothing displayed on screen." src="https://cdn-images-1.medium.com/max/1024/1*toGQsd696phi8uyCpDC84g.jpeg" /><figcaption>Looks like it’s time for a new Ledger</figcaption></figure><p>Upon closer inspection I discovered that the device was working, but the screen was extremely dim and the text was barely readable. When I covered it to shelter the screen from direct light the text on the screen became barely visible. This is hardly usable, though. Moreover, my device was around 6 months post-warranty and Ledger support could not help me with replacing it, but since Ledger’s support is outstanding, they gave me a discount for a new device (thanks again, Estelle).</p><figure><img alt="Ledger Nano S closeup. Text barely visible on screen" src="https://cdn-images-1.medium.com/max/1024/1*RC-0G6FABaUvEIRJAFswpQ.jpeg" /><figcaption>Seems like there is still some life in this little fella</figcaption></figure><p>I ordered a new Ledger (a BTC Orange Nano S Plus, which looks and works great!) and waited until dark to reset the old Nano S to factory settings. I wanted to throw it away, so I had to erase my keys.</p><h3>The itch</h3><p>I don’t like to throw things away, so I decided to search around a bit. After all, this was just a screen failure, so maybe something could be done about this. After some digging I found the <a href="https://www.aliexpress.com/item/1005003937279806.html?spm=a2g0o.order_list.0.0.595e1802Tn1wUf">correct screen type for my Ledger Nano S</a> on AliExpress. A couple of clicks and $5 later (including shipping), it was on its way.</p><p>In case the AliExpress listing goes down, the screens specs are:</p><p><strong>Size: 0.91 inch</strong></p><p><strong>Number of dots: 128×32</strong></p><p><strong>Number of pins 12</strong></p><h3>The fix</h3><p>The fix proved to be pretty straightforward. The only tricky part is to open the device without damaging the case too much. I recommend using a utility knife for that.</p><p>First, take off the metal cover.</p><figure><img alt="Ledger Nano S with metal cover removed" src="https://cdn-images-1.medium.com/max/1024/1*jjkJCDLeCrDyWTLrKsvM_A.jpeg" /><figcaption>So far so good</figcaption></figure><p>Take the utility knife and gently slide it between the upper and lower parts of the casing. One of the corners doesn’t have a latch and it’s easier to start from that one. When you put the device screen down and buttons facing you, it’s the bottom right corner. Start there and gently move up to pry the cover of your Ledger.</p><figure><img alt="Utility knife opening the Ledger Nano S cover" src="https://cdn-images-1.medium.com/max/1024/1*7jTQ_n3iFOCAuMH5fI01PA.jpeg" /><figcaption>Start here</figcaption></figure><figure><img alt="Utility knife opening the Ledger Nano S cover" src="https://cdn-images-1.medium.com/max/1024/1*T_uMCuE413uSEjj3mX5v3Q.jpeg" /><figcaption>Gently move upwards until the latch lets go</figcaption></figure><figure><img alt="Utility knife pointing at the case corner that doesn’t have a latch" src="https://cdn-images-1.medium.com/max/1024/1*-14pbg6OA35h1fDgDRNSjA.jpeg" /><figcaption>See? No latch in that corner</figcaption></figure><p>Gently, remove the board and screen from the case and put on a soft and clean surface.</p><figure><img alt="Ledger Nano S insides laying on a leather pad" src="https://cdn-images-1.medium.com/max/1024/1*-1PGflA5FzImaBuQLrf5Vw.jpeg" /></figure><p>Open the black latch to release the screen connector.</p><figure><img alt="Screen connector detached from the Nano S" src="https://cdn-images-1.medium.com/max/1024/1*nfvHDJgw1z20o_S5O0J5rg.jpeg" /></figure><p>Insert the new screen’s connector into the socket and close the latch. You might want to connect the device to power to check if the screen works and is connected correctly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8ZZZpFqwH7QG_BdLiwpKLg.jpeg" /></figure><p>If the screen works, disconnect the power and put the device back together in reverse order.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*q6K4QCyp-AhymXTonvSA7w.jpeg" /></figure><p>Et voilà! Your Ledger Nano S is as good as new. 👍</p><p>Thanks for reading. I hope you found this tutorial helpful. If you have any questions, feel free to reach out through the comment section.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9b005de6acc6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How does Chainlink provide on-chain token prices]]></title>
            <link>https://medium.com/@_kcyw/how-does-chainlink-provide-on-chain-token-prices-8de11471ba33?source=rss-a63f9acd061------2</link>
            <guid isPermaLink="false">https://medium.com/p/8de11471ba33</guid>
            <category><![CDATA[cryptocurrency]]></category>
            <category><![CDATA[aave]]></category>
            <category><![CDATA[defi]]></category>
            <category><![CDATA[loans]]></category>
            <category><![CDATA[ethereum]]></category>
            <dc:creator><![CDATA[Krzysztof Cywiński]]></dc:creator>
            <pubDate>Sun, 25 Sep 2022 17:06:40 GMT</pubDate>
            <atom:updated>2022-09-25T17:06:40.168Z</atom:updated>
            <content:encoded><![CDATA[<p>Lending protocols such as AAVE need a reliable source of token prices to be able to correctly determine the LTV or loan to value for each loan. If you’re new to DeFi loans and would like to know more, read <a href="https://medium.com/@_kcyw/what-is-an-overcollateralized-defi-loan-and-how-does-it-work-4212f8f7f7d8">my article on overcollateralized loans</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*i-s59-T-N-xgswMD" /><figcaption>Photo by <a href="https://unsplash.com/@mbaumi?utm_source=medium&amp;utm_medium=referral">Mika Baumeister</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h4>Can we trust the price feed?</h4><p>The main problem here is that on-chain price sources often suffer from low liquidity and can be manipulated during a transaction through various methods, such as a flash loan pool drains, which affect the token price for the duration of that transaction. To securely import high liquidity off-chain price data from centralized exchanges, Chainlink created an oracle system for the Ethereum blockchain.</p><p>An oracle is essentially, a semi-trusted node that reads data off-chain and when the data changes, it pushes the new data to a Chainlink node aggregator. Each node stakes a considerable amount of LINK to incentivize honesty.</p><p>When a token’s price changes, each node pushes its answer (e.g. a tokens USD price). If there are any major inconsistencies, the voting round is escalated to a higher order node for arbitration. If any foul play is detected, the stake of the violating node gets slashed. If the nodes are more or less in agreement, the answer becomes the median of all the submitted answers in a given voting round.</p><p>You can see the mechanism in action on any of Chainlinks price feed pages. <a href="https://data.chain.link/ethereum/mainnet/crypto-usd/eth-usd">Click here to see ETH/USD price oracles in action.</a></p><h4>Much more than just prices</h4><p>Chainlink can do much more that just provide price feeds. In general, oracles are needed whenever a smart contract would need real world data. Let’s imagine two insurance contracts as examples.</p><p>First, let’s imagine a tornado insurance contract. There is a pool of users that chip in their funds in ETH and deposit them in the insurance smart contract. Chainlink could then have weather oracles, that would pull weather data from multiple off-chain sources and provide the contract with data about wind or rain intensity in a given area at a given time. In case of an insurance claim, the contract could ask Chainlink for that data to verify if it should pay out the insurance amount or now.</p><p>Let’s consider a second case. We could build airline and airport oracles that would provide flight data from different off-chain sources. A user might want to insure against a delayed flight. In case of a claim, the oracle aggregator could be queried for a particular flight’s delay and an on-chain payout decision could be made by the contract.</p><p>Thanks for reading.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8de11471ba33" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is an overcollateralized DeFi loan and how does it work?]]></title>
            <link>https://medium.com/@_kcyw/what-is-an-overcollateralized-defi-loan-and-how-does-it-work-4212f8f7f7d8?source=rss-a63f9acd061------2</link>
            <guid isPermaLink="false">https://medium.com/p/4212f8f7f7d8</guid>
            <category><![CDATA[crypto]]></category>
            <category><![CDATA[defi]]></category>
            <category><![CDATA[money]]></category>
            <category><![CDATA[debt]]></category>
            <category><![CDATA[lending]]></category>
            <dc:creator><![CDATA[Krzysztof Cywiński]]></dc:creator>
            <pubDate>Tue, 19 Jul 2022 12:20:31 GMT</pubDate>
            <atom:updated>2022-07-19T12:20:31.477Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*jZzN6Rd50R1WKAjD" /><figcaption>Photo by <a href="https://unsplash.com/es/@carnations?utm_source=medium&amp;utm_medium=referral">Frederick Warren</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>You might have heard the term “overcollateralized loan” thrown around in the context of crypto and DeFi before, but do you actually know what it is and how it differs from TradFi loans? If not, read on. I’ll try to explain it in simple terms.</p><h3>What are the different kinds of loans in regard to collateral?</h3><p>Generally, there are three kinds of loans: uncollateralized, undercollateralized and overcollateralized.</p><p>Uncollateralized loans are your usual consumer debt: credit card debt, personal loans, student loans, etc. You’re expected to pay the loan back, but you do not have to post any collateral that would secure the loan in case you default. If you stop paying, the lender goes after your salary or possessions and tries to force you to pay in court, but there is nothing to guarantee that they will get what they’re owed. This poses a significant risk for the lender, so these loans are usually small to medium in value and quite expensive for the borrower.</p><p>Collateralized loans, as the name implies, require you to leave something behind as collateral. In case you default on your loan, the lender can sell your collateral to cover your debt.</p><p>An undercollateralized loan is a collateralized loan where the value of the collateral is lower than the value of the borrowed item or the borrowed amount. I can’t think of a real TradFi example of that (if you have an example, please comment). A “sort-of” real world example would be when you borrow sports equipment at a venue. You post a couple hundred dollars as collateral, but the value of the equipment greatly exceeds the value of the collateral. It’s there to cover the damages, but you can’t “default” on it. That’s the “sort-of” part, but the principle is the same. The value of the collateral is not enough to cover what you borrowed.</p><p>An overcollateralized loan is when the value of the posted collateral exceeds the value of borrowed items or assets. An example of this would be a mortgage, where you have to put some downpayment for the house and the rest is covered by debt. The value of the house is greater than the amount borrowed.</p><p>As of now, DeFi can only have overcollateralized loans. Uncollateralized and undercollateralized loans are based on trust and the borrowers credit score. DeFi is an adversarial environment with pseudonymous users, so in the current state of affairs, there can be no trust between parties. Any lender naive enough to offer uncollateralized or undercollateralized loans would get scammed to oblivion.</p><h3>The who’s who of DeFi lending?</h3><p>We’ll use AAVE v2 as an example. First, let’s define the parties involved in making a DeFi loan work.</p><h4>The lender</h4><p>Lenders lock their assets in AAVE to earn yield. Different assets provide different yields based on their current ratio of supply to demand. If the supply of an asset is large and the demand to borrow the asset is small, the APY offered to lenders will be small. If the supply is low and demand is high, the offered APY will be higher. The asset will be also more expensive to borrow. After all, the lenders APY is generated from the fees and interest paid by the borrowers.</p><h4>The borrower</h4><p>Borrowers provide collateral to be able to borrow assets from the lenders. They also pay interest to the lenders based on the current supply and demand for the token. The detailed algorithm of calculating AAVE’s interest rates can be found <a href="https://docs.aave.com/risk/v/aave-v2/liquidity-risk/borrow-interest-rate">here</a>. DeFi only enables overcollateralized loans, so the value of the collateral must exceed the value of debt at all times.</p><h4>The liquidator</h4><p>Liquidators as market participants are a concept unique to DeFi, as far as I can tell. They are the maintainers and guardians of the system. They scan the accounts looking for positions that are at risk of going under, which means that the value of their collateral drops in relation to the value of their debt. This can mean that the collateral they deposited depreciated or that their borrowed asset appreciated. Either way, their loan no longer meets the requirements of the lending platform and is free to be liquidated. The liquidator repays the loan and takes over the collateral, which should at this moment, still be worth slightly more than the repaid debt.</p><h3>What is the lifecycle of a DeFi loan?</h3><p>Let’s say you have 1 ETH and have a bullish sentiment. You decide to borrow some USDC against your ETH to buy more ETH. That’s how you do leverage on DeFi, by the way. The idea here is that ETH will appreciate, you sell it for a profit, pay back the loan and pocket the difference.</p><p>AAVE lets you do that as long as you meet certain criteria. The detailed risk parameters and definitions are detailed <a href="https://docs.aave.com/risk/v/aave-v2/asset-risk/risk-parameters">here</a>. Let’s continue with ETH as an example, or rather its ERC-20 wrapped version: WETH. WETH’s loan to value parameter is 83%, which means that for each 1 WETH deposited you can take on up to 0.83 WETH worth of debt. WETH’s liquidation threshold is 85%, which means that if the value of your debt becomes greater than 85% of the value of your collateral, your position is considered undercollateralized and is subject to liquidation. The liquidation bonus is 5%, which means that the liquidator will pocket collateral worth 105% of the value of your debt at the time of liquidation.</p><p>Let’s go over this in an example.</p><ol><li>Let’s assume 1 ETH is worth 2000 USDC</li><li>You deposit 1 ETH as collateral</li><li>You borrow 1000 USDC against your ETH. Your loan to value is 50%.</li><li>ETH falls to 1500 USDC. Your collateral is now worth 1500 USDC and your loan is still worth 1000 USDC. Your loan to value increased to 66%. You’re still safe for now.</li><li>ETH falls further to 1175 USDC. Your loan to value is now 1000 / 1175, which is roughly 85.1%. This exceeds the liquidation threshold of 85% on this asset. Your loan is now considered undercollateralized and prone to liquidation.</li><li>You can repay some of your debt or deposit more collateral to avoid liquidation. If you don’t, a liquidator will take the opportunity and repay the loan for you.</li><li>The liquidator repays the loan by covering your 1000 USDC debt. They receive collateral worth 105% of the repaid debt. In our example, this means 1050 USDC worth of ETH. Since the price of ETH at liquidation time was 1175 USDC/ETH, they would get ~0.8936 ETH. The remaining ~0.1064 ETH goes back to you.</li></ol><h3>Conclusion</h3><p>That’s all there is to it.</p><p>Hopefully, you now understand how DeFi loans work and how each user role contributes to the DeFi ecosystem.</p><p>There are additional complexities in calculating current LTV of an account, which stem from debt interest accrued over time. The interest is added to the total debt of the account and is (in the case of AAVE) computed with second precision in real time. The intricacies of computing accrued interest based on current rates and protocol liquidity are irrelevant to understanding the general principles of these loans so I decided to leave them out to keep things as simple as possible.</p><p>Thanks for reading.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4212f8f7f7d8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is a Honeypot Wallet Scam and how does it work?]]></title>
            <link>https://medium.com/@_kcyw/what-is-a-honeypot-wallet-scam-and-how-does-it-work-335871946dc1?source=rss-a63f9acd061------2</link>
            <guid isPermaLink="false">https://medium.com/p/335871946dc1</guid>
            <category><![CDATA[scam]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[token]]></category>
            <category><![CDATA[money]]></category>
            <category><![CDATA[cryptocurrency]]></category>
            <dc:creator><![CDATA[Krzysztof Cywiński]]></dc:creator>
            <pubDate>Fri, 15 Jul 2022 12:52:40 GMT</pubDate>
            <atom:updated>2022-07-15T12:52:40.546Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*4pOd7fjom0-YY1w7" /><figcaption>Photo by <a href="https://unsplash.com/@sonjalangford?utm_source=medium&amp;utm_medium=referral">Sonja Langford</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Recently I learned about an interesting type of scam, that’s been around for quite some time, apparently. I will try to explain what it is and how it works. Hopefully, it will save you some ETH in the future or at least provide some entertainment.</p><h3>The setup</h3><p>Imagine you come across a seed phrase. It may come up on any of the social media platforms with a story attached to it.</p><p>The stories vary. It might be a user asking for help and claiming to be new to crypto. It might be a fed up trader that decides to leave crypto and “just leaving this behind for the taker”. Sometimes it’s a screenshot which shows a seed phrase “carelessly” visible in a notepad window as if by posted accident.</p><p>Out of curiosity you decide to check it out. You generate an address from that seed phrase or input it to a wallet app and check the balance. To your amazement, the address happens to own several ERC-20 tokens totaling $3000 in value.</p><h3>The scam</h3><p>You might decide to go for it and take the ERC-20 tokens. The account holds little ETH or none at all, so you send a small amount of ETH to cover the gas fees of the ERC-20 transfer. You then send a transaction to transfer the tokens to your own account. Unexpectedly, this transaction fails. You inspect the wallet to find that the ETH you sent for gas has been transferred out to an unknown address.</p><h3>How it works?</h3><p>The scammer has a bot running that monitors the transactions that send ETH to the honeypot wallet address. As soon as you send ETH to it, it sends a transaction to transfer the ETH out to their own address. When you try to transfer the ERC-20 tokens out of the wallet, the account is already drained of ETH and the transaction fails due to insufficient ETH to cover the gas cost.</p><p>Example honeypot: <a href="https://etherscan.io/address/0x3c077db5e5c9f8e026eee7f18d3cf121e95e415b">0x3C077Db5e5c9F8e026EEe7F18d3CF121E95e415B</a>.</p><p>This particular honeypot earned its owner only about 0.025 ETH, but it’s easy to automate creating and running such honeypots to scam people at scale. The output address of this honeypot is <a href="https://etherscan.io/address/0xb7377609c00ef9b7eb428e3f338d9604e2a84850">0xb7377609c00Ef9b7eb428E3F338d9604e2A84850</a>, which holds ~1.5 ETH at the time of writing this post.</p><h3>Conclusion</h3><p>Never trust a seed phrase you find in the wild. No one is there to give you free tokens.</p><p>If you find such a “golden opportunity” check its transactions on Etherscan. Chances are, you’ll find a pattern similar to the one in the example honeypot above.</p><p>Thanks for reading.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=335871946dc1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why PulseChain is a stupid idea at best (but most probably a scam)]]></title>
            <link>https://medium.com/@_kcyw/why-pulsechain-is-a-stupid-idea-at-best-but-most-probably-a-scam-129684712e9a?source=rss-a63f9acd061------2</link>
            <guid isPermaLink="false">https://medium.com/p/129684712e9a</guid>
            <category><![CDATA[defi]]></category>
            <category><![CDATA[pulsechain]]></category>
            <category><![CDATA[hex]]></category>
            <category><![CDATA[scam]]></category>
            <category><![CDATA[richard-heart]]></category>
            <dc:creator><![CDATA[Krzysztof Cywiński]]></dc:creator>
            <pubDate>Fri, 08 Jul 2022 22:16:02 GMT</pubDate>
            <atom:updated>2022-07-08T22:49:33.809Z</atom:updated>
            <content:encoded><![CDATA[<p>Have you heard about the “amazing opportunity” that is <a href="https://pulsechain.com/">PulseChain</a>? <a href="https://richardheart.com/">Richard Heart</a>, a self-proclaimed “force for good in this world” launches an Ethereum fork and markets it as “the world’s largest free airdrop of coins”. You can’t just make that stuff up. 😂</p><h3>The “world’s largest free airdrop”</h3><p>If you can’t see why the “airdrop” narrative is plain silly yet, read on. PulseChain is going to be a hard fork of the Ethereum blockchain. A hard fork is a situation where the rules of the blockchain change starting from a certain block. The miners/validators of the original blockchain don’t support the new rules and the new blockchain diverges from the original blockchain from the forked block forward. What does that entail?</p><figure><img alt="Visualised hard fork process" src="https://cdn-images-1.medium.com/max/563/1*TUDaHD99LPuM7K7yW-6TVg.png" /><figcaption>Image taken from <a href="https://wiki.trezor.io/Hard_fork">https://wiki.trezor.io/Hard_fork</a></figcaption></figure><p>First of all, the new blockchain shares the history with the original blockchain up to the forked block. This means that the balances for all coins and for all addresses are identical in both chains up to the fork block. Simply put, if you owned some USDC on Ethereum when the blockchain was forked, you will own the same amount of USDC on the forked chain. It’s not an airdrop. That’s just how hard forks work and it’s a direct result of the forked blockchain sharing the original blockchains history. Marketing it as “the world’s largest free airdrop” is purposefully misleading.</p><h3>Does the fork hold any real value?</h3><p>You might argue that there is value in the forked chain. After all, all your holdings are going to be doubled and will have their counterparts on PulseChain. The key thing to understand here is that most of the newly created tokens will have no value. Why is that?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*NuY9s_r7hBhPdfY_" /><figcaption>Photo by <a href="https://unsplash.com/@neonbrand?utm_source=medium&amp;utm_medium=referral">Kenny Eliason</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h4>Stablecoin armageddon</h4><p>Let’s start with USD backed stablecoins, such as USDC (issued by Circle), BUSD (issued by Binance), and USDP (issued by Paxos). Let’s also pretend that Tether’s USDT is USD backed. By forking the Ethereum blockchain you’re effectively doubling the supply of those stablecoins, but the underlying USD reserves (or whatever Tether claims to hold) remain unchanged. There are now 2 stablecoins per each dollar in the reserves. This does not mean that each stablecoin is now worth ¢50. The newly “issued” stablecoins are worthless, because the issuers will not accept them and convert them to USD.</p><p>You might think that overcollateralized stablecoins, such as MakerDAO’s DAI, would hold their peg. Unfortunately, that’s also not true. Such stablecoins require liquidators to hunt down undercollateralized borrowers to keep their peg. You can read more about this process <a href="https://makerdao.world/en/learn/vaults/liquidation/">here</a>. All liquidators will remain on the original blockchain as there is no incentive for them to switch to PulseChain. Without the liquidators, there is nothing to ensure that each DAI issued is covered by enough collateral. As a result DAI will depeg.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*n2r80CeZ4cY9rN0N" /><figcaption>Photo by <a href="https://unsplash.com/@nampoh?utm_source=medium&amp;utm_medium=referral">Maxim Hopman</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h4>DEXes implode</h4><p>As soon as the users of PulseChain realize that all stablecoins have become worthless, all DEX stablecoin liquidity pools will be drained. Users will try to ditch their stablecoins and convert them to other tokens. This will artificially pump the value of other tokens much like with the recent UST collapse.</p><figure><img alt="BTC/USTC plot" src="https://cdn-images-1.medium.com/max/1024/1*HU4QHLTF-renMfGYZi40GQ.png" /><figcaption>Plot taken from <a href="https://coincodex.com/convert/bitcoin/terraclassicusd/">https://coincodex.com/convert/bitcoin/terraclassicusd/</a></figcaption></figure><p>All wrapped Bitcoin pools (mainly WBTC and renBTC), will be drained for the exact same reason. They will no longer be convertible to BTC.</p><p>Richard Heart goes full Nixon and removes the convertibility of stablecoins to US dollars, effectively flushing the entire DEX ecosystem down the drain.</p><h4>DeFi lending platforms implode</h4><p>With stablecoins and wrapped coins becoming worthless, DeFi lending platforms such as AAVE and CurveFi collapse.</p><p>As stablecoins on DEXes become worthless, borrowers grab them dirt cheap and cover their stablecoin debt for pennies on the dollar. The stablecoin lenders are left holding the bags and there is nothing they can do about it.</p><p>Moreover, due to the lack of liquidators in the system, undercollateralized loans are no longer being repaid. The borrowers ditch the collateral and the lenders are left holding the tokens representing their lent out tokens. These tokens will no longer be redeemable for the original lent out tokens, because there are no liquidators to repay the undercollateralized loans and return the lent out tokens back to the lending pool of the protocol.</p><h4>Price discovery halts</h4><p>A lot of the DeFi protocols use ChainLink oracles for their price discovery. Since the oracle operators all stay on the original Ethereum blockchain, the forked PulseChain stops receiving ChainLink price updates. The prices on yield farming protocols and lending platforms begin to diverge from the market prices set by the imploding DEXes, creating the opportunities for arbitrage.</p><p>You could buy a ton of now worthless stablecoins on a DEX and use it as collateral on a lending platform that relies on ChainLink oracles. Since the lending platform still considers your stablecoin collateral as pegged, you can siphon tokens from the lending pools and leave your worthless collateral behind. This will continue until all lending pools are either withdrawn or bled dry.</p><h3>Stupid at best</h3><p>As you can see, the idea of hard forking the Ethereum blockchain and hoping that the DeFi ecosystem will just work on the forked chain is doomed to fail.</p><p>It’s no wonder that most people invested in Richard Hearts delusions of grandiose can’t see that and look forward to getting their sweet airdropped tokens on PulseChain. Most of his followers and investors are people that don’t care about the technology. They’re just there for the profits and sky high APYs. They trust that their cult leader acts in their best interest and not his own. For this reason, it’s even possible that the PulseChain charade will last a while before the investors realize that their “airdropped” stablecoins hold no real value and the whole PulseChain DeFi ecosystem implodes.</p><p>I’m calling the idea stupid <strong>at best</strong>, because calling it plain stupid would assume that Richard Heart is dumb and has no idea what he’s doing. Now say what you want about Richard, but the man ain’t stupid. In my opinion he knows exactly what he’s doing and he’s going to profit handsomely from it at the expense of his followers.</p><p>I might write a followup on the mechanics of that in the next one.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=129684712e9a" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>