EIP-2069 YAML recommended for writing ERC/EIP ABIs (Recommendation for using YAML ABI in ERCs/EIPs)

No call decision · Other · EIP status Stagnant · created 2017-02-11

A recommendation that when EIP and ERC documents write a contract ABI (the definition of how functions are called), they use YAML format instead of Solidity code or JSON, neither of which allows comments.

Why it is needed

Until now, ERCs/EIPs often wrote ABIs only as Solidity contract or interface code. This approach favored a specific language, Solidity, hindering the development of other programming languages, tied the specification to a particular Solidity version, and allowed Solidity-specific syntax that is not properly representable in an ABI, putting users of other languages at a further disadvantage. The standard Contract ABI is usually expressed in JSON, which also has the limitation that it cannot contain comments, making it hard for humans to read and understand. YAML, designed to be compatible with JSON, already has tools for converting between the two and allows comments, solving both problems at once.

What changes

Today

After EIP-2069

Who is affected

In depth

Raising the problem

Existing ERCs/EIPs often wrote ABIs only as Solidity contract or interface code. This can favor a single language (Solidity) and hinder the development of other languages, ties the specification to the syntax of a particular Solidity version, and allows the use of Solidity-specific syntax and features that are not well represented in an ABI, further disadvantaging users of other languages.

The YAML notation approach

The standard Contract ABI is usually represented as a JSON object, supported by most compilers and clients. However, JSON has the drawback of not allowing comments. This proposal suggests using YAML for a human readable specification. As an example, it shows a transfer function with one input (recipient address, amount uint256) and one output (bool) written in YAML, demonstrating that a comment (# The transfer function...) can be placed above the function. Fields follow the standard ABI fields directly, such as name, type, payable, constant, stateMutability, inputs, and outputs.

Relationship with JSON

Because YAML is designed to be compatible with JSON, many tools exist to convert between the two formats. The original text shows the same transfer function side by side in JSON to explain that the two representations are equivalent. As an implementation example, it mentions yamabi, a JavaScript tool that converts between YAML and JSON. Which fields and values are valid in the ABI continues to follow the Standard Contract ABI specification as is.

Design rationale

The goal of this proposal was to choose a representation with good tooling support that also supports comments. Creating a new, more concise description language was also considered, but was judged to add unnecessary complexity and was not adopted.

Backwards compatibility

This proposal does not affect the behavior of existing code or deployed contracts. It is merely a recommendation on how to notate the ABI in documentation, not a change to execution logic.

Current status

This EIP is an Informational type, a recommendation on documentation practice rather than a technical standard that changes the protocol. Its status is Stagnant, meaning it is no longer actively discussed or going through an adoption process. There has been no discussion or decision on fork inclusion in core developer calls.

Original EIP · ← EIPs