Orderbook Deep Dive
Technical implementation details of the on-chain orderbook system
Last updated
Technical implementation details of the on-chain orderbook system
Last updated
In traditional orderbook systems, achieving a full on-chain implementation is considered challenging due to the significant amount of data reference and updates, which can lead to high . However, Secured Finance has successfully implemented an on-chain orderbook system.
Particularly, gas-intensive processes such as creating open orders, executing market orders, and auto-rolling result in increasing gas costs proportional to the data volume, according to Solidity's characteristics. In some cases, these processes may even approach Ethereum's block gas limit, potentially causing execution issues.
Creating open orders incurs increasing as the data volume on the orderbook grows.
Executing results in escalating gas costs proportional to the number of matched open orders, potentially leading to execution challenges in certain cases.
faces mounting gas costs proportional to the number of positions subject to auto-rolling, potentially leading to execution challenges in certain scenarios.
These challenges prompted Secured Finance to address them effectively and enable a practical gas cost for the full on-chain orderbook system. To achieve this, we introduced red-black trees, lazy evaluation, and the concept of Genesis Value. These solutions ensure the smooth operation of the on-chain orderbook system, optimizing gas costs and enhancing the overall efficiency and performance of the platform.
How the Red-Black Tree data structure enables efficient orderbook operations
How Lazy Evaluation reduces gas costs for on-chain operations
How Compound Factors and Genesis Values are used for price calculations
How Orderbook Rotation works during market transitions
: The self-balancing binary search tree that powers the orderbook
: The technique that minimizes gas costs for orderbook operations
: The mechanism for calculating time-value adjustments
: The initial value representation for assets and obligations
: The process for transitioning between market periods