Skip to content

Support Basenames (Base .base.eth naming) for EthereumType coins #1689

Description

@cranycrane

Summary

Blockbook does not support Basenames (Coinbase's ENS-fork naming service on Base, names of the form <label>.base.eth). The existing ENS machinery in bchain/coins/eth/ is deliberately scoped to Ethereum mainnet, so no names are indexed or resolved on Base. This is a feature request to add Basenames support.

Current state

There are two independent name-handling mechanisms for EthereumType coins, both wired to Ethereum mainnet only:

  1. Alias indexing (passive, sync-time) — scans NameRegistered logs from trusted registrar contracts and stores address → name aliases. This is what renders a name next to an address in the explorer.

    • getEnsRecordbchain/coins/eth/dataparser.go:345
    • isTrustedNameRegisteredEvent accepts only the three ENS ETHRegistrarController signatures (5/6/7-arg) — bchain/coins/eth/dataparser.go:336, constants at bchain/coins/eth/contract.go:29-37
    • trusted emitters come from the ens_registrars config; empty ⇒ records nothing (bchain/coins/eth/ethrpc.go:97-99)
    • display suffix appended by FormatAddressAlias = name + EnsSuffix (bchain/coins/eth/ethparser.go:636); default .eth (ethparser.go:68), overridden to .bnb/.trx by BSC/Tron
  2. Live forward resolution (search box)ResolveENS (bchain/coins/eth/ethrpc.go:2546), reachable from explorer search (server/public.go:1266).

    • ensContracts() hard-fails when MainNetChainID != MainNet (bchain/coins/eth/ethrpc.go:2537-2542), disabling resolution on every L2 including Base.

Live reverse resolution (address → name) does not exist in production (only a test stub, tests/dbtestdata/fakechain_ethereumtype.go).

Base config today: configs/coins/base_archive.json has address_aliases: true but no ens_registrars; configs/coins/base.json has neither. A bchain/coins/base/baserpc.go package already exists (chain id 8453) with a ResolveENS passthrough hook — a natural home for Base-specific wiring.

Proposed work

Feature A — Basenames alias indexing (core, recommended first)

  • Add the Basenames RegistrarController address to ens_registrars in configs/coins/base.json and configs/coins/base_archive.json, and set address_aliases: true on both.
  • Add the Basenames NameRegistered event signature to the constants (bchain/coins/eth/contract.go) and to isTrustedNameRegisteredEvent (dataparser.go:336). Structurally it's already compatible: getEnsRecord needs exactly 3 topics (sig + indexed label + indexed owner, owner in topic[2]) and parseEnsNameFromLogData reads the first dynamic string param by offset.
  • Set the display suffix to .base.eth for Base via SetEnsSuffix(".base.eth") in bchain/coins/base/baserpc.go Initialize() (mirrors BSC/Tron). A single flat suffix is correct because the registrar trust-list guarantees every captured alias is a Basename. (Alternative: add a generic ens_suffix config field to eth.Configuration.)
  • Backfill historical registrations with blockbook -rebuildensaliases (RebuildEnsAliases, ethrpc.go:1471); give the rescan the Basenames deployment block as a floor to avoid scanning from genesis.
  • Tests: real Basenames NameRegistered log fixture → getEnsRecord accepts it and FormatAddressAlias yields <label>.base.eth.

Feature B — live *.eth search resolution (optional)

  • Un-gate ensContracts() for Base by overriding it in bchain/coins/base to return the Basenames Registry + BaseRegistrar addresses on chain 8453.
  • ResolveENS largely works as-is: .base.eth passes the suffix check and ensNameHash already does full recursive namehash. Caveat: names resolving via CCIP-read/offchain gateways won't resolve through a plain eth_call; on-chain names will.
  • Fix or disable expiration: CheckENSExpiration (ethrpc.go:2621) extracts the label as parts[len-1], which for jesse.base.eth yields base (wrong token). Needs Basenames-aware label extraction + Base's BaseRegistrar address, or skip initially.

Out of scope

Live reverse resolution (address → name). The alias index already provides address → name for display.

Facts to confirm before implementing

  1. Basenames RegistrarController address on Base.
  2. Exact NameRegistered event signature and indexed-param layout.
  3. Whether the emitted name is the bare label (jesse) or the full name (decides whether .base.eth suffix is correct or would double-suffix).
  4. Registry / L2Resolver / BaseRegistrar addresses (Feature B).
  5. Basenames deployment block (backfill floor).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions