Hiding Book

Integrating the Hiding Book offers limit orders for your dApp with benefits like ROOK Rewards, MEV Protection, and access to the Rook Keeper network.
The Hiding Book offers friendly APIs which allow any developer to integrate the Rook Keeper Network into their front ends.
The Hiding Book is an off-chain orderbook that hosts virtualized orders only fillable by Rook Keepers. Through these Keepers, the Hiding Book provides clients with single-connection access to the entire spectrum of on-chain and off-chain liquidity. Each order is a signed message that permits a Keeper to perform the requested token swap directly with the user's wallet.

As an order book

Orders on the Hiding Book can cross against other orders on the Hiding Book, or cross against markets across DeFi and CeFi. The unique mechanism of the Rook Protocol ensures that clients and Keepers are working together to maximize profit generation from a trade.

As a relay

The Hiding Book can also act as an order relay, or as a virtual mempool. This allows protocols to relay their orders through the Hiding Book and gain the benefits of MEV resistance and better execution.

Rewards Claims

Integrating a client with the Hiding Book enables the client's users to coordinate with Rook Keepers for the capture of MEV (Miner Extractable Value). This is a win-win because both users and Keepers are working together to maximize profit generation from a trade the user was going to perform anyways. The profits generated are returned back to the user in ROOK tokens.

Cancelling an order

Once an order gets added to the Hiding Book, it will remain active up until its expiry time. If a user wishes to cancel it before expiry, there are three options.

Cancel order on the Hiding Book

Also known as a "soft cancel", this will flag the order so it cannot be viewed or bid on by Keepers. It requires the user who created the order to sign another message, but does not cost gas. This does come with a small risk that the cancellation may not be honored due to one of the following cases:
  • An auction for the order has already started.
  • There is an uncaught bug in the Hiding Book code server error that prevents it from processing the cancellation.
  • A Keeper maliciously fills the order. Note that this would difficult to do by accident as it would require bespoke code to deliberately work around the Hiding Book. There is not really an incentive to do this as it's easy to catch, wouldn't make much profit and would have serious repercussions for the Keeper.
In practice, most users use this option.

Cancel order on chain

The "hard cancel" option is to cancel the order directly on chain. It costs a gas fee, but is simple, trustless and secure. A user might choose this option if they submitted a very large order that they really don't want to fill, or if they just prefer the security guarantees of doing things on-chain.
An on-chain cancellation could still fail if the order fill is processed in the same block as the cancellation and is mined in first. This situation could arise if an order is submitted that is immediately profitable for a Keeper to fill and the user does not cancel it quickly enough.

Move funds off the wallet

As orders are just signed messages, the tokens are not actually committed to the order and remain under the user's full control. If they are transferred out of the wallet, the order will not be filled. Note that this is only equivalent to a hard cancellation if all of the sell token is transferred out for the duration of the order; any amount of the sell token left in the wallet maybe be subject to a partial order fill.