I. Revisiting the Cell model
During CKCON 2026 last month, I found myself returning to a question I had encountered repeatedly whilst developing CellScript: how much does the author of one protocol need to know about another before the two can work together?
@Hanssen has approached this through SSRI, @xxuejie and @janx through CoBuild, @OWK50GA through IDL. In CellScript, I introduced ProtocolBundle to coordinate the requirements of independently developed contracts. @doitian had been wrestling with various aspects of this problem long before many of us began building on CKB.
Shortly before the conference, @jm9k asked me whether a Myelin session could run an enhanced ’Cell Model v1.5‘, with transaction structures and rules beyond those currently supported by CKB L1.
I gave him a technical answer and went back to writing code. During the development of Myelin, however, I had already vaguely considered supporting alternative Cell-like UTXO models alongside CKB’s native model. His question gave me a reason to revisit the idea.
The community has spent seven years learning how to build protocols around the Cell model. But what might we do differently if we were designing the Cell model afresh for off-chain and Layer 2 systems?
I began looking through some of the older Nervos discussions and found several ideas worth dusting off.
In August 2019, before CKB mainnet went live, Doitian published his Cell Model Changes Preview in v0.19.0, exploring a transaction structure in which Scripts and data were stored in separate collections, with Cells referring to their contents through hashes. Although this representation never made it into the current Cell model, separating Script descriptions from Cell Outputs could reduce redundant encoding when multiple Cells share the same Script.
Figure 1. The 2019 design separated Script descriptions from Cell Outputs.
Two years later, Xuejie’s Extensible UDT explored a different aspect of the model. An asset could carry additional validation logic through a vector of extension scripts, allowing monetary conservation and supplementary policies to coexist within a single Type implementation.
Could a Cell directly reference several independently identified validation programmes, with each governing a different aspect of its state?
In 2022, Doitian’s assert proposal separated the conditions of a partial transaction from its signing mechanism. His subsequent And-Then pattern, drawing upon Xuejie’s earlier Chained Lock work, allowed several validation programmes to share a script slot. The OTX prototype developed by Doitian and Ethan in 2023 encountered some of the subtler security problems arising when independently constructed transactions intersect with existing Script Groups.
The 2024 article on ownerless contracts is particularly relevant to what I have in mind. Consider a protocol that wishes to enforce conditions on the creation of an asset whose Type slot is already occupied. Where should its validation logic reside? How can it work with an asset protocol whose author had no knowledge of its existence?
During the iCKB discussions in 2025, Jan proposed a common Meta Type capable of dispatching constituent scripts. Phroi went further, questioning the number of script slots altogether, exploring independent data regions and considering the storage implications of such a model.
Phroi also raised a similar question with me in April 2026, shortly after I introduced CellScript publicly. My answer at the time involved nothing more than companion Cells, receipts and explicit dependencies. I still consider these useful abstractions, particularly where separate state and independent lifecycles are desirable. Yet this left me wondering how much of this machinery we would need if the underlying Cell could express a richer set of relationships.
Figure 2. Selected historical explorations of script representation, validation, attachment and protocol composition.
Looking back through these discussions, I began to recognise two dimensions of composability.
One concerns how independent protocols discover one another, communicate their requirements and collaborate in constructing a transaction. Much of our work on CKB has been devoted to making this easier.
The other concerns the object itself. Can an asset become subject to several independently developed protocols, with each retaining its own identity, validation context and authority over its particular concerns?
We had all previously approached object-level composition through transaction construction. I wanted to explore what the Cell itself could express.
II. Beyond a single Type
I have always admired CKB’s distinction between Lock and Type: ownership and legitimate transformation are separate concerns.
I may own an object whose existence is governed by rules beyond my authority. A fungible asset belongs to me, but possession of its private key does not entitle me to increase its monetary supply.
Now suppose that I hold an asset subject to a vesting agreement and subsequently pledge it as collateral.
There are three protocols involved. The asset protocol governs issuance and conservation; the vesting protocol determines when certain rights become exercisable; the lending protocol governs the conditions under which the collateral may be released.
All three describe legitimate concerns about the same asset, and ideally their authors should be able to develop them independently.
On CKB today, we have several ways of constructing such an arrangement. We could introduce companion Cells, use a specialised Lock, devise a wrapper or seek cooperation from the asset’s existing Type implementation.
The appropriate choice depends on the application. Nevertheless, the author of a new protocol must often accommodate architectural decisions made by the author of an earlier one.
Suppose an asset could retain its original monetary rules whilst acquiring additional, independently identified constraints throughout its lifetime. Each constraint would be explicitly represented in the ledger.
I am tentatively calling this proposed model Polytype.
Figure 3. Independent constraints attached to a common Cell. Companion Cells remain useful wherever separate state or independent concurrency is required.
A Polytype Cell retains one Lock and an atomic unit of state, together with a collection of independently identified Types. Each attached Type contributes its own conditions for the legitimacy of a transaction.
For three Types, A, B and C, the admissible transactions satisfy:
The admissible transaction space is the intersection of the attached validators’ conditions.
Of course, the intersection may be empty. Three perfectly respectable protocols, each behaving exactly as intended, could collectively produce an asset that nobody can ever spend. We would have invented a very sophisticated brick.
III. Polytype
A Cell and its relationships
Returning to Doitian’s 2019 proposal, we might find some practical advantages in separating Script descriptions from the Cells that reference them.
A transaction containing many Cells governed by the same protocol has little reason to encode its complete Script description repeatedly. A transaction-level Script Dictionary could provide a compact representation, whilst the persistent ledger retains independently verifiable Script identities.
*Figure 4. A possible Polytype encoding inspired by the 2019 Script collection. *
The choice between hashes, indices and other forms of reference is largely a matter of representation. We could explore any of these without altering the fundamental validation semantics of Polytype.
What matters semantically is that the relationship between Cells and Types becomes many-to-many. Each Cell can participate in several protocols, and each protocol can govern arbitrarily many Cells.
Overlapping Type Groups
One of the virtues of CKB’s Type Script Groups is that they allow a programme to reason about several related Cells at once.
An asset validator, for instance, can examine a collection of consumed token Cells and compare their combined balance with that of the newly created Cells. The rules of monetary conservation are expressed over the group as a whole.
Under Polytype, a Cell may belong to several Type Groups simultaneously.
Consider two token Cells governed by the same monetary validator, A. One carries an additional vesting constraint, B, whilst the other carries a lending constraint, C.
Both belong to the conservation group of A. Their respective obligations are examined independently by B and C.
Figure 5. One proposed transaction induces three overlapping Type Groups. Monetary conservation is evaluated across all three Cells; the additional validators evaluate their respective groups. Acceptance depends upon the actual rules of B and C.
This is perhaps the most interesting property of the proposed model. An asset could acquire an additional policy without thereby acquiring a different monetary identity or becoming separated from its original conservation domain.
Validator A sees the Cells relevant to its monetary rules. B sees those participating in the vesting arrangement. C sees those participating in the lending agreement.
The runtime derives these groups from the complete Script identities and authenticated contents of the consumed and newly created Cells.
Doitian’s OTX research becomes especially relevant here. A validator’s understanding of which Cells belong to its group is part of its security model. Group membership must be derived independently of the transaction builder’s intentions.
The evolution of constraints
An interesting consequence of Polytype is that the relationships between a Cell and its governing protocols can themselves evolve.
An asset may acquire a collateral constraint when pledged against a loan and discharge it upon repayment. An immutable-content validator might forbid its own removal, whilst a governance validator might permit its replacement under certain conditions.
Figure 6. The attachment and removal of a constraint are themselves validated state transitions. The asset retains its original logical Type identity throughout.
Subject to its existing validation rules and compatible interfaces, an asset issued today could acquire obligations under a protocol developed years later, without its original developer having anticipated that particular arrangement.
I call this open-world composability.
IV. Metatype: an experiment on CKB
How much of the proposed semantics could we already express on CKB?
Building on Jan’s earlier Meta Type proposal, I am experimenting with a common dispatcher occupying CKB’s existing Type Script slot. A Metatype Cell commits to a collection of logical Types, whose validation is enforced by the dispatcher within CKB’s existing consensus rules.
Suppose two CKB Cells use Metatype, one carrying logical Types A and B, the other carrying A and C. Depending on their physical Script representation, they may belong to different CKB Type Script Groups.
Yet A must be able to reason about both Cells together.
Figure 7. Metatype reconstructs logical Type Groups across differently composed physical CKB Cells. M₁ and M₂ denote distinct physical Script identities in this example.
Simply spawning the constituent validators would leave this problem unresolved. A validator invoked through spawn does not automatically acquire a new understanding of its Script identity or the boundaries of its logical group.
Metatype must reconstruct the relevant groups across the transaction, deriving their membership from authenticated manifests and verifying that each participating Cell is subject to the appropriate enforcement mechanism. Each validator must then be provided with an execution context consistent with its logical Type identity and group membership.
The research objective can be expressed rather simply:
(Here, E translates a supported logical transaction into its physical CKB representation.)
Within the supported domain, the two environments ought to agree on the validity of the same proposed transition. Establishing this equivalence also requires Metatype to reject malformed representations and attempts to conceal or discard existing validation obligations.
Polytype and Metatype as two implementations of a common logical validation model. Establishing semantic equivalence between the two would itself be a worthwhile research objective.
There is a pleasant research opportunity here for a DSL such as CellScript as well. Contracts compiled against a sufficiently precise logical validation interface could potentially target both environments.
I am particularly keen to explore Metatype independently on CKB. Even if the native Polytype experiment never leaves the laboratory, there may be useful things we can learn and put into production on L1.
V. An open world of Cells
This brings me back to @jm9k’s question about Myelin.
A Myelin session or an altenative cell-based L2 system might offer a different environment to investigate some of the same validation semantics, albeit with different assumptions about state progression and settlement.
Figure 9. Native Polytype execution and Metatype enforcement on CKB. State authentication, settlement and exclusive spending authority require their own cross-layer mechanisms.
An asset might undergo thousands of state transitions in another execution environment before returning to CKB. I would like its logical Type identities and outstanding obligations to survive the journey, even as its physical representation changes.
This is one of the reasons I am keen to give Metatype and Polytype independent utility. Experimental execution environments could serve as somewhere to investigate more ambitious architectural ideas, the useful ones could find their way back into CKB through mechanisms available to us today.
I suspect some of our existing abstractions will survive this exercise remarkably well. Others may become simpler. A few may turn out to have been elaborate solutions to problems peculiar to the original arrangement of script slots.
Finding out which is which should be rather good fun.