
on the name
felix hausdorff was a german mathematician who spent the first half of the twentieth century working out what it meant for a shape to have a dimension that is not a whole number. a line, he wrote, has dimension one. a plane has dimension two. a coastline, with bays inside bays inside bays, each smaller than the last and shaped roughly like the larger ones, has a dimension somewhere between the two, a number that captures how much detail the shape carries as you zoom into it. the idea was published in 1918, decades before anyone called such an object a fractal and decades before any computer existed that could draw one. hausdorff did not live to see his theorem applied to anything. he and his wife took their own lives in 1942 to avoid deportation to a nazi camp. fifty years later benoit mandelbrot recovered the construction, gave it the name it carries now, and showed that the non-integer dimensions hausdorff had defined as a piece of pure measure theory were in fact the right way to describe coastlines, lungs, lightning, river deltas, turbulent flow, and, eventually, the price of risky assets. the dimension that bears hausdorff's name has outlived everything else about him.
on roughness
what does an honest market look like? traders, economists, and protocol designers have spent a century looking for a number that distinguishes real order flow from synthetic order flow, and the cleanest answer does not come from finance. it comes from geometry. a price trajectory, plotted against time, is a path. the path has a fractal dimension, a number that measures how much detail it contains as the time resolution gets finer. a perfectly smooth trend has dimension one, because zooming in reveals nothing new. pure white noise has dimension approaching two, because every scale contains the same density of detail as every other scale. real markets, when they are honest, sit somewhere between these two extremes, and the exact place they sit is not arbitrary.
the hurst exponent is a constant that characterizes how much a stochastic process drifts versus how much it noises. for processes with no memory, no manipulation, and no coordinated flow (the kind of process you would expect from a market made up entirely of independent participants acting on independent information), the hurst exponent sits near 0.618, which is, not coincidentally, the inverse of the golden ratio. the fractal dimension of such a process is two minus the hurst exponent, which works out to approximately 1.382. this is the dimension of an unmanipulated market. it is not a target. it is what naturally happens when nothing is being done to the price.
a market that drifts above this dimension is being chopped, wash traded, sandwich attacked, or otherwise subjected to coordinated high frequency noise that adds roughness without adding information. a market that drifts below it is being walked, with a whale or a coordinated group pushing the price in a straight line and suppressing the natural noise the market would otherwise produce. in both cases the dimension deviates from 1.382, and in both cases the deviation is measurable, which means it can be priced, which means it can be charged for.
on hooks
in november 2024, uniswap shipped its fourth major protocol revision and introduced a primitive the previous three versions had deliberately refused to expose. the primitive was the hook, a contract that pool deployers could attach to the moments immediately before and after a swap, immediately before and after a liquidity modification, and immediately before and after the pool's initialization. the hook ran inside the same transaction as the swap, with access to the swap's parameters, the pool's state, and the authority to modify both. it was the first time in the history of automated market makers that anyone other than the protocol itself could write logic that executed during a trade.
what hooks made possible was a class of mechanisms that had been theoretically describable for years but operationally unbuildable. dynamic fee curves that responded to volatility in real time. directional fees that charged buyers and sellers asymmetrically based on the recent imbalance of flow. mev capture mechanisms that priced in the value of the arbitrage a swap was about to create and rebated it to liquidity providers. limit orders, time weighted average makers, oracle integrations, and the entire surface of what came to be called intent based design. before v4 every one of these mechanisms required either a fork of the underlying pool or a router contract that wrapped the pool from the outside and could be bypassed by sophisticated traders calling the pool directly. v4 hooks made the mechanism inseparable from the pool. there was no version of trading through the pool that did not invoke the hook, because the pool's swap function called the hook itself, in line, before settlement.
solana arrived at the same primitive through a different door. the token-2022 program, deployed in 2023 as a successor to the original spl token program, introduced a feature called the transfer hook extension. the extension allowed a mint creator to attach a program that would be invoked on every transfer of the underlying token, regardless of which program initiated the transfer. where uniswap's hook fires when a specific pool's swap function is called, solana's transfer hook fires one layer lower, at the token movement itself. the hook runs when a dlmm pool executes a swap. it also runs when an arbitrage bot routes around the pool through a different venue. it runs when a holder sends the token to a friend, when a market maker rebalances inventory between two accounts, when a liquidator seizes collateral. there is no path through which the token moves that does not pass through the hook, because the hook is part of what the token is.
this is a stricter guarantee than uniswap v4 provides. v4 hooks are pool scoped. a token that trades on a hooked v4 pool can also trade on a v3 pool, on a v2 pool, on a balancer pool, on a curve pool, on any of the hundreds of forks of any of those, and the hook on the v4 pool sees none of it. the v4 hook is the strongest commitment you can make about behavior within a single pool, but it is silent about everything outside that pool. solana's transfer hook is the opposite. it is silent about which pool, which venue, which route, and instead commits to the only thing that matters, which is that no token can move without the hook running first. hausdorff exists because of this distinction. the protocol's correctness depends on observing every price discovery event, and on ethereum it would be possible for a sophisticated trader to route around the observation. on solana it is not possible.
on the program
hausdorff is a solana mainnet program that does one thing. it is deployed as a token-2022 transfer hook on the hausdorff mint, registered as an extension on a meteora dlmm pool for the hausdorff/sol pair, and given no other responsibilities. on every swap routed through the dlmm pool, the pool's core program invokes the spl token-2022 transfer instruction, which in turn invokes hausdorff's execute instruction through cross program invocation before the transfer settles. the program is given the swap's amount, the input and output mints, the source and destination accounts, and a set of extra accounts declared in the mint's extra account metas list at deployment. it returns a single value, the surcharge to be withheld from the input amount before the transfer completes.
on each invocation the program reads the dlmm pool's currently active bin id and the bin's corresponding price, both stored in the pool's account data and fetched in a single account read. it appends the (slot, bin_id, price) tuple to a 256 entry circular buffer maintained in a program derived address with seed ["bins", mint_pubkey]. the buffer is a fixed layout struct that fits inside a single pda account well under the ten kilobyte limit, so the per swap account allocation is zero. every write reuses the same slot in the same account. the buffer's head pointer advances on each write, wrapping at 256, and the program maintains a parallel array of cached sub window length sums that are carried forward from the previous swap so the dimension estimate can be updated in constant time rather than recomputed from scratch.
with the buffer updated, the program computes a rolling estimate of the price trajectory's fractal dimension using the higuchi method. higuchi is one of several known algorithms for estimating fractal dimension from a discrete time series, and it is the one that fits inside a solana program's compute budget because it can be expressed entirely in terms of summed absolute differences between points at fixed lag intervals, with no exponentials and no logarithms beyond a single final fit. the method evaluates the curve's length at six lag values, 8, 16, 32, 64, 128, and 256 slots, and fits a line through the log log plot of length versus lag. the slope of that line, negated, is the dimension. the fit is performed in anchor's i128 fixed point arithmetic with a precomputed log table for the six lag values, so the entire estimate completes in a deterministic and gas bounded sequence of integer operations that the program has measured at under one hundred eighty thousand compute units in the steady state.
on the surcharge
the program compares the current dimension estimate to the natural reference of 1.382, takes the absolute difference, and squares it. the result is multiplied by a fixed scaling constant baked into the program at deployment, and the product is the dynamic surcharge applied to the swap. the base swap fee is whatever the meteora dlmm pool's bin step defines for that pair, and the dynamic component sits on top of it. the surcharge is withheld from the swap's input amount through the token-2022 transfer hook's standard return value, which the token program respects atomically before the transfer balance is updated. a swap that arrives during a smoothly walked trend, with dimension near 1.05, pays roughly fourteen times the base fee. a swap that arrives during a wash traded chop, with dimension near 1.85, pays roughly twenty two times. a swap that arrives during conditions near the natural dimension pays nothing beyond the base.
the surcharge is routed to a redistribution vault, a separate program derived address controlled by the hook program and holding a single immutable allocation function. the vault receives the surcharge tokens at the moment the swap settles and accumulates them across many swaps. when the vault's balance crosses a threshold set at deployment, the program distributes the accumulated balance in two parts. half is paid to the liquidity providers whose positions span the bins that were active during the surcharged swaps, weighted by the time and liquidity integrated exposure of each position to those bins. the other half is paid to holders of the underlying token, weighted by a holding time score computed from each wallet's first acquisition slot, which is stored in a per holder pda written on first receipt and never updated thereafter except to extend its tenure.
a holder who has held for a million slots receives a larger share than a holder who has held for ten thousand, and a holder who sells loses their score entirely, resetting to zero on next acquisition. the asymmetry is intentional. the protocol charges the wallets that introduce roughness or smoothness against the natural dimension, and it pays the wallets that have done neither for the longest. the surcharge is not a tax. it is a transfer from one population to another, mediated by a measurement that neither population can directly observe but both populations affect.
on the substrate
solana is the right substrate for this because three of its properties combine to make the measurement legible. the slot time is roughly four hundred milliseconds, fast enough that a price trajectory's fractal dimension resolves in seconds rather than minutes, and a manipulation detected in slot n can be priced into the swap that occurs in slot n plus one. the token-2022 transfer hook extension is atomic with the transfer itself, so there is no window between the dimension computation and the surcharge application during which a sophisticated actor could front run the protocol's own measurement. and the program's storage model, with fixed layout accounts at deterministic addresses, means the entire dimension state is visible to any client without traversing event logs or reconstructing history from chain replays. a wallet can read the buffer, run the higuchi method itself, and confirm the dimension the hook is about to charge against. nothing about the protocol requires trust in the team, because there is no team to trust.
the program is deployed through the bpf upgradeable loader with its upgrade authority set to None at deployment, which seals the on chain bytecode against modification. there is no admin key, no migration function, no multisig controlling the vault, no proxy redirecting calls to a newer implementation, no governance contract that can be voted into existence later. the program's address is fixed. the bytecode at that address is fixed. the allocation function inside the vault is fixed. the only variable is the dimension, and the dimension is whatever the chain produces.
on the curve
the bonding curve plotted above is not decorative. it is the actual minting function written into the program. total supply equals twenty one million multiplied by the quantity one minus e raised to the negative cumulative sol divided by eight hundred fifty. the curve approaches twenty one million asymptotically and never reaches it. minting does not stop. each successive unit of supply costs exponentially more cumulative sol than the unit before it, so the practical effect is that the supply approaches the cap at a rate that slows without bound, and the marginal cost of the next token approaches infinity without ever arriving there. there is no graduation event, no listing milestone, no cliff at which the bonding curve hands off to a separate market. the curve is the same on the first slot of deployment and on the ten millionth slot after. the same function governs both the price a buyer pays and the price the protocol records as the active bin for the dimension calculation, which means the curve and the measurement are reading from the same source.
on the invariant
there is one constant inside the program, the natural dimension 1.382, and one observable computed at every slot, the running dimension of the price trajectory. when the observable approaches the constant, the protocol does nothing. when the observable deviates from the constant, the protocol charges proportionally to the square of the deviation and pays the holders who walked the curve honestly. there is no team. there is no treasury. there is no governance forum, no token vote, no parameter that can be changed by anyone after deployment. the protocol is the measurement, and the measurement is the chain.
