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.
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
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.
| Name | Type | In the log |
|---|---|---|
| label | string | data |
| labelhash | bytes32 | topic1 |
| owner | address | topic2 |
| baseCost | uint256 | data |
| premium | uint256 | data |
| expires | uint256 | data |
| referrer | bytes32 | data |
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
Get an alert on NameRegistered
Each rule opens with the contract and the conditions filled in. Sign in, pick your chat and click Create.
Contracts we list that emit NameRegistered
Any other contract with the same signature emits a log with the same topic0.
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.
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 }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){
"jsonrpc": "2.0",
"id": 1,
"method": "eth_getLogs",
"params": [
{
"address": "0x59e16fccd424cc24e280be16e11bcd56fb0ce547",
"topics": [
"0xc2240194853531f1ae318dcef227de79c6ad0fd9d1b0e4fe08568415be2e08a5"
],
"fromBlock": "latest"
}
]
}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);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.
- topic0keccak256("NameRegistered(string,bytes32,address,uint256,uint256,uint256,bytes32)")0xc2240194853531f1ae318dcef227de79c6ad0fd9d1b0e4fe08568415be2e08a5
- topic1labelhash0xabababababababababababababababababababababababababababababababab
- topic2owner0x0000000000000000000000003333333333333333333333333333333333333333
- data0x00000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000fa000000000000000000000000000000000000000000000000000000000000013880000000000000000000000000000000000000000000000000000000000001770abababababababababababababababababababababababababababababababab00000000000000000000000000000000000000000000000000000000000000076578616d706c6500000000000000000000000000000000000000000000000000
- labelstringexample
- labelhashbytes32 · indexed0xabababababababababababababababababababababababababababababababab
- owneraddress · indexed0x3333333333333333333333333333333333333333
- baseCostuint2564000
- premiumuint2565000
- expiresuint2566000
- referrerbytes320xabababababababababababababababababababababababababababababababab
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.
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.