Aori, Game Theory, and DeFi

You may associate Aori with MEV, DeFi market making, maybe even with my ranting about off-chain orderbooks. But I wanted to set the record straight and detail what Aori is all about and my belief about what DeFi will look like over the next few years. This is a writeup about:

  • What Aori is as a premise

  • How to decentralize the Aori protocol without a blockchain

  • Our progress to date

  • What we can build together with this new paradigm of settlement infrastructure.

Aori is a Settlement Contract

AoriV2.sol
AoriV2.sol

That looks complicated, but simply put it takes three parameters:

  1. Maker Signature

  2. Taker Signature

  3. Server Signature

These three signatures are used for verifying the authenticity of the order from the off-chain orderbook. We use the term orderbook in the most fundamental sense, just a book of orders where a user says what they have, and what they want:

Order struct in AoriV2.sol
Order struct in AoriV2.sol

Before I dive deeper into the implications and potential protocols, apps, and completely novel ideas that can be executed through this contract; I’ll first detail why we built this.

What Will DeFi Look Like?

I wrote a thread on my issues with trading infrastructure to date here:

That is a good start as to my issues and thoughts on the past, but I’d like to talk about the future here. Mathematicians took two approaches to solving coordination games between humans over the last century:

  1. Cryptographic enforcement

  2. Game Theory/Behavioral Economics

The cryptographers approach human problems from the point of view of abstracting out all human features inside of a system, and replacing them with unbreakable cryptographic proofs that guarantee what actors within an environment can do. This is the entire bedrock of “Crypto” today. It’s where blockchains, ZK Proofs, FHE, ECDSA Signatures, Tokens, and an innumerable number of innovations we take for granted came from.

However, the Game Theory world has been only mildly applied to crypto today. You can of course point to “Ponzi-nomics” or DAO’s as applications of game theory and human behavior being used in crypto applications that are built on cryptographic advances, but that’s about it.

Hilariously, the most intelligent and advanced cryptographers and “mechanism designers” (if you can call them that…) have created the most catastrophic failures in crypto today. Let’s take a look at block building and what effects it has had based on the most easily predictable game theoretic outcomes:

Here’s a simplified graphic detailing the flow of “MEV-Boost” or what we know as block building and consensus today. Here is the current landscape of block builders over the last 30 days as of the writing of this article:

As you can see, this is clearly what economists would define as an “Oligopolistic” market. Meaning simply, a few people have won it and are likely going to stay winners in the medium to long term.

So what’s exactly happening here?

Great question. The cryptography is obviously brilliant. To the best of my knowledge there has been a single exploit of the MEV-Boost system and it was exclusively harmful to a bad actor performing sandwich attacks, but that’s for another day. The main issue here is that the game theory is broken. Block building requires two things that give someone a sizable and long term edge:

  1. Being better at ordering transactions more efficiently

  2. Private transactions that only that block builder sees

It used to be the case that Flashbots, Titan builder, and other (“neutral,” as they are called, meaning non-hedge fund or market maker associated) builders were able to win the majority of blocks just through being faster, and/or smarter about ordering the transactions located within the public mempool. Any better ordering, and you could bid more to win the block, and therefore profit! But here’s the catch. What if another builder sees transactions that you never get to see? Then your ordering algorithm can’t compete, even if you are faster and smarter about fitting transactions in a block.

So that’s what the top three builders did. They either found or created sources of high value transactions and signed deals to isolate that orderflow and maintain a permanent non-technological advantage. Additionally several began creating said orderflow through executing CeFi-DeFi arbitrage strategies that bribe their own builder to win blocks, and capture the high profit trades.

Brilliant, huh? I think so at least. They followed the rules of the system that was organized, and took advantage of the fact that to win all you need is more transactions that pay more gas.

So what the next iteration of protocols need to do is build themselves using the expertly crafted cryptographic building blocks we already have, but while paying close attention to the most important value of any free market participant: INCENTIVES.

It’s All Just Swaps.

So this just begs the question: What does a settlement contract have to do with all this?

Well I’m glad you asked!

All of crypto (and finance in general) can be broken down into swaps, or combinations of swaps. Let’s look at a few of the largest DeFi protocols as examples:

AMM’s

  • Adding/Removing Liquidity = Send one or multiple tokens to a pool, receive LP token and vice versa

  • Swaps = User sends one of the designated tokens, receives the other token(s) at a determined exchange rate

Lending/Money Markets

  • Opening a loan = User sends collateral token, receives loan tokens

  • Protocol stores this data

  • Closing a loan = User returns loan tokens + interest, receives collateral tokens

Perps

  • Opening a position = User sends collateral tokens, receives tokenized or LP position (receipt)

  • Protocol stores data

  • Closing a position = User returns LP token/receipt and receives gain/losses

Bridges

  • User sends tokens to bridge contract

  • User is minted tokens on receipt chain if lock/mint bridge, or is sent tokens by a solver on destination chain. If solver bridge, then the solver receives the user’s tokens on the original chain

You can clearly break down the majority, if not all, protocols today into some kind of combination of token swaps. That’s how we started down this rabbit hole of how a settlement contract can be used to build orders of magnitude more interesting, and valuable, DeFi protocols than exist today.

Off-Chain Logic Is Just Better In Every Way

The burden of chain abstraction should be on the app, not the blockchain.

i am very good graphic designer
i am very good graphic designer

It makes much more sense to move the matching and any peer to peer components off-chain, while retaining the verifiers of truth (to avoid things like double spend, over drafting loans, or overspending tokens you don’t have) on-chain. This would also mean these applications off-chain can take any form, they could be app-chains, gasless EVM environments, private applications with arbitrary gates, or decentralized networks like existing peer to peer gossip networks. The level of experimentation here allows for substantially more experimentation than the frankly pathetic “Centralized vs. Decentralized” binary choices we have today.

A user could opt into:

  • whatever execution environment they wish to use

  • any app they wish to use

  • any settlement chain they wish to use

  • with any level of centralization or decentralization they wish to use

All while never leaving the chain they wish to keep their assets secure on. This is not some attempt at creating the 20th universal standard for chain abstraction, instead Aori is an attempt at making APPS abstract themselves to all chains. This execution standard fundamentally means that to change what chain a user wishes to settle on for any app, all they have to do is enter a different chain ID. One app, for every chain.

Things We Have Built, And Are Going To

Given how incredibly generalized the settlement on Aori is and the ease of replacing what chain you settle on with a single parameter, there are a lot of things we can do. Here are some we’ve worked on with examples, plus additional things we’re going to build, or you could:

RFQ Service

docs.aori.io
docs.aori.io

This basic service we built allows you to communicate directly with makers on Aori to quote you the best continuous prices of swaps at their level of speed and expected slippage. This is live on the app.aori.io frontend for chains today, such as: Base, Arbitrum, and Blast.

Flexible Quoting

The Aori settlement contract works similar to the flashloan contracts created by AAVE, Balancer, and others. We are agnostic to whether or not the maker has the assets they are requesting a swap for, as long as the swap clears once matched. This means that a “maker” on Aori of an order can use tokens sitting in their wallet, or can spend the taker’s tokens and simply return back to them the expected number of tokens they specified they would give the taker when they created an order. This would mean the flow of a “Solver Quote” on Aori would be:

  1. Maker/Solver creates order to sell 1 ETH for $2500 USDC

  2. Taker has $2500 USDC and wishes to purchase that ETH, so they sign a taker message and provide it to the orderbook API

  3. The Maker spends the Taker’s $2500 USDC, routes that USDC through various sources of liquidity on-chain and receives 1 ETH from their swaps

  4. Then the Maker sends the Taker the 1 ETH, fulfilling the Taker’s expectation.

MEV and Arbitrage

Similar in function to RFQ and Flexible Quoting, many users are executing trades on Aori with the express intention of arbitraging liquidity quoted on Aori versus centralized exchanges, other chains, or on-chain liquidity. We expect this to continue to be a growing market on Aori as inefficiencies in AMM’s and any on-chain market makers are bound by block time, AMM curves, or latency.

Auctions On Aori

We’re in the process of integrating several major auction platforms into the Aori Orderbook through replicating their auctions in realtime. This means that if a CoWSwap, UniswapX, or Across auctions (for a few examples) are in process, we stream the realtime price. Then, descend it depending on the auction mechanism. If a user fills the order on Aori, the order is then filled directly against the auction platform.

Tokenized Derivatives

Any tokenized asset can immediately be quoted and traded through Aori. It simply would require the tokenization of the derivative using a protocol like Opyn or Perp Protocol to handle the liquidation/settlement logic. These tokens can then be traded off-chain via the RFQ, Auction, or through simple direct matched orders.

AMMs, Money Markets, Bridges, etc. etc.

Similar to the analysis in the “It’s All Just Swaps” section, any of these can be replicated and mirrored via an orderbook. It’s just a matter of writing contracts to store logic between swap state. For example, a Money Market on Aori would look like:

  1. User requests loan, shows collateral willing to be posted and receives a quote for the amount the protocol is willing to lend

  2. Swap collateral for loan tokens in single swap

  3. Store collateral and loan token values in storage contract

  4. Upon repayment, the protocol requests the amount of the principal lent + interest.

  5. The user fulfills the order to receive their collateral back

  6. If the user does not pay, the protocol requests a quote from a solver to liquidate the user’s collateral and return the profit plus original loan token proceeds from the liquidation to lenders.

Scaling Blockchains Through Human Nature

In this final section I want to talk about how we can use Game Theory and Behavioral Economics to explore how to build off-chain infrastructure that can remain decentralized and how we can use this to scale blockchains by orders of magnitude more than most existing ideas.

Competitive Based Sequencers

Something we’ve been exploring is how to decentralize the orderbook in a way such that users can validate that an orderbook is in fact not censoring their order, and guaranteeing censorship resistance, or price improvement. One way to do this is through Competitive Based Sequencing. This would mean that anyone can operate an Orderbook Node, which would have an identical API to the existing one, but every orderbook operator would compete for some identical fee that can only be captured via being the fastest executor of the settlement of a swap. An example of this flow could be:

  1. Maker and Taker match a swap to sell 1 ETH for $2500 USDC, with a 3bps fee paid to the Based Sequencer

  2. They submit their orders to all orderbook node operators

  3. Node operators race on latency and/or gas bidding to settle the trade first within the block (it is important to note that this would not result in multiple orders potentially being settled and thus executing multiple trades, as once an order is settled it cannot be settled multiple times via the Aori Contract structure, so this is not a potential risk in this example).

  4. The first node operator to execute the swap receives said fee and the users their respective assets.

The equilibrium in this example is for there to be a competitive market of fast and efficient Based Settlers. We use the term based to mean “L1 sequenced” or just simply put, the blockchain the user specifies handles the tx ordering of that swap within a larger block. It is also incredibly important to note that an oligopoly such as the first example in the block builder market is not possible given that there is not a variable profit or risk for the Maker or Taker because their order, swap, and fee are all guaranteed via ECDSA signature. The only potential vector for optimization would be that one or more node operators could collude to lower their fees over other operators to capture more flow, but that would just result in a race to zero (or specifically the cost to just run the orderbook node).

Restaking Sequencers

We are exploring other alternatives, such as more AVS-esque systems involving node operators using ETH or some ERC20 stake as collateral, and failure to settle trades resulting in a direct monetary stake. This could result in slower settlement but more analysis needs to be done. The purpose of this would be to allow for decentralizing the onboarding of the settlers/makers on Aori, given that now no vetting would need to be done. A bad maker would simply be burning their stake effectively.

Competitive Centralized Orderbooks

The two previous examples are decentralized or at least permissionless markets for swap settlement, but another interesting example alluded to in the Competitive Based Sequencer example is that of purposefully centralized Orderbook node operators. This would look more like the existing Ethereum RPC market, where many centralized orderbook operators exist but the simple fact of the competitive market existing means that you get in the limit a system that appears decentralized through the varying market segments of each RPC provider. For example some can optimize for speed, or others for regulatory compliance, etc. etc. It allows the swap creators the power to control not only for latency or fees, but also permitted centralization.

In Conclusion

This has been a particularly long writeup and I thank you for reading it in it’s entirety. I sincerely hope you are at least intrigued by our approach at Aori, and if you’re interested in working on what we believe the future of DeFi will look like feel free to reach out to us on Twitter, Telegram, or email.

Subscribe to joshuabaker.eth
Receive the latest updates directly to your inbox.
Mint this entry as an NFT to add it to your collection.
Verification
This entry has been permanently stored onchain and signed by its creator.