ERC-2680 Ethereum 2 wallet storage layout (Ethereum 2 wallet layout)
Stagnant · Accounts & wallets · created 2020-05-29
Defines standard storage locations and naming conventions for placing validator wallets and keys in storage such as a filesystem or Amazon S3, so that different wallet software can share the same wallet files.
Why it is needed
Because there is no standard for how Ethereum wallets lay out files in storage, each wallet software uses its own folder structure and naming conventions. As a result, when a user wants to switch to different validator software, they must manually move or convert wallet and key files to fit the new format. This process carries the risk of accidentally deleting files or creating duplicate copies, and losing a key file means losing access to any funds controlled by that key. For those operating validators, switching software effectively becomes a risk of losing keys.
In depth
Base location
For filesystems, predetermined paths are used per operating system: %APPDATA%\ethereum2\wallets on Windows, ${HOME}/Library/Application Support/ethereum2/wallets on macOS, and ${HOME}/.config/ethereum2/wallets on Linux. For other hierarchical storage such as Amazon S3, the base location is the lowercase hexadecimal string obtained by SHA-256 hashing the string "Ethereum 2 wallet:" appended with that storage's identifier (e.g. account ID). For non-hierarchical (key/value) storage, there is no concept of a base location.
Wallet container
A container holding the walletstore and its associated keystores. It is identified by the wallet's UUID, which must be a string following the grammar defined in RFC 4122 section 3.
Walletstore and keystores
The walletstore resides inside the wallet container and is identified by the wallet's UUID. Keystores reside in the same container and are each identified by their key's UUID. Both must be UUID strings following the grammar defined in RFC 4122 section 3.
Hierarchical storage example
In storage that supports hierarchical naming, such as a filesystem, the wallet UUID 1f031fff-c51d-44fc-8baf-d6b304cb70a7 is used as the folder name, and inside it sit a walletstore file (named with the same UUID as the wallet) and keystore files each named with their key's UUID (e.g. 1302106c-8441-4e2e-b687-6c77f49fc624, 4a320100-83fd-4db7-8126-6d6d205ba834).
Non-hierarchical storage example
In non-hierarchical key/value storage, the key used is the wallet UUID and the key UUID joined with a ':' character. For example, the key for a walletstore entry takes the form "1f031fff-c51d-44fc-8baf-d6b304cb70a7:1f031fff-c51d-44fc-8baf-d6b304cb70a7", with the wallet UUID appearing twice in a row.
Index format and iterating over wallets/accounts
In hierarchical storage, or non-hierarchical storage that supports iteration, simply iterating over the entries in the base location or wallet container yields the list of wallets or accounts. An implementation may optionally maintain an index with the identifier 'index', which must follow a JSON schema consisting of an array of objects with uuid and name fields. The index must not store public keys.
Concurrent write protection undefined
The specification for how to prevent multiple processes from writing to the same wallet or keystore simultaneously is left as TBD (to be determined) in the source and is not yet defined.
Proposal status
This ERC is Stagnant, meaning the proposal is no longer under active discussion and has stalled. Its content may change in the future or may never be adopted.
Things to watch out for
- Possible exposure through storage location permissions: The wallet storage location is defined to reside within the user's personal space, but misconfigured permissions could make it readable by other users. Applications implementing this standard must set and maintain permissions so that only that user can access it.
- Preventing information leakage through metadata: Since both wallet and keystore names are UUIDs, the file names or storage key names themselves reveal no information.