Giter Site home page Giter Site logo

ens-indexer's Introduction

ENS Indexer

A simpler, less complete version of the ENS Subgraph. Built with Ponder.

Indexes the following contracts:

Name Contract Address
Registry 0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e
Base Registrar 0x57f1887a8BF19b14fC0dF6Fd9B2acc9Af147eA85
Legacy ETH Registrar Controller 0x283Af0B28c62C092C9727F1Ee09c02CA627EB7F5
ETH Registrar Controller 0x253553366Da8546fC250F225fe3d25d0C782303b
Name Wrapper 0xD4416b13d2b3a9aBae7AcD5D6C2BbDBE25686401

Example queries

Get all names owned by an address:

{
  names(
    where: {
      OR: [
        { owner: "0x179A862703a4adfb29896552DF9e307980D19285" }
        { wrappedOwner: "0x179A862703a4adfb29896552DF9e307980D19285" }
      ]
    }
  ) {
    items {
      id
      name
      resolver
      createdAt
      expiresAt
    }
  }
}

Get all subnames of a given node:

{
  names(
    where: {
      parentId: "0x4e34d3a81dc3a20f71bbdf2160492ddaa17ee7e5523757d47153379c13cb46df" # namehash('ens.eth')
    }
  ) {
    items {
      id
      name
      createdAt
    }
  }
}

You can also access the database directly for more complex SQL queries. Learn more here.

Notes to self while building

  • The first record of a .eth 2LD onchain is a Transfer event from the Base Registrar

  • The first record of a 3LD+ onchain is a NewOwner event from the Registry

  • Trace of a .eth registration from the latest ETH Registrar ontroller:

    • user calls controller.register
      • controller calls nameWrapper.registerAndWrapETH2LD
        • wrapper calls registrar.register
          • registrar emits Transfer (from ERC721), this is the first time the name is recorded onchain
          • registrar calls registry.setSubnodeOwner
            • registry emits Transfer
            • registry emits NewOwner
          • registrar emits NameRegistered
      • controller emits NameRegistered
  • tokenId from the Transfer event of the Base Registrar is the uint256 representation of the labelhash of the 2LD, where the parent is always eth

  • label from all events is the labelhash

  • name from the registrar controller events is the label as a string

  • name from the Name Wrapper events is a base64 encoded string of the full name

ens-indexer's People

Contributors

gskril avatar

Stargazers

Michael Demarais avatar Jalil Wahdatehagh avatar limes avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.