[CN/EN] 你可听见 CCC 呼唤?:来吧,我们要建造一座塔 | Do You Hear the CCC?: Come, Let Us Build a Tower

English Version


你可听见 CCC 呼唤?:来吧,我们要建造一座塔

月亮好,太阳好,我是 CCC 的开发者。你可能知道我是谁,但请我们假装不知道。

2024 年,Nervos 的工具链像腐朽的毛坯房,危害每个开发者的身心健康,鞭笞出了 CCC。CCC,我称之为 CCC is CKBer’s Codebase (告诉我自指梗还没过时不然我会哭),根植于最常用的浏览器生态。它旨在提供一站式的解决方案,让开发者可以在搭建好的脚手架上修建自己的应用,从一遍又一遍从底层概念开始构建应用的阿鼻地狱中解脱出来。

简单来讲,CCC 让开发者脑中的想法更快更可能变成现实;详细来讲,从前端点下连接钱包开始,经过用户选择钱包、处理各种协议、组装 CKB 交易(这超麻烦)、请求用户签名,最终将交易发到链上的整个流程,CCC 都提供了完整又不失灵活,自由又不失简洁的协助。


我希望你读到这里能对 CCC 开始感兴趣,因为我接下来要突然开始贴更新日志,你得靠着兴趣撑过这些没人乐意读的东西。

CCC 2.0.0:来吧,我们要建造一座塔

1.0.0 版本的发布是个无聊的时刻,那时我们甚至没想过给它起个名字,像监狱或中国学校称呼囚犯一样用序号代指它。一年过去,我们终于迎来了 2.0.0 – 还没有发布。三个月前我就发布了 v1-final 分支,但总是有差一点点就能做完的东西,等着赶上这时候,逼得我不得不诉诸「弄假直到成真」。先把更新日志写出来,我总不能拖到明年再发布吧,对吧?

更新主要版本号是一种耻辱,标记着写代码的家伙一开始没把东西想好,不得不昭告天下「我改主意啦!你们都更新一下」。虽然如此,我还是希望隐含的「某些东西变得比以前好」的意象能把我们带到一个新的开始。

2.0.0,CCC 看起来像是正经项目了。这篇日志会介绍 1.0.0 到 2.0.0 之间我觉得有趣的东西,可能已经上线一年了,也可能还在开发中。我们为常见的用法都提供了支持,也根据社区的反馈进行了迭代。CCC 不再只是个新奇的试验品,还逐渐成为了可靠的地基,或许我们已经到了要建造一座通天塔的时候。

Nostr

Nostr 不是 CCC 支持的第一个签名方式,也不会是 CCC 支持的最后一个签名方式。但我想特别表达对它的喜爱,因为我们可以感恩戴德地白嫖使用 Nostr 社区的公共中继服务器存储并分享数据。

基于这个特性(特性),我在 CCC Playground,一个浏览器里的代码运行环境中,添加了「分享」按钮。在你点下它之后,网页自动生成了一个私钥,为你的代码签名并发送到了 Nostr 上,允许你通过链接将它分享给我们的好朋友们。

CCC Playground 超进化

在今年 Playground 的更新里,我最喜欢的是为 CKB 「细胞」的概念重新做的图形化设计。我用八卦的形式展示出了「细胞」,用卦象的组合(它是二进制!)代表细胞上不同的「锁」和「类型」脚本。我还为它加了点动画,虽然不务正业,但也许能让人们觉得自己在做很酷的事情。如果你感兴趣,可以试试看这个例子

之所以我们能做到在终端里展示图像,是因为 Playground 的另外一个新功能:直接使用 React 的 TSX 语法写代码。这意味着开发者可以展示任意的前端元素,甚至编写一个带用户界面的简单工具分享给其它人使用,而不需要担心框架、依赖或部署等麻烦的问题。

更好的 Nervos DAO 适配

终于,开发者们有了个工具来操作 Nervos DAO,通过锁定 CKB 原生代币的数据存储能力,从而抵抗通货膨胀,这个 Nervos 生态设计最根本的一部分(尽管 Nervos 官网上现在也还没有它的介绍,谁愿意为它写篇文章?)。

感谢 @phroi 为这一系列改进提供了许多宝贵的反馈,他开发的 iCKB,允许 Nervos DAO 代币化并流通的协议,提供了不少真实的使用场景。

UDT

用户定义代币(UDT)系列协议,从最早出现并沿用至今的 sUDT 核心,到基本没人用过的 xUDT 扩展,支撑着所有在 CKB 上发行的二级货币。它的核心思路是用细胞中的数据来代表面额,并不复杂,但想将这套逻辑融入到应用里却颇具挑战。

CCC 为操作 UDT 提供了类似操作原生 CKB 代币的接口,避免额外的学习成本。这一系列的改进建议同样来自 @phroi ,源自他在为 iCKB 编写 UDT 相关代码总结的方案。另外也感谢来自 @rink1969 的建议,优化了 UDT 找零时的 CKB 占用。

类 Type ID 协议

Type ID 借助了 CKB 细胞只能被消费一次的特性,被用于赋予细胞链上独一无二的编号,以追踪细胞单例的更新和销毁。它从一开始被设计用于追踪可升级合约的最新状态,逐渐地被更广泛应用到了其它的协议中。

CCC 新的 Type ID 包除了提供对最简单的任意数据 Type ID 支持外,还提供了高级方法方便扩展对类 Type ID 的协议支持,随着 Type ID 包添加的 DID CKB 支持就是个很好的例子。

多签锁

又是一个对 CKB 早期功能的支持。虽然多签锁只支持 Secp256k1 算法,但它依然被频繁用于合约或资金管理等场景。在之前,开发者大部分时间都是使用 ckb-cli 命令行工具来处理多签交易,我希望在 CCC 添加了支持之后事情能变好些。

CCC 的支持囊括了按顺序签名和合并多笔签名后的交易两种模式。

FeePayer 抽象层

感谢 UTXO 模型的特性,一笔交易中的所有参与方都可以支付手续费,这使得计算手续费异常地困难。过去的 SDK 对此会假设有一个特定的原生地址会添加更多的代币负责支付手续费,但这并不能满足类似 Spore 协议的零手续费或 UDT 闪兑(有多少人知道这个有趣的东西?)想要引入的功能。

FeePayer 希望能将手续费支付抽象成一个单独的步骤,为更多的手续费支付方式提供统一的接口。在开发者们用上这些有趣的特性后,用户可以不再需要持有额外 CKB 才能发起交易,而是通过资产中预存的费用,或就地小额兑换来支付手续费。

还有更多?

老实讲,我不知道 CCC 未来会变成什么样子。我们有一些正在推进的事情,比如对 RGB++ 的支持,对 Fiber Network 的支持或将来源于 Script 的富信息(SSRI) 落地,但它们不会是 CCC 的全部。我希望 CCC 在不同的场景下都能帮助开发者解决不同的问题,而这需要弄明白开发者需要什么,需要来自社区的更多反馈。

欢迎有兴趣的人到 CCC Issues 留下你的想法,也可以看看有哪些问题是你愿意解决的。如果你喜欢 CCC,可以点 Star 来鼓励我们。




我换了个账号,希望能让你开始注意「身份」在这个社区中代表的意义,希望能提醒你思考这些被包装成具有参考价值的,却实际上没什么参考价值的东西到底有多危险。我,从我自己的角度去看,和任何的组织无关,对这种诉诸权威的做法感到失望,对人造的声望感到恶心。

让我说清楚:我纠结了很久要不要因为这种程序不义投反对票,即使我不反对提案本身。我相信这些人都有很好的理由来解释他们为什么这么做,而且(带有大量漏洞的)规则也并不禁止这种行为。我们也许应该对什么是道德的有一定共识,而不是一方用比另一方更没有底线的手法奔向逐底的深渊。

我鼓励所有对投票还有兴趣的人都想想自己的答案是什么。

11 Likes

中文版


Do You Hear the CCC?: Come, Let Us Build a Tower

Good moon, good sun. I am the developer of CCC. You might know who I am, but let’s pretend we don’t.

In 2024, toolchains in Nervos were like a rotting, unfinished house, hazardous to the physical and mental health of every developer, which eventually whipped CCC into existence. CCC, which I call CCC is CKBer’s Codebase (tell me self-referential jokes aren’t outdated yet, or I’ll cry), is rooted in the most commonly used browser ecosystem. It aims to provide a one-stop solution, allowing developers to build their applications on established scaffolding, freeing them from the Avici of building applications from bottom-level concepts over and over again.

Simply put, CCC makes the ideas in a developer’s head become reality faster and with higher probability; in detail, from the moment of clicking the frontend to connect a wallet, through the user selecting a wallet, handling various protocols, assembling CKB transactions (this is super troublesome), requesting user signatures, and finally sending the transaction to the chain. CCC provides complete yet flexible, free yet concise assistance throughout the entire process.


I hope reading this sparks your interest in CCC, because I’m about to suddenly start pasting the changelog. You’ll need that interest to survive these things no one likes to read.

CCC 2.0.0: Come, Let Us Build a Tower

The release of 1.0.0 was a boring moment. Back then, we didn’t even think to name it, referring to it by a serial number like prisons or Chinese schools refer to inmates. A year has passed, and we finally welcome 2.0.0 – which hasn’t been released yet. Three months ago, I published the v1-final branch, but there was always something that was just about to be finished waiting to make the cut for this moment, forcing me to resort to “fake it till you make it.” I’ll write the changelog first. I can’t drag this out until next year to release it, right?

Updating a major version number is a badge of shame, marking that the guy writing the code didn’t think things through at the start and has to proclaim to the world, “I changed my mind! Everyone update”. Despite this, I still hope the implied imagery of “something became better than before” can take us to a new beginning.

With 2.0.0, CCC looks like a serious project. This log will introduce the things I found interesting between 1.0.0 and 2.0.0: some may have been live for a year, others might still be in development. We have provided support for common usage scenarios and iterated based on community feedback. CCC is no longer just a novel experiment; it has gradually become a reliable foundation. Perhaps we have reached the time to build a Tower of Babel.

Nostr

Nostr is not the first signing method CCC supported, nor will it be the last. But I want to express my special fondness for it because we can gratefully freeload use the Nostr community’s public relay servers to store and share data.

Based on this feature (feature), I added a “Share” button to the CCC Playground, a code execution environment within the browser. After you click it, the webpage automatically generates a private key, signs your code, and sends it to Nostr, allowing you to share it with our good friends via a link.

CCC Playground Super Evolution

In this year’s Playground update, my favorite part is the graphical redesign for the concept of the CKB “Cell”. I used the form of Bagua to display cells, using combinations of trigrams (it’s binary!) to represent the different “Lock” and “Type” scripts on the cell. I also added some animation to it; although it’s frivolous, maybe it makes people feel like they are doing something cool. If you are interested, you can try this example.

The reason we can display images in the terminal is due to another new feature of the Playground: writing code directly using React’s TSX syntax. This means developers can display arbitrary frontend elements, or even write a simple tool with a user interface to share with others, without worrying about troublesome issues like frameworks, dependencies, or deployment.

Better Nervos DAO Adaptation

Finally, developers have a tool to operate the Nervos DAO. By locking the data storage capacity of CKB native tokens, one can resist inflation, a fundamental part of the Nervos ecosystem design (although the Nervos official website still doesn’t introduce it. Who wants to write an article for it?).

Thanks to @phroi for providing a lot of valuable feedback for this series of improvements. The iCKB he developed, a protocol that allows Nervos DAO to be tokenized and circulated, provided many real-world usage scenarios.

UDT

The User Defined Token (UDT) series of protocols, from the sUDT core that appeared earliest and is still in use today, to the xUDT extension that almost no one has used, supports all secondary currencies issued on CKB. Its core idea is to use data in cells to represent denomination. It isn’t complex, but integrating this logic into applications is quite challenging.

CCC provides an interface for operating UDTs similar to operating native CKB tokens, avoiding extra learning costs. This series of improvement suggestions also came from @phroi , stemming from the solutions he summarized while writing UDT-related code for iCKB. Additionally, thanks to suggestions from @rink1969 , we optimized CKB occupancy when calculating UDT change.

Type ID-like Protocols


Type ID leverages the characteristic that CKB cells can only be consumed once. It is used to assign a unique on-chain ID to a cell to track the updates and destruction of a cell singleton. Designed from the beginning to track the latest state of upgradable contracts, it has gradually been applied more broadly to other protocols.

CCC’s new Type ID package, in addition to supporting the simplest arbitrary data Type ID, provides advanced methods to facilitate extending support for Type ID-like protocols. The DID CKB support added alongside the Type ID package is a great example.

Multisig Lock

Another support for an early CKB feature. Although the multisig lock only supports the Secp256k1 algorithm, it is still frequently used in scenarios like contracts or fund management. Previously, developers mostly used the command-line tool ckb-cli to handle multisig transactions. I hope things will get better after adding support in CCC.

CCC’s support includes two modes: sequential signing and merging transactions after multiple signatures.

FeePayer Abstraction Layer

Thanks to the characteristics of the UTXO model, all parties in a transaction can pay the transaction fee. This makes calculating fees exceptionally difficult. Past SDKs would assume there is a specific native address that adds more tokens to be responsible for paying fees, but this cannot satisfy features like the zero-fee feature in the Spore protocol or the UDT instant convert (how many people know about this interesting thing?) that we want to introduce.

FeePayer hopes to abstract fee payment into a separate step, providing a unified interface for more fee payment methods. Once developers utilize these interesting features, users may no longer need to hold extra CKB to initiate transactions, but instead pay fees through pre-deposited assets or on-the-spot micro-exchanges.

Anything More?

Honestly, I don’t know what CCC will look like in the future. We have some things in progress, like the support for RGB++, support for the Fiber Network, or the implementation of the Script-Sourced Rich Information (SSRI), but they won’t be all that CCC is. I hope CCC can help developers solve different problems in different scenarios, and this requires understanding what developers need, which requires more feedback from the community.

Anyone interested is welcome to leave your thoughts on CCC Issues, or see if there are any problems you’d be willing to solve. If you like CCC, star the repo to encourage us.




I changed accounts, hoping to make you start paying attention to the meaning represented by “identity” in this community, hoping to remind you to think about how dangerous these things are that are packaged as having reference value but actually possess none. I, from my own perspective, unrelated to any organization, am disappointed by this appeal to authority and disgusted by artificial reputation.

Let me be clear: I struggled for a long time whether to vote against that because of the procedural injustice, even though I don’t object to the proposal itself. I believe these people all have good reasons to explain why they are doing this, and the rules (containing massive loopholes) do not prohibit this behavior. Perhaps we should have some consensus on what is ethical, rather than one side using methods with even less integrity than the other to rush towards the abyss of a race to the bottom.

I encourage everyone who is still interested in voting to think about what their own answer is.

12 Likes

Great work on this update !

CCC 2.0 really feels like a turning point for the developer experience on CKB.
Reducing friction without hiding the underlying model is not easy, and this strikes a very good balance between power and usability.
The Playground improvements, the UDT and DAO tooling, and the FeePayer abstraction all go in the right direction for real world adoption.
This kind of foundational work is exactly what helps an ecosystem grow in a sustainable way.

Bravo to everyone involved, keep going in this direction.

6 Likes

21 posts were split to a new topic: Some questions about the recent proposal vote

I can’t really stress enough that CCC grows with Community Feedback (and a lot of work from CCC BDFL, who has long-term vision and strong will-power :clap::clap::clap:)

It would be really beneficial if more people from the Community participated in the improvement of CCC, small things like these can make a big difference:

  1. Point out the issues they encounter in CCC
  2. Take a look at how on-going PRs impact their workflow
  3. Propose ideas but especially create PRs to realize them
  4. Work with CCC BDFL to bring these PRs to fruition

Let’s make CCC better together,
Phroi

4 Likes

另外,ccc的logo设计挺“个性”的,哈哈,祝好~

3 Likes