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.

ERC-7512 proposes a way to use auditors' signatures to verify smart contract audit information and attestations of ERC compliance onchain.

This article explains the proposal, with additional context and examples.

I also cover other EIPs, BIPs, SLIPs, CAIPs, ENSIPs, RFCs, and ACPs.

Overview

ERC-7512 aims to standardize an onchain representation of audit reports that smart contracts can parse. Representing an audit report onchain does not simply mean uploading a PDF or text document to a blockchain. Rather, the proposal defines a machine-readable format from which contracts can extract information about the auditor, the standards covered by the audit, and the specifications verified, such as ERC-20, ERC-721, and ERC-1155.

For more on ERC-20, see the following article.

[ERC20] ERC-20 Explained from the Ground Up

For more on ERC-721, see the following article.

[ERC721] ERC-721 Explained from the Ground Up

For more on ERC-1155, see the following article.

[ERC1155] ERC-1155 Explained from the Ground Up

Traditionally, smart contract audits have been documented offchain. Applications and users must establish whether a report is authentic, whether the auditor is trustworthy, and which specifications the audited contract satisfies.

The goal of this proposal is to make audit information available in a form that smart contracts themselves can verify and use. Bridges, protocols, and applications could use that information with fewer intermediaries and thereby improve their security. However, verifying an auditor's signature still requires trusting the auditor and assessing the scope and quality of the audit.

Motivation

Smart contract audits are an important part of establishing security and checking that contracts behave as intended. In addition to finding bugs, audits can verify compliance with standards such as ERC-20, ERC-721, and ERC-1155. As blockchain systems become more complex, an onchain verification mechanism can help applications make better use of these audits.

The ability to check audit information onchain is particularly useful in the following areas.

Bridges

Bridges transfer assets between blockchain networks. Many contain contracts, often called bridgeheads or lockboxes, that secure the assets being bridged.

Faults in such contracts may lead to serious incidents, including:

  • A halt in bridge operations.
  • Asset losses caused by the issuance of unbacked tokens or other failures.

Onchain verification of audit attestations could help bridges automatically select contracts that satisfy their audit acceptance policies. It does not establish that those contracts are free from vulnerabilities.

Token contracts

Ethereum token standards such as ERC-20 and ERC-721 define smart contract interfaces. Applications interacting with these tokens are typically designed on the assumption that their behavior conforms to those standards.

Noncompliant tokens can cause unexpected application behavior and, in some cases, user losses.

With onchain access to signed audit information, an application can automatically determine whether a trusted auditor has attested that a token implements the mandatory ERC-20 requirements. This can help build a more robust ecosystem.

Smart contract accounts (SCAs)

ERC-4337 brought greater attention to smart contract-based accounts. These accounts support flexible account designs and extensions. ERC-6900 emerged as a specification for modular extensions, such as plugins.

Modular accounts offer flexibility, but integrating external code requires applications to consider two questions:

  • Is the module trustworthy?
  • Has its security been adequately assessed?

Onchain audit verification would allow an account to automate policies such as accepting only modules that have been audited by a trusted party.

Interoperability: hooks and callbacks

More protocols provide hooks, functions invoked at particular points in execution, to integrate with external contracts. Token standards such as ERC-1155 also support callbacks during transfers.

When invoking external contracts, applications must consider whether the called code behaves securely. Unexpected reentrancy attacks and inconsistent error handling are examples of potential risks.

Onchain audit information can help an application implement an automated policy for admitting contracts that have undergone an acceptable security assessment.

Growing need for onchain audit information

As services and protocols increasingly rely on smart contracts, more complex interactions between contracts will become necessary. A way to verify that a contract has been audited can provide a foundation for more dependable interoperability.

Of course, the existence of an audit does not guarantee the absence of bugs. Nevertheless, the following elements are important building blocks for ecosystem security:

  • Identifiable, trusted auditors.
  • Clear information about the standards implemented.
  • Access to verifiable audit data without relying on an intermediary to confirm the signature.

Onchain-verifiable audit information could help smart contracts interact under more informed security policies and support increasingly sophisticated systems.

Specification

Audit properties

Audit information consists broadly of two elements: information about the auditor and information about the audit itself.

Auditor

Information about the auditor consists of the following fields.

Field Description
name The auditor's name, for display to users.
uri A URI where additional information about the auditor can be retrieved.
authors A list of contributors to the audit, identifying the people who audited the contracts and prepared the report.

These fields provide information useful for assessing the credibility of an audit.

Audit

These fields describe the contract that has been audited.

Field Description
auditor Information about the auditor, represented by the Auditor structure.
auditedContract The chain ID and deployment address of the audited contract.
issuedAt The time when the original audit identified by auditHash was issued. Required.
ercs A list of fully implemented ERC standards. The list may be empty.
auditHash The hash of the original audit report, required to associate the information with a specific audit.
auditUri A URI from which the audit report can be retrieved.

In particular, auditHash allows a verifier to check whether an offchain audit document matches the hash identified by the onchain audit information.

Contract information

The following fields identify the audited contract.

Field Description
chainId The EIP-155 chain ID represented as bytes32.
deployment The address at which the contract is deployed.

Together, these fields distinguish deployments on networks such as mainnet and testnets and identify the relevant contract instance.

For more on EIP-155, see the following article.

[EIP155] Preventing Replay Attacks Across Ethereum Networks

Auditor verification

The proposal defines signature formats to authenticate audit information.

Supported signature types

Type Data format
SECP256K1 Ethereum's conventional signing curve; encoded r, s, and v values.
SECP256R1 Encoded r, s, and v values.
ERC1271 Contract signature verification; an ABI-encoded chain ID, address, block number, and signature bytes.
BLS To be determined (TBD).

Support for ERC-1271 is particularly important because it allows contract-based authorization mechanisms, such as multisignature accounts, to verify signatures.

For more on ERC-1271, see the following article.

[ERC1271] How Contracts Verify Signatures

Signing

An AuditSummary is signed using EIP-712. Typed structured-data signing enables clear representation of the signed data and benefits from broad wallet and tooling support.

For more on EIP-712, see the following article.

[EIP712] Hashing and Signing Typed Structured Data

The EIP712Domain is defined as follows.

javascript
struct EIP712Domain {
    string name;
    string version;
}

EIP712Domain auditDomain = EIP712Domain("ERC-7652: Onchain Audit Representation", "1.0");

The domain name in this example contains ERC-7652 rather than ERC-7512. That literal appears in the referenced draft and is retained unchanged here; the proposal discussed in this article is ERC-7512.

Attaching the signature to an audit summary produces a SignedAuditSummary object. This extended structure includes the signing time (signedAt) and the auditor's signature (auditorSignature).

Data structures

ERC-7512 defines the following data types.

Structures

Auditor
javascript
struct Auditor {
    string name;
    string uri;
    string[] authors;
}

This structure holds information about the auditor, including a display name, a reference for additional auditor information, and the authors who contributed to the audit. Together, these fields provide information for assessing the audit's credibility.

Parameters

  • name
    • The auditor's name.
  • uri
    • A URI from which detailed information about the auditor can be retrieved.
  • authors
    • A list of people who performed or contributed to the audit.
Contract
javascript
struct Contract {
    bytes32 chainId;
    address deployment;
}

This structure represents the audited contract. It holds the chainId of the network on which the contract is deployed and the contract's address. These fields identify the audited deployment.

Parameters

  • chainId
    • The EIP-155 chain ID represented as bytes32.
  • deployment
    • The contract's deployment address.
AuditSummary
javascript
struct AuditSummary {
    Auditor auditor;
    uint256 issuedAt;
    uint256[] ercs;
    Contract auditedContract;
    bytes32 auditHash;
    string auditUri;
}

This structure represents an audit summary in a form suitable for onchain use. It collects the information needed to identify and verify the audit, including the auditor, issue date, target contract, implemented ERCs, and audit report hash.

Parameters

  • auditor
    • The Auditor structure identifying the auditor.
  • issuedAt
    • The time when the original audit was issued.
  • ercs
    • A list of ERC numbers implemented by the audited contract.
  • auditedContract
    • Information identifying the audited contract.
  • auditHash
    • The hash of the original audit report.
  • auditUri
    • A URI for accessing the audit report.
Signature
javascript
enum SignatureType {
    SECP256K1,
    BLS,
    ERC1271,
    SECP256R1
}

struct Signature {
    SignatureType type;
    bytes data;
}

This structure represents the auditor's signature. It stores the signature type (SignatureType) and the signature data (bytes), identifying the algorithm or validation mechanism to use.

Parameters

  • type
    • The signature type used.
  • data
    • The signature data, whose encoding depends on the signature type.
SignedAuditSummary
javascript
struct SignedAuditSummary extends AuditSummary {
    uint256 signedAt;
    Signature auditorSignature;
}

This structure represents a signed audit summary. In the proposal's notation, it extends AuditSummary with a timestamp and the auditor's signature data. This allows the authenticity of the summary to be verified onchain. The example uses conceptual structure extension syntax; Solidity structs do not support inheritance in this form.

Parameters

  • signedAt
    • The time at which the audit summary was signed.
  • auditorSignature
    • Information about the auditor's signature, represented by the Signature structure.
EIP712Domain
javascript
struct EIP712Domain {
    string name;
    string version;
}

This structure represents the domain information used for EIP-712 signatures. It associates the signed data with a name and version to help distinguish signatures intended for different purposes.

Parameters

  • name
    • The domain name.
  • version
    • The domain version.

Rationale

ERC-7512 does not define an onchain format for audit results or individual findings. Standardizing the findings themselves would introduce several complex problems.

Audit reports contain information such as severity levels, issue details, remediation status, and the scope of impact. Fully standardizing that information would require agreement on questions such as:

  • Which severity classifications should be supported?
  • Which information should be stored onchain and which should remain offchain?
  • How should differences between auditing firms be accommodated?

For these reasons, ERC-7512 focuses on establishing that an audit exists and exposing basic information about that audit in an onchain-readable format, rather than defining the findings themselves.

The important distinction is that a signed audit summary indicates the following:

  • A specific contract instance (identified by chainId and deployment) has undergone an audit.
  • The auditor attests that the contract correctly implements the listed ERCs at the time of the audit.

This normally corresponds to the final audit revision and associates the audit with the actual deployed contract.

However, ERC-7512 must not be interpreted as proof that a contract is completely secure. It provides a way to access audit information; the bridge, protocol, or application integrating the standard remains responsible for evaluating the quality and coverage of that information.

General standards versus ERCs

Limiting the scope to audits of EVM-based smart contract accounts allows the required parameters to be defined more precisely. A broader scope would make a common specification more difficult to establish, which explains the decision to focus on the EVM.

The role of chainId and deployment

A contract's behavior may vary depending on the chain on which it operates. Accordingly, ERC-7512 identifies the target of an audit using both of the following fields.

Field Meaning
chainId The network identifier of the blockchain on which the contract operates.
deployment The deployed contract's address.

Combining the two allows deployments of the same code on different networks to be treated as distinct audit targets.

Single-contract and multi-contract audits

A single audit often covers multiple contracts. For simplicity, the initial ERC-7512 proposal associates each AuditSummary with just one contract.

This approach offers two benefits:

  • ERC compliance can be recorded accurately for each contract.
  • Audit information is simpler to process.

The drawback is that an auditor must perform multiple signing operations when an audit covers several contract instances.

Why EIP-712?

EIP-712 was selected because it is widely supported by development tools and wallets and provides a standard way to sign structured data.

An audit summary is structured data, so it fits naturally into the EIP-712 format.

Associating signing keys with auditors

Auditors should publicly share the public component of their signing keys. The proposal gives examples of publication channels, including an auditor's website, professional profile, and social media.

A future public repository could aggregate auditors' keys, but such a repository is outside the scope of ERC-7512.

Polymorphic contracts and proxies

Upgradeable contracts and proxy-based architectures are widely used, but ERC-7512 does not define special treatment for them.

In practice, auditors and developers integrating the standard are responsible for deciding how to handle these contracts.

Potential future extensions

Possible future extensions include:

Area Description
Non-EVM chains Extend the approach to support audit information for other blockchain environments.
Polymorphic and upgradeable contracts Explore additional standardization for proxies and upgradeable architectures.
Auditor key management Establish more systematic ways to manage auditors' signing keys.
Standardization of audit findings Address how audit findings should be represented in a common format.

These areas may become increasingly important as the ecosystem matures.

Security

Auditor key management

The security model of ERC-7512 depends on auditors managing their keys correctly. The authenticity of signed audit information is tied to the signing key used.

If an auditor's private key is compromised, an attacker may use it to produce misleading attestations, including:

  • A signature falsely indicating that a contract has been audited.
  • An attestation falsely indicating that a contract complies with an ERC standard.

Such incidents could undermine the reliability of systems integrating ERC-7512.

Mitigating key compromise

One possible mitigation is to define an association of auditors, potentially representing an entire auditing firm or other organizational group. The association could have a separate revocation key capable of revoking signatures.

If an individual auditor's signing key is compromised, another authorized key belonging to the same organization could be used to:

  • Revoke signatures generated with the compromised key.
  • Invalidate fraudulent attestations associating a contract with an audit.

Such a mechanism could help limit the impact of key compromise and maintain the reliability of audit information. This is a potential protection measure, not a required revocation mechanism defined by the current proposal.

Why this matters

In ERC-7512, the identity of the party signing the audit information is a fundamental source of trust. If an attacker obtains that party's signing key, fraudulent audit information may be accepted as legitimate.

Loss of confidence in audit information could affect bridges, token management, protocol integrations, and other systems. Since ERC compliance checks can be automated, false attestations could propagate to multiple applications.

Key management and procedures for responding to key compromise are therefore important security considerations when adopting ERC-7512.

References

Richard Meissner - Safe (@rmeissner), Robert Chen - OtterSec (@chen-robert), Matthias Egli - ChainSecurity (@MatthiasEgli), Jan Kalivoda - Ackee Blockchain (@jaczkal), Michael Lewellen - OpenZeppelin (@cylon56), Shay Zluf - Hats Finance (@shayzluf), Alex Papageorgiou - Omniscia (@alex-ppg), "ERC-7512: Onchain Representation for Audits [DRAFT]," Ethereum Improvement Proposals, no. 7512, September 2023. [Online serial]. Available: https://eips.ethereum.org/EIPS/eip-7512.

Conclusion

This article covered ERC-7512, a proposal for using auditors' signatures to verify smart contract audit information and ERC compliance attestations onchain. I hope it helped clarify how the mechanism works.

If you have questions, feel free to reach out by direct message on Twitter.

Twitter @cardene777

I also publish content on other platforms.