ERCs
ERC-1577 — ENS Content Hash
The standard for storing content addresses (IPFS, Swarm, Arweave) in an ENS resolver. The resolver records a content hash, dapps decode it back into a URL.
import { eip155_1 } from "@ethernauta/chain/eip155-1";
import { AddressSchema } from "@ethernauta/core";
import { namehash } from "@ethernauta/erc/137";
import { contenthash } from "@ethernauta/erc/1577";
import { eth_call } from "@ethernauta/eth";
import { contract, create_reader, encode_chain_id, http } from "@ethernauta/transport";
import { parse } from "valibot";
const CHAIN_ID = encode_chain_id({ namespace: "eip155", reference: eip155_1.chainId });
const reader = create_reader([
{ chainId: CHAIN_ID, transports: [http("https://ethereum-rpc.publicnode.com")] },
]);
const resolver_address = parse(AddressSchema, "0x231b0Ee14048e9dCcD1d247744d114a4EB5E8E63");
const callable = contenthash({ node: namehash("vitalik.eth") })(
contract({ chain_id: CHAIN_ID, to: resolver_address }),
);
const result_bytes = await eth_call([{ to: callable.to, input: callable.data }])(reader({ chain_id: CHAIN_ID }));
const hash = callable.decode(result_bytes);
// → e.g. "ipfs://bafybeih..." Surface
| Method | Shape | Purpose |
|---|---|---|
content_hash({ node }) | Callable<Bytes> | Read the content hash record. |
set_content_hash({ node, hash }) | Signable<Hash32> | Set the record. |
The hash bytes follow the multicodec format — 0xe301 prefix for IPFS, 0xe40101 for Swarm, etc. Decoders live in @ethernauta/ens and run during get_ens_avatar.
See also
- @ethernauta/ens —
get_ens_avatar,parse_avatar. - ERC-137 — registry that points to the resolver.