Skip to main content
After you read this page, you can read the engine identity, its attestation evidence, its heartbeat and the live adapter list from the chain, and watch every change to them. You need only a chain node. These reads do not go through the Anafi API. The engine runs in an Intel TDX enclave. Its signer key and its encryption key are published on chain in AnafiRegistry, with the attestation evidence. The engine signs a heartbeat on chain. Each adapter and the DSL registry accept a signature only from the published signer key.

What the registry publishes

Both keys, the compose hash and the evidence change together in one call, setEngineIdentity. Each call replaces all of them and adds 1 to version().

The attestation evidence

The evidence is not in storage. It is in the data of the event that each identity change emits:
Storage holds one commitment to the three blobs:
A zero engineEvidenceHash means that the registry owner posted no evidence with the current identity. Treat such an identity as unattested. The registry does not check the quote on chain. A verifier checks it off chain.

Check the evidence

1

Read the current identity

Read version(), engineSigKey(), engineEncKey(), composeHash() and engineEvidenceHash() from the registry.
2

Fetch the event of that version

Get the EngineIdentitySet log with the indexed topic newVersion equal to version(). The first identity has version 0 and comes from initialize, which emits no EngineIdentitySet.
3

Compare the event with storage

newSigKey, newEncKey and newCompose must equal the storage values. keccak256(abi.encode(tlsCertDer, quote, eventLog)) must equal engineEvidenceHash().
4

Check the quote

Verify the Intel TDX quote with the quote verification tool of your choice. Check that the quote binds tlsCertDer, newSigKey and newEncKey.
Your node can limit the block range of getContractEvents. Split a long range into parts.

The heartbeat

The engine signs a heartbeat, and any address submits it with attestHeartbeat(attestedBlock, attestedTick, engineSignature). The registry accepts it only when:
  • attestedBlock is more than lastHeartbeatBlock() and not more than block.number,
  • the signature recovers to engineSigKey() over this digest:
Each accepted heartbeat emits HeartbeatAttested(uint64 indexed attestedBlock, uint64 attestedTick). Use the heartbeat as a liveness signal:
  • Compare lastHeartbeatTick() with the current time. A large gap means that no new heartbeat landed.
  • Compare lastHeartbeatBlock() with the chain head. This tells a stopped engine from a stopped chain.
The contract sets no heartbeat interval. Choose your own alarm threshold. To check a heartbeat yourself, take the attestHeartbeat transaction of a HeartbeatAttested log, decode its input, compute the digest, and recover the signer:
This decode works when the heartbeat transaction calls the registry directly.

The live adapter list

delegationAdapters() returns the adapters that the registry lists, in list order. Each Anafi adapter calls isDelegationAdapter(address(this)) first on each redeem. An adapter that the list does not hold refuses every redeem with AdapterNotAllowed(). Check an adapter before you grant it a permission:
  1. The registry lists it: isDelegationAdapter(adapter) is true.
  2. It reads this registry: adapter.anafiRegistry() equals the registry address. The registry checked this when it listed the adapter.
  3. It has the expected tag: ROUTE_TAG() returns 0x31747694805ea00e26185495e79555aa0fd8bc5ed92dee2440234ea76be46373.
The SDK reads delegationAdapters() and serves an account kind only while the list holds the configured adapter of that kind. See Client. Watch the list with DelegationAdapterAdded(address indexed adapter) and DelegationAdapterRemoved(address indexed adapter).

Admin and code changes

The registry owner can change the engine identity, the adapter list and the code of each proxy. See Contracts overview. Each change is visible on chain: To read the current implementation of a proxy, read the ERC-1967 implementation slot 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc:
AnafiSwapExecutor and AnafiOffRampFallbackHandler have no proxy, so their code never changes.