关于 ens-primary-name
ens-primary-name 是用于在 Base 及其他支持的链上设置和验证 ENS 主名称的技能。它通过 Bankr CLI 提交交易,并提供设置 ENS 头像的脚本。
主要功能
- 01设置 ENS 反向记录
- 02验证正向与反向解析
- 03支持 Base、Arbitrum、Optimism 和 Ethereum
- 04设置 ENS 头像
适用场景
- 01在 Base 设置 ENS 主名称
- 02在其他支持的链设置主名称
- 03验证 ENS 名称解析
- 04更新 ENS 头像
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ bankrbot/ skills --skill ens-primary-name安装后在 Claude Code 中输入/ens-primary-name确认已加载。
包含的文件
除 SKILL.md 外,安装时一起下载的参考资料和脚本。
catalog.jsonscripts/set-avatar.shset-primary.shverify-primary.sh详细介绍
ENS 主名称
通过 ENS 反向注册器,在 Base 和其他 L2 链上设置你的 ENS 主名称。
主名称会建立双向链接:
- 正向:
name.eth→0x1234...(在 ENS 解析器中设置) - 反向:
0x1234...→name.eth(通过此技能设置)
要求
必需:Bankr CLI
此技能需要使用 Bankr CLI 签署交易:
bun install -g @bankr/cli
bankr login
脚本使用 bankr agent 提交如下交易:
Submit this transaction: {"to": "0x...", "data": "0x...", "value": "0", "chainId": 8453}
必需:Node.js
脚本使用 Node.js 和 viem 计算 ENS namehash 并进行 ABI 编码。
npm install -g viem
快速入门
# Set primary name on Base
./scripts/set-primary.sh myname.eth
# Set on specific chain
./scripts/set-primary.sh myname.eth arbitrum
# Verify primary name is set
./scripts/verify-primary.sh 0x1234... base
# Set avatar (L1 only)
./scripts/set-avatar.sh myname.eth https://example.com/avatar.png
支持的链
| 链 | 反向注册器 |
|---|---|
| Base | 0x0000000000D8e504002cC26E3Ec46D81971C1664 |
| Arbitrum | 0x0000000000D8e504002cC26E3Ec46D81971C1664 |
| Optimism | 0x0000000000D8e504002cC26E3Ec46D81971C1664 |
| Ethereum | 0x283F227c4Bd38ecE252C4Ae7ECE650B0e913f1f9 |
先决条件
- 拥有或控制 ENS 名称——该名称必须已注册
- 已配置正向解析——该名称必须解析为你的地址
- 用于支付 Gas 的原生代币——目标链上的 ETH
工作原理
- 检查是否存在正向解析(名称 → 地址)
- 如果未设置特定链的地址,则发出警告
- 对
setName(string)调用数据进行编码 - 向反向注册器提交交易
- 验证主名称是否已正确设置
验证
设置后,该技能会自动进行验证。你也可以手动验证:
./scripts/verify-primary.sh 0xYourAddress base
输出:
✅ Reverse record: 0x1234... → myname.eth
✅ Forward resolution: myname.eth → 0x1234...
🎉 PRIMARY NAME VERIFIED: myname.eth
设置头像
# Set avatar (requires L1 transaction + ETH for gas)
./scripts/set-avatar.sh myname.eth https://example.com/avatar.png
支持的头像格式:
- HTTPS:
https://example.com/image.png - IPFS:
ipfs://QmHash - NFT:
eip155:1/erc721:0xbc4ca.../1234
注意: 头像是存储在 Ethereum 主网上的文本记录。脚本会自动查找你的 ENS 名称所用的解析器(适用于公共解析器和自定义解析器)。
故障排除
| 问题 | 解决方案 |
|---|---|
| "Transaction reverted" | 确保 ENS 名称解析为你的地址 |
| "Name not showing" | 该链的 cointype 可能未设置正向解析 |
| "Not authorized" | 你必须从该名称解析到的地址发起调用 |
| "Bankr CLI not found" | 使用 bun install -g @bankr/cli && bankr login 安装 |
| "Chain-specific address not set" | 通过 app.ens.domains 为目标链设置地址 |
| "Could not find resolver" | 确保 ENS 名称已存在且已设置解析器 |
链接
- ENS 文档:https://docs.ens.domains/web/reverse
- ENS 应用:https://app.ens.domains
- 主名称 UI:https://primary.ens.domains
- Bankr CLI:https://www.npmjs.com/package/@bankr/cli
评论
支持 Markdown