{"eip":6327,"title":"Elastic Signature","description":"Use password to sign data as private key","authors":["George (@JXRow)"],"status":"Draft","type":"Standards Track","category":"ERC","created":"2023-01-13","discussionsTo":"https://ethereum-magicians.org/t/eip-6327-elastic-signature-es/12554","repo":"ERCs","label":"ERC-6327","officialUrl":"https://eips.ethereum.org/EIPS/eip-6327","sourceUrl":"https://github.com/ethereum/ERCs/blob/master/ERCS/erc-6327.md","url":"https://eips.huatuo.xyz/eip-6327/","tldr":{"en":"A draft interface for password-based \"elastic signatures\": users prove knowledge of a changeable secret with a zero-knowledge proof that a contract verifies, as an extra signing factor on top of a private key.","ja":"パスワードベースの「エラスティック署名」のためのドラフトのインターフェースです。ユーザーは、変更可能な秘密を知っていることをゼロ知識証明で示し、コントラクトがそれを検証します。秘密鍵に加えるもう 1 つの署名要素として使われます。","ko":"비밀번호 기반 \"탄력적 서명(elastic signature)\"을 위한 초안 인터페이스입니다. 사용자가 바꿀 수 있는 비밀을 안다는 것을 영지식 증명으로 보이고 컨트랙트가 이를 검증하며, 개인 키 위에 더해지는 추가 서명 요소로 쓰입니다.","zh":"一个基于密码的\"弹性签名\"草案接口：用户用零知识证明来证明自己知道一个可更改的秘密，由合约验证，作为私钥之上的额外签名因素。"},"tags":["signatures","zero-knowledge","password","wallets","draft"],"explainers":{"en":{"lang":"en","tldr":"A draft interface for password-based \"elastic signatures\": users prove knowledge of a changeable secret with a zero-knowledge proof that a contract verifies, as an extra signing factor on top of a private key.","tags":["signatures","zero-knowledge","password","wallets","draft"],"related":[4337,1271],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/eip-6327/","markdown":"## What problem does it solve?\n\nPrivate keys are hard for non-technical users: they cannot be changed, cannot be remembered, and losing one means losing everything. Custodial key services make onboarding easier but depend on a vendor.\n\nERC-6327 proposes an **elastic signature (ES)**: authorising an action with a human-friendly secret, like a password, that can be changed whenever the user wants. The password is never stored or revealed. Instead the user produces a zero-knowledge proof that they know it, and a verifier contract checks the proof on-chain.\n\nThe spec positions ES as an *additional* factor, not a replacement for keys: for example a DeFi app requiring a password to withdraw even if the wallet key is compromised, or a password plugin for an [ERC-4337](/eip-4337/) smart account.\n\n## How it works\n\nThree roles and a handful of hashes:\n\n- `pwdhash` = hash of the password (bound to the user's address); stored on-chain by the verifier.\n- `datahash` = hash of the action being authorised, produced by the **requester** contract.\n- `fullhash` = hash of `datahash` plus well-known values, which should include a per-user `nonce` and the `chainid` (the reference implementation also mixes in an `expiration`).\n- `allhash` = hash of `pwdhash` and `fullhash`.\n\nFlow:\n\n1. The **prover** (user's client) computes `allhash` and a zk-SNARK `proof` from the password, address and `fullhash`.\n2. The **requester** contract calls `verify(user, proof, datahash, expiration, allhash)` on the **verifier**.\n3. The verifier recomputes `fullhash`, looks up `pwdhash`, checks the proof against the public values `[pwdhash, fullhash, allhash]`, then increments the user's nonce and emits `Verified`.\n\n`resetPassword` changes the password by requiring proofs from both the old and the new secret. The reference circuit uses Poseidon hashes (circom/snarkjs).\n\n## Sample code\n\nA requester contract that gates withdrawals on an elastic signature:\n\n```solidity\n// SPDX-License-Identifier: CC0-1.0\npragma solidity ^0.8.20;\n\ninterface IElasticSignature {\n    event SetPassword(address indexed user, uint indexed pwdhash);\n    event Verified(address indexed user, uint indexed nonce);\n    function pwdhashOf(address user) external view returns (uint);\n    function verify(address user, uint[8] memory proof, uint datahash,\n                    uint expiration, uint allhash) external;\n}\n\ncontract PasswordVault {\n    IElasticSignature public immutable es;\n    mapping(address =\u003e uint256) public balance;\n\n    constructor(IElasticSignature _es) { es = _es; }\n\n    function withdraw(uint256 amount, uint[8] calldata proof,\n                      uint expiration, uint allhash) external {\n        // datahash binds the proof to this exact action\n        uint datahash = uint(keccak256(abi.encode(address(this), msg.sender, amount)));\n        es.verify(msg.sender, proof, datahash, expiration, allhash); // reverts if invalid\n        balance[msg.sender] -= amount;\n        payable(msg.sender).transfer(amount);\n    }\n}\n```\n\n## Things to know\n\n- Status is **Draft**; the interface and hash construction may still change.\n- `pwdhash` is public, so the password can be brute-forced offline. The spec's own estimates show short passwords fall quickly on a GPU; only very long, high-entropy secrets approach private-key strength.\n- The nonce prevents replay of a proof; the chain ID in `fullhash` prevents cross-chain reuse. The prover and verifier must agree exactly on how `fullhash` and `datahash` are built.\n- Proof generation happens client-side and needs the circuit artefacts; the on-chain verifier is generated from that circuit, so both must match.\n"},"ja":{"lang":"ja","tldr":"パスワードベースの「エラスティック署名」のためのドラフトのインターフェースです。ユーザーは、変更可能な秘密を知っていることをゼロ知識証明で示し、コントラクトがそれを検証します。秘密鍵に加えるもう 1 つの署名要素として使われます。","tags":["signatures","zero-knowledge","password","wallets","draft"],"related":[4337,1271],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ja/eip-6327/","markdown":"## 何を解決するのか\n\n秘密鍵は技術に詳しくないユーザーには難しいものです。変更できず、覚えられず、1 つ失えばすべてを失います。カストディ型の鍵サービスはオンボーディングを楽にしますが、ベンダーに依存します。\n\nERC-6327 は**エラスティック署名（ES）**を提案します。パスワードのような人間に優しい秘密で操作を認可し、そのパスワードはユーザーがいつでも変更できます。パスワードが保存されたり明かされたりすることはありません。代わりに、ユーザーはそれを知っていることのゼロ知識証明を生成し、検証コントラクトがオンチェーンで証明をチェックします。\n\n仕様は ES を鍵の代替ではなく*追加の*要素と位置づけています。たとえば、ウォレットのキーが侵害されていても、引き出しにパスワードを要求する DeFi アプリや、[ERC-4337](/eip-4337/) スマートアカウント向けのパスワードプラグインなどです。\n\n## 仕組み\n\n3 つの役割と、いくつかのハッシュがあります。\n\n- `pwdhash` = パスワードのハッシュ（ユーザーのアドレスに紐づく）。検証者がオンチェーンに保存します。\n- `datahash` = 認可される操作のハッシュ。**リクエスター**コントラクトが生成します。\n- `fullhash` = `datahash` と既知の値のハッシュ。ユーザーごとの `nonce` と `chainid` を含めるべきです（リファレンス実装は `expiration` も混ぜています）。\n- `allhash` = `pwdhash` と `fullhash` のハッシュ。\n\n流れ:\n\n1. **プルーバー**（ユーザーのクライアント）が、パスワード、アドレス、`fullhash` から `allhash` と zk-SNARK の `proof` を計算します。\n2. **リクエスター**コントラクトが、**検証者**の `verify(user, proof, datahash, expiration, allhash)` を呼び出します。\n3. 検証者は `fullhash` を再計算し、`pwdhash` を参照して、公開値 `[pwdhash, fullhash, allhash]` に対して証明を確認し、ユーザーの nonce を増やして `Verified` を発行します。\n\n`resetPassword` は、古い秘密と新しい秘密の両方からの証明を要求することでパスワードを変更します。リファレンス回路は Poseidon ハッシュ（circom/snarkjs）を使っています。\n\n## サンプルコード\n\nエラスティック署名で引き出しを制御するリクエスターコントラクトです。\n\n```solidity\n// SPDX-License-Identifier: CC0-1.0\npragma solidity ^0.8.20;\n\ninterface IElasticSignature {\n    event SetPassword(address indexed user, uint indexed pwdhash);\n    event Verified(address indexed user, uint indexed nonce);\n    function pwdhashOf(address user) external view returns (uint);\n    function verify(address user, uint[8] memory proof, uint datahash,\n                    uint expiration, uint allhash) external;\n}\n\ncontract PasswordVault {\n    IElasticSignature public immutable es;\n    mapping(address =\u003e uint256) public balance;\n\n    constructor(IElasticSignature _es) { es = _es; }\n\n    function withdraw(uint256 amount, uint[8] calldata proof,\n                      uint expiration, uint allhash) external {\n        // datahash binds the proof to this exact action\n        uint datahash = uint(keccak256(abi.encode(address(this), msg.sender, amount)));\n        es.verify(msg.sender, proof, datahash, expiration, allhash); // reverts if invalid\n        balance[msg.sender] -= amount;\n        payable(msg.sender).transfer(amount);\n    }\n}\n```\n\n## 知っておくべきこと\n\n- ステータスは **Draft** です。インターフェースとハッシュの構成はまだ変わる可能性があります。\n- `pwdhash` は公開されているため、パスワードはオフラインでブルートフォースできます。仕様自身の見積もりでは、短いパスワードは GPU で素早く破られます。秘密鍵に近い強度に達するのは、非常に長くエントロピーの高い秘密だけです。\n- nonce は証明のリプレイを防ぎ、`fullhash` 内のチェーン ID はクロスチェーンでの再利用を防ぎます。プルーバーと検証者は、`fullhash` と `datahash` の構成方法について、正確に合意していなければなりません。\n- 証明の生成はクライアント側で行われ、回路のアーティファクトが必要です。オンチェーンの検証者はその回路から生成されるため、両者は一致していなければなりません。\n"},"ko":{"lang":"ko","tldr":"비밀번호 기반 \"탄력적 서명(elastic signature)\"을 위한 초안 인터페이스입니다. 사용자가 바꿀 수 있는 비밀을 안다는 것을 영지식 증명으로 보이고 컨트랙트가 이를 검증하며, 개인 키 위에 더해지는 추가 서명 요소로 쓰입니다.","tags":["signatures","zero-knowledge","password","wallets","draft"],"related":[4337,1271],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ko/eip-6327/","markdown":"## 어떤 문제를 해결하나요?\n\n개인 키는 비전문가 사용자에게 어렵습니다. 바꿀 수 없고, 외울 수 없으며, 하나를 잃으면 모든 것을 잃습니다. 수탁형 키 서비스는 온보딩을 쉽게 해주지만 업체에 의존하게 됩니다.\n\nERC-6327은 **탄력적 서명(ES)**을 제안합니다. 비밀번호처럼 사람에게 친숙한 비밀로 작업을 승인하고, 그 비밀번호는 사용자가 원할 때 언제든 바꿀 수 있습니다. 비밀번호는 저장되거나 공개되지 않습니다. 대신 사용자는 그것을 안다는 영지식 증명을 만들고, 검증자 컨트랙트가 온체인에서 증명을 확인합니다.\n\n명세는 ES를 키의 대체가 아니라 *추가* 요소로 규정합니다. 예를 들어 지갑 키가 탈취되더라도 출금 시 비밀번호를 요구하는 DeFi 앱이나, [ERC-4337](/eip-4337/) 스마트 계정용 비밀번호 플러그인 같은 것입니다.\n\n## 어떻게 동작하나요?\n\n세 가지 역할과 몇 가지 해시가 있습니다.\n\n- `pwdhash` = 비밀번호의 해시(사용자 주소에 묶임). 검증자가 온체인에 저장합니다.\n- `datahash` = 승인할 작업의 해시. **요청자** 컨트랙트가 만듭니다.\n- `fullhash` = `datahash`와 잘 알려진 값들의 해시이며, 사용자별 `nonce`와 `chainid`를 포함해야 합니다(레퍼런스 구현은 `expiration`도 섞습니다).\n- `allhash` = `pwdhash`와 `fullhash`의 해시.\n\n흐름:\n\n1. **증명자**(사용자의 클라이언트)가 비밀번호, 주소, `fullhash`로 `allhash`와 zk-SNARK `proof`를 계산합니다.\n2. **요청자** 컨트랙트가 **검증자**의 `verify(user, proof, datahash, expiration, allhash)`를 호출합니다.\n3. 검증자는 `fullhash`를 다시 계산하고, `pwdhash`를 조회하고, 공개 값 `[pwdhash, fullhash, allhash]`에 대해 증명을 확인한 뒤, 사용자의 nonce를 증가시키고 `Verified`를 발생시킵니다.\n\n`resetPassword`는 이전 비밀과 새 비밀 양쪽의 증명을 요구해 비밀번호를 바꿉니다. 레퍼런스 회로는 Poseidon 해시(circom/snarkjs)를 사용합니다.\n\n## 샘플 코드\n\n탄력적 서명으로 출금을 제어하는 요청자 컨트랙트입니다.\n\n```solidity\n// SPDX-License-Identifier: CC0-1.0\npragma solidity ^0.8.20;\n\ninterface IElasticSignature {\n    event SetPassword(address indexed user, uint indexed pwdhash);\n    event Verified(address indexed user, uint indexed nonce);\n    function pwdhashOf(address user) external view returns (uint);\n    function verify(address user, uint[8] memory proof, uint datahash,\n                    uint expiration, uint allhash) external;\n}\n\ncontract PasswordVault {\n    IElasticSignature public immutable es;\n    mapping(address =\u003e uint256) public balance;\n\n    constructor(IElasticSignature _es) { es = _es; }\n\n    function withdraw(uint256 amount, uint[8] calldata proof,\n                      uint expiration, uint allhash) external {\n        // datahash binds the proof to this exact action\n        uint datahash = uint(keccak256(abi.encode(address(this), msg.sender, amount)));\n        es.verify(msg.sender, proof, datahash, expiration, allhash); // reverts if invalid\n        balance[msg.sender] -= amount;\n        payable(msg.sender).transfer(amount);\n    }\n}\n```\n\n## 알아둘 점\n\n- 상태는 **Draft**입니다. 인터페이스와 해시 구성은 아직 바뀔 수 있습니다.\n- `pwdhash`는 공개되어 있으므로 비밀번호를 오프라인에서 무차별 대입할 수 있습니다. 명세 자체의 추정에 따르면 짧은 비밀번호는 GPU에서 금세 뚫립니다. 개인 키에 가까운 강도에 이르는 것은 아주 길고 엔트로피가 높은 비밀뿐입니다.\n- nonce는 증명의 리플레이를 막고, `fullhash`의 체인 ID는 크로스체인 재사용을 막습니다. 증명자와 검증자는 `fullhash`와 `datahash`를 어떻게 구성하는지 정확히 합의해야 합니다.\n- 증명 생성은 클라이언트 측에서 이루어지며 회로 산출물이 필요합니다. 온체인 검증자는 그 회로에서 생성되므로 둘은 일치해야 합니다.\n"},"zh":{"lang":"zh","tldr":"一个基于密码的\"弹性签名\"草案接口：用户用零知识证明来证明自己知道一个可更改的秘密，由合约验证，作为私钥之上的额外签名因素。","tags":["signatures","zero-knowledge","password","wallets","draft"],"related":[4337,1271],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/zh/eip-6327/","markdown":"## 它解决什么问题？\n\n私钥对非技术用户很难：它不能更改，记不住，丢了就等于失去一切。托管式密钥服务让入门更容易，但要依赖供应商。\n\nERC-6327 提议一种**弹性签名（ES）**：用一个对人友好的秘密（比如密码）来授权某项操作，用户可以随时更改这个秘密。密码从不被存储或泄露。用户生成的是一份证明自己知道它的零知识证明，由验证者合约在链上检查该证明。\n\n规范把 ES 定位为*额外的*因素，而不是对密钥的替代：例如，即使钱包密钥被攻破，DeFi 应用也要求输入密码才能提款，或是用作 [ERC-4337](/eip-4337/) 智能账户的密码插件。\n\n## 它如何运作\n\n三个角色和几个哈希：\n\n- `pwdhash` = 密码的哈希（与用户地址绑定）；由验证者存储在链上。\n- `datahash` = 被授权操作的哈希，由**请求者**合约生成。\n- `fullhash` = `datahash` 加上若干已知值的哈希，其中应包含每个用户的 `nonce` 和 `chainid`（参考实现还混入了 `expiration`）。\n- `allhash` = `pwdhash` 和 `fullhash` 的哈希。\n\n流程：\n\n1. **证明者**（用户的客户端）根据密码、地址和 `fullhash` 计算 `allhash` 和 zk-SNARK 的 `proof`。\n2. **请求者**合约在**验证者**上调用 `verify(user, proof, datahash, expiration, allhash)`。\n3. 验证者重新计算 `fullhash`，查出 `pwdhash`，针对公开值 `[pwdhash, fullhash, allhash]` 检查证明，然后递增用户的 nonce 并触发 `Verified`。\n\n`resetPassword` 通过要求同时提供旧秘密和新秘密的证明来更改密码。参考电路使用 Poseidon 哈希（circom/snarkjs）。\n\n## 示例代码\n\n一个以弹性签名控制提款的请求者合约：\n\n```solidity\n// SPDX-License-Identifier: CC0-1.0\npragma solidity ^0.8.20;\n\ninterface IElasticSignature {\n    event SetPassword(address indexed user, uint indexed pwdhash);\n    event Verified(address indexed user, uint indexed nonce);\n    function pwdhashOf(address user) external view returns (uint);\n    function verify(address user, uint[8] memory proof, uint datahash,\n                    uint expiration, uint allhash) external;\n}\n\ncontract PasswordVault {\n    IElasticSignature public immutable es;\n    mapping(address =\u003e uint256) public balance;\n\n    constructor(IElasticSignature _es) { es = _es; }\n\n    function withdraw(uint256 amount, uint[8] calldata proof,\n                      uint expiration, uint allhash) external {\n        // datahash binds the proof to this exact action\n        uint datahash = uint(keccak256(abi.encode(address(this), msg.sender, amount)));\n        es.verify(msg.sender, proof, datahash, expiration, allhash); // reverts if invalid\n        balance[msg.sender] -= amount;\n        payable(msg.sender).transfer(amount);\n    }\n}\n```\n\n## 需要注意\n\n- 状态为 **Draft**；接口和哈希构造仍可能变化。\n- `pwdhash` 是公开的，所以密码可以被离线暴力破解。规范自己的估算显示，短密码在 GPU 上很快就会被破解；只有非常长、高熵的秘密才接近私钥的强度。\n- nonce 防止证明被重放；`fullhash` 中的链 ID 防止跨链重用。证明者和验证者必须就 `fullhash` 和 `datahash` 的构造方式完全一致。\n- 证明生成在客户端进行，需要电路产物；链上验证者由该电路生成，所以两者必须匹配。\n"}}}
