How Tyto works

Overview

Tyto runs trading rules on Elysium: recurring buys, limit buys, take-profit ladders, stops and sliced orders, on any token with a Uniswap v4 pool. A rule is created once and then executes on its own. Until a run happens, nobody can read what the rule will do.

There are three parts, and each is small on purpose:

  • The rules contract holds a rule’s funds and one Merkle root per rule. It enforces every limit of a run at the moment the run reveals itself.
  • The keeper holds the sealed runs, encrypted, and sends each one when it is due. It pays the gas.
  • Your browser builds the rule, seals it, and keeps the key of the account that owns it.

How a rule is sealed

A rule is a list of runs. A recurring buy of ten parts is ten runs; a take profit in three steps is three; a stop is one. Your browser builds the list, then:

  • gives every run a random 32-byte salt, so a run cannot be guessed from its hash;
  • shifts each scheduled run at random inside its window and splits the sizes unevenly, with the browser’s secure randomness;
  • places the runs at random positions in a tree of at least 32 leaves, at least twice the number of runs, and fills every other place with random leaves;
  • hashes the tree to one root.

The chain receives the root and the funds. Because of the padding, neither the root nor the length of a proof says how many runs a rule has. Because of the salts, a run that has executed says nothing about the ones that have not.

The leaf

One run is one leaf. These are its fields, in order. The contract enforces each of them when the run executes.

keyThe Uniswap v4 pool: both currencies, fee, tick spacing, hook. Native HYPE is the zero address.
zeroForOneThe direction of the swap.
amountInThe exact size, or the cap when the run is a share of the balance.
shareBpsWhen set, the run trades this share of what the rule holds (used by take profits and stops, which sell what earlier runs bought).
notBefore, notAfterThe window in which the run may execute. Outside it, the contract refuses.
condition, triggerSqrtPriceX96A price level read from the pool itself: none, at or above, at or below.
maxSlippageBpsThe most the run may lose against the pool’s price at that moment, pool fee included.
minOutAn absolute floor on what the rule receives. This is the price guard: it holds even if the pool’s price was pushed just before the run.
salt32 random bytes.

The leaf’s hash is keccak256(keccak256(abi.encode(leaf))). Pairs are hashed in sorted order, so a proof is a plain list of hashes.

How a run executes

When a run is due, the keeper calls execute(ruleId, leaf, proof). The contract verifies the proof against the root, checks that the leaf has not been used, checks the window and the price level, then swaps through Uniswap v4 from the rule’s balance back into the rule’s balance. It refuses the swap if the output is under the slippage limit or under the floor. The output never goes anywhere but the rule.

Only keepers and the rule’s owner can call execute. If you would rather not depend on the keeper, sign a permission for any account you like and it can call executeWithPermit for that one leaf. Your browser holds every leaf of your own rules.

Owning a rule

Each rule is owned by its own account, whose key is derived in your browser from one signature of your wallet. The key never leaves the browser and the account never needs gas: it signs, and anyone can deliver the signature. Three actions exist, each with a nonce and a deadline:

  • Pause and resume. A paused rule executes nothing.
  • Cancel. Final. The funds stay yours to withdraw.
  • Withdraw. Any amount of any currency the rule holds, to any address, at any time, whatever the state of the rule.

Sign the same wallet message on another device and the same accounts come back. The sealed runs are kept in your browser and by the keeper; the keeper returns them only to a request signed by the rule’s own key.

The shield

Funding a rule straight from your wallet leaves one public link: the deposit. The shield removes it. You deposit notes of a fixed size (0.1, 1 or 10 HYPE), which join every other note of that size. Later a zero-knowledge proof shows that you own one of the notes without saying which, and moves it into a new rule owned by a fresh account. A relayer sends that transaction and takes its fee from the note, so the fresh account never appears as a sender.

The shield is built on the Semaphore contracts and circuits, which are audited and whose trusted setup was a public ceremony. Tyto adds no cryptography of its own. It opens with the launch. Its privacy is as strong as the number of notes of the same size that sit in it: the app shows that state before you rely on it.

What stays public

Elysium is a public chain. Tyto hides intent and identity. It does not hide history.

PublicA deposit into the shield. The amount a rule holds. Each swap, once it has happened, with the leaf that allowed it. The address you withdraw to. If you fund a rule from your wallet, the link between the two.
HiddenWhat a rule will do next. The size and time of each coming run. Your price levels. How many runs are left. With the shield, who is behind a rule.
Known to the keeperThe runs of the rules it executes, because it has to send them. It stores them encrypted, publishes nothing before a run executes, and cannot move funds anywhere but through the limits of a leaf.

Fees and the token

A run pays 0.30 %, taken in HYPE on whichever side of the swap has it. The contract cannot be set above 1 %. There is no fee to deposit, to withdraw, to pause or to cancel, and the keeper pays the gas of your runs.

Run fees buy TYTO on the open market and burn it. Each buyback will be listed with its transaction once the token is live.

Risks

  • Market. A rule trades real tokens at real prices. A stop is not a guarantee: in a fast fall the price it gets can be well below its level, bounded by the limits in its leaf.
  • Liquidity. A run that cannot meet its slippage limit or its floor does not execute. It tries again until its window closes.
  • Software. The contracts are public, verified and tested against real pools. They have not been audited by a third party.
  • The keeper. If it stops, nothing is lost: your funds stay withdrawable by your signature and your runs stay executable with your permission.
  • Your browser. The key of a rule account comes from your wallet’s signature. Whoever controls your wallet controls your rules.

Contracts

Elysium, chain 99901.

RulesDeployed with the launch
VenueDeployed with the launch
ShieldDeployed with the launch
Uniswap v4 PoolManager0xE2e105d3F7209A9DA11f83cCf3E7398a753823F1

Ready? Open the app, or read the receipts of the runs so far.