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.

This article examines ERC-2680, which defines a proposed storage layout for Ethereum wallets and keystores to facilitate interoperability between software implementations.

This explanation translates, summarizes, and expands on the following specification.

For other proposals, see https://cardene.dev/proposals.

Overview

At the time of the proposal, there was no common standard for wallet and keystore storage locations or filenames, making sharing and reusing wallets and keys between software implementations difficult.

ERC-2680 specifies walletstore and keystore placement and naming conventions for hierarchical storage, such as filesystems and Amazon S3, and non-hierarchical storage, such as key-value stores. This allows different software implementations to access the same wallet and keys.

Motivation

Standardizing wallet and account layouts improves interoperability among validator software and helps users migrate between implementations.

This also matters for security: moving files containing private keys risks accidental deletion or insecure duplication. A common layout reduces the need to move such files.

Specification

Basic Components

The standard defines four components:

  • Base location
  • Wallet container
  • Walletstore
  • Keystore

Together they establish a common format for storing and reading wallets and keys across storage systems.

Base Location

The base location is the common storage root. It differs between hierarchical and non-hierarchical storage.

Filesystems (Hierarchical Storage)

The base locations for each operating system are:

  • Windows: %APPDATA%\ethereum2\wallets
  • macOS: ${HOME}/Library/Application Support/ethereum2/wallets
  • Linux: ${HOME}/.config/ethereum2/wallets

Other Hierarchical Storage, Such as Amazon S3

Concatenate Ethereum 2 wallet: with the storage identifier, such as an account ID, compute SHA-256, and use its lowercase hexadecimal representation as the base location.

Example:

  • String: Ethereum 2 wallet:AbC0438EB
  • SHA-256 hash: 0x991ec1...c9229
  • Base location: 991ec14a8d13836b10d8c3039c9e30876491cb8aa9c9c16967578afc815c9229

Non-hierarchical Storage

Non-hierarchical storage, such as key-value stores, has no base location.

Wallet Container

A wallet container holds a walletstore and its associated keystores. It is identified by the wallet's UUID, conforming to RFC 4122.

Walletstore

A walletstore contains configuration and information for the wallet as a whole.

  • It is stored within the wallet container.
  • Its filename or object name is the wallet UUID.

Keystore

A keystore stores information for an individual key, including key material in the applicable keystore format.

  • It is stored within the wallet container.
  • Its filename or object name is the key UUID.

Hierarchical Storage Example

A wallet UUID and multiple key UUIDs are arranged as follows.

text
- 1f031fff-c51d-44fc-8baf-d6b304cb70a7
  +- 1302106c-8441-4e2e-b687-6c77f49fc624
  +- 1f031fff-c51d-44fc-8baf-d6b304cb70a7
  +- 4a320100-83fd-4db7-8126-6d6d205ba834

Non-hierarchical Storage Example

Identifiers are concatenated to form object names.

text
1f031fff-c51d-44fc-8baf-d6b304cb70a7:1302106c-8441-4e2e-b687-6c77f49fc624
1f031fff-c51d-44fc-8baf-d6b304cb70a7:1f031fff-c51d-44fc-8baf-d6b304cb70a7
1f031fff-c51d-44fc-8baf-d6b304cb70a7:4a320100-83fd-4db7-8126-6d6d205ba834

Protection Against Concurrent Writes

ERC-2680 does not yet define protections against concurrent writes by multiple processes (TBD).

Wallet Enumeration

Hierarchical and iterable non-hierarchical storage can enumerate wallets by scanning the relevant storage entries. If an implementer introduces an index, it must conform to the index format below.

Account Enumeration

Hierarchical storage can enumerate accounts by scanning files within the wallet container. An optional index must likewise conform to the index format.

Index Format

The following JSON schema defines the format for wallet and account lists.

json
{
  "type": "array",
  "items": {
    "type": "object",
    "properties": {
      "uuid": {
        "type": "string"
      },
      "name": {
        "type": "string"
      }
    },
    "required": [
      "uuid",
      "name"
    ]
  }
}
  • The index file must be named index.
  • The index must not contain public keys.

Additional Considerations

Standardizing walletstores, like keystores, improves interoperability and facilitates wallet and key migration and sharing across software implementations.

For example, when switching validator software, users can work with a common file layout without managing implementation-specific structures, simplifying migration and reducing errors.

Security

Walletstore locations are restricted to locations such as a user's home directory, reducing the chance of accidental access by others.

However, operating system configuration may make files readable by other users. Applications must therefore set and verify appropriate file permissions so that only authorized users can access them.

Walletstore and keystore filenames use UUIDs rather than descriptive names, reducing leakage of personal information or key details through filenames. This does not eliminate all possible metadata leakage.

Citation

Jim McDonald Jim@mcdee.net, "ERC-2680: Ethereum 2 wallet layout [DRAFT]," Ethereum Improvement Proposals, no. 2680, May 2020. [Online serial]. Available: https://eips.ethereum.org/EIPS/eip-2680.

Conclusion

ERC-2680 proposes a common wallet and keystore layout so different Ethereum wallet and validator software can handle the same stored data.

Further reading and author links:

https://chaldene.net/