Sign and Verify a Block Attestation
Bind a Block hash to an attester with EIP-712 typed data and verify the recovered signer. The same domain, type definition, and message must be available to both sides.
Before You Start
Prepare an EIP-712 signing library, a signer, a 32-byte Block hash, and the exact signing domain used by the integration. Dedicated Block-attestation helpers are not currently included in the JavaScript package.
How It Works
- Build the
BlockAttestationmessage. - Sign the typed data under the chosen domain.
- Reconstruct the same domain and message during verification.
- Recover the signer and compare the address with
attester.
When to Use This Workflow
Use an attestation when an application needs a durable signature over a Block hash. Use replay-protected protocol requests for time-bound operations with nonce and expiry checks.
- Define the Message
- Sign the Typed Data
- Recover and Verify
The message binds blockHash, attester, and timestamp.
BlockAttestation(
bytes32 blockHash,
address attester,
uint256 timestamp
)
Use a 32-byte Block hash, an Ethereum address, and an unsigned timestamp value.
Expected result: the signer returns an EIP-712 signature for the complete domain and message.
Provide the exact EIP-712 domain, type definition, and message to the signer. Store the domain with the signature inputs so the same data can be reconstructed.
Expected result: the recovered address matches the attester encoded in the message.
Reconstruct the domain and message, recover the signer, and compare the recovered address with attester. Reject a mismatched address, domain, Block hash, or timestamp.