Introducing *.getcode.eth: ENS based onchain metadata resolver

What is *.GetCode.eth?

Solidity compiler by default appends CBOR-encoded metadata to contract’s bytecode. *.getcode.eth is an ERC-3668 wildcard ENS resolver that extracts metadata hash from contract’s bytecode and resolves that as ENS contenthash.

Examples :

a) zAMM contracts: 0x00000000008892d085e0611eb8C8BDc9FD856fD3.getcode.eth
b) Safe Proxy: 0xA23dfEA786465E0Ef51eD6C288c9f0070d047ef7.proxy.getcode.eth

Basic UI with Metadata parsing & download features

Resolver source code :

0x7661a4705F10d828B7d9FAB680c6E9559faEABB0 (verified on etherscan)

3 modes of operation

Direct mode :
0x<addr>.getcode.eth -> IPFS contenthash (0xe3010170...) of metadata.json

CBOR mode :
0x<addr>.cbor.getcode.eth -> Returns Raw dag-cbor CID of metadata

Proxy Mode :
0x<addr>.proxy.getcode.eth -> Tries to detect proxy & resolve metadata.json

Limitations :

a) old contracts don’t have embedded metadata in contract bytecode
b) all most all contracts with swarm metadata are fail to resolve as they’re not pinned in swarm storage
c) bad proxies like USDC return blank implementation() address
d) lots of contracts don’t have their IPFS metadata pinned in IPFS network

You can read more about this in https://playground.sourcify.dev/, *.getcode.eth is same as sourcify playground but 100% onchain using contract’s bytecode & ENS wildcard resolver.

6 Likes

Very cool!
I actually suggested something similar to the Sourcify team recently: sourcify.eth-subdomains.md · GitHub

1 Like

Sourcify developer here, very cool! Thanks for shipping this. Is it open source somewhere?

1 Like