Skip to content

Repository files navigation

LedgerKeep

LedgerKeep keeps Soroban contract state from expiring.

Every piece of data a Soroban contract stores has a time-to-live measured in ledgers. When it runs out, the data is archived: persistent entries can be restored, but at a cost, and a contract's instance and code become unusable until someone restores them. There is no way for a contract to watch its own data approach expiry, because a contract cannot read its own time-to-live while it runs.

Today every protocol handles this alone, with a script someone remembers to run. There is no shared tooling, because there is no standard way for a contract to say which of its stored keys are the ones that matter.

LedgerKeep is that standard, plus the tooling that uses it.

The two halves

On-chain — a Rust crate a contract adopts with one macro, a permissionless registry where contracts publish the keys they want maintained, and a rent vault that pays whoever performs the maintenance. This is ledgerkeep-core.

Off-chain — a command-line keeper that reads a contract's time-to-live over RPC, reports how close each entry is to expiry, and extends the ones running low. This is ledgerkeep-cli.

The split is not arbitrary. A contract can extend its own time-to-live and record that it did, but it cannot observe time-to-live at runtime. Observation has to happen off-chain. So the contracts do the extending and the recording; the CLI does the watching.

How it fits together

A contract adopts the standard. It declares — at compile time — which of its stored keys are critical, and it publishes that list to the registry so tooling can find it. A keeper reads the registry, scans each registered contract's time-to-live over RPC, and calls the contract's permissionless extend_all when an entry runs low. The contract extends its keys and records who maintained it and when. The keeper then claims a tip from that contract's rent vault, which confirms the work happened by reading the record the contract left.

What to read next

Status

Deployed to Stellar testnet. The contracts are unaudited. Do not use them on mainnet with real funds without your own review.

About

Documentation for LedgerKeep — a maintenance standard that keeps Soroban contract state from expiring.

Topics

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors