Forums  > Trading  > DeFi and decentralized market making  
Page 1 of 1
Display using:  


Total Posts: 141
Joined: Sep 2015
Posted: 2020-12-01 04:12
Anyone doing anything interesting here?

I've had centralized exchange bots live since 2013.

This space moves incredibly quickly and hard to keep track.


Total Posts: 486
Joined: Jan 2015
Posted: 2020-12-01 17:15
I've been toying around with DeFi stuff as a side project for the past couple months. I never knew much about crypto or crypto trading before, so thought it would be a fun learning opportunity.

So far, I've replicated the pre-existing strats that front-run Uniswap trades in the Ethereum mempool. It's pretty amazing how easily exploitable the ecosystem is. Anyone can see your transactions before they print, then execute ahead of you by bumping the gas fee.

Front-running trades like this is kinda bush league though. The money's easy, but relatively small. The crazy high taker fees (30 bps each way), means that the only real opportunities are illiquid micro-cap tokens, which get regularly dislocated by ordinary trades. Against that you're fighting Ethereum's super-high gas fees. Plus the half dozen active players frequently get in vicious gas auction battles. A lot of the returns come from optimizations in EVM byte code. (Particularly SSTORE gas rebate tricks.)

If you could come up with a consistent strategy on the super-liquid pools (e.g. USDC-ETH), then I think you could really print money. Gas fees are invariant to transaction size. If you trade millions instead of thousands, gas costs amortize to epsilon. You could do some really cool stuff, by strategically flashing liquidity, either to avoid impermanent loss (the term DeFi zoomers use for adverse selection) or to kludge cheap passive directional execution (impossible through naive liquidity providing since Uniswap doesn't use a limit order book).

It also seems like there's a lot of opportunities to arb the DeFi exchanges against the centralized ones. My hunch would be that most price discovery occurs at the centralized exchanges. If you have the ability to dominate gas auctions, then it's basically the equivalent to latency supremacy. Going the other way, if you have the infrastructure/software to preemptively scan the mempool, then that probably gives you an advantage over regular centralized exchange traders. If they're watching Uniswap at all, they're probably only seeing market moving trades after they mine to the blockchain.

My two bps. As a neophyte, still figuring things out. It'll be interesting to see how Eth 2.0 changes the landscape. Anyone in the space or curious about it, feel free to drop a line if you want to shoot the shit offline.

Good questions outrank easy answers. -Paul Samuelson


Total Posts: 7
Joined: Jun 2020
Posted: 2020-12-04 22:33
Intriguing, I guess you're running an Ethereum full node? I'd quite like to run a node myself just cos it'd be fun, but I wasn't aware of the opportunity for both fun and profit.

On the topic of DEXs I saw there's which has a proper decentralised limit order book and what looks like crazy cheap fees ($0.00001 per transaction advertised), I wouldn't be surprised if it became quite popular. I'm not totally sure how it works, so don't take my word for it, but it appears they've nodes which handle the process of matching orders (or 'turning the crank' as they say in the technical docs, if you could get in on that it's possible you'd have some edge in the centralised markets, similar to what you mentioned with being able to scan the mempool, assuming there's enough meaningful size going through ofc. However I've not had time to properly poke around, there are so many different flavours of the month in crypto it's hard to keep on top. However I'm amazed and encouraged that opportunities like the Uniswap one exist, even if they are small.

Off topic but one thing I do continue to be interested by is the huge amounts sloshing around top of book on Bitmex / (in the near past) Deribit / probably any other exchange with the maker rebates. I'm not a trader so not sure what's going on, I can only guess it's queueing shenanigans, but it'd be fun to have a go with some small size.


Total Posts: 1245
Joined: Feb 2007
Posted: 2020-12-08 15:40
The biggest defi profits to be made are in security issues in the contracts and rube goldberg contraptions they're made out of. The bytecode generated by solidity compilers are laughable, and even the code written in solidity is absolutely hilarious. If you watch these things once in a while you'll see weird flying saucers followed by "we're upgrading our smart contracts" with little explanation of what actually happened. If you take the time to look at the transactions before and after, you rapidly realize why no explanations were forthcoming; wouldn't do much for faith in the technology. There's enough hacks they talk about people ought to be skittish.

Serum is probably fake; most of Solana is a LARP. Interesting technologies baked into it, and talented engineers involved, but the upshot is they make absolutely ridiculous claims and end up with real world performance that looks like any other generic/semi centralized proof of stake chain.

Oh yeah; eth2 -maybe in a few years. Beacon chain is only one tiny part of what eth2 is supposed to ultimately be, and there are no meaningful SCS on it. It's basically just a settlement layer for a sort of federated multichain thing that may or may not emerge some day. Eth1 is supposed to migrate there as a shard. Don't hold your breath.

"Learning, n. The kind of ignorance distinguishing the studious."


Total Posts: 4
Joined: Nov 2012
Posted: 2020-12-22 03:57
Nice, I built something similar to front run on uniswap, but couldnt make much from it. My optimisations included patching GETH to broadcast messages wider than the default 3 nodes. I did see some addresses making a few hundred thousand USD a month front running. I also wasnt super fast as I simulated every trade in a forked virtual eth chain to check I would get my capital back as some tokens, you can only buy and not sell (I found that out the hard way). If you want to compare notes sometime. drop me a line.

The biggest trade one could do at the moment is cash and carry arbitrage on deribit or ftx (or even binance) on spot vs. futures, annualising something like 12-15% at the moment.


Total Posts: 1377
Joined: Jun 2005
Posted: 2021-01-05 13:52
Decentralized exchange problems are similar to the ones solved with smart routers implemented in Bats, IB, MTF etc. in conventional markets, so tokenization of similar idea seems natural.

... What is a man
If his chief good and market of his time
Be but to sleep and feed? (c)


Total Posts: 1081
Joined: May 2004
Posted: 2021-05-24 10:03
For the next couple of years, you can probably make serious money just doing cash and carry, and arbing one exchange against another (including DEXes). No need to overcomplicate, it is just a matter of having fast, reliable connections to many exchanges and good risk management. You'd have to compete against Alameda (interestingly, ex-Susquehanna guys) and others, but the pie is big enough for several players.

I am not doing it at the moment because it seems like it would be a full-time job and I have more interesting things to spend my time on, but that would be pretty profitable I guess.

"Earth: some bacteria and basic life forms, no sign of intelligent life" (Message from a type III civilization probe sent to the solar system circa 2016)


Total Posts: 1
Joined: May 2021
Posted: 2021-05-29 03:04
This is a great inspiring article. I am pretty much pleased with your good work. You put really very helpful information.
Delhi Call Girls


Total Posts: 5
Joined: Aug 2021
Posted: 2021-08-03 10:27
Miner extracted value (MEV) seems to be what's hot right now.

You look at all the tx in the mempool, insert your own tx ordering, package the tx together then send them directly to a miner with a fee. In return the miner will package the transactions into a block using the ordering that you specified and take the cut of the fee.

For example;

Someone submits a ETH transaction for a $5k buy order in the ETH/USDC uniswap pool. You take that transaction and sandwhich it in between your own;

tx1: Buy $10k of ETH on ETH/USDC
victim's tx: Buy $5k Eth on ETH/USDC
tx2: Sell all your ETH on ETH/USDC

you pocket the difference that is left. Classic frontrunning.

You package those transactions and send them to a miner with a $fee and he executes those transactions in the order that you want.


You really think cash and carry is profitable still? The market is surprisingly efficient in crypto.


Total Posts: 486
Joined: Jan 2015
Posted: 2021-08-03 20:59
The problem is that since the advent of Flashbots, the miners are reliably extracting 90%+ of the profits in those trades. Prior to widespread Flashbots adoption, you'd win those opportunities in priority gas auctions (PGA). Most times, blocks would print well before the PGA price hit economic breakeven. There was a lot of room for technically sophisticated players to net well above their gas spend.

Now with Flashbots, competition is a lot flatter. It's a sealed auction, that goes through an easy to onramp API instead of the standard p2p mempool. There's a lot more competition, and most people bid somewhere close to the breakeven price. Consequently, it's not anywhere near as profitable as it used to be.

I haven't looked into it directly, but I think there are still opportunities in BSC and Polygon, where Flashbots (AFAIK) hasn't been adopted by the validators. The other thing is, almost all the shitcoin buys are front-run, but virtually none of the sells are. That's because nobody actually wants to carry inventory. I think there is room for quants who know how to manage portfolio risk on this side of the equation.

Good questions outrank easy answers. -Paul Samuelson


Total Posts: 5
Joined: Aug 2021
Posted: 2021-08-04 10:32

That's an interesting point on the shitcoin buy-side frontrunning but not the sell-side. I've seen that as well. But I'm not sure your statement about inventory risk is true; You can easily get shitcoin x through a loan and sell it. Unless your talking about absolute microcap coins for which there is no loan market.

tx1: Take loan from compound/aave of 500 SHIT, sell 500 SHIT
victim tx: sell 100 SHIT
tx2: buy back 500 SHIT + extra, repay loan and pocket the difference

I think it's a matter of the market just not being efficient yet. I mean look at this transaction... This guy just picked up a $13k arb opportunity on a single exchange. It's literally the most simple arb possible and it was just sitting there - this wasn't even a flashbots transaction:

The fact that the most simple arbs possible are still available means that for the complex stuff there must definitely be opportunities still. Some simple stat arb strats will probably work. What do you think?
Previous Thread :: Next Thread 
Page 1 of 1