Concepts

Hooks

A hook is a public record that describes one instruction of a program that already exists. It says which program to call, what bytes to send and which accounts to pass, with marked places where a run's own values go. Once a hook is published, that instruction can be called from a private balance. The program it describes is not changed and is not asked.

What a hook holds

A hook is one account owned by the Pook program. Anyone can read it. The registry shows every one.

PartWhat it is
NameThe id people run it by, such as jupiter.swap. Up to 48 bytes. The hook's address is derived from it, so a name can be published once.
AuthorThe wallet that published it. It earns the author's share of every run.
Target programThe program the hook calls.
Kindflow for an action that completes in one run, seat for an action on a position that stays open.
Mint in, mint outWhat may go in and what comes back: nothing, any mint, SOL, or one named mint.
Data templateThe instruction's bytes, with slots.
Account slotsThe instruction's accounts in order, each a slot.
CompanionsInstructions that must be in the same transaction.
SOL handlingWhether SOL going in is wrapped first, and whether wrapped SOL coming out is unwrapped.

The data template and its slots

The data template is the instruction data as the target program expects it, up to 256 bytes, with the values that change from run to run left blank. A data slot says where one of those values goes. A hook has up to 16.

SlotWhat the program writes there
Amount inThe run's amount in, as 8 bytes, little-endian.
Minimum outThe run's minimum out, as 8 bytes, little-endian.
Caller sliceThe next bytes the caller supplied, at a fixed place and length.
Caller tailWhatever the caller supplied after that, appended to the end.

The first two are how Pook's promise reaches the protocol: the amount the proof fixed is the amount the protocol is told to take, and the minimum the proof fixed is the minimum the protocol is told to give. Caller slices and the tail carry values only the caller knows at run time, such as a swap's route.

Every byte the caller supplies must be used by a slot. Bytes left over fail the run.

Account slots

An instruction's accounts are listed in the order the target program reads them, up to 48. Each one is a slot of a kind, with its writable flag.

SlotThe account passed
FixedOne address written into the hook: a pool, a market, a program.
StagePook's stage, the address that signs the call.
Stage inThe account holding the run's amount in. It belongs to the stage in a flow hook and to the seat in a seat hook.
Stage outThe account the result arrives in, owned the same way.
SeatThe seat. Seat hooks only. It can sign.
PayerThe relayer. Seat hooks only, for protocols that need someone to pay rent.
CallerOne account the caller supplies.
Caller remainingAll the accounts the caller supplies after that. One per hook.

The stage and the seat sign through the program, and in a seat hook the relayer can be passed as a signer. Fixed accounts and accounts the caller supplies are never signers.

What a hook can reach

A hook's call is given the stage accounts, the seat if it is a seat hook, and whatever fixed and caller accounts it names. The stage receives one run's amount in, and the program counts only what changes in the stage during that run: the result goes to the holder, and so does any input the protocol left unused.

The program refuses to pass any of its own accounts to a hook's call. That covers the Pook program and its authority, the config, the hook account, the Solana Privacy Program and its tree and vault accounts, the fee accounts and the seat's state account. A hook cannot target the Pook program, the Solana Privacy Program, the System program or the upgradeable loader.

The authority that owns every holder's notes signs only the calls to the Solana Privacy Program. It is never an account of a hook's call.

So the most a hook's call can touch is the amount one run sent to the stage. After the call the program measures what came back, and less than the run's minimum out fails the whole transaction.

Flow hooks and seat hooks

A flow hook takes an asset and gives one back in the same run: a swap, a supply, a stake. It must name an asset in.

A seat hook acts on a position that stays open at the protocol. It names the seat among its accounts, and the run presents the note that commands that seat. Seats covers them.

The 9 hooks Pook published at launch:

HookTypeMeaning
jupiter.swapflowOne asset in, another out, at Jupiter’s route.
kamino.supplyflowAn asset in, its Kamino deposit token out.
kamino.withdrawflowA Kamino deposit token in, the asset out.
jito.stakeflowSOL in, JitoSOL out.
jito.unstakeflowJitoSOL in, SOL out.
kamino.collateral.depositseatCollateral in. The first deposit opens a seat.
kamino.borrowseatBorrows against a seat’s collateral. The borrowed asset comes out.
kamino.repayseatAn asset in, the seat’s debt down.
kamino.collateral.withdrawseatCollateral out of a seat.

Companions

Some protocols need other instructions beside the main one. Kamino wants its reserves refreshed in the same transaction before a deposit or a borrow.

A hook can name up to 8 companions: a program, the first bytes of the instruction's data, and whether it has to come before the run. The program checks that each one is in the transaction. Companions are permissionless instructions that the relayer adds to the transaction. The stage does not sign them.

Resolvers

A hook says where the caller's bytes and accounts go. A resolver finds them for one run. For jupiter.swap the resolver asks Jupiter's API for a route and turns it into the caller tail and the remaining accounts. For the Kamino and Jito hooks it derives them from chain state.

A quote runs the hook's resolver and returns the resolved call. That resolved call is what your proof fixes.

A published hook does not change

There is no instruction that edits or removes a hook. A proof names the hook by its address, so what a holder agreed to run is what runs.

A new version is a new hook under a new name. The old one stays in the registry and keeps working.