---
eip: 6327
label: ERC-6327
title: Elastic Signature
status: Draft
type: Standards Track
category: ERC
created: 2023-01-13
official: https://eips.ethereum.org/EIPS/eip-6327
source: https://github.com/ethereum/ERCs/blob/master/ERCS/erc-6327.md
canonical: https://eips.huatuo.xyz/eip-6327/
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]
---

# ERC-6327: Elastic Signature

> Use password to sign data as private key

**TL;DR:** 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.

## What problem does it solve?

Private 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.

ERC-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.

The 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.

## How it works

Three roles and a handful of hashes:

- `pwdhash` = hash of the password (bound to the user's address); stored on-chain by the verifier.
- `datahash` = hash of the action being authorised, produced by the **requester** contract.
- `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`).
- `allhash` = hash of `pwdhash` and `fullhash`.

Flow:

1. The **prover** (user's client) computes `allhash` and a zk-SNARK `proof` from the password, address and `fullhash`.
2. The **requester** contract calls `verify(user, proof, datahash, expiration, allhash)` on the **verifier**.
3. 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`.

`resetPassword` changes the password by requiring proofs from both the old and the new secret. The reference circuit uses Poseidon hashes (circom/snarkjs).

## Sample code

A requester contract that gates withdrawals on an elastic signature:

```solidity
// SPDX-License-Identifier: CC0-1.0
pragma solidity ^0.8.20;

interface IElasticSignature {
    event SetPassword(address indexed user, uint indexed pwdhash);
    event Verified(address indexed user, uint indexed nonce);
    function pwdhashOf(address user) external view returns (uint);
    function verify(address user, uint[8] memory proof, uint datahash,
                    uint expiration, uint allhash) external;
}

contract PasswordVault {
    IElasticSignature public immutable es;
    mapping(address => uint256) public balance;

    constructor(IElasticSignature _es) { es = _es; }

    function withdraw(uint256 amount, uint[8] calldata proof,
                      uint expiration, uint allhash) external {
        // datahash binds the proof to this exact action
        uint datahash = uint(keccak256(abi.encode(address(this), msg.sender, amount)));
        es.verify(msg.sender, proof, datahash, expiration, allhash); // reverts if invalid
        balance[msg.sender] -= amount;
        payable(msg.sender).transfer(amount);
    }
}
```

## Things to know

- Status is **Draft**; the interface and hash construction may still change.
- `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.
- 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.
- Proof generation happens client-side and needs the circuit artefacts; the on-chain verifier is generated from that circuit, so both must match.


---

This is an unofficial plain-language summary. Read the full specification: https://eips.ethereum.org/EIPS/eip-6327
