Hi Arthur and everyone,
I have been working on a real local-devnet transaction path for the CellScript amm_pool.cell example, and I’ve hit a fundamental bootstrapping issue. I want to share what I’ve built so far, document the exact constraint, and ask for guidance before building on the wrong assumption.
What I have built so far
I created a Rust-based swap builder that encodes token data, pool data, swap math, and WitnessArgs for the CellScript AMM. It does not yet produce a fully accepted transaction on CKB, but it correctly handles the encoding and transaction shape. The code is open source:
In addition, I have:
-
Compiled and deployed
amm_pool.elf,token.elf, and analways_success.elfon a local devnet (viaoffckb). -
Built CCC scripts for deployment, funding, signing, and test-cell creation.
-
Confirmed the signing flow with
prepareTransaction()and the cellDep wrapper shape. -
Successfully created devnet test cells with secp256k1 locks.
-
Used
always_success.elfas a stand-in type script to test the swap path without real token validation.
The blocker: token.cell bootstrap
The intended flow is:
text
deploy contracts → create real token cells → seed_pool → swap_a_for_b
The first action for token.cell is mint:
text
mint(auth_before: MintAuthority, to: Address, amount: u64) -> (auth_after: MintAuthority, token: Token)
This requires an existing MintAuthority input. But I cannot find where the very first MintAuthority cell is supposed to be created. Without that, I cannot honestly create real token.elf token cells, which blocks seed_pool and swap_a_for_b.
I have considered the following possibilities but do not want to assume:
-
There is a launch/setup contract (like
launch.cell) involved. -
The deploy transaction itself creates the first authority cell.
-
The
createcapability onMintAuthorityhas a bootstrap meaning I’m missing.
Related builder friction points
-
Creation vs mutation dispatch
When I tested a variant withswap_a_for_bfirst, it failed on creation. That makes sense if creation tries to execute the first action (swap) without an existing pool input. Is “first action runs on creation” a guaranteed CellScript behavior, or just an implementation detail? -
EntryWitness encoding
I found the prefixCSARGv1\0and wrapped it inWitnessArgs.input_type. It is very easy to mis‑encode (e.g., wrong Molecule offsets). What is the canonical way for off‑chain builders to encode CellScriptEntryWitnesspayloads? Should we usecellc entry-witness, a library API, metadata from.meta.json, or manual ABI encoding? -
ProofPlan builder assumptions
The compiled metadata exposesProofPlanfields. Which ones are intended to be enforced by the builder before signing, and which are purely explanatory or runtime‑facing?
My direct questions for you (Arthur)
-
How should the first
MintAuthoritycell be created fortoken.cell?
Is there a planned bootstrap transaction or a separate contract that issues the initial authority? -
Is “first action runs on creation” a guaranteed CellScript rule across all contracts?
-
What is the canonical builder path for
EntryWitnessencoding?
(CLI tool, library, or manual ABI?) -
What
ProofPlanassumptions must an off‑chain builder enforce before signing? -
Is there a recommended local dev fixture pattern for testing
token.cellwithout usingalways_successas a fake token type?
Or should I continue with the fake token path until the bootstrap is clarified?
Why I am asking
I want to continue with the real path, not a workaround:
MintAuthority bootstrap → mint token cells → seed_pool → swap_a_for_b
Any guidance on the intended token.cell bootstrap flow would unblock the next step and allow me to produce a fully working swap builder that others can reuse.
Thank you for your work on CellScript, and I look forward to your insights.
Here are the links to the sources that informed my thinking:
-
CellScript Official: CellScript: A DSL for Cell-Based Contracts.
-
Core Concept Docs: CellScript 0.13 Direction Update; CellScript 0.15 Preview: ProofPlan in Plain English.
-
Contracts & Tooling: amm_pool.cell & token.cell; CellScript Package Management RFC.
-
Developer Tooling: OffCKB Quick Start; CCC Core Library.
