<?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 Pintail on Medium]]></title>
        <description><![CDATA[Stories by Pintail on Medium]]></description>
        <link>https://medium.com/@pintail?source=rss-6d4922da4628------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*ku_BGpUWdN8nQkTEfTWrfA.jpeg</url>
            <title>Stories by Pintail on Medium</title>
            <link>https://medium.com/@pintail?source=rss-6d4922da4628------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 14 Nov 2026 00:48:19 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@pintail/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[The Medalla Data Challenge: TL;DR]]></title>
            <link>https://pintail.medium.com/the-medalla-data-challenge-tl-dr-fb565372a860?source=rss-6d4922da4628------2</link>
            <guid isPermaLink="false">https://medium.com/p/fb565372a860</guid>
            <category><![CDATA[proof-of-stake]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Pintail]]></dc:creator>
            <pubDate>Tue, 20 Oct 2020 00:00:00 GMT</pubDate>
            <atom:updated>2020-10-25T10:56:28.894Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Originally published at </em><a href="https://pintail.xyz/posts/medalla-tldr/"><em>https://pintail.xyz</em></a><em> on October 20, 2020.</em></p><p>Thank you for taking a look at my entry to the <a href="https://ethereum.org/en/eth2/get-involved/medalla-data-challenge/">Medalla Data Challenge</a>! If you have time to get into some deeper analysis on Medalla testnet data, I’d encourage you to take a look at the four parts of my entry listed below, or perhaps have a look at the code in <a href="https://github.com/pintail-xyz/medalla_analysis">its natural habitat</a>.</p><ul><li>Part 1: <a href="https://pintail.xyz/posts/medalla-data-prep">Data Pre-processing</a></li><li>Part 2: <a href="https://pintail.xyz/posts/medalla-validator-taxonomy">Participation Rates: A Validator Taxonomy</a></li><li>Part 3: <a href="https://pintail.xyz/posts/medalla-network-stress">The Medalla Network Under Stress</a></li><li>Part 4: <a href="https://pintail.xyz/posts/medalla-client-comparison">Comparing the Eth2 Clients</a></li></ul><p>But if that’s a bit too much, then I don’t blame you. This short post will pull out some of the more interesting observations from this analysis:</p><h3>1. An Unincentivised Testnet Has Its Limitations</h3><p>It was clear from very early on was that trying to run a Proof-of-Stake network without any real <em>value</em> at stake was going to throw up some issues. In Medalla this has manifested itself in sometimes anemic participation. This has become painfully obvious in recent days as the participation rate dropped below the ⅔ level needed for finality as many validators began to throw in the towel.</p><p>But even before this point we could see the effects of validators failing to show up for duty. One contribution of the data analysis of this project is to identify which users are not treating the testnet as though validator rewards and penalties carried real value. We can even assign them names ( <em>absent</em>, <em>dormant</em> and <em>abandoned</em> validators — or taken altogether: <em>unresponsive</em> validators).</p><p>As this graph shows, many validators never submitted a single attestation (purple) whilst others walked away from the network without initiating a proper <em>voluntary exit</em> (red). Still others took a long time to submit their first attestation even after they had been activated by the network (green). It’s likely that this sort of behaviour would not occur in a properly incentivised testnet. But then, as has been pointed out, an incentivised testnet… <a href="https://twitter.com/benjaminion_xyz/status/1318521118752464896">would be mainnet</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/723/0*mRXTuJRWRrOEKa-Y.png" /></figure><h3>2. Validators Need to Prepare for Genesis</h3><p>Another theme that came out from this analysis is that genesis is a time when problems are more likely to occur. It’s taken several attempts before a smooth launch finally occurred (on the ephemeral Zinken testnet), and it’s very possible that mainnet launch could be less than smooth. The key message is that clients need to be ready with their mainnet releases well before genesis time, and validators also need to be up and running well in advance.</p><p>The graph below shows the difference in delay distribution between genesis validators and those who joined the network later on.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/727/0*Qu66XbmZ2auu7qr5.png" /></figure><h3>3. The Network Tells Us When It’s Struggling</h3><p>The <a href="https://pintail.xyz/posts/medalla-network-stress">third article</a> explores a range of metrics which may be used to highlight times that the network is experiencing stress. Two metrics in particular — <em>attestation effectiveness</em> (as defined by <a href="https://twitter.com/jgm">Jim McDonald</a>) and <em>attestation accuracy</em> (with thanks to <a href="https://twitter.com/barnabemonnot">Barnabé Monnot</a>) seemed to be somewhat complementary, and may be useful for identifying anomalous epochs for further analysis — they’re plotted in the graph below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/949/0*GLYkn_Gynws48RQA.png" /></figure><h3>4. The Clients Aren’t All the Same</h3><p>It’s immediately clear when you look at the available data for different clients, that they haven’t all been performing the same. Interestingly the three best-performing clients showed strengths in different areas, although one client didn’t seem to reach its stride during the period examined (<a href="https://pintail.xyz/posts/medalla-client-comparison">read the article to find out which one!</a>). You can draw your own conclusions from the graph below…</p><p><strong>Caveat:</strong> This analysis relied on identifying clients from <em>block graffiti</em> which is manually set by users who could easily choose to mislead.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/891/0*-1aFkNYPSyAWlSr0.png" /></figure><h3>5. If I’m Going to Do More of this Analysis, I’ll Need a Faster Computer</h3><p>Hint hint.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fb565372a860" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Ethereum fee market reform: EIP-1559 as a question of fairness]]></title>
            <link>https://pintail.medium.com/ethereum-fee-market-reform-eip-1559-as-a-question-of-fairness-567c52dac017?source=rss-6d4922da4628------2</link>
            <guid isPermaLink="false">https://medium.com/p/567c52dac017</guid>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[economics]]></category>
            <dc:creator><![CDATA[Pintail]]></dc:creator>
            <pubDate>Wed, 26 Aug 2020 15:22:45 GMT</pubDate>
            <atom:updated>2020-09-08T03:25:21.727Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Parts 1 to 4 of this article deal with the background to EIP-1559, its development and progress to date. These sections include links to some of the key articles and may be a useful reference. However for busy readers already familiar with EIP-1559’s background, skip to parts 5 to 7 for a discussion of the fairness of the proposal. If ‘gas’, ‘gas limit’, and ‘gas price’ are unfamiliar concepts, there is some useful grounding in these topics to be found on </em><a href="https://docs.ethhub.io/using-ethereum/transactions/#gas"><em>EthHub</em></a><em>.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/299/1*hl9uZabESNFbOFDmAbuLpw.png" /></figure><h3>1. Background</h3><p>Reform of Ethereum’s fee market, and the question of how best to allocate income from transaction fees, has been discussed for a long time. Well before Ethereum’s July 2015 genesis block, founder Vitalik Buterin was <a href="https://blog.ethereum.org/2014/02/01/on-transaction-fees-and-the-fallacy-of-market-based-solutions/">sharing ideas</a> about future changes to the the fee market, including the possibility of burning fees. The idea of fee burning in the context of ‘medium of exchange’ currencies was also included in a <a href="https://vitalik.ca/general/2017/10/17/moe.html">2017 piece</a> on the subject.</p><p>These ideas certainly generated interest in the Ethereum community, but without a concrete proposal to work with, they were confined to the realm of academic inquiry. Moreover fee market reform was not a pressing concern — transactions on the Ethereum blockchain were cheap. Indeed, throughout much of Ethereum’s early history, gas prices were well below miners’ <a href="https://blog.ethereum.org/2016/10/31/uncle-rate-transaction-fee-analysis/">estimated ‘rational’ minimum</a>. Occasional spikes in demand caused congestion during the ‘ICO mania’ of 2017, but on the whole users had no difficulty getting their transactions included with almost negligible fees.</p><p>By early 2018 however, this situation had changed. Whereas previously blocks had only been partly full, instead they were routinely pushing up against the gas limit. High gas demand from applications including CryptoKitties, and incentivised crypto exchange FCoin, led to <a href="https://www.coindesk.com/ethereums-growing-gas-crisis-and-whats-being-done-to-stop-it">prolonged periods of congestion</a> and extreme volatility in the gas price required to get a transaction included within a reasonable time frame.</p><p>Making sense of Ethereum’s gas price mechanism had always been a challenge for new users, but in conditions of congestion and volatile gas prices, this became much more severe. New tools like <a href="http://ethgasstation.info/">ethgasstation.info</a> helped savvy users to judge appropriate gas prices, and wallets such as Metamask increasingly built in gas price estimation tools. Nonetheless evidence from the blockchain shows that some users massively overpay for gas, and endless support tickets for stuck transactions attest to the fact that these solutions only went part way to solving the problem.</p><h3>2. A Proposal Emerges</h3><p>This was the context for <a href="https://ethresear.ch/t/first-and-second-price-auctions-and-improved-transaction-fee-markets/2410">Vitalik’s July 2018</a> article which set out in more detail a proposal for fee market reform (it was subsequently included in a <a href="https://ethresear.ch/t/draft-position-paper-on-resource-pricing/2838">wider-ranging paper</a> on resource pricing). It described a mechanism for setting a portion of the transaction fee in-protocol called the ‘basefee’, with miners to be compensated for transaction processing with a user-set commission on top of this, now often called the ‘tip’ or ‘bribe’. The mechanism targets half-full blocks (where a full block is double the size of a current Ethereum block), and achieves this target by adjusting the basefee up and down in response to demand. Since the amount of compensation miners need for including transactions varies very little with demand, the tip would be a small amount that most users won’t need to change. Therefore, users can be presented with a simple transaction price at which they can expect their transaction to be included, rather than having to figure out how to interact in an unfamiliar market for an intangible consumable (gas). A major improvement.</p><p>The question then is what should the protocol do with the basefee? On the surface there appear to be 4 possibilities:</p><ol><li>send the basefee to some fund (e.g. a developer fund);</li><li>give the basefee to the miner of the current block;</li><li>share the basefee amongst the miners of future blocks;</li><li>burn the basefee.</li></ol><p>Of these option 1 can be discounted immediately, as the creation of a centralised fund would create a governance nightmare. Option 2 is also not viable, since it would incentivise miners to fill their blocks with junk transactions at no cost, forcing the basefee upwards whether or not demand for blockspace was high. The choice was between 3 and 4.</p><p>Ultimately, burning the basefee was chosen, in part because this would result in another important benefit — that Ethereum’s native currency Ether would be cemented as the fuel for transactions on the network. This would avert the threat of economic abstraction which <a href="https://techcrunch.com/2018/09/02/the-collapse-of-eth-is-inevitable/">some had feared</a> would lead to a death-spiral for the currency, with dire consequences on the security and overall viability of the network. <em>There are other reasons for preferring fee burn, which will be discussed in parts 5 to 7.</em></p><p>This time, with a concrete proposal on offer, strong interest from the Ethereum community followed quickly, and the idea was specified as <a href="https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1559.md">Ethereum Improvement Proposal (EIP) 1559</a>. Predictably, Ether holders were excited about the potential economic consequences of fee burn, which is equivalent to proportional payouts for all Ether holders, as in a stock buyback. This enthusiasm was demonstrated in the emergence of the crowdfunded <a href="https://gitcoin.co/grants/946/eip-1559-community-fund">EIP-1559 community fund</a>, which received by far the most contributions in <a href="https://vitalik.ca/general/2020/07/21/round6.html">round 6</a> of the Gitcoin Grants programme.</p><h3>3. Developer Scepticism</h3><p>Nevertheless, if implemented, EIP-1559 would be the most dramatic change to Ethereum’s economics since genesis. It would also create significant work for wallet devs, who would need to adapt their user interfaces to the new paradigm. Accordingly, the proposal has been received with caution by experienced Ethereum developers. The most often quoted of these is Dan Finlay of Metamask, who notes that since EIP-1559 places on miners the task of fixing ‘basefee’ parameter which has the effect of diminishing their income, there appears to be a perverse incentive for miners to attempt to minimise the basefee. If miners were to succeed in doing this, EIP-1559 would effectively degenerate to the current first-price auction fee market, with users varying the tip parameter to bid for inclusion of their transactions.</p><p>Dan responded with <a href="https://github.com/danfinlay/EIPs/blob/Escalator/EIPS/eip-x.md">his own ‘Escalator’ proposal</a> which also confronts the UX problem, enabling efficient price discovery without ceding control over fee parameters to miners. This solution is also elegant, but has so far not received the same level of backing as EIP-1559. This may be in part because it doesn’t deal with the other problems which EIP-1559 addresses, such as economic abstraction. And of course, the Escalator proposal has not been received as warmly by much of the Ethereum community, who tend to hold a position in Ether, and are particularly attracted to the prospect of ETH burn. <em>As a side note, a hybrid of both EIP-1559 and Escalator combining the advantages of both is one possible outcome, but has yet to be specified as an EIP.</em></p><p>Other long-standing Ethereum developers, such as Nick Johnson from Ethereum Name Service, have <a href="https://twitter.com/wekabot/status/1285668534337646592?s=20">expressed concern</a> about the amount of momentum which has grown behind EIP-1559 before the impact and possible risks of fundamentally altering the game theoretic basis for Ethereum’s fee market are fully known. Clearly, it would be foolish to implement such a sweeping change to Ethereum’s core economics until the implications are very well understood.</p><h3>4. Renewed Impetus</h3><p>During 2020, demand for gas on Ethereum has continued to grow, as stablecoins, decentralised exchanges and a range of other decentralised finance (defi) applications have exploded in popularity. The result is that from June until August this year <a href="https://coinmetrics.io/charts/#assets=btc,eth_log=false_left=FeeTotUSD_zoom=1589906952000,1598140800000">the total value of fees paid for Ethereum transactions has been greater than total Bitcoin fees on all except 8 days</a>. Counter-intuitively, such strong fee income directed at miners may in fact cause problems for the blockchain. One group of researchers has <a href="https://www.cs.princeton.edu/~arvindn/publications/mining_CCS.pdf">argued</a> that as miner income from fees overtakes the income from the block subsidy, the blockchain becomes unstable, and security is dramatically impacted as certain attack strategies become viable with much less that 51% of hashpower. Meanwhile, the extreme volatility of the gas market and corresponding UX problems remain unaddressed.</p><p>By directing excess fee income away from miners, and maintaining the primacy of the block subsidy in rewarding them, EIP-1559 would sidestep this problem too. Accordingly, work on evaluating and implementing EIP-1559 for potential inclusion in a future Ethereum hard fork continues apace. This includes <a href="https://github.com/barnabemonnot/abm1559/blob/master/notebooks/stationary1559.ipynb">modelling and simulation work</a> carried out by Barnabé Monnot of the Ethereum Foundation’s Robust Incentives Group, as well as the <a href="https://d24n.org/tim-roughgarden-will-work-on-eip-1559/">recently announced</a> analysis to be conducted by algorithmic game theorist Tim Roughgarden, which aim to perform a rigorous evaluation of the proposal’s dynamics.</p><p>Meanwhile, work on client implementations of the EIP is also progressing. <a href="https://twitter.com/TimBeiko/status/1296883767164801024?s=20">As of late August 2020</a>, two Ethereum clients have implementations of EIP-1559, and are running an early testnet to iron out specification and implementation issues. Outside of the core Ethereum client space, implementations are also being tested by the Filecoin and Celo networks.</p><p>With significant resources now focused on EIP-1559, no viable attack vectors have yet been identified. Attack scenarios involving collusion from a majority of hashpower can be imagined, but, as noted in an <a href="https://medium.com/@MicahZoltu/eip-1559-51-attacks-should-you-live-in-fear-d817be3759dc">article</a> by Micah Zoltu, even if a 51% cartel were to form and attempt to manipulate the basefee, the strong profit incentive on miners would be to defect from the cartel. This contrasts with the well-known and much more profitable 51% block censorship attack which is already possible in Proof of Work blockchains, and allows cartel members to double their income by ignoring blocks from non-members.</p><p>As research into EIP-1559 continues, we might expect that any catastrophic defects in its economics will be identified. In the absence of such defects, perhaps cautious optimism that it can be implemented is warranted.</p><h3>5. Who owns Ethereum’s blockspace?</h3><p>So we might tentatively conclude that we probably <em>can</em> safely implement EIP-1559 in Ethereum. But <em>should</em> we? This is the question of fairness raised in this article’s title. Do miners have any right to continue to receive all income from transaction fees since <em>they</em> do the work of processing transactions?</p><p>Ethereum’s 2013 <a href="https://ethereum.org/en/whitepaper/">whitepaper</a> pointed out that this is not the case. In contrast with Bitcoin, miners in the Ethereum network are paid a block subsidy <em>in perpetuity</em> for the task of securing the network — this is currently fixed at 2 ETH per block, plus additional income from uncle blocks (i.e. blocks not included in the canonical chain, but which receive a partial block reward). Accordingly there is no requirement that income from transaction fees should ever meet the costs of securing the network. This is a strength, since transaction fee income is highly variable, and there can be no guarantee that it will be adequate to meet the network’s security needs.</p><p>The other reason miners don’t “do all the work of processing transactions” is that transactions impose a cost on the whole network, in the form of state bloat. While all full nodes bear this cost, only miners are paid for it. Users also pay an opportunity cost when gas prices are so high that they can’t execute transactions which would be profitable to them. So rather than being a resource that is in any sense ‘owned’ by miners, Ethereum’s transaction capacity is better viewed as a commons. Miners who extract full market value from this shared resource through high transaction fees are really extracting <em>economic rent</em>, since the cost to the miner of including the transaction is far less than the payment they will receive for it.</p><h3>6. Fair Compensation</h3><p>To understand which part of the transaction fee is fair compensation for the miner’s task, and which part is unearned rent, we need to know how much transaction processing actually costs miners. As mentioned in part 1, there is a “rational minimum” transaction fee, which is the marginal cost to miners of including a transaction. This is the opportunity cost arising from the increased risk of creating a less profitable uncle block. This concept is an extension of a methodology originally applied to Bitcoin. (<a href="https://www.gsd.inesc-id.pt/~ler/docencia/rcs1314/papers/P2P2013_041.pdf">1</a>)(<a href="https://www.bitcoinunlimited.info/resources/feemarket.pdf">2</a>)</p><p>Arriving at an accurate figure for the miner cost of including transactions is difficult, and this figure changes with improvements in client implementations and changes in amount of gas required to carry out certain operations on the Ethereum Virtual Machine (EVM). The figures from Vitalik’s work on the subject referenced above are therefore no longer up to date, and obtaining data on which to base new estimates is tricky. Nonetheless, improvements in client performance mean that miner costs are likely cheaper than they were in the past whereas the fees they are paid have dramatically increased.</p><p>Fortunately, the new fee market in EIP-1559 can work this out for us. Rational miners will accept only those transactions for which the tip/bribe is sufficient compensation. Users who have a very low “time preference” for having their transaction included may try a lower tip, and those desperate to be included quickly for time-sensitive arbitrage transactions might increase it. <em>But in general the tip is not expected to be as volatile as gas prices themselves. Most users should be able to accept wallet defaults to pay the market rate, rather than having to worry about the gas price they pay.</em></p><p>Anything above the fair miner compensation may be thought of as a ‘fee surplus’ or perhaps ‘transaction dividend’. This is EIP-1559’s basefee. If it doesn’t belong to miners, where should it go?</p><h3>7. Allocating the Fee Surplus</h3><p>The only option remaining of the 4 possibilities mentioned in part 2, is for the basefee to be burned. By burning the basefee, it is returned to Ether holders. Are they worthy recipients? For two reasons, I think the answer is yes.</p><p>Firstly, Ether holders pay for the Ethereum’s security through issuance, which amounts to a gradual dilution of the currency. Therefore, any surplus generated by the operation of the network might reasonably be returned to them as a rebate on this payment. It may be that the fee surplus is at times equal to or even greater than Ethereum’s issuance, but in the end it is Ether holders who are on the hook for funding security, whether or not fees are sufficient for this.</p><p>Secondly, Ether is not the only asset that benefits from the security of the network. A multitude of assets are secured by Ethereum — stablecoins, synthetic assets, prediction market outcomes, liquidity shares, equity tokens and a host of ICO tokens — all piggyback on the security funded by Ether issuance without having to pay this cost themselves. Ether is thus uniquely <em>disadvantaged</em> by the current fee market. EIP-1559 helps to fix this problem, and by minimising the net issuance of the token, perhaps eventually even reducing it below zero, maximises the value of the currency which ultimately secures the network.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=567c52dac017" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding Uniswap Returns]]></title>
            <link>https://pintail.medium.com/understanding-uniswap-returns-cc593f3499ef?source=rss-6d4922da4628------2</link>
            <guid isPermaLink="false">https://medium.com/p/cc593f3499ef</guid>
            <category><![CDATA[finance]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[decentralized-exchange]]></category>
            <dc:creator><![CDATA[Pintail]]></dc:creator>
            <pubDate>Thu, 14 Feb 2019 15:00:21 GMT</pubDate>
            <atom:updated>2020-08-30T09:04:06.440Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Update 30 August 2020: this article originally used the term “impermanent loss” to describe the losses liquidity providers experience due to price divergence. The word “impermanent” was chosen because the loss due to price divergence may be reversed if the price divergence is also reversed. However, the use of this term could create the expectation that losses are guaranteed to be reversed, which is not the case. To better reflect this, the article has now been updated to use the term “divergence loss” instead.</em></p><p>In the <a href="https://medium.com/@pintail/uniswap-a-good-deal-for-liquidity-providers-104c0b6816f2">previous article</a> we looked at the impact of price variations on the value of liquidity held in a Uniswap exchange. We found that, from the perspective of a liquidity provider, any price change would cause a reduction in the value of the stake, relative to holding the original assets. Consequently, in the short term, such losses could be greater than the fees received as a reward for supplying liquidity to the exchange.</p><p>This complicates analysis of potential future returns. Given the price dependency, we can’t really model Uniswap as providing some fixed or average rate of return on a liquidity stake. Instead, we need to find a price-independent way to think about the stake and the exchange itself, and then derive returns from this.</p><p>This article will look at how we can apply a price-independent measure to get a better sense of activity on the exchange and devise a model with which to estimate expected returns for liquidity providers, based on historical data. We will then consider how these returns might be valued by liquidity providers who start with only one of the two tokens traded on the exchange.</p><h3>Measuring Liquidity Pool Growth</h3><p>To find a price-independent measure to understand Uniswap pool size, growth, and transaction volume, we need to look at the trading formula at its heart. Uniswap depends on the “constant product” principle to govern trading — that is the <em>product</em> of the two liquidity pools should be the same after a trade as before (excluding fees). The Uniswap price is given by the <em>ratio</em> of the two liquidity pools. The constant product is therefore price-independent.</p><p>However, as we saw in the previous article, we generally need to find the square root of this number in order to calculate useful things. The square root of the product of two numbers is in fact an average of those numbers, known as the geometric mean (GM). It turns out to be a useful measure of the size of Uniswap liquidity pools. We will find we can apply the GM of ETH and Token values in many sitations in the context of Uniswap. It is given by the following formula:</p><pre>GM = sqrt(eth_value * token_value)</pre><p>Although Uniswap applies a “constant product” (or equivalently, “constant GM”) principle to govern trades, trading fees are excluded from the constant product calculation and added to the liquidity pool. Consequently the liquidity pool (GM) size will grow as trading occurs. This happens without issuance of new liquidity tokens, and so the value of existing liquidity tokens will always grow, in GM terms. This is the mechanism by which fee income is returned to liquidity providers as a reward for supplying value to the system.</p><p>The current measures available on <a href="http://uniswap.info/">uniswap.info</a> only measure the sizes of the individual liquidity pools, but of course these can fluctuate with price. Price-dependent measures are not a good way to understand how fast the pools are growing, and whether the today’s transaction volume is bigger or smaller than some time in the past when prices were different.</p><p>However we can see what this growth looks like excluding the impact of fluctuating prices, by looking at the value of liquidity tokens on the ETH-DAI exchange, measured in terms of the GM of the ETH and DAI they can be redeemed for.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*iuoOriZWeWTZWnlA" /></figure><p>As the chart above shows, the GM value of liquidity tokens for the ETH-DAI exchange has grown at a fairly consistent rate since the exchange’s launch on 2 November 2018. The red line represents an exponential growth model with an annualised growth rate (‘alpha’) of 11.26%. This model seems to be a fairly good fit for the data — if we linearise by taking logs of the data and the model we get an R² value of around 0.997.</p><p>This is interesting because it implies that the growth in trading volume and fees paid on the exchange has closely matched the growth in liquidity pool size, even as the liquidity pool has grown from a GM of 421 (30 ETH and 5,900 DAI) when the exchange was launched on 2 November 2018, to a GM of 17,890 (1,613 ETH and 198,385 DAI) on 14 February 2019 — a more than 40-fold increase.</p><h3>Calculating Actual Returns</h3><p>Of course, liquidity providers don’t care about the growth in the geometric mean of their stake. More likely, they are interested in the value of their stake as measured in one of the two tokens on the exchange. Sticking with the ETH-DAI exchange, we’ll look at what happens when we measure the value of a liquidity stake in DAI only (i.e. under the assumption that we can convert the entire ETH side of the stake into DAI at the current price). First, we’ll do this in the same way as in the previous article, where we calculated the “divergence loss” by making a comparison between someone supplying <em>X</em> ETH and <em>PX</em> DAI to the Uniswap ETH-DAI exchange, and someone holding those same amounts. Under these conditions, we get the following formula for liquidity provider returns.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/239/0*JzHXzWDA5QNnfU_1.png" /></figure><p>Here, <em>G</em> is the growth in stake value, <em>R</em> is the ratio of prices between the supply and withdrawal of liquidity, α is the growth rate (which we calculated above to be around 11% for the first few months of the ETH-DAI exchange), and <em>t</em> is time. At time <em>t=</em>0 this formula reduces to the same formula we had for <em>divergence loss</em> in the previous article. On the other hand, if the liquidity withdrawal price is the same as the liquidity supply price (i.e. <em>R</em>=1) then we are left with a straightforward exponential growth, and α becomes the real rate of return.</p><p>If α were to remain constant at 11% for the next year, we could use the formula above to calculate that a user supplying liquidity to the ETH-DAI Uniswap exchange at today’s price of 123 DAI would be in profit as long the ETH price after a year is in the range 47 DAI to 320 DAI. More generally, we can plot out this function in terms of the price ratio <em>R. </em>Assuming a continuous liquidity pool growth rate of 11%, the curves plotted out below represent the return to a liquidity provider at <em>t</em>=0, <em>t</em>=1 and <em>t</em>=2.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*MIQRclopVAlNAqZ6" /></figure><p>As the liquidity pool grows from added trading fees, and liquidity token value continues to increase, the curve on the chart above keeps moving upwards. Accordingly the price range within which the liquidity provider is in profit widens.</p><h3>Comparison with Holding a Single Token Type</h3><p>The above scenario assumes that potential liquidity providers already have quantities of both ETH and DAI which they can choose to supply as liquidity or simply HODL. This analysis makes sense for understanding the results of supplying liquidity in isolation. However, in reality it is more likely that a potential liquidity provider has a quantity of only ETH or the ERC-20 token traded on the exchange.</p><p>Let’s consider the case of a potential liquidity provider currently holding only ETH, and considering whether to:</p><ol><li>continue to hold ETH only, in the hope of profiting from an expected future price rise, or</li><li>trade half of the ETH for another token such as DAI, in order to supply liquidity on Uniswap.</li></ol><p>The value of the stake will vary according to the ratio <em>R </em>between the current ETH price and the base price (that is, the price at time <em>t=0</em>). The following formulae express the relative value <em>V </em>of the stake under each strategy at time <em>t</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/309/0*anBRK7_5NeiR2ezd.png" /></figure><p>Let’s compare these strategies by plotting the formulae against price ratio between liquidity supply and withdrawal. In the chart below the “HODL” strategy is plotted against the value of a Uniswap liquidity stake obtained by first swapping half of the ETH to DAI (neglegting fees and slippage). The red, yellow and green curves correspond to to the value of the liquidity stake at times <em>t=0</em>, <em>t=1</em> and <em>t=2, </em>assuming an annual pool growth rate of 11%.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*DNdgC6N7X2Wb5XCv" /></figure><p>We can see then, that even without receiving any fees, a liquidity provider to the Uniswap ETH-DAI exchange has reduced exposure to ETH price fluctuations, when compared to holding only ETH. This results from the square root relationship between stake value and price ratio (<em>R</em>).</p><p>The income from trading fees essentially offsets the curve, ensuring that liquidity providers are in a net positive position compared to holding ETH for all values of price ratio from 0 up to some limit, which can be seen as the points at which the Uniswap curves cross the HODL line on the chart above.</p><p>As in the previous analysis, the maximum price ratio at which the liquidity provider is in profit relative to HODL will continuously move to the right as the value of liquidity tokens increases. This reduced exposure to ETH price combined with income from liquidity fees may therefore be an attractive strategy for conservative ETH holders looking to earn a return while reducing risk from falls in the price of ETH.</p><p>Of course, this still requires that ETH-only holders go through the steps of acquiring a suitable quantity of DAI before they can supply liquidity to the exchange, either by trading on an exchange or opening a MakerDAO collateralised debt position. When the liquidity provider withdraws their liquidity from Uniswap they will also need to sell one half of the liquidity stake to return to a single-token position.</p><p>In future it may be possible for liquidity providers to use a “single token supply” function to add liquidity from a single token to a Uniswap exchange in a single transaction. This function would use the exchange itself to perform the intermediate step of trading half of the stake in order to obtain liquidity tokens. A corresponding “single token withdraw” function could do the same thing in reverse.</p><h3>Reasoning About Future Growth Rates</h3><p>The models above are based on an assumption of a continued annual growth rate α of close to that observed during the first 3 months of Uniswap’s operation, around 11%. As mentioned previously, this growth rate has been very consistent in those 3 months despite massive changes in liquidity pool size, and this may give us moderate confidence in extrapolating this growth rate into the near future.</p><p>To understand why this rate might change in future however, we should consider what type of trading activity actually occurs on Uniswap, and how this activity is affected by external factors such as ETH volatility and general trader interest, and internal factors — in particular the liquidity pool size.</p><p>Arbitrage is the easiest use case to evaluate. One of the interesting features of Uniswap is that with no order book, the only way the price can move is through trading. As the price in the wider market changes this inevitably leads to arbitrage opportunities. Accordingly, a certain volume of arbitrage trading on Uniswap, and hence fee income is, in practice, guaranteed. The expected volume of arbitrage trading based on historical price movements can be simulated. A quick look at Binance data from November-January seems to suggest that fees from arbitrage may result in liquidity pool growth rates in the range 6–7%, even if no “real” trading is conducted on Uniswap. Whether this is true in the longer term depends on volatility in the ETH-DAI trading pair.</p><p>Fees resulting from other use cases are much harder to model or predict. Certainly, interest seems to be growing, with other projects beginning to take notice of Uniswap, for example, Kyber recently integrated Uniswap as a liquidity reserve.</p><h3>Victor Tran on Twitter</h3><p>Most of the volume came from @KyberNetwork and went through @UniswapExchange as a reserve. This is what people want to see in crypto. Strong collaboration with mutual interest to bring the most value to end users. As long as the connection is there, @UniswapExchange dominates!! https://t.co/ti4upbPe7I</p><p>The question is really about which will grow faster: Uniswap liquidity or trading volume?</p><p><em>As ever, thanks to </em><a href="https://twitter.com/haydenzadams"><em>Hayden Adams</em></a><em> for continued input and discussion on all things Uniswap, and to </em><a href="https://twitter.com/conlan"><em>Conlan</em></a><em> for making Uniswap data available through an </em><a href="https://github.com/Uniswap/uniswap-api"><em>API</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cc593f3499ef" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Uniswap: A Good Deal for Liquidity Providers?]]></title>
            <link>https://pintail.medium.com/uniswap-a-good-deal-for-liquidity-providers-104c0b6816f2?source=rss-6d4922da4628------2</link>
            <guid isPermaLink="false">https://medium.com/p/104c0b6816f2</guid>
            <category><![CDATA[decentralized-apps]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[decentralized-exchange]]></category>
            <category><![CDATA[decentralized-finance]]></category>
            <dc:creator><![CDATA[Pintail]]></dc:creator>
            <pubDate>Sat, 12 Jan 2019 01:08:50 GMT</pubDate>
            <atom:updated>2020-08-30T09:01:19.504Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*EFUozXOehdE7ZCunTW3wTA.jpeg" /></figure><p><em>Update 30 August 2020: this article originally used the term “impermanent loss” to describe the losses liquidity providers experience due to price divergence. The word “impermanent” was chosen because the loss due to price divergence may be reversed if the price divergence is also reversed. However, the use of this term could create the expectation that losses are guaranteed to be reversed, which is not the case. To better reflect this, the article has now been updated to use the term “divergence loss” instead.</em></p><p><strong>What is Uniswap?</strong></p><p>Uniswap is a decentralised exchange <a href="https://uniswap.io/">protocol</a> launched on the Ethereum mainnet in November 2018. It was created by <a href="https://twitter.com/haydenzadams">Hayden Adams</a> with funding from an <a href="https://blog.ethereum.org/2018/08/17/ethereum-foundation-grants-update-wave-3/">Ethereum Foundation grant</a>. It’s built on a beautifully simple concept whereby liquidity for exchange transactions is provided in the form of on-chain pools, equal in value for both ETH and a single ERC-20 token traded. Trades are executed against these on-chain pools, which use an automated market making strategy to enable exchange free of order books or additional counterparties. The smart contract design allows for exceptionally low gas usage when compared with other exchanges. If you haven’t had the chance to learn about it yet I would recommend reading some of the excellent articles on the subject (<a href="https://medium.com/@cyrus.younessi/uniswap-a-unique-exchange-f4ef44f807bf">1</a>, <a href="https://medium.com/@rossbulat/uniswap-understanding-the-decentralised-ethereum-exchange-5ee5d7878996">2</a>), the <a href="https://docs.uniswap.io/">documentation</a> overview, or the <a href="https://hackmd.io/C-DvwDSfSxuh-Gd4WKE_ig">white paper</a>.</p><p>Uniswap already has a budding ecosystem including a <a href="http://uniswap.exchange/">trading interface</a> and <a href="http://uniswap.info/">statistics portal</a>, and integrations are coming <a href="https://twitter.com/austingriffith/status/1081212830525808640">thick</a> and <a href="https://twitter.com/TotleCrypto/status/1072489275508383744">fast</a>. Development efforts are coordinated on <a href="https://join.slack.com/t/uni-swap/shared_invite/enQtNDYwMjg1ODc5ODA4LWEyYmU0OGU1ZGQ3NjE4YzhmNzcxMDAyM2ExNzNkZjZjZjcxYTkwNzU0MGE3M2JkNzMxOTA2MzE2ZWM0YWQwNjU">Slack</a>, <a href="https://github.com/uniswap">GitHub</a> and <a href="https://www.reddit.com/r/uniswap">Reddit</a>. In only its first 2 months, Uniswap has already achieved significant trading volume.</p><h3>Uniswap on Twitter</h3><p>🦄 Thanks for creating this @calebsheridan 💸 @UniswapExchange has had over $1M in trading volume since launch two months ago. 💜 Really grateful to all the fantastic contributors and community members who helped make this happen. https://t.co/OcDVyZN1Pv</p><p><strong>Who are Liquidity Providers?</strong></p><p>Trades on Uniswap cause price slippage, with trades that are large relative to total liquidity causing more slippage. So, for Uniswap to function well and allow large trades it also needs large liquidity pools. So who provides this liquidity, and why should they pool their valuable ETH and ERC-20 tokens in a Uniswap exchange? Liquidity providers can be anyone who is able to supply equal values of ETH and an ERC-20 token to a Uniswap exchange contract. In return they are given tokens from the exchange contract which can be used to withdraw their proportion of the liquidity pool at any time. Whenever someone trades on the exchange, the trader pays a 0.3% fee which is added to the liquidity pool. Since no new liquidity tokens are minted, this has the effect of splitting the transaction fee proportionally between all existing liquidity providers.</p><p>In fact, not only do liquidity providers receive fees from all trades, but trades are <em>guaranteed</em> to occur when the price in the wider market changes. This is because if the price changes on another exchange, there will be an arbitrage opportunity created by the price differential between that exchange and Uniswap. When an arbitrageur executes the profitable trade that brings the Uniswap exchange back into line with the wider market, liquidity providers benefit from Uniswap exchange fees. Sure enough, on all Uniswap exchanges with significant liquidity, arbitrageurs are hard at work such that prices track closely with the rest of the market.</p><p>Understandably, with this apparent promise of income for liquidity providers, people have been quick to pool their assets in Uniswap exchange contracts.</p><h3>Spencer Noon 🕛 on Twitter</h3><p>@UniswapExchange, one of the newest #OpenFinance apps, is currently experiencing explosive growth. The amount of $ETH locked up in its system is +65% over the last month and up 15x from its launch on November 2nd.</p><p>But after a few days with their liquidity in the pool, some liquidity providers are looking at the value of their stake in the liquidity pool and finding it’s worth less than what they put in, when measured in either ETH or the ERC-20 token on the exchange. What’s going on here?</p><p><strong>Why is my liquidity worth less than I put in?</strong></p><p>To understand why the value of a liquidity provider’s stake can go down despite income from fees, we need to look a bit more closely at the formula used by Uniswap to govern trading. The formula really is very simple. If we neglect trading fees, we have the following:</p><pre>eth_liquidity_pool * token_liquidity_pool = constant_product</pre><p>In other words, the number of tokens a trader receives for their ETH and vice versa is calculated such that after the trade, the product of the two liquidity pools is the same as it was before the trade. The consequence of this formula is that for trades which are very small in value compared to the size of the liquidity pool we have:</p><pre>eth_price = token_liquidity_pool / eth_liquidity_pool</pre><p>Combining these two equations, we can work out the size of each liquidity pool at any given price, assuming constant total liquidity:</p><pre>eth_liquidity_pool = sqrt(constant_product / eth_price)</pre><pre>token_liquidity_pool = sqrt(constant_product * eth_price)</pre><p>So let’s look at the impact of a price change on a liquidity provider. To keep things simple, let’s imagine our liquidity provider supplies 1 ETH and 100 DAI to the Uniswap DAI exchange, giving them 1% of a liquidity pool which contains 100 ETH and 10,000 DAI. This implies a price of 1 ETH = 100 DAI. Still neglecting fees, let’s imagine that after some trading, the price has changed; 1 ETH is now worth 120 DAI. What is the new value of the liquidity provider’s stake? Plugging the numbers into the formulae above, we have:</p><pre>eth_liquidity_pool = 91.2871</pre><pre>dai_liquidity_pool = 10954.4511</pre><p>Since our liquidity provider has 1% of the liquidity tokens, this means they can now claim 0.9129 ETH and 109.54 DAI from the liquidity pool. But since DAI is approximately equivalent to USD, we might prefer to convert the entire amount into DAI to understand the overall impact of the price change. At the current price then, our liquidity is worth a total of 219.09 DAI. What if the liquidity provider had just held onto their original 1 ETH and 100 DAI? Well, now we can easily see that, at the new price, the total value would be 220 DAI. So our liquidity provider lost out by 0.91 DAI by providing liquidity to Uniswap instead of just holding onto their initial ETH and DAI.</p><p>Of course, if the price were to return to the same value as when the liquidity provider added their liquidity, this loss would disappear. This loss is only realised when the liquidity provider withdraws their liquidity, and is based on the divergence in price between deposit and withdrawal. We can therefore call it <em>divergence loss </em>(previously described as <em>impermanent loss</em>). Using the equations above, we can derive a formula for the size of the divergence loss in terms of the price ratio between when liquidity was supplied and now. We get the following:</p><pre>divergence_loss = 2 * sqrt(price_ratio) / (1+price_ratio) — 1</pre><p>Which we can plot out to get a general sense of the scale of the divergence loss at different price ratios:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*_3S1Yx3udbQh1yja" /></figure><p>Or to put it another way:</p><p>a 1.25x price change results in a 0.6% loss relative to HODL<br>a 1.50x price change results in a 2.0% loss relative to HODL<br>a 1.75x price change results in a 3.8% loss relative to HODL<br>a 2x price change results in a 5.7% loss relative to HODL<br>a 3x price change results in a 13.4% loss relative to HODL<br>a 4x price change results in a 20.0% loss relative to HODL<br>a 5x price change results in a 25.5% loss relative to HODL</p><p>N.B. The loss is the same whichever direction the price change occurs in (i.e. a doubling in price results in the same loss as a halving).</p><p><strong>Returns for Liquidity Providers in Practice</strong></p><p>So the actual return for liquidity providers is a balance between the divergence loss caused by the price differential and the accumulated fees from trades on the exchange. Since all trades are recorded on the blockchain we can take a look how this has played out since the mainnet launch of Uniswap. Let’s keep looking at the ETH &lt;-&gt; DAI exchange.</p><p>The very first liquidity provider on the ETH &lt;-&gt; DAI exchange was account 0xf369af914dBed0aD7afdDdEbc631Ee0FDA1b4891, which provided 30 ETH and 5900 DAI (i.e. at a price of 1 ETH = 196.67 DAI) to initiate the exchange in block 6629139 on 2 November 2018. This account has so far not added or withdrawn any liquidity since this initial transaction and as of block 7047556 still holds 5.6% of the total liquidity tokens on the ETH &lt;-&gt; DAI exchange contract.</p><p>On the following chart we have the net position of account 0xf369af914dBed0aD7afdDdEbc631Ee0FDA1b4891 at every point from block 6629139 until block 7047556. Using the formulae above, we also have the divergence loss and the accumulated fees. All figures have been converted into DAI for ease of comparison.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*BpWzKCPzT7cCkVGF" /></figure><p>This chart shows that for most of the time since providing liquidity, this account has been in a net negative position (yellow line), compared to just holding the original funds. This is due to the large divergence losses (blue line) created by the ETH price movements (green line) over the period. However, throughout there has been a steady accumulation of fees (red line). With the ETH price recently moving closer to the price at which liquidity was provided, most of the losses have now been reversed.</p><p>If the ETH price were to return to exactly the same as it was at block 6629139, this account would have gained the equivalent of 255.60 DAI in fees, which amounts to a return of 2.2% in 70 days, or an annualised rate of about 11.8%. Note however that this rate applies only to the first two months of the exchange’s existence, and we should expect it will change in future.</p><p>The return from fees depends on many factors not explored here, and there will always be some loss from price differential to take into account. As shown above, if long term price movements are large, they could result in losses much greater than the return from fees. However, if Uniswap manages to gain enough traction it could be profitable for liquidity providers, dependent on price movements.</p><p>All of which is to say, providing liquidity to a Uniswap exchange is an interesting way to discover the emerging world of decentralised finance. Uniswap has the potential to earn a return on your ETH and ERC-20 tokens, without having to entrust your funds to any third party, but comes with its own set of risks and trade-offs.</p><p><em>Many thanks to </em><a href="https://twitter.com/haydenzadams"><em>Hayden Adams</em></a><em> and </em><a href="https://medium.com/@fernandocmartinelli"><em>Fernando Martinelli</em></a><em> for their feedback and input into this article.</em></p><p>Edited 15 January to correct a mathematical error in the hypothetical rate of return calculated above.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=104c0b6816f2" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>