On-Chain Verification

Publish commitments and enable proof verification from contracts.

On-chain verification is typically implemented as a commitment registry plus optional verifier calls. This keeps gas costs low while preserving auditability.

Recommended pattern

  1. Publish the batch commitment (hash) on-chain.
  2. Publish a proof hash or proof ID in your off-chain metadata store.
  3. Provide a public verification endpoint or explorer link.

Commitment registry example

SOLIDITY
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

contract FairseqRegistry {
    event BatchCommitted(bytes32 indexed batchHash, bytes32 indexed proofHash);

    function commit(bytes32 batchHash, bytes32 proofHash) external {
        emit BatchCommitted(batchHash, proofHash);
    }
}

Optional verifier interface

SOLIDITY
interface IFairseqVerifier {
    function verify(
        bytes32 proofHash,
        bytes calldata proof
    ) external view returns (bool);
}

Best practices

  • Store proof hashes in events, not storage, to reduce gas.
  • Keep proof bytes off-chain and fetchable by ID.
  • Bind batch hash and proof hash together for easy auditing.

Gas Costs

On-chain verification costs vary by proof size. A registry-only pattern is the lowest cost path.

Was this page helpful? /
Back to docs