English
1. Project overview
- Name: DAO Cycle Alerts
- One line: A read-only Telegram bot and CLI that tell Nervos DAO depositors when each deposit’s 180-epoch cycle is about to end, so they start a withdrawal in time and do not lose another 30 days.
- Type: user tool (Telegram bot) plus developer tool (npm package and CLI).
2. Team profile
- Yuki Kawata: sole developer and maintainer.
- Past work: TheYukiKawata (Yuki Kawata) · GitHub (ton-checkout, arc-tabs, arc-till: payment tools on TON and Arc, deployed on Cloudflare Workers).
- Contact: [email protected] (email only).
3. Project background
A Nervos DAO deposit unlocks only at the end of a 180-epoch cycle, about 30 days (RFC 23). You can start a withdrawal (phase 1) at any time, but the CKB stays locked until the current cycle ends. The deposit also stops earning compensation from that moment.
So the best time to start phase 1 is a few hours before the cycle ends. If you miss it by a day, the deposit rolls into a new cycle and you wait about 30 more days.
Today you find out where your deposit sits in its cycle only by opening Neuron or another wallet and checking. Nothing tells you ahead of time. There are 16,696 depositors holding 8.12 billion CKB in the DAO (CKB Explorer, 2026-09-26). Many of them hold long term and do not open a wallet every week.
Scenario: Li deposited 50,000 CKB in March and wants the CKB back for a purchase in October. She opens Neuron on October 3, starts the withdrawal, and learns that the cycle ended on October 1. The CKB unlocks on October 31.
4. Solution
- In Telegram, the user sends
/watch <ckb address>. The bot lists each DAO deposit with its cycle end time. - The bot sends a message 3 days and 12 hours before each cycle end: “Deposit of 50,000 CKB (tx 0xab..): cycle ends in about 12 hours (epoch 9123, around 2026-10-01 14:00 UTC). Start the withdrawal in your wallet before then to unlock at that time.”
- For deposits already in phase 1, the bot sends a message when phase 2 becomes possible: “Your withdrawing deposit can be unlocked now.”
/listshows every watched deposit./forgetdeletes the address and chat data.- The bot never asks for keys, signatures or wallet connections. It reads public chain data only.
- Differences from existing tools: wallets show a countdown only while you have them open. This tool sends the reminder to you, and it works for any address, including cold wallets and multisig.
5. Technical approach
- Language: TypeScript. Runtime: Cloudflare Workers with a cron trigger every 30 minutes. Storage: Cloudflare D1 (chat id, address, sent reminders).
- Chain data: CKB public RPC and indexer (
get_cellsfiltered by the Nervos DAO type script and the user’s lock script,get_headerfor deposit epochs,get_tip_headerfor the current epoch). - Core library
dao-cycle(built, see section 9), on top of CCC:- find the address’s Nervos DAO cells and classify them as deposited (data is 8 zero bytes) or withdrawing (data is the deposit block number);
- compute the unlock epoch with the DAO script’s own rule (
c/dao.c): count the epochs from deposit to withdrawal, round up to a multiple of 180 (at least 180), add that to the deposit epoch. For a deposited cell the withdrawal epoch is the current tip, so the result is the end of the current cycle; - estimate wall-clock time from the average epoch length over the last 300,000 blocks (about 180 epochs).
- CLI:
dao-cycle check <address>prints the same table the bot uses. - Hardest part: accurate time estimates, since epoch length changes. The bot states times as “around” and re-checks every 30 minutes, so the 12-hour reminder uses fresh data.
- Language: English, with Chinese message templates.
- AI use: code, tests and docs are written with an AI coding agent (Claude).
- Testing: the unlock epoch math is covered by tests, including RFC 23’s example transaction, and was checked against CCC’s
calcDaoClaimEpochon 150 mainnet withdrawing cells.
6. To-do list
- Week 1: Telegram bot on Cloudflare Workers.
/watch,/list,/forget, D1 storage, cron job. Milestone: bot answers/watchon mainnet. - Week 2: Reminders. 3-day and 12-hour messages, “ready to unlock” message, reminder de-duplication, Chinese and English messages,
simulatecommand. Milestone: reminders live,dao-cyclepublished to npm. - Week 3: Seed users. Announce on Nervos Talk and CKB community channels. Target: 20 watched addresses. Collect feedback and fix issues.
- Week 4: Completion report: usage numbers, reminders sent, feedback, fund usage.
7. Required funding and breakdown
- Total: $1,000, paid in CKB.
- Technical work (weeks 1 and 2): $700. Bot, reminders,
simulatecommand, npm release, tests, deployment. - User testing (weeks 3 and 4): $200. Onboarding seed users, fixes from feedback, completion report.
- Hosting: $100. Runs on the Cloudflare Workers free tier. This covers a paid tier or a dedicated RPC endpoint if load or rate limits require it, for 12 months after completion.
8. Deliverables and how to verify
Deliverables:
- Public GitHub repository (MIT) with the library, CLI and bot.
- npm package
dao-cyclewith the CLI. - Live Telegram bot on mainnet.
- Completion report on Nervos Talk.
How to verify (no code review needed):
- Unlock math:
bun install && bun test. Expected: all tests pass, including the RFC 23 case (deposit at epoch 2+648/1677, withdrawing cell at 47+382/1605, unlock at 182+648/1677). - CLI against real data:
bunx dao-cycle check <any address with a DAO deposit>. Expected: one row per deposit with the next cycle end epoch. Compare it with the same address in Neuron or CKB Explorer. - Bot: send
/watch <address>to the bot. Expected: the same table within a minute. - Reminder timing without waiting 30 days:
bunx dao-cycle simulate <address> --at-epoch <epoch>prints the reminders the bot would send at that epoch. - Privacy:
/forget, then/list. Expected: “No addresses watched.”
Environment: Bun 1.x on any OS, internet access, a Telegram account. About 10 minutes in total.
9. Current state and funded work
- Current state: the core library and CLI work on mainnet: GitHub - TheYukiKawata/dao-cycle: Find when each Nervos DAO deposit on a CKB address reaches the end of its 180-epoch cycle · GitHub (MIT). Run
bun install && bun src/cli.ts check <address>to see each DAO cell on an address with its unlock epoch, estimated time and time left. Tests pass in CI, including the RFC 23 example. The unlock math gave the same result as CCC’scalcDaoClaimEpochon the 150 newest withdrawing cells on mainnet. - Funded work: the Telegram bot, reminders,
simulatecommand, npm release, seed users and the completion report (sections 6 and 8).
10. CKB alignment
The tool depends on CKB features: the Nervos DAO type script, cell data as the deposit/withdrawing marker, and absolute-epoch since rules. It serves CKB holders directly and keeps DAO deposits from being locked longer than needed. Future work, if the committee wants it after DAO v1.1 settles: reminders for Community Fund DAO votes, since DAO deposits are the voting weight.
中文
1. 项目概述
- 名称:DAO Cycle Alerts
- 一句话:一个只读的 Telegram 机器人和命令行工具,在每笔 Nervos DAO 存款的 180 个 epoch 周期即将结束时提醒存款人,让他们及时发起取款,避免再等 30 天。
- 类型:用户工具(Telegram 机器人)+ 开发者工具(npm 包和 CLI)。
2. 团队简介
- Yuki Kawata:唯一开发者和维护者。
- 过往项目:github.com/TheYukiKawata(ton-checkout、arc-tabs、arc-till:基于 TON 和 Arc 的支付工具,部署在 Cloudflare Workers 上)。
- 联系方式:[email protected](仅限邮件)。
3. 项目背景
Nervos DAO 存款只能在 180 个 epoch(约 30 天)周期结束时解锁(RFC 23)。你可以随时发起取款第一步,但 CKB 会一直锁定到当前周期结束,而且从那一刻起不再获得补偿。
因此,最佳做法是在周期结束前几个小时发起第一步。如果晚了一天,存款会进入新周期,需要再等约 30 天。
目前,想知道存款处于周期的哪个位置,只能打开 Neuron 或其他钱包查看,没有任何工具会提前通知你。Nervos DAO 目前有 16,696 位存款人,存款总额 81.2 亿 CKB(CKB Explorer,2026-09-26)。其中很多人长期持有,并不会每周打开钱包。
场景:Li 在 3 月存入 50,000 CKB,想在 10 月取回用于一笔支出。她在 10 月 3 日打开 Neuron 发起取款,才发现周期已在 10 月 1 日结束,CKB 要到 10 月 31 日才能解锁。
4. 解决方案
- 用户在 Telegram 发送
/watch <CKB 地址>,机器人列出每笔 DAO 存款及其周期结束时间。 - 在每个周期结束前 3 天和 12 小时,机器人发送提醒:“50,000 CKB 存款(交易 0xab..):周期约 12 小时后结束(epoch 9123,约 2026-10-01 14:00 UTC)。请在此之前在钱包中发起取款,届时即可解锁。”
- 对已处于第一步的存款,当可以执行第二步时,机器人发送:“你的取款中存款现在可以解锁了。”
/list显示所有监控中的存款;/forget删除地址和聊天数据。- 机器人从不索取私钥、签名或钱包连接,只读取公开链上数据。
- 与现有工具的区别:钱包只有在打开时才显示倒计时;本工具主动推送提醒,并适用于任何地址,包括冷钱包和多签地址。
5. 技术方案
- 语言:TypeScript。运行环境:Cloudflare Workers,每 30 分钟执行一次定时任务。存储:Cloudflare D1(聊天 ID、地址、已发送的提醒)。
- 链上数据:CKB 公共 RPC 和索引器(按 Nervos DAO type script 和用户 lock script 调用
get_cells,用get_header获取存款 epoch,用get_tip_header获取当前 epoch)。 - 核心库
dao-cycle(已完成,见第 9 节),基于 CCC:- 查找地址上的 Nervos DAO cell,并区分存款 cell(data 为 8 个零字节)和取款中 cell(data 为存款区块高度);
- 按 DAO 脚本自身的规则(
c/dao.c)计算解锁 epoch:统计从存款到取款经过的 epoch 数,向上取整到 180 的倍数(至少 180),再加到存款 epoch 上。对存款 cell,取款 epoch 取当前 tip,因此结果就是当前周期的结束点; - 根据最近 300,000 个区块(约 180 个 epoch)的平均 epoch 时长估算实际时间。
- CLI:
dao-cycle check <地址>输出与机器人相同的表格。 - 难点:epoch 时长会变化,时间估算需要准确。机器人以“约”表述时间,并每 30 分钟重新计算,确保 12 小时提醒使用最新数据。
- 语言:英文,附中文消息模板。
- AI 使用:代码、测试和文档借助 AI 编程代理(Claude)编写。
- 测试:解锁 epoch 计算有测试覆盖(包括 RFC 23 的示例交易),并已在 150 个主网取款中 cell 上与 CCC 的
calcDaoClaimEpoch对照。
6. 执行计划
- 第 1 周:部署在 Cloudflare Workers 上的 Telegram 机器人。
/watch、/list、/forget、D1 存储、定时任务。里程碑:机器人在主网上响应/watch。 - 第 2 周:提醒功能。3 天和 12 小时提醒、“可以解锁”提醒、提醒去重、中英文消息、
simulate命令。里程碑:提醒上线,dao-cycle发布到 npm。 - 第 3 周:种子用户。在 Nervos Talk 和 CKB 社区频道发布。目标:20 个监控地址。收集反馈并修复问题。
- 第 4 周:结项报告:使用数据、已发送提醒数、用户反馈、资金使用情况。
7. 所需资金与明细
- 总额:1,000 美元,以 CKB 支付。
- 技术开发(第 1、2 周):700 美元。机器人、提醒、
simulate命令、npm 发布、测试、部署。 - 用户测试(第 3、4 周):200 美元。种子用户引导、根据反馈修复、结项报告。
- 托管:100 美元。项目运行在 Cloudflare Workers 免费套餐上;若负载或速率限制需要,用于结项后 12 个月内的付费套餐或专用 RPC。
8. 交付物与验证方式
交付物:
- 公开 GitHub 仓库(MIT 协议),包含库、CLI 和机器人。
- npm 包
dao-cycle(含 CLI)。 - 主网上线的 Telegram 机器人。
- Nervos Talk 上的结项报告。
验证方式(无需审查代码):
- 解锁计算:
bun install && bun test。预期:全部测试通过,包括 RFC 23 用例(存款于 epoch 2+648/1677,取款中 cell 于 47+382/1605,解锁于 182+648/1677)。 - 真实数据:
bunx dao-cycle check <任意有 DAO 存款的地址>。预期:每笔存款一行,显示下一个周期结束 epoch。可在 Neuron 或 CKB Explorer 中对照同一地址。 - 机器人:向机器人发送
/watch <地址>。预期:一分钟内返回相同表格。 - 无需等待 30 天验证提醒时机:
bunx dao-cycle simulate <地址> --at-epoch <epoch>输出机器人在该 epoch 会发送的提醒。 - 隐私:发送
/forget后再发送/list。预期:“没有监控中的地址。”
环境:任意系统上的 Bun 1.x、网络连接、一个 Telegram 账号。总计约 10 分钟。
9. 当前状态与资助范围
- 当前状态:核心库和 CLI 已可在主网上使用:https://github.com/TheYukiKawata/dao-cycle(MIT 协议)。运行
bun install && bun src/cli.ts check <地址>,即可查看该地址上每个 DAO cell 的解锁 epoch、预计时间和剩余时间。CI 中测试全部通过,包括 RFC 23 示例。解锁计算在主网最新的 150 个取款中 cell 上与 CCC 的calcDaoClaimEpoch结果一致。 - 资助范围:Telegram 机器人、提醒功能、
simulate命令、npm 发布、种子用户和结项报告(第 6、8 节)。
10. CKB 契合度
本工具依赖 CKB 的特性:Nervos DAO type script、以 cell data 区分存款与取款中状态、以及绝对 epoch 的 since 规则。它直接服务 CKB 持有者,避免 DAO 存款被多锁一个周期。后续方向(如委员会在 DAO v1.1 稳定后有需要):为社区基金 DAO 投票发送提醒,因为 DAO 存款就是投票权重。