ZNS Registry
The ZNS registry.
Registry
The ZNS registry is the zkSync contract that lies at the heart of ZNS resolution. All ZNS lookups start by querying the registry. The registry maintains a list of domains, recording the owner, resolver, and TTL for each, and allows the owner of a domain to make changes to that data.
The ZNS registry is specified in EIP 137.
Get Owner
Returns the owner of the name specified by node
.
Get Resolver
Returns the address of the resolver responsible for the name specified by node
.
Get TTL
Returns the caching time-to-live of the name specified by node
. Systems that wish to cache information about a name, including ownership, resolver address, and records, should respect this value. If TTL is zero, new data should be fetched on each query.
Set Owner
Reassigns ownership of the name identified by node
to owner
. Only callable by the current owner of the name.
Emits the following event:
Set Resolver
Updates the resolver associated with the name identified by node
to resolver
. Only callable by the current owner of the name. resolver
must specify the address of a contract that implements the Resolver interface.
Emits the following event:
Set TTL
Updates the caching time-to-live of the name identified by node
. Only callable by the current owner of the name.
Emits the following event:
Set Subdomain Owner
Creates a new subdomain of node
, assigning ownership of it to the specified owner
. If the domain already exists, ownership is reassigned but the resolver and TTL are left unmodified.
label
is the keccak256 hash of the subdomain label to create. For example, if you own alice.zk and want to create the subdomain iam.alice.zk, supply namehash('alice.zk')
as the node
, and keccak256('iam')
as the label
.
Emits the following event:
Set Record
Sets the owner, resolver, and TTL for an ZNS record in a single operation. This function is offered for convenience, and is exactly equivalent to calling setResolver
, setTTL
and setOwner
in that order.
Set Subdomain Record
Sets the owner, resolver and TTL for a subdomain, creating it if necessary. This function is offered for convenience, and permits setting all three fields without first transferring ownership of the subdomain to the caller.
Set Approval
Sets or clears an approval. Approved accounts can execute all ZNS registry operations on behalf of the caller.
Check Approval
Returns true if operator
is approved to make ZNS registry operations on behalf of owner
.
Check Record Existence
Returns true if node
exists in this ZNS registry. This will return false for records that are in the legacy ZNS registry but have not yet been migrated to the new one.
Last updated