1.0.0 • Published 3 years ago

@knsdomain/kns v1.0.0

Weekly downloads
-
License
MIT
Repository
gitlab
Last release
3 years ago

Migrations: https://testnet.bscscan.com/address/0x797630011a3172FE7F7344Aa79AA72e159291136#contracts

Total cost: 0.0084251 BNB

BNSRegistry: https://testnet.bscscan.com/address/0x437613959999fcFBEC5d13f407Ecfab2faBa4732#contracts

FIFSRegistrar: https://testnet.bscscan.com/address/0x83A1E01c6af28905829009f8697f618E9d3D5dB0#contracts

Total cost: 0.039425 BNB

BNSRegistry

Implementation of the BNS Registry, the central contract used to look up resolvers and owners for domains.

FIFSRegistrar

Implementation of a simple first-in-first-served registrar, which issues (sub-)domains to the first account to request them.

BNS Registry interface

The BNS registry is a single central contract that provides a mapping from domain names to owners and resolvers, as described in EIP 137.

The BNS operates on 'nodes' instead of human-readable names; a human readable name is converted to a node using the namehash algorithm, which is as follows:

def namehash(name):
  if name == '':
    return '\0' * 32
  else:
    label, _, remainder = name.partition('.')
    return sha3(namehash(remainder) + sha3(label))

The registry's interface is as follows:

owner(bytes32 node) constant returns (address)

Returns the owner of the specified node.

resolver(bytes32 node) constant returns (address)

Returns the resolver for the specified node.

setOwner(bytes32 node, address owner)

Updates the owner of a node. Only the current owner may call this function.

setSubnodeOwner(bytes32 node, bytes32 label, address owner)

Updates the owner of a subnode. For instance, the owner of "foo.com" may change the owner of "bar.foo.com" by calling setSubnodeOwner(namehash("foo.com"), sha3("bar"), newowner). Only callable by the owner of node.

setResolver(bytes32 node, address resolver)

Sets the resolver address for the specified node.