---
description: >-
  This ERC proposes a specification about how to handle signed data in Ethereum
  contracts.
---

# EIP-191

EIP-191 is an Ethereum Improvement Proposal that specifies a standard for signed Ethereum messages. It provides a way to structure data that is signed, so it's clear what the signer's intention was and prevents various potential security issues.

Here are some key points about EIP-191:

1. **Why EIP-191**: Before EIP-191, Ethereum already had a defacto standard for signing messages which involved prefixing messages with a known string (`\x19Ethereum Signed Message:` followed by the message length). However, this was limited in flexibility and didn't cover various use-cases that applications required. EIP-191 aimed to provide a more structured and flexible way to sign different types of data.
2. **Versioning**: EIP-191 introduced versioning to the structure of signed data. It allowed for different types of structures, each identified by a version byte.
3. **Structure**: The format of a signed message under EIP-191 is:

<pre class="language-solidity"><code class="lang-solidity"><strong>0x19 &#x3C;version specific data> &#x3C;data to sign>
</strong></code></pre>

```solidity
0x19 <version specific data> <intended validator address> <data to sign>
```

* `0x19` is a magic value that ensures the signed data has a length of at least 1 byte, making it impossible to match the structure with Ethereum transactions.
* The `<version byte>` specifies the type of structure/data being signed.
* `<version-specific data>` is the data being signed, structured according to the specified version.

1. **Versions**:
   * `0x00`: Signs a typed data structure. This is used by the `eth_signTypedData` RPC method.
   * `0x01`: Signs a structured data (EIP-712) provided by an application, often a specific dApp.
   * `0x45`: The old `\x19Ethereum Signed Message:` prefix, for signing simple messages. This was included for backward compatibility.
2. **Security**: By providing a structured way to sign data, EIP-191 helps in preventing potential misuse where a user might be tricked into signing something they didn't intend to. By making it clear what's being signed and for what purpose, it adds an extra layer of clarity and security.

In short, EIP-191 provides a more flexible and safer way to sign different types of data on the Ethereum network, ensuring that the signer's intent is always clear.

<figure><img src="https://3547655941-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRVaGqrTkWVRFb9yH5Pt5%2Fuploads%2F4vNUb7tLQMEvNilVTkKe%2Fimage.png?alt=media&#x26;token=1dca5e4d-8636-42a7-822f-6bfd624ec8c5" alt=""><figcaption></figcaption></figure>

<figure><img src="https://3547655941-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRVaGqrTkWVRFb9yH5Pt5%2Fuploads%2FT0IGjogDXXpz364mfs9C%2Fimage.png?alt=media&#x26;token=0f79cf8d-8703-415d-8ed9-e5d08853f841" alt=""><figcaption></figcaption></figure>

{% embed url="https://www.youtube.com/watch?v=OKg4PqD01Z0" %}

{% embed url="https://eips.ethereum.org/EIPS/eip-191" %}

{% embed url="https://www.youtube.com/watch?v=rtyaD-RASbQ" %}

{% embed url="https://www.youtube.com/watch?v=wBr_N7CtIts" %}

{% embed url="https://www.youtube.com/watch?v=vYwYe-Gv_XI&t=71s" %}

