Creating Historical Onchain Data In The Absence Of It.

381e35

381e35

8/24/2026

#plugs#database#strategy
The blockchain has no memory.
Ask it for your balance and you get an exact answer. Ask it for a price, a rate, the value of a vault share, and you get an exact answer. Ask it what any of those were last Tuesday and you get nothing, because the chain only ever knows the block it is in. Every number onchain is a photograph, and the album is empty.
Almost everything you actually want to know about your money is a comparison across time. Did this position make money. How far has my portfolio drifted from the mix I chose. What did I pay for this. Is the yield going up or down. Every one of those is two photographs and the distance between them, and the chain only holds one photograph at a time.
For years the industry solved this by leaving the chain. Someone runs an indexer. Someone publishes a feed. Someone runs a bot that remembers on your behalf. Your strategy ends up depending on a server you do not control, and any asset whose defining number is calculated in an office somewhere gets written off as impossible to automate. Tokenized treasuries. Real estate tokens. Anything whose yield is announced rather than observed.
We spent a month running into that wall, and the way through was hiding in something Plug had already shipped.

The Number That Isn't There

Pendle publishes an underlying APY for every market. Every trader looking at a yield trade looks at that number first. We went to add it as an action so a plug could read it and act on it, and it turns out it does not exist onchain. Anywhere. At any block.
It is a seven-day moving average. By Pendle's own definition it is the change in a vault index across a week, annualized:
(syIndex / prevSyIndex) ^ (365 / days) - 1
Read that as a question you are asking the chain: what was this number a week ago compared to today. The chain cannot answer, because the chain does not know what anything was a week ago. The most-watched number on the platform is something Pendle's servers compute and hand you, and the chain has never seen it.
We could have stood up a feed and pretended the number came from the chain. Instead we asked why anyone needed the number in the first place.

You Never Needed The Yield

What you want to know is whether the position made money. An APY is one way of describing that. There is a much better one, and it is already sitting onchain.
Yield can only reach a chain as a price. A vault that earns has to show that earning in what one share is worth, otherwise nobody could ever withdraw the earning. Every single day, the exact result of every trade, fee, and interest payment that vault ever made is compressed into one number: the share price.
So a share price at block A against the share price at block B is the yield. Exact. Verifiable by anyone. No oracle, no feed, no one's spreadsheet. Two reads and a subtraction, and you are holding the number Pendle's servers spend a week averaging toward.
The catch is that you have to have written the first number down.

What Dies And What Doesn't

A plug is deliberately forgetful. When a run finishes, every value it computed along the way is gone. That is a feature. It means a run is a sealed object you can read top to bottom, and nothing you did last week is secretly steering what happens today.
One thing survives. The Database protocol gives a plug durable storage on the chain itself. Plain values, keyed maps, maps inside maps. Write a number this run, read it back next run, next month, next year. No server holding the real copy while the chain holds a stale one. The memory lives in the same place the money lives.
Every value belongs to something: your wallet, one plug, or one exact version of one plug. Two automations can never trample each other's numbers, and a strategy you rewrite does not wake up carrying stale state from the strategy it replaced. Without that last rule, durable memory is a loaded gun.

The Turn

The chain can only tell you about now. The database can write a "now" down and hand it back later.
Put those together and a plug does not need to find historical data. It creates it. Every run writes one sample. Run it every hour for a month and you own a 720-point time series that was never published anywhere, that no indexer ever produced, that exists onchain because your plug put it there.
The numbers you care about most were never going to have a publisher. Your cost basis. Your drift from your target. What this specific market paid you, specifically. Nobody was ever going to build a feed for that. Nobody has to. The strategy writes down what it saw, and the history is yours from the first sample.

Somebody Already Built It

While we were arguing about Pendle's APY, Elise had already done this.
Elise is on our team. She runs live capital through plugs she builds herself and writes up what she learns: faviconcomposable logic blocks, favicona fleet of plugs on Morpho, faviconcapturing upside on Aave loops, and faviconthe Glider rebuild these two plugs come from. Nobody on the team has shipped more strategies, and she got to memory before we did.
The first plug takes a token and a window. It gets the current time and rounds it down to the start of an interval. It reads a Chainlink price, which is spot, exact, and the only thing Chainlink will ever give you. It writes that price into a map keyed by token and by time bucket. Then it reads the previous buckets back, adds them up, and divides.
That is a moving average of a price Chainlink does not average and never will. Traders pay for this on every chart they open. Here it is computed onchain, by the strategy, from a series that did not exist in the world until this plug started writing it.
The second plug uses it as an input. Target weights written to a map, the moving average pulled in through a use, and a rebalance executed against a number that is the product of the strategy's own history. No part of it touches a server.

The Shapes Worth Knowing

Once a plug can remember, most strategies that seemed to need an oracle turn out to need one of four things instead.
Lock instead of measure. Pendle's implied APY is onchain and exact, because it is a price. "Buy the fixed rate when it clears 4%, roll at expiry" needs zero outside input. You are not measuring a yield. You are buying one.
Compare instead of judge. "Is 4% good" needs the outside world. "Is Pendle's fixed rate higher than what Aave is paying me this block" is two exact reads and a comparison. Almost every threshold anyone actually wants is a comparison wearing a level's clothes.
Convergence. A principal token walks to par on a known date. Its price and its time to expiry are both onchain and both certain. Nothing to forecast.
Measured yield. Write the share price. Read it next run. Act on the difference. This one does not care whether the yield was earned in a pool or declared in a press release. If it moved the share price, you can measure it. If it did not move the share price, it was never yours.

What This Reopens

The assets everyone gave up on were given up on for a bad reason.
A tokenized treasury. A real estate token. A fund share that accrues in an office and settles onchain. All "unautomatable," because their yield is defined somewhere you cannot read. You were never going to read it. You were going to read the price twice and subtract, and that works for every one of them, without asking the issuer for anything and without trusting anyone's arithmetic but your own.
For the record, the Pendle number that started this: on the wstETH December 2027 market, the onchain fixed rate is 2.11% and the off-chain underlying is 2.29%. Eighteen basis points, in exchange for a dependency on someone else's server. Never worth it.

Plans With Memory

The protocol's own description says it in one line:
Plans without memory repeat themselves; plans with memory compound.
Every automation ever written has hit the same moment: the run ends, and everything it learned dies with it. The next run starts blank, does the same work, and reaches the same conclusion, or does the same work and reaches a different one.
A plug that remembers stops repeating itself. A cost basis written the day the position opened, checked on every run since. A counter that caps how many times a rule may fire. The last price a strategy acted on, kept so it only moves again when the move is real.
Nobody has to watch it. Nobody has to publish anything. The strategy carries its own history, onchain, and it gets longer every time it runs.

Creating Historical Onchain Data In The Absence Of It.

Back