ERC-5313 Lightweight contract ownership lookup (Light Contract Ownership)

Final · Accounts & wallets · created 2022-07-22

A minimal interface standard that lets you look up the address of the account that owns a contract with a single owner() function.

Why it is needed

Contracts have owners too. For example, whoever created an NFT collection contract has the authority to change that contract's settings or manage the collection page on a marketplace. But if there is no common way to check from outside which account owns the contract, each website or marketplace has to find out the owner in its own way. An ownership standard (EIP-173) already existed, but it also requires an ownership transfer function and events, which was heavier than necessary when all that is needed is to check the owner. This standard requires only one function that returns the owner address, so that simpler ownership implementations can also follow the standard.

What to implement

In depth

The only required item is the EIP5313 interface

Every contract that follows this standard MUST implement the EIP5313 interface. The interface has only one function, owner(), which is declared view external and returns an address. It defines only the minimum interface needed to identify the account that controls the contract. MUST follows the definition in RFC 2119.

A lightweight alternative to EIP-173

This standard was created as a slim alternative to EIP-173. The design prioritized minimizing the number of functions in the interface and backward compatibility with existing contracts. The original text explains that because its scope is small, more and simpler ownership implementations are possible, and other standards can extend this one to add further ownership features, and have in fact done so.

Why EIP-165 is not required

The original text acknowledges that implementing EIP-165, which advertises interface support, could be a valuable addition to this specification. However, this standard was written to codify an existing protocol that connects contracts (mainly NFTs) with third-party websites (mainly well-known NFT marketplaces), so it does not make EIP-165 mandatory.

Backward compatibility with EIP-173

Every contract that implements EIP-173 already implements this specification, because the owner() function in EIP-173 is the same as the only function this standard requires. Therefore existing EIP-173 contracts satisfy this standard without any change.

Things to watch out for

Original ERC · ← ERCs