ERCs
ERC-2304 — Multichain ENS addresses
ENS resolvers can store addresses for chains other than Ethereum — Bitcoin, Litecoin, Solana, etc. Each chain has a SLIP-44 coin type identifier; the resolver’s addr(node, coinType) returns the chain-specific bytes.
import { eip155_1 } from "@ethernauta/chain/eip155-1";
import { AddressSchema, Uint256Schema } from "@ethernauta/core";
import { namehash } from "@ethernauta/erc/137";
import { addr } from "@ethernauta/erc/2304";
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 = addr({
node: namehash("vitalik.eth"),
coinType: parse(Uint256Schema, "0x0"), // Bitcoin
})(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 btc = callable.decode(result_bytes); Surface
| Method | Shape | Purpose |
|---|---|---|
addr_multichain({ node, coin_type }) | Callable<Bytes> | Read a multichain address. |
set_addr_multichain({ node, coin_type, address }) | Signable<Hash32> | Set one. |
SLIP-44 coin types
| Type | Coin |
|---|---|
| 0 | Bitcoin |
| 2 | Litecoin |
| 60 | Ethereum (default) |
| 501 | Solana |
The encoding for each chain’s address bytes follows ENSIP-9.