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.

Background

ERC-7512 proposes onchain verification of contract audit information to make audits more transparent and improve contract security.

This article explains and expands on the proposal below.

My other EIP articles are listed here.

Overview

The proposal defines a standard way to represent audit reports onchain. Contracts could parse that representation to determine who performed an audit and which standards the auditor checked.

The proposal defines a signed audit summary that software can process onchain. It includes a hash and URI for the audit report. This would make the information easier to access and help users assess its provenance.

Motivation

Smart contracts underpin bridges, token contracts, smart contract accounts (SCAs), and interoperability systems. Security failures in any of these applications can have serious consequences. Audits help verify that a contract follows security practices and implements standards such as ERC-20 or ERC-721 correctly.

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

https://chaldene.net/erc20

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

https://chaldene.net/erc721

Audits help improve contract security. A way to check that an audit took place onchain would also strengthen the ecosystem's ability to verify and manage the contracts that decentralized applications (DApps) rely on in day-to-day operation.

The proposed system gives applications a way to check whether a specific contract was audited. That makes it a building block for onchain security systems. Proof that an audit took place gives users more evidence to work with, while the possibility of bugs and defects remains.

Example

Example workflow for verifying a token audit before bridge activation Source: https://eips.ethereum.org/EIPS/eip-7512

Consider a bridge for ERC-1155 tokens. It should scale by making new tokens easy to register and bridge. To reduce the risk of accepting malicious or faulty tokens, the bridge verifies their audits onchain.

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

https://chaldene.net/erc1155

The system has four participants.

  1. User.
    • The end user who wants to bridge a token.
  2. Bridge operator.
    • The party that maintains the bridge.
  3. Bridge.
    • The contract the user calls to initiate a bridging operation.
  4. Validator.
    • The contract that validates tokens for bridging.

Registration proceeds as follows.

  1. The operator specifies the auditor keys or accounts whose audits it will accept during token registration.
  2. The user or token holder starts the registration flow.
  3. The system performs two checks.
    • It verifies that the submitted audit is valid and was signed by a trusted auditor (step 4 in the diagram).
    • It confirms that the token contract implements ERC-1155, the standard supported by the bridge (step 7).
  4. After these checks, the operator should still manually activate the token for bridging (step 10).
  5. Once the token is active, the user can bridge it (step 11).

These checks reduce the risk of registering a malicious or faulty token and help the bridge accept only tokens that satisfy its requirements.

Specification

Properties

The proposal defines properties for onchain audit reports. It standardizes information about the auditor, the audit, and the contract so that participants can verify audit information consistently.

Auditor properties

  • name
    • The auditor's display name.
  • uri
    • A URI where more information about the auditor is available.
  • authors
    • The list of contributors. This should include the people who audited the contract and wrote the report.

Audit properties

  • auditor
    • Information about the auditor.
  • auditedContract
    • Must include the chain ID and deployment address of the contract covered by the audit.
  • issuedAt
    • Must indicate when the original audit identified by auditHash was issued.
  • ercs
    • The list of ERCs the contract implements. Every listed ERC must be implemented in full. The list may be empty.
  • auditHash
    • The hash of the original audit. It is used to verify onchain that information belongs to a particular audit.
  • auditUri
    • Should point to a source from which the audit can be retrieved.

Contract properties

  • chainId
    • The bytes32 representation of the EIP-155 chain ID where the contract was deployed.
  • deployment
    • The contract's deployment address, represented as an address.

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

[EIP-155] How Ethereum prevents replay attacks across chains

These properties make audit information easier to manage onchain and give users and contracts a consistent way to retrieve information about audited deployments. This helps improve the transparency and security of digital assets.

Verification

Digital signatures can establish the authenticity of transactions and contract-related information. The proposal names the signature schemes and data formats used to verify an auditor's signature.

Signature types

  • SECP256K1
    • The elliptic curve used for signatures in Bitcoin, Ethereum, and other blockchains. Signature data encodes r, s, and v.
  • BLS
    • A signature scheme that supports features such as signature aggregation. Its specific data format is marked TBD.
  • ERC1271
    • An Ethereum standard that allows a smart contract to verify signatures. The data ABI-encodes chainId, address, blocknumber, and the signature bytes.

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

[ERC-1271] How contracts verify signatures

  • SECP256R1
    • An elliptic-curve signature scheme that uses a different curve from SECP256K1. Its signature data also encodes r, s, and v.

Data

In a signing operation, the data being signed is the message or transaction whose contents the verifier checks. A signature establishes that the signer authorized those exact contents and that the signed contents have not been altered.

Verifying the auditor's signature establishes the authenticity and integrity of the audit information. This is the basis on which applications can rely on an audit summary for onchain decisions.

Data types

Auditor

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

Overview

Stores basic information about the auditor.

Details

This structure describes the person or organization that conducted the audit. It includes a name, a URI for further information, and a list of contributors.

Parameters

  • name
    • The auditor's name.
  • uri
    • A URI for additional information about the auditor.
  • authors
    • The names of the people who contributed to the audit.

Contract

javascript
struct Contract {
    bytes32 chainId;
    address deployment;
}

Overview

Stores information about a deployed contract.

Details

The chain identifier and deployment address together identify the specific contract instance.

Parameters

  • chainId
    • Identifies the chain where the contract was deployed.
  • deployment
    • The contract's deployment address.

AuditSummary

javascript
struct AuditSummary {
    Auditor auditor;
    uint256 issuedAt;
    uint256[] ercs;
    Contract auditedContract;
    bytes32 auditHash;
    string auditUri;
}

Overview

Stores a summary of the audit.

Details

The summary includes the auditor, the time of issuance, the ERC standards implemented by the audited contract, its deployment details, the audit hash, and the URI where the report is available.

Parameters

  • auditor
    • Information about the auditor that conducted the audit.
  • issuedAt
    • The audit's issuance timestamp.
  • ercs
    • The list of ERC standards implemented by the audited contract.
  • auditedContract
    • Information about the audited contract.
  • auditHash
    • The audit hash, which lets a verifier check a report against its hash onchain.
  • auditUri
    • The URI where the audit report is available.

Signatures

EIP712Domain

javascript
struct EIP712Domain {
    string name;
    string version;
}

Overview

Defines domain information for signing a message using EIP-712.

Details

EIP-712 specifies typed structured data signing on Ethereum. The EIP712Domain structure identifies the domain, such as an application or contract, to which the signed data belongs. Its name and version fields distinguish the relevant domain.

Parameters

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

SignatureType

javascript
enum SignatureType {
    SECP256K1,
    BLS,
    ERC1271,
    SECP256R1
}

Overview

An enumeration of signature types.

Details

The four variants are SECP256K1, BLS, ERC1271, and SECP256R1. The variants cover different verification mechanisms and use cases.

Parameters

  • The enum value selects the signature scheme or verification method.

Signature

javascript
struct Signature {
    SignatureType type;
    bytes data;
}

Overview

Stores signature information.

Details

The Signature structure combines a SignatureType with the corresponding signature bytes. The same container can represent several digital signature formats.

Parameters

  • type
    • The signature type.
  • data
    • The signature data.

SignedAuditSummary

javascript
struct SignedAuditSummary extends AuditSummary {
    uint256 signedAt;
    Signature auditorSignature;
}

Overview

Stores a signed audit summary.

Details

SignedAuditSummary adds the signing time (signedAt) and the auditor's signature (auditorSignature) to AuditSummary. This lets a verifier check that a particular auditor approved the summary and when the auditor signed it.

Parameters

  • signedAt
    • The signing time.
  • auditorSignature
    • The auditor's signature information.

Together, these definitions let auditors sign structured audit data with EIP-712, so a verifier can authenticate the signer and detect changes to the signed information.

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

[EIP-712] How typed structured data is hashed and signed

Additional notes

The ERC deliberately leaves audit findings out of scope. Standardizing findings would require agreement on severity levels, which data belongs onchain or offchain, and similar audit attributes that are difficult to define rigorously.

A signed audit summary indicates that a particular contract instance, identified by its chainId and deployment address, received a security audit. It also attests that the instance correctly implements the listed ERCs. This generally corresponds to the final audited revision and its specific deployment.

The ERC gives applications a way to extract relevant information about a smart contract. Integrators assess the data's quality, the audit's scope, and the strength of the assurance it provides.

The proposal communicates that a contract was audited and implements the specified ERC standards. Developers and organizations still evaluate the quality and relevance of the audit information for their own use cases.

Considerations

The following design choices affect how smart contract audits are represented.

Standards and ERCs

Limiting the scope to audits associated with EVM-based smart contract accounts keeps the parameter definitions clearer.

Chain ID and deployment

A contract's behavior depends on the blockchain where it was deployed. Each contract referenced by an audit is therefore associated with a chainId and a deployment address.

Single contracts and multi-contract systems

Many audits cover several contracts in the same protocol. To keep the first version simple, each audit summary refers to one contract. If the same engagement covers several contracts, the audit information can be associated with different instances. Each instance can then list the ERCs it supports, at the cost of requiring multiple auditor signatures.

Why EIP-712?

EIP-712 was chosen because existing tools support it, including tools for generating signatures.

How can an auditor be associated with a signing key?

An auditor should publish the public part of its signing key. It could do so on its website, a professional profile, or social media. A public directory could extend the proposal, but building one is outside its scope.

Polymorphic contracts and proxies

The ERC leaves the handling of polymorphic contracts and proxies to auditors and implementers. Both remain important considerations when associating audit information with a deployment.

These considerations clarify what an audit summary can establish and how auditors can apply it across different contract and deployment designs.

Extensions

Future versions could extend the representation in several ways.

Support for non-EVM chains

The current ERC focuses on EVM-based chains. Future versions could cover networks with other execution environments, such as Solana and Polkadot, to make audit representations usable across a broader range of chains.

Support for polymorphic and upgradeable contracts and multi-contract audits

Future work could cover polymorphic contracts, upgradeable contracts, and protocols that contain several contracts. These systems have structures that the current ERC does not fully model and need more precise ways to manage and standardize audit information.

Management of auditor signing keys

Clearer guidelines or mechanisms for managing the keys auditors use to sign their reports could strengthen audit authenticity and auditor authentication.

Definition of audit findings

Future work could define findings and audit results in more detail. Audit findings are currently considered too complex to record directly onchain, but future representations could make these details easier to manage and access.

These extensions would help the audit process cover more of the blockchain ecosystem and improve transparency and confidence in audit information.

Compatibility

The proposal identifies no compatibility issues with existing ERC standards.

Security considerations

Auditor key management

The system depends on participating auditors managing their keys securely. If an auditor's key is compromised, someone could make an unaudited or noncompliant contract appear to have been audited or to comply with a standard. One possible safeguard is an auditor association that allows a secondary key to revoke existing signatures when the primary key is compromised.

Key management matters because confidence in an audit signature depends on control of the signing key. A leaked key could otherwise cause an untrusted contract to be accepted as audited or compliant.

Proposed safeguards

  • Auditor association
    • A group of auditors, such as audit firms, could take responsibility for key management on behalf of its members.
  • Secondary key
    • A secondary key could revoke existing signatures if an auditor's key is compromised.

Such a system could protect the integrity of the audit process and preserve trust in its records even after a key compromise.

Citation

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

ERC-7512 proposes a format that lets contracts verify audit information onchain. Applications can check who signed an audit summary, which deployment it covers, and which standards the auditor verified.

If you have questions, you can reach me by direct message on Twitter.

Twitter @cardene777

You can find more of my writing here.

https://chaldene.net/