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-4974 proposes a common interface for managing on-chain rating systems.

This article translates, summarizes, and expands on the following proposal.

More EIP explainers:

Overview

ERC-4974 defines an interface for assigning numerical ratings to Ethereum addresses. Ratings are recorded in a smart contract and can be queried by other applications.

Introducing scores associated with accounts or addresses creates opportunities for applications such as weighted voting, game experience systems, customer loyalty programs, and insurance risk assessments.

The standard describes the representation and management of ratings rather than prescribing how their values must be determined.

Motivation

Blockchain applications have traditionally emphasized asset ownership and transfers. In community-oriented projects, this can create pay-to-play incentives. The proposal identifies this concern in the context of EVM games and DAOs in 2021.

Ratings offer an additional mechanism for designing incentives beyond asset ownership.

Potential applications include:

  • Weighted voting in DAOs

    A DAO can assign ratings reflecting members' contributions and use those ratings as inputs to its voting-weight calculation.

  • Experience systems in decentralized games

    Games can assign scores based on player activities, track progression, and unlock content.

  • Customer loyalty programs

    Businesses can use ratings to represent customer engagement and determine eligibility for benefits or discounts.

  • Asset risk assessment in decentralized insurance

    Insurers can use asset-related ratings as inputs when determining premiums or coverage.

The fairness and reliability of these applications depend on the underlying rating methodology and governance, not merely on recording scores on-chain.

ERC-4974 follows interface conventions familiar from ERC-20 and ERC-721, facilitating integration with existing smart contract tooling without modifying those token standards.

Specification

Required interfaces

A compatible contract must implement:

  • IERC4974.
  • IERC165.

For ERC-165, see the following article.

ERC-165: Detecting supported smart contract interfaces

IERC4974 interface

IERC4974.sol
// SPDX-License-Identifier: CC0

pragma solidity ^0.8.0;

/// @title EIP-4974 Ratings
/// @dev See https://eips.ethereum.org/EIPS/EIP-4974
///  Note: the EIP-165 identifier for this interface is #######.
///  Must initialize contracts with an `operator` address that is not `address(0)`.
interface IERC4974 /* is ERC165 */ {

    /// @dev Emits when operator changes.
    ///  MUST emit when `operator` changes by any mechanism.
    ///  MUST ONLY emit by `setOperator`.
    event NewOperator(address indexed _operator);

    /// @dev Emits when operator issues a rating. 
    ///  MUST emit when rating is assigned by any mechanism.
    ///  MUST ONLY emit by `rate`.
    event Rating(address _rated, int8 _rating);

    /// @dev Emits when operator removes a rating. 
    ///  MUST emit when rating is removed by any mechanism.
    ///  MUST ONLY emit by `remove`.
    event Removal(address _removed);

    /// @notice Appoint operator authority.
    /// @dev MUST throw unless `msg.sender` is `operator`.
    ///  MUST throw if `operator` address is either already current `operator`
    ///  or is the zero address.
    ///  MUST emit an `Appointment` event.
    /// @param _operator New operator of the smart contract.
    function setOperator(address _operator) external;

    /// @notice Rate an address.
    ///  MUST emit a Rating event with each successful call.
    /// @param _rated Address to be rated.
    /// @param _rating Total EXP tokens to reallocate.
    function rate(address _rated, int8 _rating) external;

    /// @notice Remove a rating from an address.
    ///  MUST emit a Remove event with each successful call.
    /// @param _removed Address to be removed.
    function removeRating(address _removed) external;

    /// @notice Return a rated address' rating.
    /// @dev MUST register each time `Rating` emits.
    ///  SHOULD throw for queries about the zero address.
    /// @param _rated An address for whom to query rating.
    /// @return int8 The rating assigned.
    function ratingOf(address _rated) external view returns (int8);
}

interface IERC165 {
    /// @notice Query if a contract implements an interface.
    /// @dev Interface identification is specified in EIP-165. This function
    ///  uses less than 30,000 gas.
    /// @param interfaceID The interface identifier, as specified in EIP-165.
    /// @return bool `true` if the contract implements `interfaceID` and
    ///  `interfaceID` is not 0xffffffff, `false` otherwise.
    function supportsInterface(bytes4 interfaceID) external view returns (bool);
}

The excerpt is preserved from the original article. Its comments contain an interface-ID placeholder and inconsistent references to event and function names, including Appointment, Remove, and remove. Implementers should reconcile these with the actual declarations and applicable specification before deployment.

Events

NewOperator

Emitted when the operator responsible for managing ratings changes. The declared operation for changing the operator is setOperator.

Rating

Emitted when the operator assigns or updates a rating for an address through rate.

Removal

Emitted when an existing rating is removed through removeRating.

Functions

setOperator

Changes the address authorized to administer ratings.

The caller must be the current operator. The proposed replacement must not be the zero address or the current operator's address. A successful change emits NewOperator according to the displayed event declaration.

rate

Assigns a numerical rating to the specified address. A successful call emits Rating.

The operation can support systems such as reputation scores, game-related ratings, or community contribution assessments.

The rating uses int8, so an application requiring experience values beyond that range needs an additional representation or another interface.

removeRating

Removes the rating associated with an address. A successful call emits Removal according to the displayed declaration.

ratingOf

Returns the current rating associated with the supplied address.

The contract's stored rating must be consistent with successful rating updates. The interface comments recommend rejecting queries for the zero address.

Clients must establish how the implementation represents an unrated address and distinguish an absent rating from a valid zero rating where necessary.

IERC165 interface

supportsInterface

Determines whether a contract supports a particular interface, such as IERC4974, following the ERC-165 interface detection convention. The query must use less than 30,000 gas.

Rationale

Assigning ratings

The contract's operator is responsible for issuing ratings. This address could represent an individual, such as a sports coach, or a smart contract, such as a DAO-controlled multisignature wallet.

ERC-4974 does not prescribe the decision-making or governance process used to determine scores. Implementers are responsible for defining and administering that process.

The design is intended to allow ratings to represent reputation or contributions independently of monetary value. Unlike transferable assets, a rating can reflect an assessment associated with a particular address.

Why int8 is used

  • Signed values

    A rating system can represent neutral assessments with zero and negative assessments with negative values.

  • Eight-bit representation

    The range of int8 is -128 to 127. Keeping the range limited can make comparisons and aggregation easier and discourage unnecessarily large numerical scales.

    A common integer type does not guarantee that ratings issued by different systems have equivalent meanings.

Updating and removing ratings

Ratings can change over time. For example, a participant's contribution score may decrease after misconduct, or an operator may discover that a previous assessment was inaccurate.

Supporting both updates and removal allows a rating system to respond to changing circumstances.

Updating or removing a rating from current contract state does not erase the corresponding historical blockchain transactions and logs.

Interface detection

ERC-165 provides a standard mechanism through which applications and contracts can discover whether the rating interface is supported.

Metadata design

The proposal recommends metadata functions such as:

  • name()
    • Returns the rating system's name.
  • description()
    • Returns a description of the rating system.

These fields help users understand the context and intended meaning of ratings, particularly when an application uses multiple rating criteria.

Empty strings are also valid return values under the metadata design discussed in the original article.

Names and descriptions are chosen by the implementation and do not establish the reliability of its ratings. Applications must evaluate the rating system's trustworthiness independently.

Potential disadvantages

Ratings may be subjective or inaccurate. Update and removal functions allow corrections, but they do not prevent an operator from deliberately assigning unfair scores.

Public ratings can also be misused for harassment or discrimination. Implementers should consider transparent assessment criteria, oversight, dispute resolution, and the consequences of making rating information public.

Security

False or misleading ratings

Risks

A malicious or unreliable operator may assign high ratings for contributions that did not occur, or unfairly assign low ratings to unrelated addresses.

Consequences may include:

  • Distorting governance decisions when voting weight depends on ratings.
  • Causing users to make decisions based on misleading information.

Mitigations

The interface provides two correction mechanisms:

  • Updating a rating through rate.
  • Removing a rating through removeRating.

These mechanisms allow the authorized operator to correct inaccurate assessments. They do not independently establish the correctness of a rating or provide recourse against a malicious operator. Applications may need separate governance and appeal mechanisms.

Compromise of operator authority

Risks

The design assigns significant administrative authority to a single operator address. If that authority is compromised, an attacker may manipulate ratings and undermine the reliability of the system.

Mitigations

Recommended precautions include:

  • Secure management of the operator's credentials, including appropriate cold-storage or hardware-wallet arrangements.
  • Using a multisignature or governance-controlled smart contract as the operator to distribute authorization across several parties.

The implementation must actually restrict administrative rating operations to the intended authority. The interface alone does not enforce access control.

Overall security considerations

The security of a rating system depends on both the protection of operator authority and the design and administration of its assessment rules.

Consumers should consider who assigns ratings, how decisions are made, and what mechanisms exist to correct errors or challenge abusive behavior.

The Solidity interface has been retained from the original article and has not been independently compiled or audited as part of this translation.

Conclusion

ERC-4974 proposes a shared interface for assigning, querying, updating, and removing numerical ratings associated with Ethereum addresses. It provides a foundation for applications that use reputation or contribution scores while leaving assessment policies to their implementers.

Questions are welcome via Twitter @cardene777.

Other publications:

https://chaldene.net/