A public treasury whose daily keeper is chosen by continuous auction, and whose power arrives as a scoped NEAR access key that the contract mints on itself and deletes when the day ends. The key can speak and give. It cannot take.
- Treasury (testnet):
commons.dk-dave.testnet - Take the seat from a browser, no install: https://daykeeper-tau.vercel.app/act
- Recorded run, every transaction linked:
docs/demo-run.md - Product review and the reasoning behind the current design:
docs/product-review.md
One round end to end. Open the larger version: docs/diagrams/daykeeper-day.html.
Drawn as phases for readability; in the contract they overlap. There is one clock, round_end_ns: the moment settle() seats a keeper it starts the next round, so bidding for tomorrow runs while today's keeper still holds the keys. At that same instant the keeper's grant and say start refusing with the keeper's day is over, and the keys are deleted from the account at the next settle.
A treasury shared by strangers needs someone to decide who gets the money. A multisig needs a council, a token vote needs turnout, a grant committee needs trust — and all three hand custody to a permanent class of approvers.
Daykeeper replaces the approvers with a clock and a market. Each round, the right to run the
treasury for one day is sold to the highest bidder. That person receives two keys on the
treasury account: one may call grant, one may call say. Neither can attach NEAR, so neither
can move the principal. Both die at the deadline, because every privileged method re-checks
block_timestamp — not because a job deletes them.
The grant is an absolute amount fixed at launch, not a percentage of the pool:
you bid 0.20 NEAR → you may hand out 1.00 NEAR today, to anyone but yourself
That gap is the product. It is a charity-auction dynamic: you are buying the right to be the one who gives, in public, on a permanent record. The pool does not drain — one capped grant leaves per round and bids keep refilling it.
| Attempt | Result | Enforced by |
|---|---|---|
| speak as the treasury | ✅ | voice key scoped to say |
answer one ask, up to give |
✅ | grant key scoped to grant, one per round |
| grant a second time in the same day | ❌ | keeper_grants_left |
give more than give |
❌ impossible | the amount is min(give, pool), fixed at launch |
| name themselves as the recipient | ❌ | recipient != keeper |
| fund an ask but pay someone else | ❌ | the ask's asker must be the recipient |
call grant with the voice key |
❌ | key scope |
| transfer NEAR out | ❌ impossible | a function-call key cannot attach NEAR |
| act one second after the deadline | ❌ | block_timestamp check in every method |
| keep acting after the day ends | ❌ | the key is deleted at the next settle |
The recorded run refuses six of these against a live treasury and prints the chain's own
sentence for each — e.g. Smart contract panicked: the keeper cannot name themselves.
Anyone may post an ask (one line + an amount) for a fee of 0.01 NEAR. The fee is not a toll: it goes into the pool the ask is asking, so the queue funds the treasury it addresses. The keeper answers one ask per day, and the grant records which ask it answered.
This is why the seat is worth holding: not "fund anyone", but "choose, today, out of what people actually asked for".
Two minutes, screen-recorded from the live deployment, narrated: the pool, a browser taking the seat with client-minted keys, the clock running out, the bell, the keys installed on the treasury, and the chain refusing the keeper's attempt to pay itself.
docs/daykeeper-demo.mp4 — rendered from open-video-demo;
the story and scene list live in that repo under videos/daykeeper/.
Hosted, no install: https://daykeeper-tau.vercel.app/act
- Mint your two keys in the page (the private halves never leave the browser).
- Ask the demo faucet for a funded testnet account — or paste your own throwaway key.
- Bid. If you are outbid, the contract refunds you in the same transaction.
- When the round ends, ring the bell (permissionless). If you won, your keys are installed.
- Speak as the treasury, answer an ask, then press send the pool to myself and watch the chain refuse you with its own error text.
From a terminal, the same path:
pnpm install
node scripts/state.mjs # the whole ledger + installed keys
node scripts/ask.mjs dk-erin.testnet "bus fare" 0.3 # post an ask (0.01 NEAR fee → pool)
node scripts/bid.mjs dk-alice.testnet 0.2 # mints your two keys locally
node scripts/settle.mjs # anyone, once the round is over
node scripts/say.mjs .keeper-voice-dk-alice.testnet "…" # signed as the treasury
node scripts/grant.mjs .keeper-grant-dk-alice.testnet --ask 1 "…"
node scripts/refuse.mjs .keeper-grant-dk-alice.testnet .keeper-voice-dk-alice.testnet
node scripts/demo.mjs # the whole story; exits non-zero on any deviation
node scripts/keeper-agent.mjs # a keeper that is not a person
node scripts/verify.mjs # 12 invariant checks against the live chain; exit 0The contract, the two keys it installs on itself, and every call either of them can make. Larger: docs/diagrams/daykeeper-keys.html.
No backend, no cron, no keeper service. contract/ is one Rust file with no setters; scripts/
is the auditable CLI; web/ is a Next.js page that reads the contract directly over public RPC
and can sign in the browser.
node scripts/verify.mjs→ 12 checks against the live chain, exit 0. Re-reads the contract, the account's installed key scopes and the whole grant history, and fails if any claim in this README does not hold.cargo test --target x86_64-unknown-linux-gnu→ 18 tests, each refusal asserted verbatim.node scripts/demo.mjs→ exit 0, and prints a linked transaction for every claim. If any expected refusal is not refused, or a key is not installed, or the grant moves the wrong amount, it exits non-zero.node scripts/state.mjs→view_access_key_liston the treasury showing exactly the two scopes the contract installed.- Read the recorded run:
docs/demo-run.md.
Real, on testnet, with hashes: the auction and same-transaction refunds; the handover of two scoped keys; the keeper speaking and answering an ask with no NEAR of their own; six refusals; the deadline deleting both keys; a keeper account created by the in-page faucet and driven entirely from a browser.
Deliberately constrained: launch parameters are immutable — changing the round length or
give means a new deployment, because a treasury with an admin key is a treasury with an admin.
Rounds are 30 seconds here so a judge can watch one end; a day on mainnet.
Not built: the voice writes to contract state. On mainnet the same key shape points at
near.social's social account, which does not exist on testnet — a mainnet seam, not a claim.
Sputnik DAO / Trezu integration is the obvious next step and is not done. Wallet-connect bidding
is not wired: the page signs locally with a key you control, which needs no extension.
- Identity is the signing key. A keeper's key lives on the treasury account, so
predecessor_account_idis always the treasury. Every privileged method comparesenv::signer_account_pk()against the exact key the contract issued. A predecessor check compiles, looks right, and can never pass. - Build with
--cfg nearor your error messages disappear.near-sdk-envonly compiles its host panic path forall(near, target_arch = "wasm32");cargo near buildsets that flag and a plaincargo builddoes not. Without it every failedrequire!reaches the chain asWebAssembly trap: An 'unreachable' opcode was executedand the reasons — the whole argument of this contract — are invisible.contract/.cargo/config.tomlsets it for the wasm target.
Three strong entries in this track put graded authority over a DAO treasury: Petty Cash (budgets with rules inside a Sputnik DAO), Patch Fund (tiered payouts by earned trust) and Potluck (allowances = reputation × unit, endorsements pay rewards). All three decide how much someone may spend, by rules.
Daykeeper decides who holds the authority, what it costs, and when it ends — and the ending is
not a policy, it is a key the chain deletes. The auction is the allocation mechanism, the day is
the term limit, and the scope is enforced by the protocol rather than by an if in a contract.
MIT — see LICENSE. The contract, the scripts, the console and the diagrams are all
under it; use them however you like.

