{"action":"created","issue":{"url":"https://api.github.com/repos/ethereum/EIPs/issues/1616","repository_url":"https://api.github.com/repos/ethereum/EIPs","labels_url":"https://api.github.com/repos/ethereum/EIPs/issues/1616/labels{/name}","comments_url":"https://api.github.com/repos/ethereum/EIPs/issues/1616/comments","events_url":"https://api.github.com/repos/ethereum/EIPs/issues/1616/events","html_url":"https://github.com/ethereum/EIPs/issues/1616","id":383890673,"node_id":"MDU6SXNzdWUzODM4OTA2NzM=","number":1616,"title":"ERC: Attribute Registry Standard","user":{"login":"0age","id":37939117,"node_id":"MDQ6VXNlcjM3OTM5MTE3","avatar_url":"https://avatars2.githubusercontent.com/u/37939117?v=4","gravatar_id":"","url":"https://api.github.com/users/0age","html_url":"https://github.com/0age","followers_url":"https://api.github.com/users/0age/followers","following_url":"https://api.github.com/users/0age/following{/other_user}","gists_url":"https://api.github.com/users/0age/gists{/gist_id}","starred_url":"https://api.github.com/users/0age/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/0age/subscriptions","organizations_url":"https://api.github.com/users/0age/orgs","repos_url":"https://api.github.com/users/0age/repos","events_url":"https://api.github.com/users/0age/events{/privacy}","received_events_url":"https://api.github.com/users/0age/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-11-23T17:11:15Z","updated_at":"2018-11-25T20:02:42Z","closed_at":null,"author_association":"NONE","body":"| eip    | title                                | author                                                                                                                     | discussions-to                               |\r\n|--------|--------------------------------------|----------------------------------------------------------------------------------------------------------------------------|----------------------------------------------|\r\n| 1616   | ERC-1616 Attribute Registry Standard | 0age (@0age), Santiago Palladino (@spalladino), Leo Arias (@elopio), Alejo Salles (@fiiiu), Stephane Gosselin (@thegostep) | https://github.com/ethereum/EIPs/issues/1616 |\r\n\r\n| status | type            | category | created    | requires |\r\n|--------|-----------------|----------|------------|----------|\r\n| Draft  | Standards Track | ERC      | 2018-11-23 | 165      |\r\n\r\n\r\n## Simple Summary\r\n<!--\"If you can't explain it simply, you don't understand it well enough.\" Provide a simplified and layman-accessible explanation of the EIP.-->\r\nEIP-1616 provides a basic interface for querying a registry for attribute metadata assigned to Ethereum accounts.\r\n\r\n## Abstract\r\n<!--A short (~200 word) description of the technical issue being addressed.-->\r\nThis EIP contains the following core ideas:\r\n1. Instead of relying directly on the reputation of a claims issuer to assess the veracity of a given claim, trust can be brought up to the level of a registry curator. This registry which we call an \"**Attribute Registry**\" allows for reduced complexity in implementation since a party needing to verify an attribute can now work with a trusted claims aggregator instead of relying on individual claim providers.\r\n2. Claims are abstracted as standard \"attributes\" which represent metadata assigned to an account, with claims decoupled from the issuing party. Attributes are registered as a flat `uint256 -> uint256` key-value pair on each account, with the important property that **each attribute type has one canonical value per address**. This property allows for composability of attribute registries and advanced attribute formation.\r\n3. There is a generic method for determining the set of attribute keys or IDs made available by the registry. The standard does not specify requirements or recommendations for how attributes and their values are managed, or what additional metadata may be associated with attributes. It is likely that a standard set of attribute names and metadata schema could be proposed in a separate EIP.\r\n\r\nPotential advanced uses of attribute registries include:\r\n* Encoding complex boolean expressions which combine multiple attributes into a single uint256 key, which is then parsed and evaluated by the registry logic.\r\n* Using values associated with an attribute to query additional on-chain or off-chain metadata.\r\n* Resolving attribute values by calling into seperate attribute registries or other contracts, delegating authority without changing the interface of the registry.\r\n\r\n## Motivation\r\n<!--The motivation is critical for EIPs that want to change the Ethereum protocol. It should clearly explain why the existing protocol specification is inadequate to address the problem that the EIP solves. EIP submissions without sufficient motivation may be rejected outright.-->\r\nThis EIP is motivated by the need for contracts and external accounts to be able to verify information about a given address from a single trusted source **without concerning themselves with the particular details of how the information was obtained**, and to do so in as simple a manner as possible. It is also motivated by the desire to promote broad **cross-compatibility and composability** between attribute registries, a property which is amplified by both the simplicity of the interface as well as by the guarantees on uniqueness provided by the proposed standard.\r\n\r\nExisting EIPs for assigning metadata to an account include EIP-735 and EIP-780, which both allow for multiple claims to be issued on the same address for any given claim topic. This forces verifiers of said metadata to assess the veracity of each claim, taking into account the relative reputation of each claim issuer. It also prescribes a methodology for adding and removing claims, which may not be appropriate for all use cases.\r\n\r\nThis EIP proposes a light-weight abstraction layer for a standard account metadata registry interface. This abstraction layer can sit on top of claims registries like EIP-735 and EIP-780 or others as the attribute registry curator selects trusted data sources.\r\n\r\n## Specification\r\n<!--The technical specification should describe the syntax and semantics of any new feature. The specification should be detailed enough to allow competing, interoperable implementations for any of the current Ethereum platforms (go-ethereum, parity, cpp-ethereum, ethereumj, ethereumjs, and [others](https://github.com/ethereum/wiki/wiki/Clients)).-->\r\nThe Attribute Registry interface contains four functions, outlined as follows:\r\n```Solidity\r\n/**\r\n * @title EIP-1616 Attribute Registry Standard interface. EIP-165 ID: 0x5f46473f\r\n */\r\ninterface AttributeRegistryInterface {\r\n  function hasAttribute(address account, uint256 attributeTypeID) external view returns (bool);\r\n  function getAttributeValue(address account, uint256 attributeTypeID) external view returns (uint256);\r\n  function countAttributeTypes() external view returns (uint256);\r\n  function getAttributeTypeID(uint256 index) external view returns (uint256);\r\n}\r\n```\r\n\r\nContracts that comply with the Attribute Registry EIP MUST implement the above interface.\r\n\r\nAs an additional requirement, the ERC-165 interface MUST be included:\r\n```Solidity\r\n/**\r\n * @title EIP-165 interface. EIP-165 ID: 0x01ffc9a7\r\n */\r\ninterface EIP-165 {\r\n  /**\r\n   * @notice EIP-165 support. Attribute Registry interface ID is 0x5f46473f.\r\n   * @param _interfaceID The interface identifier, as specified in EIP-165\r\n   * @return True for 0x01ffc9a7 & 0x5f46473f, false for unsupported interfaces.\r\n   */\r\n  function supportsInterface(bytes4 _interfaceID) external view returns (bool);\r\n}\r\n```\r\n\r\nThe implementation MUST follow the specifications described below.\r\n\r\n### View Functions\r\nThe view functions detailed below MUST be implemented.\r\n\r\n#### `hasAttribute` function\r\n```Solidity\r\nfunction hasAttribute(address account, uint256 attributeTypeID) external view returns (bool)\r\n```\r\n\r\nCheck if an attribute has been assigned to a given account on the registry and is currently valid.\r\n\r\n_**NOTE**_: This function MUST return either true or false - i.e. calling this function MUST NOT cause the caller to revert. Implementations that wish to call into another contract during execution of this function MUST catch any `revert` and instead return `false`.\r\n\r\n_**NOTE**_: This function MUST return two equal values when performing two directly consecutive function calls with identical `account` and `attributeTypeID` parameters, regardless of differences in the caller's address, the transaction origin, or other out-of-band information.\r\n\r\n\r\n\r\n#### `getAttributeValue` function\r\n```Solidity\r\nfunction getAttributeValue(address account, uint256 attributeTypeID) external view returns (uint256)\r\n```\r\n\r\nRetrieve the `uint256` value of an attribute on a given account on the registry, assuming the attribute is currently valid.\r\n\r\n_**NOTE**_: This function MUST revert if a directly preceding or subsequent function call to `hasAttribute` with identical `account` and `attributeTypeID` parameters would return false.\r\n\r\n_**NOTE**_: This function MUST return two equal values when performing two directly consecutive function calls with identical `account` and `attributeTypeID` parameters, regardless of differences in the caller's address, the transaction origin, or other out-of-band information.\r\n\r\n#### `countAttributeTypes` function\r\n```Solidity\r\nfunction countAttributeTypes() external view returns (uint256)\r\n```\r\n\r\nRetrieve the total number of valid attribute types defined on the registry. Used alongside `getAttributeTypeID` to determine all of the attribute types that are available on the registry.\r\n\r\n_**NOTE**_: This function MUST return a positive integer value  - i.e. calling this function MUST NOT cause the caller to revert.\r\n\r\n_**NOTE**_: This function MUST return a value that encompasses all indexes of attribute type IDs whereby a call to `hasAttribute` on some address with an attribute type ID at the given index would return `true`.\r\n\r\n#### `getAttributeTypeID` function\r\n```Solidity\r\nfunction getAttributeTypeID(uint256 index) external view returns (uint256)\r\n```\r\n\r\nRetrieve an ID of an attribute type defined on the registry by index. Used alongside `countAttributeTypes` to determine all of the attribute types that are available on the registry.\r\n\r\n_**NOTE**_: This function MUST revert if the provided `index` value falls outside of the range of the value returned from a directly preceding or subsequent function call to `countAttributeTypes`. It MUST NOT revert if the provided `index` value falls inside said range.\r\n\r\n_**NOTE**_: This function MUST return an `attributeTypeID` value on *some* index if the same `attributeTypeID` value would cause a given call to `hasAttribute` to return `true` when passed as a parameter.\r\n\r\n## Rationale\r\n<!--The rationale fleshes out the specification by describing what motivated the design and why particular design decisions were made. It should describe alternate designs that were considered and related work, e.g. how the feature is supported in other languages. The rationale may also provide evidence of consensus within the community, and should discuss important objections or concerns raised during discussion.-->\r\nThis standard extends the applicability of metadata assignment to those use cases that are not adequately represented by EIP-735, EIP-780, or similar proposals. Namely, it enforces the constraint of one attribute value per attribute ID per address, as opposed to one value per ID per address *per issuer*.\r\n\r\nAside from the prescribed attribute value, attribute properties are deliberately omitted from the standard. While many attribute registries will require additional metadata on attributes at both the instance and the class level, reliable and flexible interoperability between highly variable registry extensions is facilitated more effectively by enforcing a widely-applicable base layer for attributes.\r\n\r\n## Backwards Compatibility\r\n<!--All EIPs that introduce backwards incompatibilities must include a section describing these incompatibilities and their severity. The EIP must explain how the author proposes to deal with these incompatibilities. EIP submissions without a sufficient backwards compatibility treatise may be rejected outright.-->\r\nThere are no backwards compatibility concerns.\r\n\r\n## Test Cases\r\n<!--Test cases for an implementation are mandatory for EIPs that are affecting consensus changes. Other EIPs can choose to include links to test cases if applicable.-->\r\nTargeted test cases with 100% code coverage can be found at [this repository](https://github.com/0age/AttributeRegistry). See [here](https://github.com/TPL-protocol/tpl-contracts) for tests on a more complex contract that implements the application registry interface.\r\n\r\n## Implementation\r\nSee [this repository](https://github.com/0age/AttributeRegistry/blob/master/contracts/mock/AttributeRegistry.sol) for an example implementation (or [here](https://github.com/TPL-protocol/tpl-contracts/blob/master/contracts/BasicJurisdiction.sol#L399) for an example of a more complex implementing contract).\r\n\r\n## Copyright\r\nCopyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/)."},"comment":{"url":"https://api.github.com/repos/ethereum/EIPs/issues/comments/441468345","html_url":"https://github.com/ethereum/EIPs/issues/1616#issuecomment-441468345","issue_url":"https://api.github.com/repos/ethereum/EIPs/issues/1616","id":441468345,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0MTQ2ODM0NQ==","user":{"login":"pedrouid","id":10136079,"node_id":"MDQ6VXNlcjEwMTM2MDc5","avatar_url":"https://avatars2.githubusercontent.com/u/10136079?v=4","gravatar_id":"","url":"https://api.github.com/users/pedrouid","html_url":"https://github.com/pedrouid","followers_url":"https://api.github.com/users/pedrouid/followers","following_url":"https://api.github.com/users/pedrouid/following{/other_user}","gists_url":"https://api.github.com/users/pedrouid/gists{/gist_id}","starred_url":"https://api.github.com/users/pedrouid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pedrouid/subscriptions","organizations_url":"https://api.github.com/users/pedrouid/orgs","repos_url":"https://api.github.com/users/pedrouid/repos","events_url":"https://api.github.com/users/pedrouid/events{/privacy}","received_events_url":"https://api.github.com/users/pedrouid/received_events","type":"User","site_admin":false},"created_at":"2018-11-25T20:02:42Z","updated_at":"2018-11-25T20:02:42Z","author_association":"CONTRIBUTOR","body":"Thanks for the detailed breakthrough @0age! That was super helpful 🙏 "}}
{"actor":{"display_login":"pedrouid"}}