cluck

Lean all the way down, inside a TEE.

cluck is an operating system written in Lean 4 that boots in an AWS Nitro Enclave or an Intel TDX trust domain with no Linux and no C library under it. A service on it is a function from bytes to bytes. Everything that reads a byte from outside the machine is Lean, and what the machine answers comes back with an attestation you can check.

Source on GitHub Threat model What is done, and what is not
2 TEEsAWS Nitro Enclaves and Intel TDX, each run on real hardware
108 functionsis the whole runtime compiled Lean was measured to need
Same bytesthe image builds twice to the same hash, from a clean clone too
~4 secondsfrom starting QEMU to a TDX guest answering on TCP
The guest

What is in the machine, and what language it is in

The usual confidential VM is a Linux distribution with your program somewhere on top, and its attestation measures all of it. Here the measured image is small enough to read: a service, the drivers and network stack it needs, and a Lean runtime cut down to what compiled Lean actually calls. C and assembly exist only underneath, and never interpret bytes that came from outside.

ServiceLean
A function from a request to a response. The demo answers ping, random, selftest and an attestation over a nonce.
Network, TDXLean
Ethernet, ARP and neighbour discovery, IPv4, IPv6, fragments, routes, TCP, UDP and a DNS resolver, over a virtio device.
Drivers, NitroLean
virtio-mmio, vsock, the attestation device, serial, the server loop.
RuntimeLean, and Lean printed as C
Big-number arithmetic with machine-checked proofs, UTF-8, the allocator, reference counting, arrays, strings, hashing. Held to Lean's own runtime by differential tests, under sanitizers and bare under QEMU.
UnderneathC and assembly, by hand
Closures, start-up and stopping; the boot stub and page tables on Nitro; the firmware calls and the TDX report call on TDX.
2026-11-15 · AWS Nitro

A real enclave, verified off-host

The image CI built ran in a Nitro Enclave, not in debug mode. Its attestation document verified on another machine against the AWS root, with the measurements CI reproduced from source.

2026-11-18 · Intel TDX

An EFI program on its own IP stack

Booted on Intel hardware under KVM. Concurrent TCP streams, IPv6, fragmented UDP and DNS were exercised against it, and the host's quoting service turned its report into a quote that Intel's DCAP library accepted.

No Linux means

The guest cannot be broken the way the host can

The enclave and the machine beside it share no kernel, no C library and no parser. One flaw is not enough to take both. The threat model says where that holds and where it does not.

Attestation

An answer tied to the machine that gave it

A request can carry 32 bytes of the asker's choosing. The response then comes with a TDX report whose REPORTDATA is SHA-256(challenge ‖ request) ‖ SHA-256(response), and the host's quoting service signs that into a quote. Whoever checks the quote learns that a trust domain with those measurements gave this response to this request, after the challenge was chosen.

The repository has a page that does the checking in the browser: Intel's signatures from the quote up to Intel's SGX root key, the signer of the quoting enclave, the debug attribute, and the two hashes computed locally. The server it talks to is treated as the adversary it is.

The demo page after a block with a false state root was sent to the TDX guest: the block is rejected, and ten checks of the TDX quote pass in the browser.
The demo page from evm/demo/. A chain whose last block claims a state root that executing it does not give was sent to the guest. It rejected the block, and the rejection itself is what the quote covers.
What the browser check leaves out: it does not ask Intel whether the processor's firmware is current or a certificate revoked, and the measurements are compared with ones recorded by whoever runs the page. Tying a measurement to a commit means rebuilding the image and booting it on a TDX host of your own.
An experiment on top

Ethereum blocks as the service: checked, and now built

The service in evm/ is Jaune, an executable specification of the EVM written in Lean by someone else, for proofs. Linked against this runtime it becomes a machine that takes blocks, re-executes every transaction, and refuses a block unless the state root comes out as its header claims. The aim is a block builder: the one piece of Ethereum's block market that is run in trust domains today, there on a Linux virtual machine, here with no Linux under it.

Running today, in TDX

Five chains from Ethereum's own test suite, each with its whole starting state in the request. Every answer is the fixture's tip hash and state root, byte for byte, as a process on Lean's runtime, as a process on the minimal runtime, and as a TDX guest.

Test chainBlocksGasIn the TDX guest
highGasUsage110.23M20 ms
DelegateCallSpam18M600 ms
walletReorganizeOwners25938M3.1 s
ShanghaiLove14.5M110 ms

Blocks of the real chain, in the guest

Mainnet's state cannot be sent whole, so a request carries a witness instead: the trie nodes on the paths to what the block touches. The guest checks them against the parent's state root, executes, and recomputes the root. Anything the block read that the witness did not prove is answered with "no verdict", never with a guess. (That sentence was wrong until 21 November 2026: a contract's call to an account the witness left out went unnoticed, and a valid block could be answered invalid. It was found when the node refused a block the guest had built, and it is closed and tested on real blocks now.)

On 20 November 2026, 100 consecutive mainnet blocks (26458315 to 26458414, up to 625 transactions and 60M gas, requests of 2 to 22 MB) were put to the TDX guest, each with a witness from a reth node. All 100 came back valid with the block hash and state root the node reports. The first time through, a block took 10.8 seconds at the median. After a day of rewrites (one step of the pairing check that zero-knowledge proofs use, the recovery of senders from signatures, the check of jump destinations, the reading of witnesses, and an interpreter that copied all of a contract's memory at every write to it) it takes 3.0, between 0.4 and 19. A relay needs about 3.

Building blocks: one is on mainnet

Since 21 November 2026 the guest also builds. Each slot, a program on the host hands it the transactions pending in public and proofs of the state they touch. The guest orders them by what they pay the proposer, runs them, throws out any that read something the proofs do not cover, and answers with a block header and a bid for it, signed with a key it drew when it started and that never leaves it. It is told how long it has, and ends the block with what is in it when that is up. Each block goes first to the node's own validator, which is the code relays run on a builder's block.

Mainnet block 26463293 (21 November 2026, 11:50:59 UTC, hash 0xb24cccb2…b509382b, extra data cluck) was built this way inside the TDX guest and signed by the guest's key. It went to four relays seven seconds before its slot; all four took it, the proposer chose it, and Flashbots, Aestus and Titan list it as delivered under that key. Kept with it is an Intel-signed quote that covers the exact request the guest was sent and the exact reply it gave, the key and signature included, made after the block's parent existed. It won because 0.02 ETH was paid to the proposer on top, by a transaction signed outside the guest: the next bid was 0.0076 ETH, and what the block's own transactions paid was 0.0001.

Mainnet block 26465583 (21 November 2026, 19:31:11 UTC, hash 0x7e4a7ada…b4eb94a9, extra data cluck) goes further. Its last transaction was sealed, in the format of RFC 9180, to a key the guest drew when it started, and was handed to the host as 161 bytes the host could not read. The guest opened it, built it into a block with the second engine below, and posted the block to four relays itself, over TLS 1.3 written in Lean and sitting in the image, to relays and under roots that are part of what the image's measurement covers. The host carried the packets and was told only that one sealed transaction had gone in and that the four relays had said yes. Every frame that crossed the guest's network was written down and searched for the transaction and its signature, and they were not there. Flashbots, Aestus and Titan list the block as delivered under the guest's builder key, and that key had been asked for with an Intel-signed quote two blocks before. It won, like the first, because 0.02 ETH was paid to the proposer on top.

Mainnet block 26470277 (22 November 2026, 11:12:23 UTC, hash 0x346e9070…e6f5281e, extra data cluck) closes what the second left open. There the host had to prove the sender's account to the guest, and so knew whose transaction it was carrying. Here the sender sealed the proofs in with the transaction, a call to a contract from an account of its own, 16 KB in all. The guest, which holds none of the chain's state, was shown each new block with that block's witness, checked it, and brought the proofs forward itself. The host was asked nothing about the account or the storage the call reads. Everything the host handled, 20 MB of it, was searched for the transaction, its signature, the account's address and the storage slot, and none was there. Ultra Sound and Titan list the block as delivered under the guest's builder key. The 0.02 ETH that won the slot came from a different account, in the open.

An hour of bids, unpaid (22 November 2026). The guest now builds for a slot again and again until half a second before it, not once when the parent arrives, and sends each better block to the relays itself. Over 300 consecutive slots it sent 1,432 blocks to Flashbots, Ultra Sound, Aestus and Titan with nothing paid on top. A node's validator, the code relays run, judged every one valid afterwards, and no relay refused one. None was chosen: a block of ours paid a third of what the chosen block paid, at the median, and never more. The reason is measured too. Of the transactions in the blocks that were chosen, four in ten had ever been public, carrying a third of a block's fees at the median and a tenth of all the fees paid; of that public part ours held nine tenths of what had appeared a second or more before the slot. The rest of a winning block is transactions sent to builders in private, which this builder has none of.

A thousand slots in a row (22 November 2026, blocks 26472890 to 26473889), with the guest building all through each slot and sending to a stand-in for the relay on the same machine. It was never restarted. It sent 6,532 blocks; the validator judged every one valid, every signature checked, and none arrived after its slot had begun. Two slots had no block, both because the block before them came too late to build on in time; and one block of the 6,532 never reached the stand-in, because the host took three seconds to answer the guest's connection, as the recorded frames show. This is the line the earlier runs below did not reach, moved from two seconds before the slot to its start.

Over 1,300 consecutive mainnet slots in the TDX guest, 1,045 blocks were built. The validator judged all 1,045 valid and every signature checked from outside. The other 255 slots were lost in one stretch to a fault in the host program after the chain replaced a block, and one block came back after its slot had begun. A second run built 765 more, all valid and none late, and lost 24 slots to another fault in the host program. The line set beforehand, 1,000 slots in a row each with a valid block two seconds early, was not reached: in 1,810 blocks none was wrong, and every break but the one late block was a slot with no block.

A second engine, written for speed. Jaune was written to be proved about, and it is slow. Beside it in the image there is now an engine of this project's own, in Lean, that holds a 256-bit number in four machine words and undoes a failed call from a journal. It is held to Jaune and to Ethereum's own tests, not proved: it passes all 4,723 files of the chain tests for Prague, Osaka and the forks since, accepting every block it should and refusing every one of the 3,575 it should (the first run found two faults no mainnet block had met); on 121 blocks of mainnet it reproduces every commitment in the block's own header, the state root among them; it passes the same tests of short and wrong witnesses; and over 150 slots in the TDX guest the block it built and signed was, byte for byte, the block Jaune built. Checking a mainnet block takes it 1.1 seconds at the median where Jaune takes 2.6 (as a process on the guest's runtime), and building a slot's block in the guest takes at most a third of the time on the slots that were slowest. With its gas cap raised from 8M to 30M it still had every block ready 3.6 seconds early, and the blocks were no bigger for it: what is pending in public is small.

What this is not, yet: one block is one block, and it was paid for: the builder cannot win a slot on what its blocks earn. The payment was signed on the host, so money and the key that moves it sit outside the trust domain. The request, reply and quote for the block are kept but not published here yet. The second and third blocks each kept one transaction from the host, once, and both transactions were this project's own. In the second the host still learned which account the transaction touched, because the host proved the state. In the third the sender sealed the proofs in with the transaction, and the guest kept them good by following the chain itself, block by block; the host was told nothing of what the transaction touches. In both, sender and host were one program on one machine playing two parts, and what was searched is what the host's part handled. The guest checks that each block it is shown follows from the one before, not that it is the chain validators agreed on. Either way the host learns the length of what was sealed to the nearest 16 KB, when it came, and how long the block took to build; and the relay sees the whole block, as from any builder. The relays also publish, for every bid they are sent, its hash, the gas it used, what it pays and how many transactions it holds. So whether a hidden transaction went into a block, and how much gas it used, can be read off a relay by anyone who knows what else was in the block, as the host does. What stays hidden is what the transaction is: who sent it, to what, and with what data. A host that works at it can go further: it chooses the block's other transactions, so it can put its own after a hidden one, built to fail if a given contract was touched, and read from the relay's figures whether they failed. Sealing keeps a transaction from a host that carries and watches, and from everyone else; it does not keep what the transaction does from a host that sets out to find it, and no rule inside the guest would. The TLS, the sealing and the certificate checks behind it are tested against OpenSSL, not proved and not reviewed by anyone else. Certificates are judged at a date the host supplies, since the guest has no clock that knows one. Its signing is written to take the same time whatever the key and was checked in the places looked at, not proved. As a checker, one block in a hundred still takes 19 seconds and a hostile block can hold the machine for a long time. Three fast paths and one correction in the EVM it runs are tested against the specification, not proved equal to it. The shortcuts already taken are listed in the repository, not here.
Try it

Build the guest and boot it

The development image runs under QEMU's emulated processor anywhere; the TDX image needs an Intel TDX host. Lean is pinned by the repository.

git clone https://github.com/posix4e/cluck && cd cluck
lake build
scripts/build-efi dev && scripts/run-efi dev          # the OS and its demo, emulated
export SILO_TDVF=/path/to/OVMF.fd                      # the patched firmware, see TDX.md
scripts/build-efi tdx && scripts/run-efi tdx          # in a trust domain

cd evm                                                 # the block validator
scripts/build-efi tdx && scripts/run-fixtures tdx     # five test chains, in TDX
demo/server.py                                         # the page in the picture above

Details, including the firmware the TDX target needs, are in TDX.md and evm/README.md.