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 ERC8128, which attaches Ethereum account signatures directly to HTTP requests to support request-level authentication without API keys or sessions.
This explanation translates, summarizes, and expands on the following specification.
I have also written about other EIPs, BIPs, SLIPs, CAIPs, ENSIPs, RFCs, and ACPs.
Overview
ERC8128 uses Ethereum accounts to attach cryptographic signatures to HTTP requests, enabling authentication and integrity verification for signed request components. It builds on RFC 9421, HTTP Message Signatures, and defines Ethereum-specific signing and verification.
Conventional HTTP authentication commonly uses bearer credentials, such as cookies, API keys, and bearer JWTs, which grant access to whoever possesses them. If stolen, such credentials can be reused by another party and do not themselves bind authorization to the specific request contents.
With ERC8128, signatures can be cryptographically bound to the request's method, path, query, and body so alterations to signed components are detectable. The server need not issue or maintain bearer credentials and can use Ethereum account identities directly.
What is RFC 9421?
RFC 9421 (HTTP Message Signatures) is an IETF standard for applying cryptographic signatures to HTTP messages.
Rather than only authenticating a sender, HTTP message signatures can bind cryptographic evidence to the contents of a request. A signer selects components such as the method, path, and headers, serializes their values in a specified canonical format, and produces a cryptographic signature. The verifier reconstructs the signature base using the same procedure and verifies the signature to check integrity of the covered components.
RFC 9421 defines the following elements.
| Element | Description |
|---|---|
Signature-Input header |
Contains the covered component list and signature parameters |
Signature header |
Contains signature bytes |
| Derived component | A value derived from the HTTP message, such as @method, @authority, @path, or @query |
| Signature base | Canonicalized values of covered components combined into the message to be signed |
| Signature parameters | Values such as created (creation time), expires (expiration), nonce (replay protection), and keyid (key identifier) |
RFC 9421 is an algorithm-independent framework. It supports different signature algorithms, including RSA, ECDSA, and Ed25519.
ERC8128 combines this framework with ERC191 Ethereum message signing and ERC1271 smart contract signature verification to support Ethereum account authentication.
For more about ERC191, see the following article.
[ERC191] Using Signed Data Securely
Motivation
The following issues motivated the proposal.
Limitations of existing HTTP authentication
HTTP APIs commonly authenticate through bearer credentials such as cookies, API keys, and JWTs. These mechanisms authenticate possession of a credential but do not inherently bind it to the request's contents. Issuing and protecting server-managed credentials also creates operational overhead.
HTTP message signing addresses this by binding cryptographic evidence to the request itself. Clients sign selected components and servers verify them, allowing authentication and integrity protection without issuing or storing bearer credentials.
Differences from SIWE
EIP4361, Sign-In with Ethereum (SIWE), is widely used for interactive login in web applications.
For more about EIP4361, see the following article.
[ERC4361] Signing In to Off-Chain Services with Ethereum Addresses
SIWE establishes a session through a signed statement; it is not itself a per-request HTTP authentication profile. It does not directly standardize use cases such as the following.
- Machine-to-machine communication between API clients and servers.
- Automated API calls by AI agents.
- Authentication of individual requests without sessions or bearer credentials.
Using Ethereum accounts
Ethereum accounts provide globally verifiable identities with associated on-chain state. Using these accounts as HTTP signing authorities allows requests to be authenticated through proof of key control for EOAs or satisfaction of contract-defined signature policies for smart contract accounts (SCAs) through ERC1271.
For more about ERC1271, see the following article.
[ERC1271] Verifying Signatures through Smart Contracts
This enables richer authorization models, including delegation, session modules, scoped policies, and on-chain composability.
The proposal moves the selection of signing parameters toward the signer while leaving acceptance policy with the verifier. Traditional systems issue credentials, assign scopes, and manage risks on the server side. With ERC8128, the signer selects the covered request components and whether replay protection is included. The verifier evaluates the resulting signature against its acceptance rules.
Specification
Terminology
| Term | Definition |
|---|---|
| EOA | Externally owned account controlled by a private key |
| SCA | Smart contract account that verifies signatures through on-chain logic |
| Signer | HTTP client producing the request signature |
| Verifier | HTTP server or gateway verifying incoming request signatures |
| Request-Bound | Signature model binding authorization to a specific HTTP request |
| Class-Bound | Signature model binding authorization to a class of requests |
| Non-Replayable | A signature that cannot be accepted again within its validity window |
| Replayable | A signature that can be reused within its validity window, subject to policy |
Headers
Signatures are carried in the following two RFC 9421 HTTP headers.
Signature-Input- Contains the list of covered components and signature parameters.
Signature- Contains signature bytes corresponding to the label.
The recommended label is eth.
Any other label valid under RFC 9421 may also be used.
The following is an example of signed HTTP request headers.
Signature-Input: eth=("@method" "@authority" "@path" "@query" "content-digest");created=1736940000;expires=1736940060;nonce="b64url_r4Nd0mN0nCEK0YQY4d4r7A";keyid="eip8128:1:0x2a3b4c5d6e7f8091a2b3c4d5e6f708192a3b4c5d"
Signature: eth=:base64_encoded_signature_bytes:Signature-Input contains the covered components, such as @method and @authority, and the parameters created, expires, nonce, and keyid for the label eth.
Signature contains the corresponding Base64-encoded signature bytes.
Security model
ERC8128 expresses security along two independent axes: Request Binding and Replay Protection. No preliminary negotiation or capability discovery is necessary. The signer selects components and parameters, and the verifier evaluates them.
| Non-Replayable | Replayable | |
|---|---|---|
| Request-Bound | Strongest baseline; required for conformance | Request integrity, with reuse permitted during validity |
| Class-Bound | Authorization for a class of requests | Most flexible, but least restrictive |
Request binding
A Request-Bound signature authorizes a particular HTTP request. The proposal requires coverage of the following components in the applicable order. The source table lists authority first, while the preserved signing examples and reference code list method first; follow the authoritative profile when implementing component ordering.
| Component | Contents | Requirement |
|---|---|---|
@authority |
Authority (host and applicable port) | Always required |
@method |
HTTP method | Always required |
@path |
Path | Always required |
@query |
Query string | When a query is present |
content-digest |
Request-body digest | When the applicable body condition is met |
Changes to covered method, path, query, or body data invalidate the signature or digest verification.
A Class-Bound signature omits some of these components. By retaining the applicable ordering of the remaining components, it authorizes a class of requests matching the signed components rather than one fully specified request.
For example, a signature covering only @authority and @method could authorize POST requests to api.example.com under a policy accepting that class.
Because differing paths or bodies may still satisfy the signature, this is more flexible but provides weaker binding.
Limit such signatures to low-risk cases with explicitly defined request classes, such as appropriate read operations.
Replay protection
A Non-Replayable signature must not be accepted more than once.
- Include the
nonceparameter. - The verifier must ensure uniqueness of each (
keyid,nonce) pair within its application-defined nonce retention window. - Reject Non-Replayable signatures whose
expires - createdexceeds the nonce retention window. - A previously accepted nonce must not be accepted again during that window.
Omitting nonce makes the signature Replayable. It may be reused during its validity window if the verifier's policy permits.
Conformance
A conforming implementation must support signatures satisfying both of the following conditions.
- Request-Bound.
- Non-Replayable.
This baseline enables interoperability when signers choose the strongest binding and replay-protection configuration, subject to the verifier's remaining acceptance conditions. An implementation supporting only signatures that fail either baseline condition is not conformant.
Verifiers may optionally accept Replayable or Class-Bound signatures. A verifier accepting Replayable signatures must implement early signature invalidation, as described below.
Signature parameters
keyid
This parameter identifies an Ethereum account with an explicit chain context. Use the following format.
keyid="eip8128:<chain-id>:<address>"<chain-id>: Decimal integer defined by EIP155.<address>: Ethereum address represented by0xfollowed by 40 hexadecimal characters.
For more about EIP155, see the following article.
[EIP155] Preventing Cross-Chain Replay of Ethereum Transactions
Signers are encouraged to serialize addresses in lowercase hexadecimal. Verifiers must treat address casing as insignificant.
The chain ID is used to determine the relevant smart contract account and perform ERC1271 verification.
The eip8128 namespace resembles the CAIP-10 account identifier syntax (eip155:<chain-id>:<address>), but uses a distinct prefix to identify this signing profile explicitly.
created and expires
created: Unix timestamp in seconds at which the signature becomes valid.expires: Unix timestamp in seconds at which the signature expires; must be greater thancreated.
The verifier rejects signatures in the following cases.
createdorexpiresis not an integer Unix timestamp.- The current time falls outside the accepted validity interval.
Verifiers are also encouraged to configure clock-skew tolerance for created and a maximum signature lifetime.
nonce
This parameter provides replay protection. It is required for Non-Replayable signatures and omitted for Replayable signatures.
Constructing a signature
The following diagram illustrates how a signing client attaches a signature to an HTTP request.
sequenceDiagram
participant Client as Client (signer)
participant Wallet as Wallet
participant Server as Server (verifier)
Note over Client: Prepare the request
Client->>Client: Compute content-digest if a body is present
Client->>Client: Select covered components
Client->>Client: Construct Signature-Input
Client->>Client: Construct signature base M under RFC 9421
Client->>Wallet: Request ERC-191 signing of M
Wallet-->>Client: Return signature bytes
Client->>Client: Set Signature-Input and Signature headers
Client->>Server: Send signed HTTP request
The signing procedure is as follows.
- If the request has a body, compute
content-digestand add the corresponding header. - Construct
Signature-Inputusing labeleth, the covered components, and the parameterscreated,expires,nonce, andkeyid. - Construct signature base
Maccording to RFC 9421. - Use ERC191
personal_signencoding to compute the signing hash and obtain the wallet signature. - Set the
Signature-InputandSignatureheaders.
Compute hash H from signature base M as follows, using the byte length of M.
H = keccak256("\x19Ethereum Signed Message:\n" || decimal(len(M)) || M)For an EOA, create an ECDSA signature over H, then Base64-encode its bytes into the Signature header. A contract account uses its applicable signature policy.
Signature base example
The following illustrates a Request-Bound and Non-Replayable signature base.
"@method": POST
"@authority": api.example.com
"@path": /foo
"@query": ?a=1&b=two
"content-digest": sha-256=:ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad:
"@signature-params": ("@method" "@authority" "@path" "@query" \
"content-digest");created=1736940000;expires=1736940060;\
nonce="b64url_r4Nd0mN0nCEK0YQY4d4r7A";keyid="eip8128:1:0x2a3b4c5d6e7f8091a2b3c4d5e6f708192a3b4c5d"The example covers the POST method, authority api.example.com, path /foo, query ?a=1&b=two, and body digest.
The validity period is 60 seconds, from created=1736940000 to expires=1736940060, with nonce-based replay protection.
Verification flow
The following diagram shows the verifier's processing flow. Nonce acceptance must ultimately be an atomic check-and-consume operation after successful authentication.
sequenceDiagram
participant Server as Server (verifier)
participant Chain as Blockchain
Note over Server: Receive signed request
Server->>Server: Parse Signature-Input and Signature
Server->>Server: Validate created and expires
Server->>Server: Check nonce uniqueness
Server->>Server: Recompute and compare content-digest
Server->>Server: Reconstruct signature base M under RFC 9421
Server->>Server: Compute ERC-191 hash H
alt EOA
Server->>Server: Recover address with ecrecover and compare with keyid
else SCA
Server->>Chain: Call ERC-1271 isValidSignature
Chain-->>Server: Return verification result
end
Server->>Server: Atomically consume nonce if unused
Note over Server: Authentication succeeds
The verification procedure is as follows.
- Parse
Signature-InputandSignatureusing labelethor the corresponding selected label. - Validate
createdandexpires, and check whether the nonce has already been used if present. - If
content-digestis covered, recompute the digest from the received body and compare it with the signed header. - Reconstruct signature base
Mfrom the received request andSignature-Inputaccording to RFC 9421. - Compute the ERC191 signing hash
HfromM. - Extract the chain ID and address from
keyidand verify the signature. - Atomically consume the unused nonce before accepting the request, retaining it for the required window and at least until
expires.
EOA verification
For an EOA, use the applicable ERC191 signature verification procedure to recover the address with ecrecover and compare it with the address in keyid.
SCA verification
For an SCA, verify through ERC1271 isValidSignature.
Resolve the contract on the chain specified by keyid.
For more about ERC6492, see the following article.
[ERC6492] Verifying Signatures from Undeployed Contract Accounts
The reference implementation also supports verification of undeployed SCAs through ERC6492 and pre-delegated accounts, alongside deployed SCAs using ERC1271.
Signature invalidation
Invalidating Non-Replayable signatures
These signatures are invalidated by consuming their nonce.
- Track nonces and treat them as consumed after their first accepted use.
- Retain (
keyid,nonce) state for at least the accepted Non-Replayable signature's validity duration (expires - created) under the described retention policy.
Invalidating Replayable signatures
These signatures primarily become invalid through expiration. Because they lack nonce-based replay protection, verifiers accepting Replayable signatures must provide a signer-triggered early invalidation mechanism.
Include at least one of the following mechanisms.
- A not-before timestamp per
keyid. - Per-signature invalidation, such as a fingerprint of the signature or signature base.
Authenticate early invalidation requests with Request-Bound signatures. Class-Bound signatures must not authorize invalidation.
Early invalidation requires request binding because it is a control-plane operation changing the verifier's authorization state. Allowing broad Class-Bound authorization could enable excessive revocation or unintended expansion of authority.
Key compromise and rotation
If an EOA private key is compromised, the verifier relies on policy-based invalidation. For an SCA, changes to contract state, such as replacing an authorized signer, may invalidate previously issued signatures depending on the ERC1271 implementation.
Worked example
The following traces the signing and verification process using illustrative sample data rather than executable cryptographic test vectors.
Scenario
Consider the following situation.
Alice uses an EOA to send a purchase-order request to an NFT marketplace API. The server authenticates Alice's Ethereum address without using API keys or sessions.
| Item | Value |
|---|---|
| Sender | Alice (EOA) |
| Ethereum address | 0x70997970c51812dc3a010c7d01b50e0d17dc79c8 |
| Chain ID | 1 (Ethereum Mainnet) |
| Destination API | api.example.com |
| Operation | NFT purchase order |
HTTP request before signing
Alice wants to send the following HTTP request.
POST /api/v1/orders?currency=eth HTTP/1.1
Host: api.example.com
Content-Type: application/json
{"item":"nft_001","price":"0.5"}Its components are described below.
| Component | Value | Meaning |
|---|---|---|
| Method | POST |
Sends data to create a resource (an order) |
| Path | /api/v1/orders |
Order API endpoint |
| Query | ?currency=eth |
Specifies ETH as the payment currency |
| Host | api.example.com |
Destination server name |
| Body | {"item":"nft_001","price":"0.5"} |
NFT identifier and price (0.5 ETH) |
At this point, the request does not contain authentication information. The API server cannot yet establish that Alice authorized it.
Complete signing and verification flow
The following sequence diagram traces signing and verification with the sample request.
sequenceDiagram
participant Alice as Alice(EOA)
participant Server as API server
participant Store as Nonce store
Note over Alice: POST /api/v1/orders?currency=eth<br>body: {"item":"nft_001","price":"0.5"}
Alice->>Alice: 1. Compute content-digest
Alice->>Alice: 2. Select covered components<br>[@method, @authority, @path,<br>@query, content-digest]
Alice->>Alice: 3. Set parameters<br>[keyid, created, expires, nonce]
Alice->>Alice: 4. Construct Signature-Input
Alice->>Alice: 5. Construct signature base M (RFC 9421)
Alice->>Alice: 6. ERC-191 hash H = keccak256(...)
Alice->>Alice: 7. signature = sign(H, private key)
Alice->>Server: Send signed HTTP request
Server->>Server: 1. Parse Signature-Input / Signature
Server->>Server: 2. Validate timestamps
Server->>Store: 3. Check nonce
Store-->>Server: Unused
Server->>Server: 4. Recompute and compare content-digest
Server->>Server: 5. Reconstruct signature base M
Server->>Server: 6. ecrecover(H, sig) recovers address
Server->>Server: 7. Compare addresses
Server->>Store: 8. Atomically consume nonce (60-second retention example)
Server-->>Alice: 200 OK (order accepted)
Follow each step in order.
Signing steps
Step 1: Calculate content-digest
content-digest represents a digest of the HTTP request body.
A cryptographic hash function maps data of arbitrary length to a fixed-length value, and even a one-byte change is expected to produce a very different digest.
This example uses SHA-256, a widely used hash function with a 256-bit output.
Because the request has a body, compute its SHA-256 digest and include it in the Content-Digest header.
Input (body):
{"item":"nft_001","price":"0.5"}
↓ SHA-256 hash, then Base64 encoding
Output (illustrative Content-Digest header value):
sha-256=:RK/0qy18MlBSVnWgjwz6lZEWjP/lF5HF9bvEF8FabDg=:The digest acts as a fingerprint of the body. A change to the body is expected to produce a different digest, allowing tampering to be detected. The server recomputes SHA-256 over the received body and compares the result with the signed digest.
Step 2: Select covered components
For a Request-Bound signature, select the required components of the request.
A component is an individual element of the HTTP message.
RFC 9421 distinguishes derived components, whose names start with @, from ordinary HTTP fields.
The following table describes the components and their values in the sample request.
| Component | Meaning | Sample value |
|---|---|---|
@method |
HTTP method, such as GET, POST, or DELETE | POST |
@authority |
Destination authority (host and applicable port) | api.example.com |
@path |
Path identifying the endpoint on the destination server | /api/v1/orders |
@query |
Query string representing parameters following ? in the URL |
?currency=eth |
content-digest |
Body digest represented by the Content-Digest header from Step 1 |
sha-256=:RK/0qy...=: |
Request element Covered component
───────────────────── ──────────────────────
POST → @method (required)
api.example.com → @authority (required)
/api/v1/orders → @path (required)
?currency=eth → @query (query present)
{"item":"nft_001",...} → content-digest (body present)@method, @authority, and @path are required, with @query and content-digest added according to the request contents.
This binds the signature to the important covered elements of the request so modifications to them are detectable.
Step 3: Set signature parameters
Set four signature parameters. Separate from the covered components, these parameters describe the signer, validity interval, and replay-protection conditions.
| Parameter | Purpose |
|---|---|
keyid |
Identifies the Ethereum account, including its chain ID and address |
created |
Start of the validity interval, expressed in Unix seconds since January 1, 1970 |
expires |
Expiration time, after which the request is rejected |
nonce |
Single-use value for protecting against replay of the signed request |
keyid = "eip8128:1:0x70997970c51812dc3a010c7d01b50e0d17dc79c8"
├─ eip8128 → Profile namespace
├─ 1 → Chain ID (Ethereum Mainnet)
└─ 0x7099.. → Alice's address
created = 1736940000 → Valid from (2025-01-15 11:20:00 UTC)
expires = 1736940060 → Valid until (2025-01-15 11:21:00 UTC)
nonce = "k8Jx9mPq2nR5tV7wY0zA" → Unique randomly generated valueThe validity interval is 60 seconds.
Including nonce makes the signature Non-Replayable under the verifier's nonce uniqueness rules.
Clients commonly generate random nonces using a cryptographically secure random generator, such as crypto.randomUUID().
Step 4: Construct Signature-Input
Signature-Input is the HTTP header describing what was signed.
It contains the list of covered components and signature parameters, which the server uses to reconstruct the signature base.
Combine the components from Step 2 with the parameters from Step 3.
eth=("@method" "@authority" "@path" "@query" "content-digest");created=1736940000;expires=1736940060;nonce="k8Jx9mPq2nR5tV7wY0zA";keyid="eip8128:1:0x70997970c51812dc3a010c7d01b50e0d17dc79c8"The resulting string has the following structure.
eth= → Label identifying this signature
("@method" "@authority" ...) → List of covered components
;created=1736940000 → Semicolon-separated parameters
;expires=1736940060
;nonce="k8Jx9mPq2nR5tV7wY0zA"
;keyid="eip8128:1:0x7099..."It is serialized using the Structured Fields format specified by RFC 9421.
Step 5: Construct signature base M
Signature base M is the message passed to the wallet for signing.
Apply RFC 9421 serialization rules to the selected components' actual values and combine them into a single string.
"@method": POST
"@authority": api.example.com
"@path": /api/v1/orders
"@query": ?currency=eth
"content-digest": sha-256=:RK/0qy18MlBSVnWgjwz6lZEWjP/lF5HF9bvEF8FabDg=:
"@signature-params": ("@method" "@authority" "@path" "@query" "content-digest");created=1736940000;expires=1736940060;nonce="k8Jx9mPq2nR5tV7wY0zA";keyid="eip8128:1:0x70997970c51812dc3a010c7d01b50e0d17dc79c8"Each line contains a component name and its canonicalized value, in the form "component-name": value.
The final @signature-params line contains the applicable serialized signature parameters and component list from Signature-Input.
The complete string is the message M being signed.
The signature base is deterministically constructed from the request and signature parameters.
The signer and verifier can reconstruct the same M by applying the same rules to the same request.
This property enables verification.
Step 6: Calculate the ERC191 hash and sign
This step obtains a cryptographic signature over the signature base. The main terms are described below.
| Term | Definition |
|---|---|
| ERC191 | Ethereum message signing format that distinguishes signed messages from transaction signatures using a prefix such as \x19Ethereum Signed Message:\n, followed by the message length |
keccak256 |
Hash function commonly used in Ethereum, producing a fixed 256-bit (32-byte) output |
| ECDSA | Elliptic curve digital signature algorithm; a private key signs data and the corresponding public key enables verification |
ecrecover |
Operation recovering an Ethereum address from a digest and ECDSA signature |
Apply the ERC191 message prefix and length to signature base M, then calculate the Keccak-256 hash.
Alice's wallet signs the digest using her private key.
M (signature base string)
│
↓ Add ERC-191 prefix and message length
"\x19Ethereum Signed Message:\n" + len(M) + M
│
↓ Keccak-256 hash
H = 0x7a8b9c... (32-byte illustrative hash)
│
↓ ECDSA signature (Alice's private key)
signature = 0x3f4a5b... (65 bytes = r[32] + s[32] + v[1])
│
↓ Base64 encoding
"P0pbNmQ4eXFyM3Q1djd3OXpBYkNkRWZHaElqS2xNbk9w..."The ERC191 prefix (\x19Ethereum Signed Message:\n) marks the signed data as a message.
Together with the encoding rules, it separates the signed message from ordinary Ethereum transaction signing.
A wallet's signMessage method (or personal_sign) applies the prefix and hash internally, so the signer passes M rather than an already prefixed digest.
The ordinary EOA signature is 65 bytes: 32-byte r, 32-byte s, and a one-byte recovery value v. Base64-encode these bytes for the Signature header.
HTTP request after signing
After the signing steps, the following illustrative HTTP request is sent to the API server. The original method, path, and body remain unchanged, with three additional authentication-related headers.
POST /api/v1/orders?currency=eth HTTP/1.1
Host: api.example.com
Content-Type: application/json
Content-Digest: sha-256=:RK/0qy18MlBSVnWgjwz6lZEWjP/lF5HF9bvEF8FabDg=:
Signature-Input: eth=("@method" "@authority" "@path" "@query" "content-digest");created=1736940000;expires=1736940060;nonce="k8Jx9mPq2nR5tV7wY0zA";keyid="eip8128:1:0x70997970c51812dc3a010c7d01b50e0d17dc79c8"
Signature: eth=:P0pbNmQ4eXFyM3Q1djd3OXpBYkNkRWZHaElqS2xNbk9w...:
{"item":"nft_001","price":"0.5"}Compared with the unsigned request, three headers have been added.
| Added header | Purpose | Contents |
|---|---|---|
Content-Digest |
Body fingerprint | SHA-256 digest of the body, recomputed and compared by the verifier |
Signature-Input |
Signature description | Covered components and signature parameters, including signer, timestamps, and nonce |
Signature |
Signature bytes | Base64-encoded ECDSA signature produced by the wallet for this EOA example |
The original body and request components remain unchanged; only the authentication headers are added. The server uses these headers to verify authorization and integrity of the covered components.
Verification steps
The following traces how the API server verifies the signed request using the illustrative data.
Step 1: Parse the headers
Extract signature information for label eth from the Signature-Input and Signature headers.
Information extracted from Signature-Input:
├─ Covered components
│ @method, @authority, @path, @query, content-digest
│
├─ Parameters
│ created = 1736940000
│ expires = 1736940060
│ nonce = "k8Jx9mPq2nR5tV7wY0zA"
│ keyid = "eip8128:1:0x70997970c51812dc3a010c7d01b50e0d17dc79c8"
│
└─ Parsed keyid
Namespace = eip8128
Chain ID = 1
Address = 0x70997970c51812dc3a010c7d01b50e0d17dc79c8
Extracted from Signature:
└─ Signature bytes = P0pbNmQ4eXFyM3Q1djd3OXpBYkNkRWZHaElqS2xNbk9w...Prefer label eth, but also process a valid alternative label using an ERC8128 keyid beginning with eip8128:.
Step 2: Validate timestamps
Check that created and expires define an acceptable validity interval.
created = 1736940000 (2025-01-15 12:00:00 UTC)
expires = 1736940060 (2025-01-15 12:01:00 UTC)
Current time = 1736940030 (2025-01-15 11:20:30 UTC)
Checks:
expires > created → 1736940060 > 1736940000 ✅
Current time ≥ created → 1736940030 ≥ 1736940000 ✅ Validity has begun
Current time ≤ expires → 1736940030 ≤ 1736940060 ✅ Within validity window
expires - created ≤ max lifetime → 60 seconds ≤ 300 seconds ✅ Acceptable lifetime
Result: ✅ Timestamp checks passedIf the current time exceeds expires, for example 1736940120 (11:22:00 UTC), reject the request at this step.
Step 3: Check nonce uniqueness
A nonce is a value intended for one-time use. A nonce store is a database or cache recording previously accepted nonces so repeated use can be detected.
Check whether the same (keyid, nonce) combination has already been consumed.
Lookup key:
keyid = "eip8128:1:0x70997970c51812dc3a010c7d01b50e0d17dc79c8"
nonce = "k8Jx9mPq2nR5tV7wY0zA"
Query the nonce store:
→ This key does not exist (first use)
Result: ✅ Preliminary nonce uniqueness check passedA replay of an already accepted request is rejected because its nonce is recorded. Concurrent requests must also be protected through atomic nonce consumption after successful verification.
Step 4: Verify content-digest
Recompute the digest from the received request body and compare it with the header.
Received body:
{"item":"nft_001","price":"0.5"}
↓ Recompute SHA-256
Recomputed digest:
sha-256=:RK/0qy18MlBSVnWgjwz6lZEWjP/lF5HF9bvEF8FabDg=:
Content-Digest header value:
sha-256=:RK/0qy18MlBSVnWgjwz6lZEWjP/lF5HF9bvEF8FabDg=:
Comparison: match → ✅ Body matches the claimed digestIf the body had been modified in transit, for example by changing the price to "0.001", the recomputed digest would not match the original header and the request would be rejected.
Step 5: Reconstruct signature base M
Use the received request values and Signature-Input to reconstruct M in the same way as the signer.
"@method": POST ← Received method
"@authority": api.example.com ← Received authority
"@path": /api/v1/orders ← Received path
"@query": ?currency=eth ← Received query
"content-digest": sha-256=:RK/0qy18MlB...=: ← Received header value
"@signature-params": ("@method" ...) ← Received signature parametersIf the covered request components and signature parameters have not changed, this M matches the one Alice signed.
Step 6: Verify the signature (EOA)
Calculate the ERC191 hash H from the reconstructed M and recover the signer's address using ecrecover.
ecrecover is an Ethereum cryptographic operation that derives the address corresponding to a digest and a recoverable ECDSA signature.
M (reconstructed signature base)
│
↓ Add ERC-191 prefix and length, then hash with Keccak-256
H = 0x7a8b9c... (32 bytes)
│
↓ ecrecover(H, signature)
Recovered address: 0x70997970c51812dc3a010c7d01b50e0d17dc79c8
│
↓ Compare with the keyid address
keyid address: 0x70997970c51812dc3a010c7d01b50e0d17dc79c8
Match → ✅ Signature is valid for Alice's address in this illustrationThis is the central authentication mechanism in ERC8128.
The server does not know Alice's private key. A valid signature that recovers to the address specified by keyid establishes authorization by the corresponding key.
Because M derives from the covered request contents, modifying those contents changes the signing digest and prevents the existing signature from verifying against the expected address.
The verifier checks both the signer's authorization and integrity of the covered request components.
If any covered component, such as the method, path, query, or body digest, is modified, the verifier reconstructs a different M from the one Alice signed.
The resulting hash H changes, causing signature verification against Alice's expected address to fail.
This is how ERC8128 provides request integrity protection.
Step 7: Consume the nonce
After signature verification succeeds, atomically record the nonce as consumed, accepting the request only if that operation succeeds. A repeated request can then be rejected by the nonce uniqueness check. TTL (time to live) is the period for which the nonce store retains the entry.
Record in the nonce store:
Key: ("eip8128:1:0x70997970...c8", "k8Jx9mPq2nR5tV7wY0zA")
Remaining signature validity: 30 seconds (expires - current time = 1736940060 - 1736940030)
→ Retain the nonce at least until expiration and for the full required policy window; the example's lifetime is 60 seconds
→ Reject a repeated request containing the same nonceOnly after all verification and atomic nonce-consumption checks succeed does the server authenticate the request and proceed with order-specific authorization and processing.
Examples of detected tampering
The following examples illustrate which checks detect changes to the signed request.
Body tampering: changing the price
Suppose a party changes the request body price from "0.5" to "0.001".
┌─────────────────────────────────────────────────────┐
│ Modified request │
│ │
│ Original body: {"item":"nft_001","price":"0.5"} │
│ Modified body: {"item":"nft_001","price":"0.001"} │
└─────────────────────────────────────────────────────┘
Verification on the server (Step 4):
Digest of the modified body:
sha-256=:x9Yp3kM7nQ2wF4vR... (different illustrative value)
Content-Digest header (original signed value):
sha-256=:RK/0qy18MlBSVnWgjwz...
→ Mismatch ❌ Detected at Step 4; request rejectedIf the digest header is also modified, the signature base changes because content-digest is signed. Signature verification in Step 6 therefore still fails.
Path tampering: redirecting to another endpoint
Suppose the path is changed from the order endpoint to an administrative endpoint.
┌─────────────────────────────────────────────────────┐
│ Modified request │
│ │
│ Original path: /api/v1/orders │
│ Modified path: /api/v1/admin/delete-all │
└─────────────────────────────────────────────────────┘
Verification on the server (Steps 5–6):
Reconstructed M:
"@path": /api/v1/admin/delete-all ← Modified path
(Other components remain the same)
→ M differs from the message Alice signed
→ The hash H differs
→ The recovered address does not match Alice's address
→ ❌ Detected at Step 6; request rejectedReplay: resending the same request
Suppose a previously accepted, legitimately signed request is submitted again without modification.
┌─────────────────────────────────────────────────────┐
│ Replay scenario │
│ │
│ 1. Alice sends a signed request to the API server │
│ 2. A copy of that request is obtained │
│ 3. The API server accepts Alice's request │
│ 4. The copied request is submitted again │
└─────────────────────────────────────────────────────┘
Repeated request (identical to the original):
nonce = "k8Jx9mPq2nR5tV7wY0zA" ← Same nonce as Alice’s request
Verification on the server (Step 3):
Check the nonce store:
→ "k8Jx9mPq2nR5tV7wY0zA" has already been consumed
→ ❌ Detected at Step 3; request rejectedAfter nonce retention ends, the signature should already have expired, so a delayed replay fails timestamp validation in Step 2.
Authority change: reuse at another server
Consider a signed request forwarded to a different destination.
┌─────────────────────────────────────────────────────┐
│ Modified request │
│ │
│ Original host: api.example.com │
│ Other destination: evil.example.com │
└─────────────────────────────────────────────────────┘
Verification at evil.example.com (Steps 5–6):
Reconstructed M:
"@authority": evil.example.com ← Different authority
(Other components remain the same)
→ Alice’s signed M contains "@authority": api.example.com
→ M differs, so signature verification fails
→ ❌ Detected at Step 6; request rejectedThese integrity examples assume a Request-Bound signature. Class-Bound signatures do not detect modifications to components they do not cover. Use Request-Bound signatures for security-sensitive operations, together with replay protection and application authorization.
Additional considerations
Design goals
The proposal has two principal design goals.
Zero-Handshake Interoperability means that signers can interact with conforming verifiers without preliminary handshakes or capability discovery. The verifier decides acceptance based on signature verification and the applicable acceptance rules.
Security-First by Default means that conforming verifiers support the strongest baseline: Request-Bound and Non-Replayable signatures. Implementations may explicitly opt into alternative modes with different security and performance trade-offs.
Why ERC191?
The proposal uses ERC191 (personal_sign) rather than EIP712 for message signing.
ERC191 is broadly supported by the Ethereum signing stack, including noninteractive signing and machine-to-machine communication. It supports signing arbitrary message bytes without an additional typed-data schema or EIP712 domain separator, fitting RFC 9421's model of signing the signature base directly.
EIP712 is designed for structured data and is useful for human-readable wallet confirmation and phishing mitigation. Its benefits are different when HTTP message signatures are handled programmatically. Using EIP712 would require an additional typed-data encoding and domain-separation layer to represent the RFC 9421 signature base, reducing direct interoperability with generic RFC 9421 tooling.
Choosing between SIWE and ERC8128
EIP4361 (SIWE) and ERC8128 address different use cases.
| Aspect | SIWE (EIP4361) | ERC8128 |
|---|---|---|
| Purpose | Interactive frontend login | Authentication of individual HTTP requests |
| Session | Commonly establishes a session through a cookie or JWT | Not required |
| Request integrity | Not provided per request by SIWE itself | Covered by request-bound signatures |
| Replay protection | Depends on login and session management | Nonce and expiration |
| Use cases | Web application login | APIs, agents, and server-to-server communication |
SIWE establishes an identity through a signed statement and is commonly used to create a session. ERC8128 authenticates individual HTTP requests without requiring bearer credentials, making it suitable for machine-to-machine communication, gateways, and AI agents.
Nonce management
The proposal does not standardize how nonces are obtained. The appropriate mechanism depends on the deployment.
- Client-generated nonce (for example, a random 128-bit value)
- Requires no additional round trip and suits agents or offline signing, but requires verifier-side nonce tracking.
- Server-issued nonce
- Can support server-controlled sequencing and stricter issuance management at the cost of an additional round trip.
To preserve zero-handshake interoperability, the proposal standardizes semantics rather than nonce issuance. Presence of a nonce indicates Non-Replayable mode, and the verifier must ensure uniqueness for the required validity and retention period. Storage backends, such as in-memory stores, shared caches, or databases, and concurrency strategies are implementation choices.
Inferring replayability from nonce presence
Early designs considered additional parameters such as request-type="non-replayable" to identify the signer’s intent.
Because nonce presence directly identifies Non-Replayable mode, the additional parameter was considered redundant and removed.
Algorithm signaling
RFC 9421 defines the alg parameter using values from the IANA "HTTP Signature Algorithms" registry.
In the proposal version discussed here, its Ethereum signing profile (ERC191 over secp256k1 with EOA recovery or SCA verification through ERC1271) did not have a registered algorithm identifier.
Defining an unregistered alg value would introduce ambiguity and reduce interoperability. The design therefore omits alg and identifies the profile through keyid.
If an appropriate IANA identifier is registered in the future, the proposal could be updated to permit or require it.
Why support Replayable and Class-Bound signatures?
While requiring the security-first baseline for all conforming verifiers, the proposal recognizes that some applications need different latency and cost trade-offs.
Replayable signatures can allow repeated use of an authorization during a short validity interval, potentially reducing repeated verification overhead when safe caching is possible. Class-Bound signatures can cover an entire defined class of requests, such as certain idempotent reads, reducing signing overhead.
These modes are explicitly optional and should be limited to low-risk operations and short validity periods. Separating replayability from request binding enables all four combinations without imposing a small set of fixed modes.
Security
Concurrent nonce management
Verifiers must implement checking and consuming (keyid, nonce) as an atomic operation.
In concurrent or distributed systems, a non-atomic check-then-write operation can allow two simultaneous requests with the same nonce to pass verification.
Use shared storage supporting atomic conditional operations, such as transactional database writes or atomic shared-cache operations, and retain nonce state for the required validity period.
Replay attacks
A replay occurs when a previously signed request is submitted again to obtain unauthorized repeated execution.
Use Non-Replayable signatures and enforce nonce uniqueness.
A short signature lifetime (expires - created) further limits the window of exposure.
Reject Non-Replayable signatures whose validity interval exceeds the nonce retention window.
Parameter tampering
This involves modifying query parameters or the body of a signed request.
Use Request-Bound signatures covering the method, path, applicable query, and body digest.
content-digest enables verification of body integrity when bound to the signature.
Authority and path confusion
This involves reusing a signature intended for one destination or endpoint at another.
The signed @authority and @path components bind authorization to the specified authority and path.
Key compromise
Compromise of a private key allows an attacker to produce valid signatures. This lies outside the signature format's protection; secure key management is a prerequisite.
For EOAs, use policy-based invalidation such as blocking compromised addresses. For SCAs, changing contract state, such as authorized signers, may invalidate signatures depending on the ERC1271 implementation.
Reference implementation
Signer (client) implementation
The following is the illustrative signer implementation.
type Req = {
method: string;
authority: string; // host[:port]
path: string;
query?: string; // includes leading "?"
body?: Uint8Array;
headers: Record<string, string>;
};
type SignParams = {
keyid: `eip8128:${number}:0x${string}`;
created: number; // unix seconds
expires: number; // unix seconds
nonce: string; // sf-string (recommend base64url)
};
function covered(req: Req): string[] {
const c = ["@method", "@authority", "@path"];
if (req.query) c.push("@query");
if (req.body && req.body.length > 0) c.push("content-digest");
return c;
}
export async function signRequest(
req: Req,
wallet: { signMessage: (m: string) => Promise<Uint8Array> },
p: SignParams
): Promise<Req> {
if (req.body && req.body.length > 0 && !req.headers["content-digest"]) {
req.headers["content-digest"] = computeContentDigest(req.body);
}
const components = covered(req);
const sigInput = sfSerializeSignatureInput("eth", components, {
created: p.created,
expires: p.expires,
nonce: p.nonce,
keyid: p.keyid,
});
const M = createSignatureBase(req, "eth", sigInput);
const sigBytes = await wallet.signMessage(M);
req.headers["signature-input"] = sigInput;
req.headers["signature"] = `eth=:${base64(sigBytes)}:`;
return req;
}The covered function selects signed components based on the request contents.
If a body is present, calculate content-digest and construct an RFC 9421 Signature-Input through sfSerializeSignatureInput.
Use createSignatureBase to construct M and obtain an ERC191 signature through the wallet's signMessage method.
Verifier (server) implementation
The following illustrates the verifier. The preserved sample separates nonceSeen from invalidateNonce; production code must use an atomic conditional consumption operation and reject the request if it fails, normalize account identity for replay keys, enforce the required retention window, and use the actual selected label.
export async function verifyRequest(
req: Req,
policy: VerifyPolicy
): Promise<boolean> {
const headers = parseSignatureHeaders(req);
const { sigInput, sig } = findEIP8128MessageSignature(headers);
const { created, expires, nonce, keyid } = parseSignatureInput(sigInput);
if (!validateTimestamps(created, expires, policy)) return false;
if (!nonce) return false;
const replayKey = `${keyid}:${nonce}`;
if (await policy.nonceSeen(replayKey)) return false;
if (!checkRequestIntegrity(req, sigInput)) return false;
const M = rfc9421CreateSignatureBase(req, "eth", sigInput);
const H = eth191Hash(M);
const { chainId, address } = parseKeyid(keyid);
const valid = await verifyMessage(chainId, address, H, sig);
if (!valid) return false;
await policy.invalidateNonce(replayKey, Math.max(0, expires - policy.now));
return true;
}findEIP8128MessageSignature selects an ERC8128 signature from the headers, preferring the eth label.
After timestamp checks, nonce checks, and request-integrity checks including digest verification, reconstruct M and calculate the ERC191 hash H.
verifyMessage recovers the address for an EOA and verifies an SCA through ERC1271 or supported extensions such as ERC6492 and ERC8010.
Compatibility
This proposal uses the Signature-Input and Signature HTTP fields as an application-layer profile of RFC 9421.
Non-supporting clients, servers, and intermediaries can ignore these fields as ordinary HTTP fields, allowing gradual adoption where the application's authentication policy permits it.
The profile can coexist with other authentication mechanisms, such as cookies, API keys, OAuth, and SIWE. When supporting multiple authentication methods, applications must define their precedence and acceptance policy.
The described profile does not register a new RFC 9421 algorithm. Implementations recognize it through keyid and use the applicable Ethereum signature verification procedure, including ERC191 for EOAs and ERC1271 for SCAs.
References
Conclusion
This article examined ERC8128's mechanism for authenticating HTTP requests through Ethereum wallet signatures. I hope it helped clarify the mechanism.
If you have questions, feel free to reach out through Twitter DM.
I also publish articles on the following platforms.




