ERC-8338 Token-bound executable skill (Token-Bound Executable Skills)

Draft · NFTs & multi-token · created 2026-07-10

Binds an AI agent's executable skill package (a bundle of documents and files) to an ERC-721 token via a hash, so content changes can be verified and update authority and privacy can be managed separately from ownership.

Why it is needed

AI agents can have on-chain identities like ERC-8004 or smart accounts like ERC-4337, but the skills they actually execute are stored in centralized registries. Such registries cannot be verified or owned, and there is no way to know if an operator silently changes the content, making them a root cause of supply chain attacks. tokenURI is merely a display pointer shown in wallet interfaces and does not guarantee that the content has not changed. Even if a registry or package manager can identify, locate, and distribute a skill, it cannot answer a more fundamental question that the execution runtime needs: exactly which document and file composition, which version, and which update history is the token bound to. Without a common artifact-binding model, different clients may apply different companion files, different update histories, and different confidentiality interpretations even for the same skill.

What to implement

In depth

Core binding: mdHash, packageHash, version

The SkillBinding struct in ISkillToken consists of mdHash (the SHA-256 hash of the plaintext source document), packageHash (the SHA-256 hash of the deterministically encoded bytes of the entire published SkillRoot), and version (the content version, starting at 1). At mint time all three values must be populated, version must be 1, and mdHash and packageHash cannot be bytes32(0). An update changes mdHash and packageHash atomically in a single call to updateSkill, and the new packageHash must differ from the existing value, but mdHash can remain unchanged if the source document itself did not change. version is not specified by the caller; the contract increments it by exactly 1 on every successful update and reverts on uint64 overflow.

Separation of identity and transport

A skill's identity consists of the three values (mdHash, packageHash, version), and packageURI is merely a transport hint indicating where to download the package, and is not part of the identity. setSkillURI does not change version and only emits SkillURIUpdated, so replacing a dead endpoint with a new address does not create a new skill version. packageURI must not be treated as a trusted input; consumers must verify downloaded content against the committed values regardless of where it was obtained, and discard it if it does not match.

Publishing authority is distinct from ownership

updateAuthorityOf(tokenId) is initialized at mint time, and only the current update authority may call updateSkill, updateSkillWithDocument, setSkillURI, setUpdateAuthority, or freezeSkill. ownerOf does not automatically become the update authority, ERC-721 transfers do not change the update authority, and approved/operator approvals do not grant these authorities either. setUpdateAuthority(tokenId, address(0)) must revert, because relinquishing management should be expressed through freezeSkill rather than by zeroing out the authority. A zero-address authority would be the worst possible state, since it would make packageURI permanently unfixable while leaving frozen as false.

Freezing binds only the content

freezeSkill is irreversible and must emit SkillFrozen, and once frozen, updateSkill and updateSkillWithDocument revert forever. Freezing binds only the content, mdHash, packageHash, and version, not the transport, so setSkillURI and setUpdateAuthority remain callable after freezing. This is so that if a particular storage provider disappears, the discovery hints for a frozen skill can still be kept alive.

Definition of the hashes

mdHash is the SHA-256 of the raw bytes of the plaintext source markdown document as is, with no line-ending, whitespace, BOM, or Unicode normalization, and no salt or key. Even if the published copy is encrypted, the commitment target is always the plaintext. packageHash is the SHA-256 of the deterministically encoded SkillRoot bytes, that is, the package exactly as published, and in confidential mode it targets the ciphertext objects. It is not the hash of a zip, tar, or .skill archive.

SkillRoot: an off-chain object graph

SkillRoot is an object encoded as CBOR following the deterministic encoding rules of RFC 8949 (fixed length, shortest-form integers, map keys sorted by encoded bytes), containing md (source document), manifest (link to the public manifest), entry (execution entry point), and optionally license, files, confidentiality, and prev. Every object is referenced by CID, and paths must be relative, case-sensitive UTF-8 POSIX paths, matched only byte-for-byte. There is exactly one source document, and it cannot reappear as a key in files; if version is greater than 1, prev must be present, and the digest within it must equal the packageHash of the immediately preceding version. If entry.path equals md.path, entry.cid must equal md.cid; otherwise files[entry.path] must equal entry.cid.

Optional on-chain document extension

IOnchainSkillDocument is an optional extension that publishes the source document on chain in plaintext. hasOnchainSkillDocument must remain permanently true once it becomes true, and publishSkillDocument publishes the current document without changing packageHash or version, succeeding only if sha256(document) equals the existing mdHash. updateSkillWithDocument is used when the document content actually changes; it computes mdHash inside the contract as sha256(document) and updates the document, both hashes, and version in a single transaction. For a token with an on-chain document, any updateSkill call that changes mdHash must revert and must instead go through updateSkillWithDocument. If the source document is confidential, hasOnchainSkillDocument must return false and skillDocument must revert.

The confidentiality descriptor, verification procedure, and relationship to other standards

The confidentiality descriptor is public JSON that exists only when a confidentiality link is present; schemaVersion, mode, profile, and objects are required, and objects records, per path, ciphertext (which must match the CID in the SkillRoot) and plaintextHash (the SHA-256 of the plaintext). Public-mode verification proceeds by fetching the SkillRoot, checking packageHash, the path rules, and the version chain, then verifying each leaf by CID, while confidential mode first verifies the ciphertext by CID, then proves authorization, obtains the key according to the profile, decrypts, and finally confirms the plaintext hash. Unlike ERC-4907 (usage roles) and ERC-5169 (contract-level scripts), this standard binds content-addressed executable artifacts at the token level, and it is used complementarily alongside ERC-1155-based rights contracts or registries like ERC-8257, with each handling a separate role. This proposal is currently in Draft status, not yet finalized, and its details may change or discussion may stall.

Things to watch out for

Original ERC · ← ERCs