🤖
LNS Documentation
  • Introduction
  • Terminology
  • Frequently Asked Questions
  • Tokenomics
  • LNS Deployments
  • Registrar Frequently Asked Questions
  • Deploying LNS on a Private Chain
  • DNS Registrar guide
  • Bug Bounty Program
  • ENS Improvement Proposals
    • ENSIP-1: ENS
    • ENSIP-2: Initial Hash Registrar
    • ENSIP-3: Reverse Resolution
    • ENSIP-4: Support for contract ABIs
    • ENSIP-5: Text Records
    • ENSIP-6: DNS-in-ENS
    • ENSIP-7: Contenthash field
    • ENSIP-8: Interface Discovery
    • ENSIP-9: Multichain Address Resolution
    • ENSIP-10: Wildcard Resolution
    • ENSIP-11: EVM compatible Chain Address Resolution
    • ENSIP-12: Avatar Text Records
  • Dapp Developer Guide
    • LNS Enabling your DApp
    • LNS Libraries
    • Working with LNS
    • Resolving Names
    • Managing Names
    • Registering & Renewing Names
    • LNS Front-End Design Guidelines
    • LNS as NFT
  • Contract API Reference
    • Name Processing
    • Registry
    • ReverseRegistrar
    • PublicResolver
    • .bch Permanent Registrar
      • Registrar
      • Controller
    • DNS Registrar
  • Contract Developer Guide
    • Resolving Names On-chain
    • Writing a Resolver
    • Writing a Registrar
    • LNS Support Chat
Powered by GitBook
On this page
  • Get Owner
  • Get Resolver
  • Get TTL
  • Set Owner
  • Set Resolver
  • Set TTL
  • Set Subdomain Owner
  • Set Record
  • Set Subdomain Record
  • Set Approval
  • Check Approval
  • Check Record Existence
Edit on GitHub
  1. Contract API Reference

Registry

The LNS registry.

PreviousName ProcessingNextReverseRegistrar

Last updated 3 years ago

The LNS registry is the core contract that lies at the heart of LNS resolution. All LNS 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 LNS registry is specified in .

Get Owner

function owner(bytes32 node) external view returns (address);

Returns the owner of the name specified by node.

Get Resolver

function resolver(bytes32 node) external view returns (address);

Returns the address of the resolver responsible for the name specified by node.

Get TTL

function ttl(bytes32 node) external view returns (uint64);

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

function setOwner(bytes32 node, address owner) external;

Reassigns ownership of the name identified by node to owner. Only callable by the current owner of the name.

Emits the following event:

event Transfer(bytes32 indexed node, address owner);

Set Resolver

function setResolver(bytes32 node, address resolver) external;

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:

event NewResolver(bytes32 indexed node, address resolver);

Set TTL

function setTTL(bytes32 node, uint64 ttl) external;

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:

event NewTTL(bytes32 indexed node, uint64 ttl);

Set Subdomain Owner

function setSubnodeOwner(bytes32 node, bytes32 label, address owner) external;

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.bch and want to create the subdomain iam.alice.bch, supply namehash('alice.bch') as the node, and keccak256('iam') as the label.

Emits the following event:

event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);

Set Record

function setRecord(bytes32 node, address owner, address resolver, uint64 ttl);

Sets the owner, resolver, and TTL for an LNS 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

function setSubnodeRecord(bytes32 node, bytes32 label, address owner, address resolver, uint64 ttl);

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

function setApprovalForAll(address operator, bool approved);

Sets or clears an approval. Approved accounts can execute all LNS registry operations on behalf of the caller.

Check Approval

function isApprovedForAll(address owner, address operator) external view returns (bool);

Returns true if operator is approved to make LNS registry operations on behalf of owner.

Check Record Existence

function recordExists(bytes32 node) public view returns (bool);

Returns true if node exists in this LNS registry. This will return false for records that are in the legacy LNS registry but have not yet been migrated to the new one.

Source
EIP 137