{"eip":8143,"title":"Smart Credential Resolution Interface","description":"Resolve credentials.","authors":["Prem Makeig (@nxt3d)"],"status":"Draft","type":"Standards Track","category":"ERC","created":"2025-12-15","requires":[165,3668],"discussionsTo":"https://ethereum-magicians.org/t/erc-8143-smart-credentials-uniform-credential-resolution-interface/27642","repo":"ERCs","label":"ERC-8143","officialUrl":"https://eips.ethereum.org/EIPS/eip-8143","sourceUrl":"https://github.com/ethereum/ERCs/blob/master/ERCS/erc-8143.md","url":"https://eips.huatuo.xyz/eip-8143/","tldr":{"en":"A one-function contract interface, `getCredential(key)`, that lets wallets, apps and AI agents look up issuer-controlled credentials such as KYC, proof of personhood or reputation in a uniform way, onchain or via CCIP-Read.","ja":"`getCredential(key)` 1 つだけの関数を持つコントラクトインターフェース。ウォレット、アプリ、AI エージェントが、KYC、人間性の証明、評判など発行者が管理するクレデンシャルを、オンチェーンまたは CCIP-Read 経由で統一的に参照できるようにする。","ko":"함수 하나짜리 컨트랙트 인터페이스 `getCredential(key)`로, 지갑, 앱, AI 에이전트가 KYC, 사람 증명, 평판처럼 발행자가 관리하는 자격 증명을 온체인 또는 CCIP-Read를 통해 일관된 방식으로 조회할 수 있게 한다.","zh":"一个只有一个函数 `getCredential(key)` 的合约接口，让钱包、应用和 AI 智能体可以用统一的方式查询由发行方控制的凭证，例如 KYC、真人证明或信誉，可以在链上进行，也可以通过 CCIP-Read 进行。"},"tags":["identity","credentials","kyc","agents","ccip-read"],"explainers":{"en":{"lang":"en","tldr":"A one-function contract interface, `getCredential(key)`, that lets wallets, apps and AI agents look up issuer-controlled credentials such as KYC, proof of personhood or reputation in a uniform way, onchain or via CCIP-Read.","tags":["identity","credentials","kyc","agents","ccip-read"],"related":[3668,165,8119,8004],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/eip-8143/","markdown":"## What problem does it solve?\n\nSome facts about a user should not be under that user's control: \"this person passed KYC\", \"this account belongs to a unique human\", \"this AI agent has a reputation score of 95\". Such records are written by a third-party **issuer**, not by the user.\n\nIssuers can already publish data from contracts, including offchain data via [ERC-3668](/eip-3668/) (CCIP-Read). But every issuer exposes it differently, so a client has to integrate each one by hand. ERC-8143 standardizes a minimal interface so that any client, including an autonomous agent, can resolve credentials and even discover new ones by watching a standard event. In the spec, \"users\" means both humans and AI agents.\n\n## How it works\n\nA Smart Credential contract implements:\n\n- `getCredential(string key) returns (bytes)` to fetch a credential.\n- `event CredentialSet(string key)`, emitted whenever a credential is set or updated, so clients can discover new keys without knowing them in advance.\n- [ERC-165](/eip-165/) `supportsInterface`, returning true for interface ID `0xd091187f`.\n\nThe standard deliberately does **not** fix the key format or the encoding of the returned bytes. Each issuer defines and documents its own. Keys may follow the [ERC-8119](/eip-8119/) parameterized style (`kyc:0xabc…`, `pop/0xabc…`), but that is optional. If a client knows no format for a key, it should treat the bytes as raw UTF-8.\n\nFor offchain data, `getCredential` can revert with ERC-3668 `OffchainLookup`. Compliant clients must follow the CCIP-Read flow: fetch from the gateway, then call the contract's callback, which verifies the response (signature, Merkle proof, ZK proof…) before returning it.\n\n## Sample code\n\nInterface and a simple onchain issuer:\n\n```solidity\n// SPDX-License-Identifier: CC0-1.0\npragma solidity ^0.8.20;\n\ninterface IERC8143 {\n    event CredentialSet(string key);\n    function getCredential(string calldata key) external view returns (bytes memory result);\n}\n\ncontract SimpleIssuer is IERC8143 {\n    address public immutable issuer = msg.sender;\n    mapping(string =\u003e bytes) private creds;\n\n    function setCredential(string calldata key, bytes calldata value) external {\n        require(msg.sender == issuer, \"not issuer\");\n        creds[key] = value;\n        emit CredentialSet(key);\n    }\n\n    function getCredential(string calldata key) external view returns (bytes memory) {\n        return creds[key];\n    }\n\n    function supportsInterface(bytes4 id) external pure returns (bool) {\n        return id == 0xd091187f || id == 0x01ffc9a7; // ERC-8143, ERC-165\n    }\n}\n```\n\nResolving from a client with ethers v6 (`enableCcipRead` follows ERC-3668 reverts):\n\n```ts\nimport { Contract, AbiCoder } from \"ethers\";\n\nconst c = new Contract(issuerAddr, [\"function getCredential(string) view returns (bytes)\"], provider);\nconst raw = await c.getCredential(`pop:${user}`, { enableCcipRead: true });\nconst [isHuman] = AbiCoder.defaultAbiCoder().decode([\"bool\"], raw); // format defined by issuer\n```\n\n## Things to know\n\n- **Status: Draft.** The interface may change.\n- A credential is only as trustworthy as its issuer. Clients should decide which issuer contracts they trust before relying on any result.\n- You cannot guess the encoding of a credential; consult the issuer's documentation for each key.\n- Putting personal data such as KYC records onchain is permanent and public. Privacy-preserving designs (offchain storage via CCIP-Read, or zero-knowledge proofs, which the spec explicitly aims to support) are worth considering.\n"},"ja":{"lang":"ja","tldr":"`getCredential(key)` 1 つだけの関数を持つコントラクトインターフェース。ウォレット、アプリ、AI エージェントが、KYC、人間性の証明、評判など発行者が管理するクレデンシャルを、オンチェーンまたは CCIP-Read 経由で統一的に参照できるようにする。","tags":["identity","credentials","kyc","agents","ccip-read"],"related":[3668,165,8119,8004],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ja/eip-8143/","markdown":"## 何を解決するのか\n\nユーザーに関する事実のなかには、そのユーザー自身が管理すべきでないものがあります。「この人は KYC を通過した」「このアカウントは唯一の人間に属する」「この AI エージェントの評判スコアは 95」などです。こうした記録は、ユーザーではなく第三者の**発行者**が書き込みます。\n\n発行者は既にコントラクトからデータを公開でき、[ERC-3668](/eip-3668/)（CCIP-Read）によるオフチェーンデータも含まれます。しかし発行者ごとに公開のしかたが異なるため、クライアントは 1 つずつ手作業で対応する必要があります。ERC-8143 は最小限のインターフェースを標準化し、自律エージェントを含むあらゆるクライアントが、クレデンシャルを解決し、標準イベントを監視して新しいクレデンシャルを発見することまでできるようにします。仕様における「ユーザー」とは、人間と AI エージェントの両方を意味します。\n\n## 仕組み\n\nSmart Credential コントラクトは次を実装します。\n\n- クレデンシャルを取得する `getCredential(string key) returns (bytes)`。\n- クレデンシャルが設定または更新されるたびに emit される `event CredentialSet(string key)`。クライアントは事前に知らなくても新しい key を発見できます。\n- [ERC-165](/eip-165/) の `supportsInterface`。インターフェース ID `0xd091187f` に対して true を返します。\n\nこの標準は、key の形式や返される bytes のエンコーディングをあえて**定めていません**。それぞれの発行者が自分で定義し、文書化します。key は [ERC-8119](/eip-8119/) のパラメータ化されたスタイル（`kyc:0xabc…`、`pop/0xabc…`）に従ってもかまいませんが、任意です。クライアントが key の形式を知らない場合は、bytes を生の UTF-8 として扱うべきです。\n\nオフチェーンデータの場合、`getCredential` は ERC-3668 の `OffchainLookup` で revert できます。準拠するクライアントは CCIP-Read のフローに従わなければなりません。ゲートウェイから取得し、次にコントラクトのコールバックを呼びます。コールバックは、レスポンスを返す前に検証します（署名、Merkle 証明、ZK 証明など）。\n\n## サンプルコード\n\nインターフェースと、単純なオンチェーン発行者:\n\n```solidity\n// SPDX-License-Identifier: CC0-1.0\npragma solidity ^0.8.20;\n\ninterface IERC8143 {\n    event CredentialSet(string key);\n    function getCredential(string calldata key) external view returns (bytes memory result);\n}\n\ncontract SimpleIssuer is IERC8143 {\n    address public immutable issuer = msg.sender;\n    mapping(string =\u003e bytes) private creds;\n\n    function setCredential(string calldata key, bytes calldata value) external {\n        require(msg.sender == issuer, \"not issuer\");\n        creds[key] = value;\n        emit CredentialSet(key);\n    }\n\n    function getCredential(string calldata key) external view returns (bytes memory) {\n        return creds[key];\n    }\n\n    function supportsInterface(bytes4 id) external pure returns (bool) {\n        return id == 0xd091187f || id == 0x01ffc9a7; // ERC-8143, ERC-165\n    }\n}\n```\n\nethers v6 でクライアントから解決する例（`enableCcipRead` が ERC-3668 の revert に従います）:\n\n```ts\nimport { Contract, AbiCoder } from \"ethers\";\n\nconst c = new Contract(issuerAddr, [\"function getCredential(string) view returns (bytes)\"], provider);\nconst raw = await c.getCredential(`pop:${user}`, { enableCcipRead: true });\nconst [isHuman] = AbiCoder.defaultAbiCoder().decode([\"bool\"], raw); // format defined by issuer\n```\n\n## 知っておくべきこと\n\n- **ステータス: Draft。** インターフェースは変更される可能性があります。\n- クレデンシャルの信頼性は、発行者の信頼性を超えません。クライアントは、結果に頼る前に、どの発行者コントラクトを信頼するかを決めておくべきです。\n- クレデンシャルのエンコーディングは推測できません。key ごとに発行者のドキュメントを確認してください。\n- KYC の記録のような個人データをオンチェーンに置くと、永続的かつ公開になります。プライバシーを守る設計（CCIP-Read によるオフチェーン保存や、仕様が明示的にサポートを目指しているゼロ知識証明）を検討する価値があります。\n"},"ko":{"lang":"ko","tldr":"함수 하나짜리 컨트랙트 인터페이스 `getCredential(key)`로, 지갑, 앱, AI 에이전트가 KYC, 사람 증명, 평판처럼 발행자가 관리하는 자격 증명을 온체인 또는 CCIP-Read를 통해 일관된 방식으로 조회할 수 있게 한다.","tags":["identity","credentials","kyc","agents","ccip-read"],"related":[3668,165,8119,8004],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ko/eip-8143/","markdown":"## 어떤 문제를 해결하나요?\n\n사용자에 대한 어떤 사실은 그 사용자가 통제해서는 안 됩니다. \"이 사람은 KYC를 통과했다\", \"이 계정은 고유한 사람의 것이다\", \"이 AI 에이전트의 평판 점수는 95다\" 같은 것들입니다. 이런 기록은 사용자가 아니라 제3자인 **발행자**가 씁니다.\n\n발행자는 이미 컨트랙트에서 데이터를 공개할 수 있고, [ERC-3668](/eip-3668/)(CCIP-Read)을 통한 오프체인 데이터도 가능합니다. 하지만 발행자마다 공개 방식이 달라서 클라이언트는 하나하나 수작업으로 연동해야 합니다. ERC-8143은 최소한의 인터페이스를 표준화해서, 자율 에이전트를 포함한 모든 클라이언트가 자격 증명을 조회하고, 표준 이벤트를 지켜보다가 새로운 자격 증명을 발견할 수도 있게 합니다. 사양에서 \"사용자\"는 사람과 AI 에이전트를 모두 뜻합니다.\n\n## 어떻게 동작하나요?\n\nSmart Credential 컨트랙트는 다음을 구현합니다.\n\n- 자격 증명을 가져오는 `getCredential(string key) returns (bytes)`.\n- 자격 증명이 설정되거나 갱신될 때마다 emit되는 `event CredentialSet(string key)`. 클라이언트는 미리 알지 못해도 새 key를 발견할 수 있습니다.\n- [ERC-165](/eip-165/) `supportsInterface`. 인터페이스 ID `0xd091187f`에 대해 true를 반환합니다.\n\n이 표준은 key 형식과 반환되는 bytes의 인코딩을 일부러 **정하지 않습니다**. 각 발행자가 직접 정의하고 문서화합니다. key는 [ERC-8119](/eip-8119/)의 파라미터화된 스타일(`kyc:0xabc…`, `pop/0xabc…`)을 따를 수 있지만 선택 사항입니다. 클라이언트가 어떤 key의 형식을 모른다면 bytes를 원시 UTF-8로 취급해야 합니다.\n\n오프체인 데이터의 경우 `getCredential`은 ERC-3668 `OffchainLookup`으로 revert할 수 있습니다. 규격을 따르는 클라이언트는 CCIP-Read 흐름을 따라야 합니다. 게이트웨이에서 가져온 뒤 컨트랙트의 콜백을 호출하고, 콜백은 응답을 반환하기 전에 검증합니다(서명, Merkle 증명, ZK 증명 등).\n\n## 샘플 코드\n\n인터페이스와 간단한 온체인 발행자:\n\n```solidity\n// SPDX-License-Identifier: CC0-1.0\npragma solidity ^0.8.20;\n\ninterface IERC8143 {\n    event CredentialSet(string key);\n    function getCredential(string calldata key) external view returns (bytes memory result);\n}\n\ncontract SimpleIssuer is IERC8143 {\n    address public immutable issuer = msg.sender;\n    mapping(string =\u003e bytes) private creds;\n\n    function setCredential(string calldata key, bytes calldata value) external {\n        require(msg.sender == issuer, \"not issuer\");\n        creds[key] = value;\n        emit CredentialSet(key);\n    }\n\n    function getCredential(string calldata key) external view returns (bytes memory) {\n        return creds[key];\n    }\n\n    function supportsInterface(bytes4 id) external pure returns (bool) {\n        return id == 0xd091187f || id == 0x01ffc9a7; // ERC-8143, ERC-165\n    }\n}\n```\n\nethers v6로 클라이언트에서 조회하기(`enableCcipRead`가 ERC-3668 revert를 따라갑니다):\n\n```ts\nimport { Contract, AbiCoder } from \"ethers\";\n\nconst c = new Contract(issuerAddr, [\"function getCredential(string) view returns (bytes)\"], provider);\nconst raw = await c.getCredential(`pop:${user}`, { enableCcipRead: true });\nconst [isHuman] = AbiCoder.defaultAbiCoder().decode([\"bool\"], raw); // format defined by issuer\n```\n\n## 알아둘 점\n\n- **상태: Draft.** 인터페이스는 바뀔 수 있습니다.\n- 자격 증명은 발행자만큼만 신뢰할 수 있습니다. 클라이언트는 어떤 결과든 의존하기 전에 어떤 발행자 컨트랙트를 신뢰할지 정해야 합니다.\n- 자격 증명의 인코딩은 추측할 수 없습니다. key마다 발행자의 문서를 확인하세요.\n- KYC 기록 같은 개인 데이터를 온체인에 올리면 영구적이고 공개됩니다. 프라이버시를 지키는 설계(CCIP-Read를 통한 오프체인 저장, 또는 사양이 명시적으로 지원을 목표로 하는 영지식 증명)를 고려해 볼 만합니다.\n"},"zh":{"lang":"zh","tldr":"一个只有一个函数 `getCredential(key)` 的合约接口，让钱包、应用和 AI 智能体可以用统一的方式查询由发行方控制的凭证，例如 KYC、真人证明或信誉，可以在链上进行，也可以通过 CCIP-Read 进行。","tags":["identity","credentials","kyc","agents","ccip-read"],"related":[3668,165,8119,8004],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/zh/eip-8143/","markdown":"## 它解决什么问题？\n\n关于用户的某些事实，不应由该用户自己控制：\"此人通过了 KYC\"、\"此账户属于唯一的真人\"、\"这个 AI 智能体的信誉分是 95\"。这类记录由第三方**发行方**写入，而不是由用户写入。\n\n发行方已经可以从合约发布数据，包括通过 [ERC-3668](/eip-3668/)（CCIP-Read）发布的链下数据。但每个发行方的暴露方式各不相同，客户端只能逐个手动集成。ERC-8143 标准化了一个最小接口，使任何客户端（包括自主智能体）都能解析凭证，甚至通过监听标准事件来发现新的凭证。在规范中，\"用户\"既指人类，也指 AI 智能体。\n\n## 它如何运作\n\nSmart Credential 合约实现：\n\n- `getCredential(string key) returns (bytes)`，用于获取凭证。\n- `event CredentialSet(string key)`，每当凭证被设置或更新时触发，使客户端无需事先知道就能发现新的 key。\n- [ERC-165](/eip-165/) 的 `supportsInterface`，对接口 ID `0xd091187f` 返回 true。\n\n该标准有意**不**规定 key 的格式，也不规定返回字节的编码。每个发行方自行定义并公开文档。key 可以遵循 [ERC-8119](/eip-8119/) 的参数化风格（`kyc:0xabc…`、`pop/0xabc…`），但这是可选的。如果客户端不知道某个 key 的格式，应把这些字节当作原始 UTF-8。\n\n对于链下数据，`getCredential` 可以用 ERC-3668 的 `OffchainLookup` 进行 revert。合规的客户端必须遵循 CCIP-Read 流程：先从网关获取，再调用合约的回调，由回调在返回之前验证响应（签名、Merkle 证明、ZK 证明等）。\n\n## 示例代码\n\n接口和一个简单的链上发行方：\n\n```solidity\n// SPDX-License-Identifier: CC0-1.0\npragma solidity ^0.8.20;\n\ninterface IERC8143 {\n    event CredentialSet(string key);\n    function getCredential(string calldata key) external view returns (bytes memory result);\n}\n\ncontract SimpleIssuer is IERC8143 {\n    address public immutable issuer = msg.sender;\n    mapping(string =\u003e bytes) private creds;\n\n    function setCredential(string calldata key, bytes calldata value) external {\n        require(msg.sender == issuer, \"not issuer\");\n        creds[key] = value;\n        emit CredentialSet(key);\n    }\n\n    function getCredential(string calldata key) external view returns (bytes memory) {\n        return creds[key];\n    }\n\n    function supportsInterface(bytes4 id) external pure returns (bool) {\n        return id == 0xd091187f || id == 0x01ffc9a7; // ERC-8143, ERC-165\n    }\n}\n```\n\n在客户端用 ethers v6 解析（`enableCcipRead` 会跟进 ERC-3668 的 revert）：\n\n```ts\nimport { Contract, AbiCoder } from \"ethers\";\n\nconst c = new Contract(issuerAddr, [\"function getCredential(string) view returns (bytes)\"], provider);\nconst raw = await c.getCredential(`pop:${user}`, { enableCcipRead: true });\nconst [isHuman] = AbiCoder.defaultAbiCoder().decode([\"bool\"], raw); // format defined by issuer\n```\n\n## 需要注意\n\n- **状态：Draft。** 接口可能变化。\n- 凭证的可信度不会超过其发行方。在依赖任何结果之前，客户端应先决定信任哪些发行方合约。\n- 你无法猜出凭证的编码；请针对每个 key 查阅发行方的文档。\n- 把 KYC 记录等个人数据放到链上是永久且公开的。保护隐私的设计（通过 CCIP-Read 进行链下存储，或规范明确希望支持的零知识证明）值得考虑。\n"}}}
