Event signature · Proxies and ownership

OwnershipTransferred event signature and topic0

The topic0 of the OwnershipTransferred event is 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0, the keccak-256 hash of OwnershipTransferred(address,address); 2 of its 2 arguments are indexed. Contract ownership handed to a new owner.

Anatomy of a OwnershipTransferred log

Topics

  • topic00x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0keccak256("OwnershipTransferred(address,address)")
  • topic1previousOwner (address)indexed: filterable
  • topic2newOwner (address)indexed: filterable
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
previousOwneraddresstopic1
newOwneraddresstopic2

Solidity declaration

event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

Canonical signature

OwnershipTransferred(address,address)

topic0

0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0

Ready-made alerts

Get an alert on OwnershipTransferred

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 OwnershipTransferred

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

Code

Read OwnershipTransferred logs in code

The same filter in viem, ethers and plain JSON-RPC, and the Solidity that emits it. The address is ENS names (.eth registrar), 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: "0x57f1887a8bf19b14fc0df6fd9b2acc9af147ea85",
  event: parseAbiItem("event OwnershipTransferred(address indexed previousOwner, address indexed newOwner)"),
  fromBlock: "latest",
})

for (const log of logs) console.log(log.args) // { previousOwner, newOwner }
ethers v6
import { Interface, JsonRpcProvider } from "ethers"

const provider = new JsonRpcProvider(process.env.RPC_URL)
const iface = new Interface(["event OwnershipTransferred(address indexed previousOwner, address indexed newOwner)"])

const logs = await provider.getLogs({
  address: "0x57f1887a8bf19b14fc0df6fd9b2acc9af147ea85",
  topics: [iface.getEvent("OwnershipTransferred")!.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": "0x57f1887a8bf19b14fc0df6fd9b2acc9af147ea85",
      "topics": [
        "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0"
      ],
      "fromBlock": "latest"
    }
  ]
}
Solidity
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

// inside a function:
emit OwnershipTransferred(previousOwner, newOwner);
Example

An example OwnershipTransferred 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("OwnershipTransferred(address,address)")0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0
  • topic1previousOwner0x0000000000000000000000001111111111111111111111111111111111111111
  • topic2newOwner0x0000000000000000000000002222222222222222222222222222222222222222
  • data0x
Decoded with the ABI
  • previousOwneraddress · indexed0x1111111111111111111111111111111111111111
  • newOwneraddress · indexed0x2222222222222222222222222222222222222222
FAQ

Frequently asked questions

What is the topic0 of the OwnershipTransferred event?

0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0: the keccak-256 hash of OwnershipTransferred(address,address).

Which OwnershipTransferred arguments are indexed?

previousOwner, newOwner are indexed and sit in the log's topics.

How do I get an alert when a contract emits OwnershipTransferred?

Open one of the ready-made rules on this page, or add any contract and pick OwnershipTransferred 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.