• Stars
    star
    185
  • Rank 208,271 (Top 5 %)
  • Language
    CSS
  • License
    BSD 2-Clause "Sim...
  • Created about 7 years ago
  • Updated 8 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A registrar that sells subdomains to users on behalf of their owners

ENS Subdomain registrar

Build Status License

This is a set of smart contracts and corresponding webapp that facilitates easy registration of ENS subdomains for users. By simply entering a desired subdomain name and choosing from a list of available domains, they can register a subdomain and point it at their account in one click.

This code is currently BETA. Prior versions of the smart contract have been audited, but changes have been made subsequently, for which an audit has not yet been completed. Use with care.

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

Installing

The ENS Subdomain registrar uses npm to manage dependencies, therefore the installation process is kept simple:

npm install

Running tests

The ENS Subdomain registrar uses truffle for its ethereum development environment. All tests can be run using truffle:

truffle test

To run linting, use solium:

solium --dir ./contracts

Running the dapp

ganache-cli &
truffle deploy
npm run dev

Operation

SubdomainRegistrar implements a contract that takes ownership of (multiple) .eth domains, and sells subdomains to users for a simple one-time fee. When users register a subdomain, it is automatically configured with a default resolver and pointed at their account. This permits easy one-transaction claiming and assignment of an ENS domain for users, significantly improving the ENS user-experience.

A variety of frontends can be built to interact with the subdomain registrar; a simple implementation is provided in this repository. Domain owners may set a 'commission rate', which is a percentage fee that is sent to the address the frontend nominates. This can be any amount, but frontends are free to set criteria for inclusion or prioritisation based on the fee paid.

There is no functionality in the contract for listing or querying domains that are registered with it, though events are emitted when new domains are registered. To avoid spamming with low-quality domains, we recommend that frontend operators maintain a whitelist of domains to offer subdomain registrations on.

Adding a domain

Any .eth domain owner may use this contract by:

  1. Transferring ownership of the Deed to the deployed contract.
  2. Calling configureDomain(name, price, referralFeePPM), where name is the name of the domain (without .eth), price is the price in wei to charge for a subdomain registration, and referralFeePPM is the referral fee to offer to frontends, in parts-per-million.
  3. Getting the new domain whitelisted with frontends so users can buy it.

Note that this process is IRREVOCABLE! For the security of customers, once you have transferred your domain to the subdomain registrar, you cannot claim it back except under very limited circumstances (see below).

Upgrades to the subdomain registrar

In the event of a bug or issue with the subdomain registrar being found, a migration path to a new implementation is provided. The owner of the subdomain registrar may halt new registrations, followed by setting a migration address to a new implementation. Afterwards, domain owners may call migrate to transfer ownership of their domain to the new implementation. Only domain owners may do this, so as to prevent the owner of the subdomain registrar from being able to sieze ownership of the names.

Upgrades to the .eth registrar

The current .eth registrar is an interim implementation, and is expected to be replaced in the near future. This is likely to be accompanied by a change in API, which makes catering to this in existing contracts difficult. To avoid this, the subdomain registrar implements a precommitment strategy.

At any point, the owner of a domain may specify a 'transfer address' for their domain. Once a transfer address is set, it may not be changed or unset. At the point at which the .eth registrar is replaced (and not before), the owner may call the upgrade function, transferring ownership of the Deed to this address.

The intended workflow is as follows:

  1. A new .eth registrar is deployed, but not yet activated. Users are advised of a migration date.
  2. Domain owners on the subdomain registrar set the transfer address for their domains to that of a 'migration contract' that will handle upgrading the domain to the new registrar and committing it to a new subdomain registrar.
  3. Users have an opportunity to evaluate the upgrade path, and stop using their subdomains if unhappy with it.
  4. The .eth registrar upgrade happens.
  5. The domain owner calls upgrade, transferring ownership and performing the upgrade process.

Built With

  • Truffle - Ethereum development environment

Authors

See also the list of contributors who participated in this project.

License

This project is licensed under the BSD 2-clause "Simplified" License - see the LICENSE file for details

More Repositories

1

ens

Implementations for ENS core functionality: The registry, registrars, and public resolvers.
JavaScript
1,159
star
2

ens-contracts

The core contracts of the ENS protocol
TypeScript
576
star
3

ens-app

Legacy ENS manager app
JavaScript
223
star
4

ensjs-v2

Javascript bindings for the Ethereum Name Service
JavaScript
206
star
5

governance-contracts

Governance contracts for the ENS DAO
JavaScript
160
star
6

address-encoder

Encodes and decodes address formats for various cryptocurrencies
TypeScript
148
star
7

offchain-resolver

TypeScript
142
star
8

docs

Main documentation site for the ENS protocol
TypeScript
136
star
9

evmgateway

This repository implements a generic CCIP-Read gateway for fetching state proofs of data on other EVM chains. The intended use is for contracts on L1 to be able to fetch and verify data from contracts on L2 in a read context.
TypeScript
132
star
10

ens-app-v3

The official ENS manager app. Register and manage your ENS names here.
TypeScript
126
star
11

ensjs

ENS javascript library for contract interaction
TypeScript
123
star
12

ensdomains-landing

ENS Homepage V2, the main homepage of the ENS protocol.
TypeScript
105
star
13

ethregistrar

Solidity
92
star
14

thorin

A web3 native design system.
TypeScript
81
star
15

ens-metadata-service

TypeScript
71
star
16

resolvers

A collection of resolvers for ENS domains
JavaScript
69
star
17

dnssec-oracle

A DNSSEC oracle for Ethereum
Solidity
57
star
18

react-ens-address

React Component to resolve ENS names or reverse resolve addresses
JavaScript
57
star
19

ui

UI components and reusable functions
JavaScript
55
star
20

l2gateway-demo

A simple demonstration of a proposed L2 gateway specification
JavaScript
52
star
21

name-wrapper

JavaScript
45
star
22

ens-avatar

ENS Avatar resolver library for both nodejs and browser.
TypeScript
40
star
23

solsha1

Pure-solidity implementation of the SHA1 hash function.
Solidity
39
star
24

ens.domains

JavaScript
31
star
25

reverse-records

JavaScript
27
star
26

dnsprovejs

A tool to convince an Ethereum DNSSEC oracle of the contents of DNS records
TypeScript
25
star
27

buffer

A library for working with mutable byte buffers in Solidity.
Solidity
25
star
28

governance-web-react

JavaScript
23
star
29

governance-docs

Governance documentation for the ENS DAO
22
star
30

offchain-resolver-example

CCIP Offchain ENS Resolver example implementation
TypeScript
21
star
31

dnsregistrar

DNS registrar for ENS
Solidity
21
star
32

ens-manager

JavaScript
19
star
33

ethers-ccip-read

Ethers-rs CCIP-Read Middleware
Rust
19
star
34

media-kit

ens media kit resources
CSS
17
star
35

ens-validation

TypeScript
17
star
36

root

New ENS root contract
JavaScript
16
star
37

op-resolver

JavaScript
15
star
38

ens-twitter-api

TypeScript
14
star
39

ens-avatar-worker

Cloudflare worker that facilitates gasless avatar record updates via the ENS manager app
TypeScript
13
star
40

dnssecoraclejs

TypeScript/JavaScript library for generating DNSSEC proofs for the ENS DNSSEC oracle contract
TypeScript
11
star
41

court

Basic smart contracts for the arbitration processes.
Solidity
11
star
42

docs-v2

The Ethereum Name Service (ENS) is a distributed, open, and extensible naming system based on the Ethereum blockchain. This repository contains documentation, examples, and much more.
HTML
11
star
43

blacklist

Blacklisting tools for ENS
Solidity
10
star
44

optimistic-dnssec

Optimistic Implementation of the DNSSEC Registrar
Solidity
10
star
45

ens-archived-contracts

Collection of compiled ENS smart contracts
Solidity
10
star
46

hackathon-registrar

A simple ENS registrar for Hackathons
Solidity
9
star
47

gas-estimate-worker

Cloudflare worker for estimating registration gas costs with tenderly
TypeScript
9
star
48

name-reservations

Repository for 3-6 character name reservations in .eth.
CSS
9
star
49

enschain

Solidity
9
star
50

frontend-template

Starter web app for web3 developers
TypeScript
8
star
51

offchain-gateway-rs

Offchain CCIP Gateway Resolver implementation in Rust
Rust
7
star
52

learn-docs

Documentation for learning about ENS domains
7
star
53

renewal-widget

ENS Renewal widget displays a popup window if there are any expiring ENS names.
JavaScript
7
star
54

arb-resolver

JavaScript
7
star
55

ensips

ENS Improvement Proposals
TypeScript
7
star
56

hack.ens.domains

JavaScript
7
star
57

k-ens

ENS formally verified
6
star
58

auction

An auction contract for a one-off vickery style auction of 3-6 character names
JavaScript
6
star
59

my-ens-app

HTML
6
star
60

ccip-read-dns-gateway

ENS CCIP-Read DNSSEC Gateway
TypeScript
5
star
61

dnssectool

JavaScript
5
star
62

short-name-claims-app

A webapp for submitting claims for ENS short names (3-6 characters)
TypeScript
5
star
63

blog

Official Ethereum Name Service Blog
TypeScript
5
star
64

hack2018

5
star
65

research

ENS relevant research.
5
star
66

ccip-tools

CCIP Multitool for testing your offchain resolver!
TypeScript
5
star
67

ens-support-docs

ENS Support Docs
CSS
4
star
68

ens-reclaim-deposit-subgraph

TypeScript
4
star
69

hackathon-registrar-app

JavaScript
4
star
70

renewal

JavaScript
4
star
71

ens-print

Micro App for printing ENS stickers
JavaScript
4
star
72

ethlink-request

It fetches newly created subdomain and send request to eth.link to add to the DoH proxy
TypeScript
4
star
73

mock

Module for mocking ENS locally
JavaScript
4
star
74

integrations

List of integrations for ENS
TypeScript
4
star
75

reclaim

TypeScript
3
star
76

moonpay-worker

JavaScript
3
star
77

normalise-refund

JavaScript
3
star
78

test-utils

ENS test utilities
JavaScript
3
star
79

tldclaims

JavaScript
3
star
80

verify-ratification

Code to verify the votes ratifying the ENS constitution
JavaScript
3
star
81

usd-oracle

USD oracle research
3
star
82

batch-gateway

3
star
83

short-name-claims-subgraph

A subgraph for indexing ENS .eth short name claims
TypeScript
3
star
84

migration-scripts

Python
3
star
85

ens-faucet-worker

Cloudflare worker to help distribute testnet ETH to ENS manager app users
TypeScript
3
star
86

ens-bigquery-udf

JavaScript
3
star
87

ens-evmgateway

TypeScript
3
star
88

crypto-addr-serialize

Encode/Decode various cryptocurrency addresses
JavaScript
3
star
89

ens-og-image

TypeScript
2
star
90

enscluster

Config files for the ensdomains Kubernetes clusters
Python
2
star
91

dnssec-oracle-anchors

JavaScript
2
star
92

dao-pm

Project management repository for the ENS DAO
2
star
93

context-resolver

TypeScript
2
star
94

constitution-book-claim

ENS DAO constitution book claim site
TypeScript
2
star
95

ens-avatar-fallback

JavaScript
2
star
96

arbitrum-resolver

JavaScript
1
star
97

pm

an place to hold ENS project issues which cannot be assigned to any existing repos
1
star
98

ens-cfw

TypeScript
1
star
99

rasterize-gcp

ENS NFT Rasterization Service
JavaScript
1
star
100

punycode

Solidity
1
star