
Company News
Socket Named Top Sales Organization by RepVue
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.
@bchdomains/lns-contracts
Advanced tools
For documentation of the LNS system, see docs.bch.domains.
This repo doubles as an npm package with the compiled JSON contracts
import {
BaseRegistrar,
BaseRegistrarImplementation,
BulkRenewal,
ENS,
ENSRegistry,
ENSRegistryWithFallback,
ETHRegistrarController,
FIFSRegistrar,
LinearPremiumPriceOracle,
PriceOracle,
PublicResolver,
Resolver,
ReverseRegistrar,
StablePriceOracle,
TestRegistrar
} from '@ensdomains/ens-contracts'
// Registry
import '@bchdomains/lns-contracts/contracts/registry/ENS.sol';
import '@bchdomains/lns-contracts/contracts/registry/ENSRegistry.sol';
import '@bchdomains/lns-contracts/contracts/registry/ENSRegistryWithFallback.sol';
import '@bchdomains/lns-contracts/contracts/registry/ReverseRegistrar.sol';
import '@bchdomains/lns-contracts/contracts/registry/TestRegistrar.sol';
// EthRegistrar
import '@bchdomains/lns-contracts/contracts/ethregistrar/BaseRegistrar.sol';
import '@bchdomains/lns-contracts/contracts/ethregistrar/BaseRegistrarImplementation.sol';
import '@bchdomains/lns-contracts/contracts/ethregistrar/BulkRenewal.sol';
import '@bchdomains/lns-contracts/contracts/ethregistrar/BaseRegistrar.sol';
import '@bchdomains/lns-contracts/contracts/ethregistrar/ETHRegistrarController.sol';
import '@bchdomains/lns-contracts/contracts/ethregistrar/LinearPremiumPriceOracle.sol';
import '@bchdomains/lns-contracts/contracts/ethregistrar/PriceOracle.sol';
import '@bchdomains/lns-contracts/contracts/ethregistrar/StablePriceOracle.sol';
// Resolvers
import '@bchdomains/lns-contracts/contracts/resolvers/PublicResolver.sol';
import '@bchdomains/lns-contracts/contracts/resolvers/Resolver.sol';
If your environment does not have compiler, you can access to the raw hardhat artifacts files at node_modules/@bchdomains/lns-contracts/artifacts/contracts/${modName}/${contractName}.sol/${contractName}.json
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. It also includes some generic registrars.
Interface of the LNS Registry.
Implementation of the LNS Registry, the central contract used to look up resolvers and owners for domains.
The new impelmentation of the LNS Registry after the 2020 ENS Registry Migration.
Implementation of a simple first-in-first-served registrar, which issues (sub-)domains to the first account to request them.
Implementation of the reverse registrar responsible for managing reverse resolution via the .addr.reverse special-purpose TLD.
Implementation of the .test registrar facilitates easy testing of LNS on the Ethereum test networks. Currently deployed on Ropsten network, it provides functionality to instantly claim a domain for test purposes, which expires 28 days after it was claimed.
Implements an LNS registrar intended for the .bch TLD.
These contracts were audited by ConsenSys dilligence; the audit report is available here.
BaseRegistrar is the contract that owns the TLD in the LNS registry. This contract implements a minimal set of functionality:
This separation of concerns provides name owners strong guarantees over continued ownership of their existing names, while still permitting innovation and change in the way names are registered and renewed via the controller mechanism.
EthRegistrarController is the first implementation of a registration controller for the new registrar. This contract implements the following functionality:
The commit/reveal process is used to avoid frontrunning, and operates as follows:
The minimum delay and expiry for commitments exist to prevent miners or other users from effectively frontrunnig registrations.
SimplePriceOracle is a trivial implementation of the pricing oracle for the EthRegistrarController that always returns a fixed price per domain per year, determined by the contract owner.
StablePriceOracle is a price oracle implementation that allows the contract owner to specify pricing based on the length of a name, and uses a fiat currency oracle to set a fixed price in fiat per name.
Resolver implements a general-purpose LNS resolver that is suitable for most standard LNS use-cases. The public resolver permits updates to LNS records by the owner of the corresponding name.
PublicResolver includes the following profiles that implements different EIPs.
ABI()).addr()).contenthash()).supportsInterface()).name()).pubkey()).text()).git clone https://github.com/bchdomains/lns-contracts
cd lns-contracts
yarn
yarn test
yarn pub
There is a command line interface to register a single or a list of LNS names.
Be sure to copy .env.org to .env and set the USER_KEY to a private key with some BCH available.
For register task address is an optional parameter allowing to set the SmartBCH address of newly registered name.
Otherwise, all registered names can get their SmartBCH address set in the app.
yarn
npx hardhat --network smartbch-amber register --name test1 --address 0xabcdef....
npx hardhat --network smartbch-amber register:list --names test4,test5,test6
FAQs
LNS contracts
The npm package @bchdomains/lns-contracts receives a total of 5 weekly downloads. As such, @bchdomains/lns-contracts popularity was classified as not popular.
We found that @bchdomains/lns-contracts demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.