# Vif protocol > Vif protocol is an ultra‑efficient, fully onchain order book protocol. ## Docs - [Getting Started](/protocol/introduction/getting-started): First, you will need to install foundry to be able to compile the contracts. - [Vif Protocol: Overview](/protocol/introduction): **Vif** is a new, fully on-chain order book protocol designed from the ground up for maximum efficiency. In the landscape of decentralized finance, different blockchains have different strengths. Vif is specifically engineered for environments where computation is relatively cheap, but writing to storage and emitting logs—actions common in many DeFi protocols—are significantly more expensive. - [Project Structure](/protocol/introduction/project-structure): The project depends on [solady's](https://github.com/Vectorized/solady) ultra-efficient libraries. It also draws inspiration from its optimization tricks throughout the codebase. - [Current Book and History](/protocol/indexing/current-book-and-history): The book is fully on-chain and thus it can be obtained directly through an `eth_call` to a periphery reader contract. However, if needed, it can also be constructed off-chain from either an initial state or genesis. For this purpose, we need to build a synthetic clone of the book off-chain. Only by creating this off-chain clone would we be able to construct the full history of the book. - [Global Parameters](/protocol/indexing/global-parameters): Vif is an ownable, pausable contract. In addition, it has one global parameter, which is the provision required to create a limit order with an expiry (defined in gwei). - [Indexing Vif Protocol](/protocol/ing/index): The Vif protocol has very minimal logs due to the nature of the EVM chains it targets. For this reason, indexing will be more challenging than with traditional AMMs or order book DEXes. - [Market Orders](/protocol/indexing/market-orders): Market orders are defined within a transaction and can be uniquely identified by block and event index. - [Market Creation](/protocol/indexing/market-parameters): A market is defined by the following parameters: - [Offer Owners](/protocol/indexing/offer-owners): If you want to have a simple resourceless indexing solution, this section will be the last one you should index. But you won't have full offer history. - [Flash Accounting](/protocol/how-it-works/flash-accounting): Flash accounting is the innovative mechanism that allows Vif to batch multiple operations without transferring tokens until final settlement. This system uses **transient storage** (EIP-1153) to track per-token debts and credits globally. - [Overview](/protocol/how-it-works): Vif is an ultra-efficient, fully on-chain order book protocol that combines innovative design patterns to deliver optimal performance and user experience. - [Markets & Units](/protocol/how-it-works/markets): Markets in Vif are the fundamental trading pairs, uniquely identified by their configuration parameters. Understanding how markets work and how to configure token units is essential for optimal protocol usage. - [Offers & Lists](/protocol/how-it-works/offers): At each price point (tick) in the order book, offers are organized in **double linked lists**. Understanding offer structure and list mechanics is crucial for efficient order book operations. - [Tick Tree Structure](/protocol/how-it-works/tick-tree): The tick tree is the core data structure that enables efficient price discovery in Vif. It's a **3-level bitmap tree** where each level uses 256-bit integers as bitmaps. - [Binary exponentiation](/protocol/glossary/binary-exponentiation): To compute the price from a tick value, we use [binary exponentiation](https://cp-algorithms.com/algebra/binary-exp.html). - [Tick](/protocol/glossary/tick): The tick is a price representation of a price level. It is a 24-bit integer that is the log base `1.00001` of the price. This means that the price difference between 2 ticks is 0.1 basis points. The mathematical formula to go from tick to price is: - [Units](/protocol/glossary/units): In order to save gas and space while storing offer details, we decided not to use the usual 128 bits to store an amount, but rather 48 bits to store received and sent amounts, and 64 bits for market orders. - [Developer Documentation](/developer): Welcome to the Vif Protocol developer documentation. This section covers everything you need to build applications on top of Vif. - [Reading Protocol State](/developer/reading-state): The `VifReader` contract provides gas-efficient methods for reading the Vif protocol state off-chain. Use it to query order book data, market information, and user positions. - [Core Classes](/developer/sdk/core-classes): The vifdk provides several core classes for working with tokens, markets, offers, and order books. - [TypeScript SDK (vifdk)](/developer/sdk): The vifdk is the official TypeScript SDK for the Vif protocol. It provides a high-level, type-safe interface for interacting with Vif smart contracts using [viem](https://viem.sh). - [Router Actions](/developer/sdk/router-actions): Actions are the building blocks of Vif transactions. The vifdk provides type-safe methods for all available router actions. - [VifRouter](/developer/sdk/vif-router): The `VifRouter` class is the main entry point for building and executing transactions with the Vif protocol. - [Authorization](/developer/sdk/guides/authorization): Learn how to authorize the VifRouter to act on your behalf in the Vif protocol. - [Cancelling Limit Orders](/developer/sdk/guides/cancel-limit-order): Learn how to cancel (delete) limit orders from the Vif order book. - [Claiming Limit Orders](/developer/sdk/guides/claim-limit-order): Learn how to claim filled amounts from your limit orders while keeping them active on the order book. - [Creating Limit Orders](/developer/sdk/guides/create-limit-order): Learn how to place limit orders (make offers) on the Vif order book using vifdk. - [Editing Limit Orders](/developer/sdk/guides/edit-limit-order): Learn how to update existing limit orders on the Vif order book. - [Creating Market Orders](/developer/sdk/guides/market-order): Learn how to execute market orders (swaps) on the Vif order book using vifdk. - [Viewing Offers](/developer/sdk/guides/view-offers): Learn how to query and view offers from the Vif order book using vifdk. - [Building Custom Routers: Limit Orders](/developer/interactions/custom-router-limits): This guide shows how to build a custom router for placing limit orders. For most use cases, consider using the [built-in VifRouter](/developer/interactions/using-vif-router) instead. - [Building Custom Routers: Swaps](/developer/interactions/custom-router-swaps): This guide shows how to build a custom router for executing market orders (swaps). For most use cases, consider using the [built-in VifRouter](/developer/interactions/using-vif-router) instead. - [Using VifRouter](/developer/interactions/using-vif-router): The built-in `VifRouter` is a command-based router that provides a flexible interface for interacting with the Vif protocol. It uses a dispatcher pattern to execute multiple operations in a single transaction.