Event signature · NFT sales, names and staking

NameRegistered (ENS) event signature and topic0

The topic0 of the NameRegistered (ENS) event is 0xc2240194853531f1ae318dcef227de79c6ad0fd9d1b0e4fe08568415be2e08a5, the keccak-256 hash of NameRegistered(string,bytes32,address,uint256,uint256,uint256,bytes32); 2 of its 7 arguments are indexed. New .eth name registered through the ENS controller.

Anatomy of a NameRegistered (ENS) log

Topics

  • topic00xc2240194853531f1ae318dcef227de79c6ad0fd9d1b0e4fe08568415be2e08a5keccak256("NameRegistered(string,bytes32,address,uint256,uint256,uint256,bytes32)")
  • topic1labelhash (bytes32)indexed: filterable
  • topic2owner (address)indexed: filterable

Data

  • datalabel (string), baseCost (uint256), premium (uint256), expires (uint256), referrer (bytes32)ABI-encoded, decoded with the ABI
Parameters

Arguments and where they sit in the log

Indexed arguments travel as topics and can be filtered cheaply; the others are ABI-encoded together in the data.

NameTypeIn the log
labelstringdata
labelhashbytes32topic1
owneraddresstopic2
baseCostuint256data
premiumuint256data
expiresuint256data
referrerbytes32data

Solidity declaration

event NameRegistered(string label, bytes32 indexed labelhash, address indexed owner, uint256 baseCost, uint256 premium, uint256 expires, bytes32 referrer);

Canonical signature

NameRegistered(string,bytes32,address,uint256,uint256,uint256,bytes32)

topic0

0xc2240194853531f1ae318dcef227de79c6ad0fd9d1b0e4fe08568415be2e08a5

Ready-made alerts

Get an alert on NameRegistered

Each rule opens with the contract and the conditions filled in. Sign in, pick your chat and click Create.

Who emits it

Contracts we list that emit NameRegistered

Any other contract with the same signature emits a log with the same topic0.

Code

Read NameRegistered logs in code

The same filter in viem, ethers and plain JSON-RPC, and the Solidity that emits it. The address is ENS ETH Registrar Controller, a contract we list that emits it.

viem
import { createPublicClient, http, parseAbiItem } from "viem"
import { mainnet } from "viem/chains"

const client = createPublicClient({ chain: mainnet, transport: http() })

const logs = await client.getLogs({
  address: "0x59e16fccd424cc24e280be16e11bcd56fb0ce547",
  event: parseAbiItem("event NameRegistered(string label, bytes32 indexed labelhash, address indexed owner, uint256 baseCost, uint256 premium, uint256 expires, bytes32 referrer)"),
  fromBlock: "latest",
})

for (const log of logs) console.log(log.args) // { label, labelhash, owner, baseCost, premium, expires, referrer }
ethers v6
import { Interface, JsonRpcProvider } from "ethers"

const provider = new JsonRpcProvider(process.env.RPC_URL)
const iface = new Interface(["event NameRegistered(string label, bytes32 indexed labelhash, address indexed owner, uint256 baseCost, uint256 premium, uint256 expires, bytes32 referrer)"])

const logs = await provider.getLogs({
  address: "0x59e16fccd424cc24e280be16e11bcd56fb0ce547",
  topics: [iface.getEvent("NameRegistered")!.topicHash],
})

for (const log of logs) console.log(iface.parseLog(log)?.args)
JSON-RPC (eth_getLogs)
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "eth_getLogs",
  "params": [
    {
      "address": "0x59e16fccd424cc24e280be16e11bcd56fb0ce547",
      "topics": [
        "0xc2240194853531f1ae318dcef227de79c6ad0fd9d1b0e4fe08568415be2e08a5"
      ],
      "fromBlock": "latest"
    }
  ]
}
Solidity
event NameRegistered(string label, bytes32 indexed labelhash, address indexed owner, uint256 baseCost, uint256 premium, uint256 expires, bytes32 referrer);

// inside a function:
emit NameRegistered(label, labelhash, owner, baseCost, premium, expires, referrer);
Example

An example NameRegistered log, encoded and decoded

Placeholder values, not a real transaction: how each argument is stored in the topics and the data, and what decoding gives back.

Encoded (as the node returns it)
  • topic0keccak256("NameRegistered(string,bytes32,address,uint256,uint256,uint256,bytes32)")0xc2240194853531f1ae318dcef227de79c6ad0fd9d1b0e4fe08568415be2e08a5
  • topic1labelhash0xabababababababababababababababababababababababababababababababab
  • topic2owner0x0000000000000000000000003333333333333333333333333333333333333333
  • data0x00000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000fa000000000000000000000000000000000000000000000000000000000000013880000000000000000000000000000000000000000000000000000000000001770abababababababababababababababababababababababababababababababab00000000000000000000000000000000000000000000000000000000000000076578616d706c6500000000000000000000000000000000000000000000000000
Decoded with the ABI
  • labelstringexample
  • labelhashbytes32 · indexed0xabababababababababababababababababababababababababababababababab
  • owneraddress · indexed0x3333333333333333333333333333333333333333
  • baseCostuint2564000
  • premiumuint2565000
  • expiresuint2566000
  • referrerbytes320xabababababababababababababababababababababababababababababababab
FAQ

Frequently asked questions

What is the topic0 of the NameRegistered (ENS) event?

0xc2240194853531f1ae318dcef227de79c6ad0fd9d1b0e4fe08568415be2e08a5: the keccak-256 hash of NameRegistered(string,bytes32,address,uint256,uint256,uint256,bytes32).

Which NameRegistered (ENS) arguments are indexed?

labelhash, owner are indexed and sit in the log's topics; label, baseCost, premium, expires, referrer are in the data.

How do I get an alert when a contract emits NameRegistered (ENS)?

Open one of the ready-made rules on this page, or add any contract and pick NameRegistered (ENS) from the event list. Conditions can be set on indexed and non-indexed arguments, and each alert names the contract and links to the transaction.

Keep exploring

More event signatures and tools

Know the moment a contract emits it

The Beta plan is free: one wallet and one contract, no credit card.