bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 75쪽 중 39쪽
Header";
## ENSIP-4: Support for contract ABIs
<EnsipHeader authors={["nick.eth"]} created="February 6, 2017" status="final" />
A mechanism for storing ABI definitions in ENS, for easy lookup of contract interfaces by callers (formerly [EIP-205](https://eips.ethereum.org/EIPS/eip-205)).
### Abstract
ABIs are important metadata required for interacting with most contracts. At present, they are typically supplied out-of-band, which adds an additional burden to interacting with contracts, particularly on a one-off basis or where the ABI may be updated over time. The small size of ABIs permits an alternative solution, storing them in ENS, permitting name lookup and ABI discovery via the same process.
ABIs are typically quite compact; the largest in-use ABI we could find, that for the DAO, is 9450 bytes uncompressed JSON, 6920 bytes uncompressed CBOR, and 1128 bytes when the JSON form is compressed with zlib. Further gains on CBOR encoding are possible using a CBOR extension that permits eliminating repeated strings, which feature extensively in ABIs. Most ABIs, however, are far shorter than this, consisting of only a few hundred bytes of uncompressed JSON.
This ENSIP defines a resolver profile for retrieving contract ABIs, as well as encoding standards for storing ABIs for different applications, allowing the user to select between different representations based on their need for compactness and other considerations such as onchain access.
### Specification
#### ABI encodings
In order to allow for different tradeoffs between onchain size and accessibility, several ABI encodings are defined. Each ABI encoding is defined by a unique constant with only a single bit set, allowing for the specification of 256 unique encodings in a single uint.
The currently recognised encodings are:
| ID | Description |
| -- | -------------------- |
| 1 | JSON |
| 2 | zlib-compressed JSON |
| 4 | CBOR |
| 8 | URI |
This table may be extended in future through the ENSIP process.
Encoding type 1 specifies plaintext JSON, uncompressed; this is the standard format in which ABIs are typically encoded, but also the bulkiest, and is not easily parseable onchain.
Encoding type 2 specifies zlib-compressed JSON. This is significantly smaller than uncompressed JSON, and is straightforward to decode offchain. However, it is impractical for onchain consumers to use.
Encoding type 4 is [CBOR](https://cbor.io). CBOR is a binary encoding format that is a superset of JSON, and is both more compact and easier to parse in limited environments such as the EVM. Consumers that support CBOR are strongly encouraged to also support the [stringref extension](http://cbor.schmorp.de/stringref) to CBOR, which provides significant additional reduction in encoded size.
Encoding type 8 indicates that the ABI can be found elsewhere, at the specified URI. This is typically the most compact of the supported forms, but also adds external dependencies for implementers. The specified URI may use any schema, but HTTP, IPFS, and Swarm are expected to be the most common.
#### Resolver profile
A new resolver interface is defined, consisting of the following method:
```solidity
function ABI(bytes32 node, uint256 contentType) constant returns (uint256, bytes);
```
The interface ID of this interface is 0x2203ab56.
contentType is a bitfield, and is the bitwise OR of all the encoding types the caller will accept. Resolvers that implement this interface must return an ABI encoded using one of the requested formats, or `(0, "")` if they do not have an ABI for this function, or do not support any of the requested formats.
The `abi` resolver profile is valid on both forward and reverse records.
#### ABI lookup process
When attempting to fetch an ABI based on an ENS name, implementers should first attempt an ABI lookup on the name itself. If that lookup returns no results, they should attempt a reverse lookup on the Ethereum address the name resolves to.
Implementers should support as many of the ABI encoding formats as practical.
### Rationale
Storing ABIs onchain avoids the need to introduce additional dependencies for applications wishing to fetch them, such as swarm or HTTP access. Given the typical compactness of ABIs, we believe this is a worthwhile tradeoff in many cases.
The two-step resolution process permits different names to provide different ABIs for the same contract, such as in the case where it's useful to provide a minimal ABI to some callers, as well as specifying ABIs for contracts that did not specify one of their own. The fallback to looking up an ABI on the reverse record permits contracts to specify their own canonical ABI, and prevents the need for duplication when multiple names reference the same contract without the need for different ABIs.
### Copyright
Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/).
import { EnsipHeader } from "../../components/EnsipHeader";
## ENSIP-5: Text Records
<EnsipHeader authors={["ricmoo.eth"]} created="May 17, 2017" status="final" />
A standard for storage of text records in ENS (formerly [EIP-634](https://eips.ethereum.org/EIPS/eip-634)).
### Abstract
This ENSIP defines a resolver profile for ENS that permits the lookup of arbitrary key-value text data. This allows ENS name holders to associate e-mail addresses, URLs and other informational data with a ENS name.
### Motivation
There is often a desire for human-readable metadata to be associated with otherwise machine-driven data; used for debugging, maintenance, reporting and general information.
In this ENSIP we define a simple resolver profile for ENS that permits ENS names to associate arbitrary key-value text.
### Specification
#### Resolver Profile
A new resolver interface is defined, consisting of the following method:
```solidity
interface IERC634 {
/// @notice Returns the text data associated with a key for an ENS name
/// @param node A nodehash for an ENS name
/// @param key A key to lookup text data for
/// @return The text data
function text(bytes32 node, string key) view returns (string text);
}
```
The EIP-165 interface ID of this interface is `0x59d1d43c`.
The `text` data may be any arbitrary UTF-8 string. If the key is not present, the empty string must be returned.
#### Global Keys
Global Keys must be made up of lowercase letters, numbers and the hyphen (-).
* **avatar** - a URL to an image used as an avatar or logo
* **description** - A description of the name
* **display** - a canonical display name for the ENS name; this MUST match the ENS name when its case is folded, and clients should ignore this value if it does not (e.g. `"ricmoo.eth"` could set this to `"RicMoo.eth"`)
* **email** - an e-mail address
* **keywords** - A list of comma-separated keywords, ordered by most significant first; clients that interpresent this field may choose a threshold beyond which to ignore
* **mail** - A physical mailing address
* **notice** - A notice regarding this name
* **location** - A generic location (e.g. `"Toronto, Canada"`)
* **phone** - A phone number as an E.164 string
* **url** - a website URL
#### Service Keys
Service Keys must be made up of a *reverse dot notation* for a namespace which the service owns, for example, DNS names (e.g. `.com`, `.io`, etc) or ENS name (i.e. `.eth`). Service Keys must contain at least one dot.
This allows new services to start using their own keys without worrying about colliding with existing services and also means new services do not need to update this document.
The following services are common, which is why recommendations are provided here, but ideally a service would declare its own key.
* **com.github** - a GitHub username
* **com.peepeth** - a Peepeth username
* **com.linkedin** - a LinkedIn username
* **com.twitter** - a Twitter username
* **io.keybase** - a Keybase username
* **org.telegram** - a Telegram username
This technique also allows for a service owner to specify a hierarchy for their keys, such as:
* **com.example.users**
* **com.example.groups**
* **com.example.groups.public**
* **com.example.groups.private**
#### Legacy Keys
The following keys were specified in earlier versions of this ENSIP.
Their use is not likely very wide, but applications attempting maximal compatibility may wish to query these keys as a fallback if the above replacement keys fail.
* **vnd.github** - a GitHub username (renamed to `com.github`)
* **vnd.peepeth** - a peepeth username (renamed to `com.peepeth`)
* **vnd.twitter** - a Twitter username (renamed to `com.twitter`)
### Rationale
#### Application-specific vs general-purpose record types
Rather than define a large number of specific record types (each for generally human-readable data) such as `url` and `email`, we follow an adapted model of DNS's `TXT` records, which allow for a general keys and values, allowing future extension without adjusting the resolver, while allowing applications to use custom keys for their own purposes.
### Backwards Compatibility
Not applicable.
### Security Considerations
None.
### Copyright
Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/).
import { EnsipHeader } from "../../components/EnsipHeader";
## ENSIP-6: DNS-in-ENS
<EnsipHeader authors={["mcdee"]} created="June 26, 2018" status="obsolete" />
Defines a resolver profile for ENS that provides features for storage and lookup of DNS records (formerly [EIP-1185](https://eips.ethereum.org/EIPS/eip-1185)).
### Abstract
This ENSIP defines a resolver profile for ENS that provides features for storage and lookup of DNS records. This allows ENS to be used as a store of authoritative DNS information.
### Motivation
ENS is a highly desirable store for DNS information. It provides the distributed authority of DNS without conflating ownership and authoritative serving of information. With ENS, the owner of a domain has full control over their own DNS records. Also, ENS has the ability (through smart contracts) for a domain's subdomains to be irrevocably assigned to another entity.
### Specification
The resolver profile to support DNS on ENS follows the resolver specification as defined in #137.
Traditionally, DNS is a zone-based system in that all of the records for a zone are kept together in the same file. This has the benefit of simplicity and atomicity of zone updates, but when transposed to ENS can result in significant gas costs for simple changes. As a result, the resolver works on the basis of record sets. A record set is uniquely defined by the tuple (domain, name, resource record type), for example the tuple (example.com, [www.example.com](http://www.example.com), A) defines the record set of A records for the name [www.example.com](http://www.example.com) in the domain example.com. A record set can contain 0 or more values, for example if [www.example.com](http://www.example.com) has A records 1.2.3.4 and 5.6.7.8 then the aforementioned tuple will have two values.
The choice to work at the level of record sets rather than zones means that this specification cannot completely support some features of DNS, such as zone transfers and DNSSEC. It would be possible to build a different resolver profile that works at the zone level, however it would be very expensive to carry out updates and so is not considered further for this ENSIP.
The DNS resolver interface consists of two functions to set DNS information and two functions to query DNS information.
#### setDNSRecords(bytes32 node, bytes data)
`setDNSRecords()` sets, updates or clears 1 or more DNS records for a given node. It has function signature `0x0af179d7`.
The arguments for the function are as follows:
* node: the namehash of the fully-qualified domain in ENS for which to set the records. Namehashes are defined in #137
* data: 1 or more DNS records in DNS wire format. Any record that is supplied without a value will be cleared. Note that all records in the same RRset should be contiguous within the data; if not then the later RRsets will overwrite the earlier one(s)
#### clearDNSZone(bytes32 node)
`clearDNSZone()` removes all DNS records for the domain. It has function signature `0xad5780af`.
Although it is possible to clear records individually with `setDNSRecords()` as described above this requires the owner to know all of the records that have been set (as the resolver has no methods to iterate over the records for a given domain), and might require multiple transactions. `clearDNSZone()` removes all zone information in a single operation.
The arguments for the function is as follows:
* node: the namehash of the fully-qualified domain in ENS for which to clear the records. Namehashes are defined in #137
#### dnsRecords(bytes32 node, bytes32 name, uint16 resource) view returns (bytes)
`dnsRecords()` obtains the DNS records for a given node, name and resource. It has function signature `0x2461e851`.
The arguments for the function are as follows:
* node: the namehash of the fully-qualified domain in ENS for which to set the records. Namehashes are defined in #137
* name: the `keccak256()` hash of the name of the record in DNS wire format.
* resource: the resource record ID. Resource record IDs are defined in [https://en.wikipedia.org/wiki/List\\\_of\\\_DNS\\\_record\\\_types](https://en.wikipedia.org/wiki/List\\_of\\_DNS\\_record\\_types)
The function returns all matching records in DNS wire format. If there are no records present the function will return nothing.
#### hasDNSRecords(bytes32 node, bytes32 name) view returns (bool)
`hasDNSRecords()` reports if there are any records for the provided name in the domain. It has function signature `0x4cbf6ba4`.
This function is needed by DNS resolvers when working with wildcard resources as defined in [https://tools.ietf.org/html/rfc4592](https://tools.ietf.org/html/rfc4592)
The arguments for the function are as follows:
* node: the namehash of the fully-qualified domain in ENS for which to set the records. Namehashes are defined in #137
* name: the `keccak256()` hash of the name of the record in DNS wire format.
The function returns `true` if there are any records for the provided node and name, otherwise `false`.
### Backwards Compatibility
Not applicable.
### Implementation
The reference implementation of the DNS resolver is at [https://github.com/wealdtech/wealdtech-solidity/blob/master/contracts/ens/DNSResolver.sol](https://github.com/wealdtech/wealdtech-solidity/blob/master/contracts/ens/DNSResolver.sol)
[https://github.com/wealdtech/ethereal.git](https://github.com/wealdtech/ethereal.git) can be used to test the functionality of the resolver with the "dns set", "dns get" and "dns clear" commands.
### Test Cases
Test cases for the DNS resolver are at [https://github.com/wealdtech/wealdtech-solidity/blob/master/test/ens/DNSResolver.js](https://github.com/wealdtech/wealdtech-solidity/blob/master/test/ens/DNSResolver.js)
### Copyright
Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/).
import { EnsipHeader } from "../../components/EnsipHeader";
## ENSIP-7: Contenthash field
<EnsipHeader authors={["nick.eth","decanus"]} created="November 13, 2018" status="final" />
Introduces a field for storing content addresses and hashes in ENS (formerly [EIP-1577](https://eips.ethereum.org/EIPS/eip-1577)).
### Abstract
This ENSIP introduces the new `contenthash` field for ENS resolvers, allowing for a better defined system of mapping names to network and content addresses. Additionally the `content` and `multihash` fields are deprecated.
### Motivation
Multiple applications including [Metamask](https://metamask.io) and mobile clients such as [Status](https://status.im) have begun resolving ENS names to content hosted on distributed systems such as [IPFS](https://ipfs.io) and [Swarm](https://swarm-guide.readthedocs.io). Due to the various ways content can be stored and addressed, a standard is required so these applications know how to resolve names and that domain owners know how their content will be resolved.
The `contenthash` field allows for easy specification of network and content addresses in ENS.
### Specification
The field `contenthash` is introduced, which permits a wide range of protocols to be supported by ENS names. Resolvers supporting this field MUST return `true` when the `supportsInterface` function is called with argument `0xbc1c58d1`.
The fields `content` and `multihash` are deprecated.
The value returned by `contenthash` MUST be represented as a machine-readable [multicodec](https://github.com/multiformats/multicodec). The format is specified as follows:
```go
<protoCode uvarint><value []byte>
```
protoCodes and their meanings are specified in the [multiformats/multicodec](https://github.com/multiformats/multicodec) repository.
The encoding of the value depends on the content type specified by the protoCode. Values with protocodes of 0xe3 and 0xe4 represent IPFS and Swarm content; these values are encoded as v1 [CIDs](https://github.com/multiformats/cid) without a base prefix, meaning their value is formatted as follows:
```go
<protoCode uvarint><cid-version><multicodec-content-type><multihash-content-address>
```
When resolving a `contenthash`, applications MUST use the protocol code to determine what type of address is encoded, and resolve the address appropriately for that protocol, if supported.
#### Example
**IPFS**
Input data:
```go
storage system: IPFS (0xe3)
CID version: 1 (0x01)
content type: dag-pb (0x70)
hash function: sha2-256 (0x12)
hash length: 32 bytes (0x20)
hash: 29f2d17be6139079dc48696d1f582a8530eb9805b561eda517e22a892c7e3f1f
```
Binary format:
```go
0xe3010170122029f2d17be6139079dc48696d1f582a8530eb9805b561eda517e22a892c7e3f1f
```
Text format:
```txt
ipfs://QmRAQB6YaCyidP37UdDnjFY5vQuiBrcqdyoW1CuDgwxkD4
```
#### Swarm
Input data:
```go
storage system: Swarm (0xe4)
CID version: 1 (0x01)
content type: swarm-manifest (0xfa)
hash function: keccak256 (0x1b)
hash length: 32 bytes (0x20)
hash: d1de9994b4d039f6548d191eb26786769f580809256b4685ef316805265ea162
```
Binary format:
```go
0xe40101fa011b20d1de9994b4d039f6548d191eb26786769f580809256b4685ef316805265ea162
```
Text format:
```go
bzz://d1de9994b4d039f6548d191eb26786769f580809256b4685ef316805265ea162
```
Example usage with swarm hash:
```go
$ swarm hash ens contenthash d1de9994b4d039f6548d191eb26786769f580809256b4685ef316805265ea162
> e40101fa011b20d1de9994b4d039f6548d191eb26786769f580809256b4685ef316805265ea162
```
#### Fallback
In order to support names that have an IPFS or Swarm hash in their `content` field, a grace period MUST be implemented offering those name holders time to update their names. If a resolver does not support the `multihash` interface, it MUST be checked whether they support the `content` interface. If they do, the value of that field SHOULD be treated in a context dependent fashion and resolved. This condition MUST be enforced until at least March 31st, 2019.
#### Implementation
To support `contenthash`, a new resolver has been developed and can be found [here](https://github.com/ensdomains/resolvers/blob/master/contracts/PublicResolver.sol), you can also find this smart contract deployed on:
* Mainnet : [0xd3ddccdd3b25a8a7423b5bee360a42146eb4baf3](https://etherscan.io/address/0xd3ddccdd3b25a8a7423b5bee360a42146eb4baf3)
* Ropsten : [0xde469c7106a9fbc3fb98912bb00be983a89bddca](https://ropsten.etherscan.io/address/0xde469c7106a9fbc3fb98912bb00be983a89bddca)
There are also implementations in multiple languages to encode and decode `contenthash`:
* [JavaScript](https://github.com/pldespaigne/content-hash)
* [Python](https://github.com/filips123/ContentHashPy)
### Copyright
Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/).
import { EnsipHeader } from "../../compone프로젝트로 돌아가기