KaRoot

Radix trie optimized for efficient order matching for onchain orderbooks

ETHGlobal SingaporeShipped September 20, 2024
Repo
KaRoot banner

About

On-chain orderbooks are not widely used as most matching algorithms have linear matching, which makes it almost impossible to execute onchain. For this reason we implement radix trie in cairo, that can be used to efficiently implement on-chain matching with logarithmic complexity.

How it's made

Binary radix trie is constructed separately for bid and ask orders. Key is constructed as a combination of price and order number, which helps to maintain price-time priority. Each leaf of the trie is an order, each node contains sum_value and sum_coins of its children. In order to acknowledge actual distribution of orders, we additionally optimize rightmost-branch of the trie, so that it keeps only sums of left children. This allows us to skip going up across the rightmost branch of the trie each time we change an order on the rightmost branch.

From the public ETHGlobal showcase page. Votes, swipes and the judge score are hackfeed's own.

AI judge

Not judged yet. A free model reads this page, compares it with similar projects and this event's winners, then scores it and says what would make it win.

Still being built?

Not checked yet.

Swipe stats

0upvotes
0skips
0saves

Discussion 0

No comments yet. Ask the team something, or say what you'd use it for.

Posting as a guest. Plain text, 1,000 characters max.

Already built nearby

Closest projects by meaning and shared words. Similar isn't the same as copied: read them.

Limit order book

fully on chain limit order book built on arbitrum stylus using a novel bitmap algorithm

Crossline

Cross-chain on/off-ramp powered by custom order matching using state channels and limit orders.