{"eip":8100,"title":"Representable Contract State","description":"Interface and XML binding schema for contracts that expose a canonical representation of their state.","authors":["Christian Fries (@cfries)","Peter Kohl-Landgraf (@pekola)","Raphael Prandtl (@RKP1101)"],"status":"Draft","type":"Standards Track","category":"ERC","created":"2025-12-01","requires":[155],"discussionsTo":"https://ethereum-magicians.org/t/erc-8100-representable-contract-state/26974","repo":"ERCs","label":"ERC-8100","officialUrl":"https://eips.ethereum.org/EIPS/eip-8100","sourceUrl":"https://github.com/ethereum/ERCs/blob/master/ERCS/erc-8100.md","url":"https://eips.huatuo.xyz/eip-8100/","tldr":{"en":"Lets a contract publish an XML template whose attributes bind to its view functions, so off-chain renderers can produce a canonical, block-pinned XML document of the contract's state, aimed at financial instruments and reporting.","ja":"コントラクトが、属性がその view 関数にバインドされる XML テンプレートを公開できるようにする。これにより、オフチェーンのレンダラーが、コントラクトの状態を正規の、ブロック固定の XML ドキュメントとして生成できる。金融商品とレポーティングを対象とする。","ko":"컨트랙트가 속성이 자신의 view 함수에 바인딩되는 XML 템플릿을 게시할 수 있게 해, 오프체인 렌더러가 컨트랙트 상태를 표준적이고 블록에 고정된 XML 문서로 만들 수 있게 한다. 금융 상품과 리포팅을 겨냥한다.","zh":"让合约发布一个 XML 模板，其属性绑定到合约的 view 函数，使链下渲染器能生成合约状态的规范化、固定区块的 XML 文档，面向金融工具和报告场景。"},"tags":["xml","state","finance","tooling","standard"],"explainers":{"en":{"lang":"en","tldr":"Lets a contract publish an XML template whose attributes bind to its view functions, so off-chain renderers can produce a canonical, block-pinned XML document of the contract's state, aimed at financial instruments and reporting.","tags":["xml","state","finance","tooling","standard"],"related":[155,20,721,1155],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/eip-8100/","markdown":"## What problem does it solve?\n\nSmart contracts can manage the whole lifecycle of a financial product, such as a derivative or a bond, to the point where the contract effectively *is* the product. But the surrounding world still needs a document describing it: valuation oracles need inputs for settlement, tokenized bonds need term sheets and regulatory reports, and auditors want reproducible snapshots.\n\nTraditional finance handles this with XML-based standards such as FpML, where the XML document is the source of truth. ERC-8100 flips that around: the **contract is the source of truth**, and it exposes a standard way for generic tools to render its current state as XML, without project-specific adapters.\n\n## How it works\n\n- **The interface.** A contract implements `IXMLRepresentableState.stateXmlTemplate()`, which returns an effectively constant XML string.\n- **Bindings.** Elements in the template carry attributes in the `urn:evm:state:1.0` namespace (prefix `evmstate`). `evmstate:call=\"notional()(uint256)\"` tells the renderer which view function to call and how to decode the result. `evmstate:format` and `evmstate:scale` control formatting (scale 2 turns `100000000` into `1000000.00`), and `evmstate:target` writes into an attribute instead of the element text. Several bindings per element are allowed via semicolon-separated lists, and an optional array profile expands arrays (for example a payment schedule) into repeated rows.\n- **Consistent snapshots.** Renderers must pick a single block `B` up front and run every `eth_call` at that block, so the document reflects one consistent state. The root element gets `evmstate:chain-id` (the [EIP-155](/eip-155/) chain ID), `evmstate:contract-address` and `evmstate:block-number`.\n- **XML-complete.** A contract is XML-complete if its rendering covers all semantically relevant mutable state. This is a promise by the author, not something enforced on-chain.\n- **Optional extras.** `stateVersion()` for cheap change detection and caching, `stateHash()` for integrity checks, and `statePartXmlTemplate(partId)` for partial views (for example a settlement context). Events can refer to such views by URI, e.g. `evmstate://self/part/{partId}`, instead of logging large data blobs.\n\n## Sample code\n\nA template fragment and what a renderer produces from it:\n\n```xml\n\u003c!-- returned by stateXmlTemplate() --\u003e\n\u003cSwap xmlns=\"urn:example:instrument\"\n      xmlns:evmstate=\"urn:evm:state:1.0\"\n      evmstate:chain-id=\"\" evmstate:contract-address=\"\" evmstate:block-number=\"\"\u003e\n  \u003cNotional evmstate:call=\"notional()(uint256)\" evmstate:format=\"decimal\" evmstate:scale=\"2\"/\u003e\n  \u003cParty evmstate:call=\"partyALEI()(string)\" evmstate:target=\"id\"/\u003e\n\u003c/Swap\u003e\n\n\u003c!-- rendered at a fixed block (evmstate:* binding attributes may be stripped) --\u003e\n\u003cSwap xmlns=\"urn:example:instrument\" xmlns:evmstate=\"urn:evm:state:1.0\"\n      evmstate:chain-id=\"1337\" evmstate:contract-address=\"0x...\" evmstate:block-number=\"37356\"\u003e\n  \u003cNotional\u003e1000000.00\u003c/Notional\u003e\n  \u003cParty id=\"LEI-of-Party-A\"/\u003e\n\u003c/Swap\u003e\n```\n\nSolidity side:\n\n```solidity\n// SPDX-License-Identifier: CC0-1.0\npragma solidity ^0.8.19;\n\ninterface IXMLRepresentableState {\n    function stateXmlTemplate() external view returns (string memory);\n}\n```\n\n## Things to know\n\n- **Status: Draft.** The binding schema and profiles may still change.\n- Bind only to deterministic views. Functions that read `block.timestamp` or call other contracts can make the rendering unstable.\n- A contract can claim XML-completeness while leaving things out. Review the code, and where provided use `stateHash()` to check that a rendering matches on-chain state.\n- Correctness ultimately depends on the off-chain renderer; independent implementations and tests are recommended.\n- Large templates mean many `eth_call`s, which can be slow or rate-limited on public RPCs.\n- Can be implemented alongside [ERC-20](/eip-20/), [ERC-721](/eip-721/), [ERC-1155](/eip-1155/) or any other standard.\n"},"ja":{"lang":"ja","tldr":"コントラクトが、属性がその view 関数にバインドされる XML テンプレートを公開できるようにする。これにより、オフチェーンのレンダラーが、コントラクトの状態を正規の、ブロック固定の XML ドキュメントとして生成できる。金融商品とレポーティングを対象とする。","tags":["xml","state","finance","tooling","standard"],"related":[155,20,721,1155],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ja/eip-8100/","markdown":"## 何を解決するのか\n\nスマートコントラクトは、デリバティブや債券などの金融商品のライフサイクル全体を管理でき、コントラクトが実質的にその商品*そのもの*になる場合もあります。それでも周囲の世界には、それを説明するドキュメントが必要です。評価オラクルは決済のための入力を必要とし、トークン化された債券にはタームシートや規制当局向けレポートが必要で、監査人は再現可能なスナップショットを求めます。\n\n従来の金融では、FpML のような XML ベースの標準でこれに対応し、XML ドキュメントが信頼できる情報源（source of truth）です。ERC-8100 はこれを逆転させます。**コントラクトが信頼できる情報源**であり、汎用ツールがプロジェクト固有のアダプターなしに、その現在の状態を XML としてレンダリングできる標準的な方法を公開します。\n\n## 仕組み\n\n- **インターフェース。** コントラクトは `IXMLRepresentableState.stateXmlTemplate()` を実装し、実質的に定数の XML 文字列を返します。\n- **バインディング。** テンプレート内の要素は、`urn:evm:state:1.0` 名前空間（プレフィックス `evmstate`）の属性を持ちます。`evmstate:call=\"notional()(uint256)\"` は、どの view 関数を呼び出し、結果をどうデコードするかをレンダラーに伝えます。`evmstate:format` と `evmstate:scale` はフォーマットを制御し（scale 2 なら `100000000` が `1000000.00` になります）、`evmstate:target` は要素のテキストではなく属性に書き込みます。セミコロン区切りのリストにより、1 つの要素に複数のバインディングを指定でき、任意の配列プロファイルは、配列（たとえば支払スケジュール）を繰り返しの行に展開します。\n- **一貫したスナップショット。** レンダラーは最初に 1 つのブロック `B` を選び、すべての `eth_call` をそのブロックで実行しなければなりません。これにより、ドキュメントは 1 つの一貫した状態を反映します。ルート要素には `evmstate:chain-id`（[EIP-155](/eip-155/) のチェーン ID）、`evmstate:contract-address`、`evmstate:block-number` が付きます。\n- **XML 完全性（XML-complete）。** レンダリングが意味的に関連するすべての可変状態を網羅していれば、そのコントラクトは XML-complete です。これは作者による約束であり、オンチェーンで強制されるものではありません。\n- **任意の追加機能。** 安価な変更検出とキャッシュのための `stateVersion()`、整合性チェックのための `stateHash()`、部分ビュー（たとえば決済コンテキスト）のための `statePartXmlTemplate(partId)`。イベントは、大きなデータの塊をログに出す代わりに、`evmstate://self/part/{partId}` のような URI でそうしたビューを参照できます。\n\n## サンプルコード\n\nテンプレートの断片と、レンダラーがそこから生成するもの:\n\n```xml\n\u003c!-- returned by stateXmlTemplate() --\u003e\n\u003cSwap xmlns=\"urn:example:instrument\"\n      xmlns:evmstate=\"urn:evm:state:1.0\"\n      evmstate:chain-id=\"\" evmstate:contract-address=\"\" evmstate:block-number=\"\"\u003e\n  \u003cNotional evmstate:call=\"notional()(uint256)\" evmstate:format=\"decimal\" evmstate:scale=\"2\"/\u003e\n  \u003cParty evmstate:call=\"partyALEI()(string)\" evmstate:target=\"id\"/\u003e\n\u003c/Swap\u003e\n\n\u003c!-- rendered at a fixed block (evmstate:* binding attributes may be stripped) --\u003e\n\u003cSwap xmlns=\"urn:example:instrument\" xmlns:evmstate=\"urn:evm:state:1.0\"\n      evmstate:chain-id=\"1337\" evmstate:contract-address=\"0x...\" evmstate:block-number=\"37356\"\u003e\n  \u003cNotional\u003e1000000.00\u003c/Notional\u003e\n  \u003cParty id=\"LEI-of-Party-A\"/\u003e\n\u003c/Swap\u003e\n```\n\nSolidity 側:\n\n```solidity\n// SPDX-License-Identifier: CC0-1.0\npragma solidity ^0.8.19;\n\ninterface IXMLRepresentableState {\n    function stateXmlTemplate() external view returns (string memory);\n}\n```\n\n## 知っておくべきこと\n\n- **ステータス: Draft。** バインディングのスキーマとプロファイルは、まだ変わる可能性があります。\n- バインドするのは決定的な view だけにしてください。`block.timestamp` を読んだり他のコントラクトを呼んだりする関数は、レンダリングを不安定にする可能性があります。\n- コントラクトは、何かを省いたまま XML-complete だと主張できてしまいます。コードをレビューし、提供されている場合は `stateHash()` を使って、レンダリングがオンチェーンの状態と一致することを確認してください。\n- 正しさは最終的にオフチェーンのレンダラーに依存します。独立した実装とテストが推奨されます。\n- テンプレートが大きいと `eth_call` が多くなり、パブリック RPC では遅くなったりレート制限を受けたりすることがあります。\n- [ERC-20](/eip-20/)、[ERC-721](/eip-721/)、[ERC-1155](/eip-1155/) やその他の標準と併せて実装できます。\n"},"ko":{"lang":"ko","tldr":"컨트랙트가 속성이 자신의 view 함수에 바인딩되는 XML 템플릿을 게시할 수 있게 해, 오프체인 렌더러가 컨트랙트 상태를 표준적이고 블록에 고정된 XML 문서로 만들 수 있게 한다. 금융 상품과 리포팅을 겨냥한다.","tags":["xml","state","finance","tooling","standard"],"related":[155,20,721,1155],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ko/eip-8100/","markdown":"## 어떤 문제를 해결하나요?\n\n스마트 컨트랙트는 파생상품이나 채권 같은 금융 상품의 전체 수명 주기를 관리할 수 있으며, 컨트랙트가 사실상 그 상품 *그 자체*가 되기도 합니다. 하지만 주변 세계에는 여전히 이를 설명하는 문서가 필요합니다. 가치 평가 오라클은 정산을 위한 입력이 필요하고, 토큰화된 채권에는 텀시트와 규제 보고서가 필요하며, 감사인은 재현 가능한 스냅샷을 원합니다.\n\n전통 금융은 FpML 같은 XML 기반 표준으로 이를 처리하며, 이때 XML 문서가 신뢰할 수 있는 원천(source of truth)입니다. ERC-8100은 이를 뒤집습니다. **컨트랙트가 신뢰할 수 있는 원천**이며, 범용 도구가 프로젝트별 어댑터 없이 컨트랙트의 현재 상태를 XML로 렌더링할 수 있는 표준 방법을 제공합니다.\n\n## 어떻게 동작하나요?\n\n- **인터페이스.** 컨트랙트는 `IXMLRepresentableState.stateXmlTemplate()`을 구현하며, 사실상 상수인 XML 문자열을 반환합니다.\n- **바인딩.** 템플릿의 요소는 `urn:evm:state:1.0` 네임스페이스(접두사 `evmstate`)의 속성을 가집니다. `evmstate:call=\"notional()(uint256)\"`는 렌더러에게 어떤 view 함수를 호출하고 결과를 어떻게 디코딩할지 알려 줍니다. `evmstate:format`과 `evmstate:scale`은 포맷을 제어하고(scale 2는 `100000000`을 `1000000.00`으로 바꿉니다), `evmstate:target`은 요소 텍스트 대신 속성에 값을 씁니다. 세미콜론으로 구분한 목록으로 요소 하나에 여러 바인딩을 둘 수 있고, 선택적 배열 프로필은 배열(예: 지급 일정)을 반복되는 행으로 펼칩니다.\n- **일관된 스냅샷.** 렌더러는 먼저 단일 블록 `B`를 고르고 모든 `eth_call`을 그 블록에서 실행해야 하며, 그래야 문서가 하나의 일관된 상태를 반영합니다. 루트 요소에는 `evmstate:chain-id`([EIP-155](/eip-155/) 체인 ID), `evmstate:contract-address`, `evmstate:block-number`가 붙습니다.\n- **XML 완전성(XML-complete).** 렌더링이 의미상 관련된 모든 가변 상태를 포괄하면 그 컨트랙트는 XML-complete입니다. 이는 작성자의 약속이지 온체인에서 강제되는 것이 아닙니다.\n- **선택적 추가 기능.** 저렴한 변경 감지와 캐싱을 위한 `stateVersion()`, 무결성 검사를 위한 `stateHash()`, 부분 뷰(예: 정산 컨텍스트)를 위한 `statePartXmlTemplate(partId)`. 이벤트는 큰 데이터 덩어리를 로그로 남기는 대신 `evmstate://self/part/{partId}` 같은 URI로 그런 뷰를 참조할 수 있습니다.\n\n## 샘플 코드\n\n템플릿 조각과 렌더러가 이로부터 만들어 내는 결과:\n\n```xml\n\u003c!-- returned by stateXmlTemplate() --\u003e\n\u003cSwap xmlns=\"urn:example:instrument\"\n      xmlns:evmstate=\"urn:evm:state:1.0\"\n      evmstate:chain-id=\"\" evmstate:contract-address=\"\" evmstate:block-number=\"\"\u003e\n  \u003cNotional evmstate:call=\"notional()(uint256)\" evmstate:format=\"decimal\" evmstate:scale=\"2\"/\u003e\n  \u003cParty evmstate:call=\"partyALEI()(string)\" evmstate:target=\"id\"/\u003e\n\u003c/Swap\u003e\n\n\u003c!-- rendered at a fixed block (evmstate:* binding attributes may be stripped) --\u003e\n\u003cSwap xmlns=\"urn:example:instrument\" xmlns:evmstate=\"urn:evm:state:1.0\"\n      evmstate:chain-id=\"1337\" evmstate:contract-address=\"0x...\" evmstate:block-number=\"37356\"\u003e\n  \u003cNotional\u003e1000000.00\u003c/Notional\u003e\n  \u003cParty id=\"LEI-of-Party-A\"/\u003e\n\u003c/Swap\u003e\n```\n\nSolidity 쪽:\n\n```solidity\n// SPDX-License-Identifier: CC0-1.0\npragma solidity ^0.8.19;\n\ninterface IXMLRepresentableState {\n    function stateXmlTemplate() external view returns (string memory);\n}\n```\n\n## 알아둘 점\n\n- **상태: Draft.** 바인딩 스키마와 프로필은 아직 바뀔 수 있습니다.\n- 결정적인 view에만 바인딩하세요. `block.timestamp`를 읽거나 다른 컨트랙트를 호출하는 함수는 렌더링을 불안정하게 만들 수 있습니다.\n- 컨트랙트는 무언가를 빠뜨린 채로 XML-complete라고 주장할 수 있습니다. 코드를 검토하고, 제공되는 경우 `stateHash()`로 렌더링이 온체인 상태와 일치하는지 확인하세요.\n- 정확성은 결국 오프체인 렌더러에 달려 있으므로, 독립적인 구현과 테스트가 권장됩니다.\n- 큰 템플릿은 `eth_call`이 많아진다는 뜻이며, 공용 RPC에서는 느리거나 속도 제한이 걸릴 수 있습니다.\n- [ERC-20](/eip-20/), [ERC-721](/eip-721/), [ERC-1155](/eip-1155/) 또는 다른 어떤 표준과도 함께 구현할 수 있습니다.\n"},"zh":{"lang":"zh","tldr":"让合约发布一个 XML 模板，其属性绑定到合约的 view 函数，使链下渲染器能生成合约状态的规范化、固定区块的 XML 文档，面向金融工具和报告场景。","tags":["xml","state","finance","tooling","standard"],"related":[155,20,721,1155],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/zh/eip-8100/","markdown":"## 它解决什么问题？\n\n智能合约可以管理金融产品（如衍生品或债券）的整个生命周期，甚至到合约实际上*就是*该产品的程度。但外部世界仍然需要一份描述它的文档：估值预言机需要结算所需的输入，代币化债券需要条款清单和监管报告，审计人员希望得到可复现的快照。\n\n传统金融用 FpML 等基于 XML 的标准来处理这些需求，XML 文档就是事实来源（source of truth）。ERC-8100 把这一点反过来：**合约才是事实来源**，并提供一种标准方式，让通用工具把合约的当前状态渲染为 XML，而无需针对具体项目的适配器。\n\n## 它如何运作\n\n- **接口。** 合约实现 `IXMLRepresentableState.stateXmlTemplate()`，返回一个实际上恒定不变的 XML 字符串。\n- **绑定。** 模板中的元素带有 `urn:evm:state:1.0` 命名空间（前缀 `evmstate`）下的属性。`evmstate:call=\"notional()(uint256)\"` 告诉渲染器调用哪个 view 函数以及如何解码结果。`evmstate:format` 和 `evmstate:scale` 控制格式化（scale 为 2 时，`100000000` 变成 `1000000.00`），`evmstate:target` 则写入属性而不是元素文本。通过分号分隔的列表，一个元素可以有多个绑定；可选的数组 profile 可把数组（例如付款计划）展开为重复的行。\n- **一致的快照。** 渲染器必须预先选定单个区块 `B`，并在该区块上执行每一次 `eth_call`，使文档反映同一个一致的状态。根元素会带上 `evmstate:chain-id`（[EIP-155](/eip-155/) 链 ID）、`evmstate:contract-address` 和 `evmstate:block-number`。\n- **XML 完备（XML-complete）。** 如果合约的渲染结果涵盖了所有语义相关的可变状态，它就是 XML-complete。这是作者的承诺，而不是链上强制执行的。\n- **可选扩展。** `stateVersion()` 用于低成本的变更检测和缓存，`stateHash()` 用于完整性检查，`statePartXmlTemplate(partId)` 用于局部视图（例如结算上下文）。事件可以通过 URI（例如 `evmstate://self/part/{partId}`）引用这类视图，而不是在日志中记录大块数据。\n\n## 示例代码\n\n一段模板片段，以及渲染器据此生成的结果：\n\n```xml\n\u003c!-- returned by stateXmlTemplate() --\u003e\n\u003cSwap xmlns=\"urn:example:instrument\"\n      xmlns:evmstate=\"urn:evm:state:1.0\"\n      evmstate:chain-id=\"\" evmstate:contract-address=\"\" evmstate:block-number=\"\"\u003e\n  \u003cNotional evmstate:call=\"notional()(uint256)\" evmstate:format=\"decimal\" evmstate:scale=\"2\"/\u003e\n  \u003cParty evmstate:call=\"partyALEI()(string)\" evmstate:target=\"id\"/\u003e\n\u003c/Swap\u003e\n\n\u003c!-- rendered at a fixed block (evmstate:* binding attributes may be stripped) --\u003e\n\u003cSwap xmlns=\"urn:example:instrument\" xmlns:evmstate=\"urn:evm:state:1.0\"\n      evmstate:chain-id=\"1337\" evmstate:contract-address=\"0x...\" evmstate:block-number=\"37356\"\u003e\n  \u003cNotional\u003e1000000.00\u003c/Notional\u003e\n  \u003cParty id=\"LEI-of-Party-A\"/\u003e\n\u003c/Swap\u003e\n```\n\nSolidity 一侧：\n\n```solidity\n// SPDX-License-Identifier: CC0-1.0\npragma solidity ^0.8.19;\n\ninterface IXMLRepresentableState {\n    function stateXmlTemplate() external view returns (string memory);\n}\n```\n\n## 需要注意\n\n- **状态：Draft。** 绑定模式和 profile 仍可能改变。\n- 只绑定确定性的 view。读取 `block.timestamp` 或调用其他合约的函数可能使渲染结果不稳定。\n- 合约可能声称自己是 XML-complete，却遗漏了某些内容。请审查代码，并在提供时使用 `stateHash()` 检查渲染结果是否与链上状态一致。\n- 正确性最终取决于链下渲染器；建议有独立的实现和测试。\n- 大型模板意味着大量 `eth_call`，在公共 RPC 上可能很慢或受到速率限制。\n- 可以与 [ERC-20](/eip-20/)、[ERC-721](/eip-721/)、[ERC-1155](/eip-1155/) 或任何其他标准一起实现。\n"}}}
