Introduction
Hi, I'm cardene, a software engineer and technical writer focused on blockchain and AI.
I've also authored Japanese technical books on specification-driven development with LLMs and decentralized application (DApp) development.
I also build and publish a variety of tools, libraries, and open-source projects.
This article covers ERC8111, which proposes compressing ECDSA signatures from 96 bytes to 64 bytes by fixing the y-parity parameter (v), while also eliminating signature malleability.
This article explains the proposal linked below.
I also cover a range of EIPs, BIPs, SLIPs, CAIPs, ENSIPs, RFCs, and ACPs.
Overview
ERC8111 compresses ECDSA signatures from 96 bytes to 64 bytes by fixing the v parameter at 27.
ECDSA signatures used in Ethereum consist of three parameters, v, r, and s, occupying 96 bytes when encoded using the Solidity ABI.
However, v can have only two values, 27 or 28, so 32 bytes are used to convey a single bit of information.
ERC8111 always fixes v at 27 and transforms s when necessary, allowing the signature to be represented by the 64 bytes of r and s alone.
The approach also eliminates the signature malleability issue discussed here, in which multiple valid signatures exist for the same message.
ECDSA signature fundamentals
ECDSA (Elliptic Curve Digital Signature Algorithm) is a digital signature algorithm based on elliptic curve cryptography. Ethereum uses the secp256k1 elliptic curve, and its signatures consist of the following three parameters.
secp256k1 is an elliptic curve that became widely used after its adoption in Bitcoin. The name refers to Standards for Efficient Cryptography (sec), a prime field (p), a 256-bit size, and Koblitz curve number 1 (k1). Ethereum also uses this curve; its private keys, public keys, and signatures are all based on its mathematics.
| Parameter | Size | Description |
|---|---|---|
r |
32 bytes | The x-coordinate of a point on the elliptic curve, calculated from a randomly chosen point during signing. |
s |
32 bytes | The signature's challenge response, calculated using the private key and message hash. |
v |
32 bytes (ABI) | A value indicating y-parity (whether the y-coordinate is even or odd): 27 or 28. Because the elliptic curve is symmetric, two y-coordinates correspond to a given x-coordinate; this value selects the intended solution. |
Y-parity deserves a closer look. A point on an elliptic curve has coordinates (x, y), and a given x-coordinate has two possible y-coordinates because the curve is symmetric about the x-axis. v carries one bit of information selecting the y-coordinate: 27 for even and 28 for odd. A signature verifier uses this information to recover the public key (address) unambiguously.
Solidity ABI encoding aligns each parameter to 256 bits (32 bytes), bringing the total to 96 bytes.
Yet v effectively conveys only one bit of information.
Signature malleability
Signature malleability is the property that another valid signature can be computed from an existing one.
With ECDSA, if (v, r, s) is a valid signature, (v', r, s') is also valid.
Here, v' is the inverse of v (27 becomes 28, and 28 becomes 27), while s' is the order N of secp256k1 minus s.
This property matters when signature hashes are used to determine transaction uniqueness. For example, when a multisig wallet checks whether a signature has already been used, transforming the signature into another valid form may allow the same approval to be used twice.
Example attack scenario
Suppose a contract maintains a mapping from signature hashes to flags indicating whether a signature has been used. After the original signature (v=27, r, s) has been marked as used, an attacker may submit the mathematically equivalent signature (v=28, r, N-s) for the same approval. Because the hashes differ, the used-signature check does not recognize the equivalent form. This is a double-use attack based on signature malleability.
Motivation
Signature size and gas costs
In Ethereum smart contracts, ECDSA signatures are passed in calldata (the bytes sent when invoking a contract function, containing its actual arguments). Each byte of calldata incurs a gas cost, so signature size directly affects cost. Reducing signatures from 96 to 64 bytes can lower gas costs for contracts that receive them.
Limitations of existing compression methods
ERC2098 already provides a way to compress signatures to 64 bytes.
Its approach stores the y-parity value in the most significant bit (MSB) of s.
Under EIP2, canonical signatures (signatures whose s value is limited to half the secp256k1 order N or less) always have a zero in the most significant bit of s. That bit can therefore be reused to store y-parity.
However, ERC2098 has a drawback.
Before a smart contract can pass a compressed signature to the ecrecover precompile, it must unpack the signature by extracting v from the most significant bit and masking that bit out of s.
This unpacking incurs additional gas costs.
The ecrecover precompile is a special low-level function built into Ethereum. It is implemented directly in the EVM for faster and less expensive execution than ordinary Solidity code and resides at address 0x0000...0001. Calling ecrecover(digest, v, r, s) returns the address corresponding to the private key that generated the signature. Solidity's built-in ecrecover() function invokes this precompile.
The diagram below compares the compression methods of ERC2098 and ERC8111. The existing diagrams, including their Japanese labels, are retained from the original article.

The Bound Signatures approach
Bound Signatures in ERC8111 take a different approach.
Always fix v at 27; if the original signature has v = 28, replace s with the secp256k1 order N minus its original value.
The compressed signature can then be supplied directly to ecrecover(digest, 27, r, s), eliminating the unpacking step.
This makes the approach more gas-efficient than ERC2098.
Specification
Contract-side rules
Smart contracts accepting Bound Signatures use only 27 as v.
They must not accept other values.
The following code verifies a Bound Signature.
address signer = ecrecover(digest, 27, r, s);
require(signer != address(0));Since ecrecover returns address(0) when the signature is invalid, the check ensures that the result is not the zero address.
The key design detail is that v is not accepted as an argument.
Conventional ECDSA verification accepts v as in ecrecover(digest, v, r, s), whereas Bound Signatures always use 27 for v, allowing the argument to be omitted.
This saves 32 bytes of calldata.
Allowing both 27 and 28 as v would reintroduce signature malleability.
For example, if a signature with v = 27, s = X is valid, so is one with v = 28, s = N - X.
Accepting both would leave two valid signatures for the same message, so the contract must restrict acceptance to 27.
The bind function
The bind function converts an ECDSA signature into a Bound Signature as follows.
const SECP256K1_N: bigint = 0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141n
function bind(sig: Signature, v: 27 | 28 = 27): Signature {
if (sig.v === v) {
return sig
}
const s = SECP256K1_N - sig.s
return new Signature(sig.r, s, v)
}The proposal is written in TypeScript, where the type of v is restricted to the two values 27 | 28.
The default is 27, but the general-purpose design also permits conversion to v = 28 by specifying 28 as an argument.
The function works as follows.
If the original signature's v already matches the target value (27 by default), it returns the signature unchanged.
Otherwise, it replaces s with the secp256k1 curve order N minus its original value, sets the target v, and returns the result.
SECP256K1_N is the order of the secp256k1 elliptic curve, a constant defining the possible range of s.
By the mathematical properties of the curve, transforming s into N - s reverses v (y-parity).
This allows a signature with v = 28 to be converted into one with v = 27.
The order is the number of times an elliptic curve point must be added to itself to return to the identity element (the point at infinity). The secp256k1 order N is a large prime near 2 to the power of 256, and s always falls between 1 以上 N-1 以下 (1 and N-1 inclusive). The values s and N-s are mathematically symmetric: transforming one into the other preserves which public key the signature can be verified against while reversing y-parity. This property enables the conversion of v.
The following Mermaid diagram shows the flow of the bind function.
flowchart TD
A["署名(v, r, s)を受け取る"] --> B{"v == 27 ?"}
B -- はい --> C["そのまま返す\n(v=27, r, s)"]
B -- いいえ --> D["s' = N - s に変換"]
D --> E["変換後の署名を返す\n(v=27, r, s')"]
If the original signature's v is 27, it can be used unchanged.
If it has v=28, transforming s produces a form from which ecrecover can recover the correct signer using v=27.
The diagram below shows the overall Bound Signature generation and verification flow.

Signature verification flow
The following sequence diagram shows on-chain verification with Bound Signatures.
sequenceDiagram
participant Signer as 署名者(オフチェーン)
participant Client as クライアント
participant Contract as スマートコントラクト
participant Precompile as ecrecover
Signer->>Client: ECDSA署名(v, r, s)を生成
Client->>Client: bind(sig)でv=27に変換
Client->>Contract: (r, s)のみ送信(64バイト)
Contract->>Precompile: ecrecover(digest, 27, r, s)
Precompile-->>Contract: 署名者のアドレスを返却
Contract->>Contract: アドレスの検証
The signer produces an ordinary ECDSA signature, which the client converts to v=27 using the bind function.
Only the 64 bytes of r and s are sent to the contract, which calls ecrecover using the fixed value 27.
Rationale
Comparison with ERC2098
ERC8111 and ERC2098 both compress ECDSA signatures to 64 bytes, but their approaches differ.
| Aspect | ERC2098 | ERC8111 |
|---|---|---|
| Compression method | Store y-parity in the MSB of s |
Fix v at 27 and adjust s |
| Signature size | 64 bytes | 64 bytes |
Compatibility with ecrecover |
Requires unpacking | Direct input |
| Contract-side processing | Bit shifts and masking | None (specify v=27 directly) |
| Gas efficiency | Additional gas for unpacking | More efficient |
| Signature malleability | Eliminated | Eliminated |
With ERC2098, after receiving the compressed signature, the contract must extract the most significant bit of yParityAndS to recover v, then recover s from the remaining 255 bits.
By contrast, ERC8111 Bound Signatures can be passed directly to the ecrecover precompile without that additional gas cost.
Why choose 27?
The fixed value 27 for v was chosen to make y-parity falsy.
In Ethereum, v = 27 corresponds to y-parity 0 (even), and v = 28 corresponds to y-parity 1 (odd).
Since zero is falsy in many programming languages, it is an intuitive choice.
Backward compatibility
Bound Signatures are compatible with the ecrecover precompile.
Setting the v parameter to 27 allows verification using conventional ecrecover.
However, there is a restriction on using this scheme for transaction signatures.
Under EIP2, Ethereum transaction signatures require a low s.
Specifically, s must be no greater than half the secp256k1 order N.
Because Bound Signatures perform transformations such as s = N - original_s, s may exceed half of N, producing a high s.
The scheme is therefore intended for custom signature verification within contracts rather than transaction signatures.
Examples include meta-transactions (where another address pays gas so users can operate contracts without holding ETH), multisig wallets, off-chain approvals (permit, which allows token approval through a signature without an on-chain transaction), and typed-data signatures under EIP712, a standard for signing structured data with type information.
Test cases
The proposal provides the following three test vectors.
Executing ecrecover with v = 27 in each case recovers the correct signer address.
| Signer | Digest | r |
s |
|---|---|---|---|
0x4a6f6B9fF1fc974096f9063a45Fd12bD5B928AD1 |
0xb0922c37cafd247fe3ada4eb1d1e3735b7d2837437c1178e9af120d535214270 |
0xdb7f75635124c807ec1f8b03e34cd76b633dc3a189e3c85fc5aee7e7d71df38c |
0x5f1e6c6edf21cacfc2acba2815b253b9048b894eec5aaf70343389bb596c48bc |
0x4a6f6B9fF1fc974096f9063a45Fd12bD5B928AD1 |
0xd92ff06caae7253883627416a425414d79e9003b91d6208add30e73735ef13c3 |
0xaa40efd534ac7f96b85babd7df9228fa131e8523115ca1ebc025698c37f3867d |
0xa4b8d3c650fe62e46a563aed681bfdd44d50452fa7712bd139f2bfba3aed59c9 |
0x6B93E3bB9C0780C0f9042346Ffc379530a5882c1 |
0xfa75eba87f076cf22489da7c53a651bb3869473f78d09d4814afb7ab2d54ed45 |
0xaf4a877600ab6d14ebac626830cf1063d624487932b3cc73a7cd98ae7fbf337f |
0xbc41d29acfcd3a1e7b5cb2dde1b85fe8882739312639b5f16d476a87584c040f |
These test vectors verify that Bound Signatures correctly recover the signer with ecrecover.
With Bound Signatures, s may exceed half the secp256k1 order N (high s), but the ecrecover precompile itself works with high s.
As noted above, transaction signatures with high s are invalid under EIP2, so distinguish these use cases.
Reference implementation
The following is a reference Solidity library for verifying Bound Signatures.
pragma solidity ^0.8.30;
library BoundSignatures {
function recover(bytes32 digest, bytes32 r, bytes32 s) internal pure returns (address signer) {
signer = ecrecover(digest, 27, r, s);
require(signer != address(0));
}
}The recover function does not accept the v parameter, using the fixed value 27 internally.
It has one fewer argument than a conventional signature verification function.
If ecrecover returns the zero address, the signature is invalid, so the function checks the result with require.
The library provides a concise way to verify Bound Signatures safely.
Usage example
The following contract uses the library to verify the signer of a message.
pragma solidity ^0.8.30;
import "./BoundSignatures.sol";
contract SignatureVerifier {
using BoundSignatures for bytes32;
mapping(bytes32 => bool) public usedSignatures;
function verify(bytes32 digest, bytes32 r, bytes32 s) external view returns (address) {
return digest.recover(r, s);
}
function executeWithSignature(
bytes32 digest,
bytes32 r,
bytes32 s,
address expectedSigner
) external {
bytes32 sigHash = keccak256(abi.encodePacked(r, s));
require(!usedSignatures[sigHash], "Signature already used");
address signer = digest.recover(r, s);
require(signer == expectedSigner, "Invalid signer");
usedSignatures[sigHash] = true;
}
}The executeWithSignature function uses signature hashes to prevent double use.
The original article treats Bound Signatures as unique for a message and thus identifies a signature using the hash of r and s alone.
With the signature malleability discussed here eliminated, transforming a signature into its equivalent form cannot bypass the double-use check.
Security
Signature recoverability
Bound Signatures are recoverable signatures.
Because ecrecover can recover the signer's public key (address), they have the same security properties as conventional ECDSA signatures.
Eliminating signature malleability
Bound Signatures fix v at 27, eliminating the malleability discussed here.
Conventional ECDSA signatures have two equivalent valid forms, (27, r, s) and (28, r, N - s). Accepting only v = 27 leaves one of those forms for a given digest.
This supports the pattern described in the original article of using signature hashes as keys to prevent replay (reusing an already used signature to repeat an operation).
References
Conclusion
This article covered 64-byte ECDSA signature compression and the elimination of signature malleability using ERC8111. I hope this explanation was useful.
If you have questions, feel free to send me a direct message on Twitter.
I also publish content on other platforms.




