It can be hard having a giant pile of crypto.
Especially if you want to trade it for a different giant pile of crypto.
Sometimes investors or organizations want to move a lot of cryptocurrency, and they would prefer to do it in a way that doesn’t have a big impact on the market. The folks at venture fund Paradigm have a new idea for addressing this issue without having to trust anyone.
Called the time-weighted average market maker (TWAMM), it’s an idea that assembles a variety of needs and insights from crypto’s recent days and is worth unpacking.
Oftentimes, when some entity or person wants to shift a large number of assets they would prefer that doing so had relatively little effect on the market. Odds are, the person who makes this kind of trade wants to basically trade at the current price. The problem is that large trades have a way of moving the price.
When people want to sell off a lot of one asset without a lot of so-called slippage, they go to specialized brokers who know how to tease out such a trade. If the priority is more the right price and not so much getting it done quickly, that’s a boon to market makers because it gives them liquidity to work with.
(Sometimes there are people who want to move a lot of assets really quickly, and that’s a whole different story but it’s not relevant here.)
There’s no great way to do a big, slow trade trustlessly in crypto yet.
As we’ve previously reported, we are in an era where decentralized autonomous organizations (DAOs) are getting forward-thinking about managing their treasuries, but they have largely had to rely on cutting sweetheart deals with venture capitalists to turn governance tokens into something more liquid, such as stablecoins.
Furthermore, Paradigm’s idea is based on one of the biggest successes for decentralized finance (DeFi) in recent years: enabling human traders to transact with robots, known as automated market makers (AMMs). instead of people, so they don’t have to trust a third party.
These AMMs use internal pricing systems that go haywire if someone trades too much of one asset too fast.
Plus, since these trades are all transparent, Ethereum is littered with hustlers looking to steal value from big trades with all kinds of strategies that take advantage of market participants announcing their move before a trade is finalized.
If it’s built and works as intended, Paradigm’s TWAMM would give traders the benefits of an AMM while allowing them to execute large trades over time in a way that would likely cause only minimal market fuss.
Whether or not this specific design sees fruition, it helps to illuminate the kinds of problems that entrepreneurs in decentralized finance are thinking about.
And it is also worth talking about because it will probably see fruition.
Can we talk about numbers just a little?
Before we even get into it, I want you to forget about crypto and markets for a second.
Picture a big curve on a graph. You know what the curve represents, right? A series of paired values. Say you have a price going up and down and you have time going from left to right.
If the curve makes a big upside-down U shape, then you can picture price going up, peaking and then falling again, eventually reaching zero as time passes.
With me so far?
So let’s say it starts at 1 p.m. and goes to 10 p.m.. At 1 p.m. the price is $0. At 5 p.m. it’s $100 and at 10 p.m. it’s $0 again. That’s the arc of the curve.
So you have all these little moments in there when the price is slightly different from what it was a moment ago. Either it’s going up or it’s going down.
Let’s say you wanted to make a bunch of equally sized purchases along some part of the curve. Though you are buying multiple times at different prices, the average price would in fact be the final price you’d paid for all those individual purchases combined.
To say it with specifics, it wouldn’t really matter if the first buy had been made at $80, the next $90, the next $100, the next $90 again and the last one also at $80. In effect, you would have paid $88. That’s the average price. And from your wallet’s perspective, it was the price of all of them.
Over a series in which for whatever reason, things are changing, then it’s just really in practice one average price across each purchase.
That insight is at the heart of Paradigm’s proposal. More likely than not, it will probably end up informing some kind of big decentralized exchange designed for buying or selling large amounts of crypto in a transparent way.
Who wants to sell lots of crypto slowly?
If history is any guide, probably more people than we expect.
But one obvious example of a group that might like to make a very large sale in a transparent way might be the decentralized autonomous organizations (DAOs) diversifying their treasuries these days.
These are organizations with a large but undiversified treasury that might want to reallocate to some other asset in order to insure against a downturn or to participate in yield farming in order to cover operational costs.
While a DAO has an interest in diversification, it also has an interest in not tanking the token price and upsetting its community. By communicating clearly with the market and making the sales steady and predictable, it can avoid a market shock.
Hedge and venture funds that have made outsized gains in a token and just want to sell off a small portion of that position just to rediversify might also be interested in this kind of service.
This isn’t without risk, but for a certain kind of user it can be worth it. As Paradigm notes in its paper: “The biggest tradeoff long-term traders are likely to encounter with the TWAMM is the information leakage they are exposed to when placing publicly visible orders, which are necessary due to the nature of Ethereum.”
But for some market players that openness might be the point, as well.
How does it work?
The core trick of the TWAMM is laziness.
Before we get to that we have to talk about patience.
The TWAMM has an AMM built into it, in this design. Perhaps when it gets built it will be added as a feature to an existing market maker, but that would take a lot of clever engineering. For now, the TWAMM is envisioned as a standalone thing.
So if it had a pool of two tokens and someone wanted to put in an order for a long series of trades on that pool, selling a ton of tokens into that pool is really going to shift the price.
AMMs set prices based on the ratio of the two tokens in each pool, so 2,000 DAI and 1 ETH in a pool means that ETH is trading at $2,000 (or 2,000 DAI). But as soon as users start adding DAI to buy ETH, that starts pushing the price up a tiny bit.
Adding a lot at once will push the price up wildly.
But adding a little bit over a long period of time will have a very different effect, because everyone else in the market will start to see when the price has begun to get out of sync with the rest of the market. When that happens, market makers looking for arbitrage opportunities will trade it away (arbitrage is when a trader makes free money by spotting small discrepancies in a market).
So that’s the first insight. Trade slow and count on arbitrageurs.
Obviously, the very fact that a large trade is happening and everyone knows it will have some effect on the broader market price, but probably not as much as doing it suddenly. When people are willing to trade a lot openly over time, that’s a way of communicating to the market that the trader doesn’t know anything the market doesn’t.
The really fun notion here, though, is the second insight: the idea of laziness.
Simply put, the TWAMM saves its users gas by doing trades without doing them.
That’s not really true, it does do them, it just does fewer of them than it seems.
Remember the example at the top. We made six trades with a different price on each, but in the end it was really just one price, the average price, right?
Well, AMMs can do the same thing.
If you have a pool with a certain amount of two tokens in it and you announce that you want to trade, say, 1 million ETH for some other token in that pool, and you want to do it evenly over, say, 3,000 blocks, you can predict the average price for all 3,000 blocks from the very first one, at least if nothing else happens. (A new block is added to the Ethereum chain every 13 seconds, on average.)
As Paradigm’s paper explains, there’s a certain class of plugged-in broker who does this for large equity trades in traditional stock trading. This proposal does the same in a more crypto-native way.
If no one else trades in the pool over those 3,000 blocks, the average price of all 3,000 would be completely predictable from the start. You could calculate the average price over all 3000 blocks and just do one trade for all of it at that price at the 3,000th block.
What’s the advantage there? The trader pays gas (the cost of sending transactions or performing computations on Ethereum) one time, not 3,000 times.
This is what’s called “lazy.” It pretends to take a bunch of actions but actually does as little as it can get away with.
Remember how I wrote that if you trade in a ton of one asset into a two-sided pool, it will knock the price out of whack with the market? That will still happen here, but because it’s happening slowly, the market can knock it back in line as it goes.
See, the TWAMM also makes it clear to the public market where the trades it has running have moved the price, even if it hasn’t actually executed the trades yet on-chain (because it is being lazy).
This would allow arbitrageurs to step in and readjust the underlying prices anyway, even though the trades have not been logged on Ethereum. If nothing is changing, the smart contract waits but if someone steps in and makes a trade in the pool, that changes the math. So the TWAMM goes ahead and totals the extended trade up to that point, registers it on chain and then starts the lazy operation again based on the new state of the pools.
This mechanism not only lowers gas but also makes sure that the long trade largely stays in line with the overall market.
Is that it?
No, that’s just the crux of it.
The TWAMM is also able to make other more sophisticated moves. Say, for example, two long trades are running on the same pool. Provided no one else interacts with the pool, it can run multiple long trades lazily as well.
What if prices go crazy elsewhere in the market during a trade?
A long trade can always be canceled midway (though the trades up to that point will execute, whether it’s been lazy or not). That said, an automated canceling system is not built into the design for the TWAMM.
This is probably for the best. If an order posted that it would stop the trade if prices changed too much one way or another, third parties would be able to game that information.
That said, if the TWAMM gets built, someone probably will build a tool that would allow a trader to send an order to kill a trade if the market moved too much against them while it was running.
What does TWAMM have to do with other AMMs?
We can only guess about that right now.
As noted above, as it stands any AMM that wanted to add a TWAMM-like feature would need to do a code update. The Uniswap team is cited on the document as consulting on it; Uniswap did not reply to a request for comment from CoinDesk.
SushiSwap is in the middle of a big code change right now and the team is basically planning to incorporate every AMM format into their own. Perhaps they will add the TWAMM design to the mix as well?
This is all just conceptual right now anyway. A design and code to run it are two very different things.
Into what crypto trends does this product fit?
As more and more DAOs begin to act like large players in the market, functioning more like the crypto equivalent of publicly traded companies rather than traders, they will want more crypto-native ways to make big moves.
Right now they are selling their tokens to prepare for a downturn. Later, they may turn to buying back their tokens to reward supporters.
They would want to do all of this in the spirit of crypto: openly, without spooking the market.
It also fits into the ongoing conversation about MEV. It should make it a bit harder for attackers to jump the line and steal value from some big players making moves in the market.
Perhaps most importantly it fits into the story of markets becoming truly decentralized.
AMMs have proven to be one of the most transformative technologies to sprout from blockchains and the more useful varieties of AMMs that can be devised, the less of a role centralized exchanges will have to play.