Core Member
- Name/Nickname: WuodOdhis
- Role: Builder / Developer
- GitHub: WuodOdhis (pUNK) · GitHub
- Telegram:Cyborgsil
Background
I have been working through CKB transaction construction, the Cell Model, CCC/offckb devnet workflows, and CellScript-based contract examples. My current work focuses on building an external transaction builder for CellScript AMM flows.
Related repositories:
- Project Background
On account-based chains like Ethereum, a user usually calls a contract function and the chain computes the result. The wallet mostly builds a thin transaction around a function call.
CKB is different. On CKB, the transaction must already describe the full state transition. The builder must find live cells, read their current data, compute the new state off-chain, assemble the expected output cells, attach witnesses and cell deps, then submit the complete transaction for verification.
This makes external builders essential.
While working with CellScript AMM examples, I found that the hardest part was not only the contract logic. The harder part was building the correct transaction around the contract:
- Which cells should be consumed?
- Which new cells should be created?
- Which type scripts should be used?
- How should witness bytes be generated?
- How should script hashes be calculated?
- How can a developer verify the transaction before signing or submitting?
I already built a working prototype for the first step, launch_token, and verified it with CKB local devnet dry-run. The next step is to extend this into a complete AMM transaction builder flow.
- Solution
The project will provide a CLI-first builder for CellScript AMM transactions.
The builder will help developers construct transactions for these CellScript actions:
- launch_token
- mint_with_authority
- seed_pool
- swap_a_for_b
From a developer’s perspective, the tool should let them run commands like:
cellscript-amm-builder launch
cellscript-amm-builder mint
cellscript-amm-builder seed
cellscript-amm-builder swap
or equivalent script commands during the prototype phase.
The builder will: - load compiler-generated CellScript resource identities;
- generate canonical witness bytes using cellc entry-witness;
- query CKB devnet for live cells;
- construct valid transaction inputs and outputs;
- run CKB dry-run verification;
- optionally submit the transaction;
- store output cell references in a state file for the next step.
The difference from a normal script is that this project is not just hardcoding one transaction. The goal is to turn CellScript compiler outputs into a practical builder workflow that other CKB developers can inspect, reproduce, and extend.
- Technical Approach
Tech Stack
- CellScript v0.16.2
- CKB local devnet / offckb
- CKB JSON-RPC
- Python and/or Node.js CLI scripts
- CCC SDK where signing is needed
- CKB Cell Model
- CellScript resource identities, builder manifests, and entry witnesses
Architecture Overview
The builder will have these main parts:
- Compiler Metadata Loader
- Reads CellScript resource identity plans.
- Reads action ABI/manifest information.
- Avoids guessing type scripts manually.
- Live Cell Reader
- Queries CKB devnet for live input cells.
- Reads cell data such as token amounts, symbols, pool reserves, and capacity.
- Transaction Constructor
- Builds the correct inputs, outputs, outputs data, cell deps, and witnesses.
- Uses Molecule-packed CKB Script hashing.
- Uses cellc entry-witness for canonical CellScript witness bytes.
- Verifier
- Runs CKB dry_run_transaction.
- Optionally integrates cellc builder check --production where applicable.
- Prints clear success/failure output.
- State Index
- Records generated output cells after launch/mint/seed.
- Allows the next command to use the previous transaction’s outputs.
- To-Do List
Week 1: Finalize Launch Builder + Output Indexing
- Finalize the existing launch_token builder.
- Add optional submit mode.
- Record created output cells into a state JSON file.
- Improve error messages and configuration.
Milestone:
launch_token can be dry-run and optionally submitted. Created output cells are indexed.
Week 2: Build mint_with_authority Flow - Consume a live MintAuthority cell.
- Build updated authority and new token outputs.
- Generate witness with cellc entry-witness.
- Add dry-run verification.
Milestone:
mint_with_authority transaction dry-runs successfully.
Week 3: Build seed_pool Flow - Consume Pool and Token cells.
- Build updated Pool, LPReceipt, and change outputs.
- Add capacity handling and dry-run verification.
Milestone:
seed_pool transaction dry-runs successfully.
Week 4: Build swap_a_for_b Flow - Read pool reserves from live Pool cell.
- Compute swap output off-chain.
- Enforce minimum output / slippage.
- Build updated Pool and output Token cells.
- Run dry-run verification.
Milestone:
swap_a_for_b transaction dry-runs successfully.
Week 5: Unified CLI + State Management - Wrap commands into one CLI interface.
- Add config file support.
- Add state file support for output cell tracking.
- Improve command help and failure messages.
Milestone:
Developer can run launch, mint, seed, and swap commands from one CLI flow.
Week 6: Documentation + Demo - Write setup guide.
- Write verification guide.
- Add sample transaction JSON outputs.
- Record demo video or walkthrough.
- Document current limitations.
Milestone:
Reviewer can reproduce the flow locally without reading the code.
Funding Breakdown
-
$700 - Core builder development
-
complete the live-cell transaction builder flow after
launch_token -
implement/index the remaining AMM steps:
mint_with_authority,seed_pool, andswap_a_for_b -
$200 - Verification and devnet testing
-
local devnet dry-run checks
-
reproducible transaction JSON outputs
-
expected command outputs for reviewers
-
$100 - Documentation and demo preparation
-
setup guide
-
usage guide
-
verification walkthrough
- Deliverables + How to Verify
A. Deliverable - Updated Public GitHub Repository
- Repository contains the completed builder scripts/CLI.
- Acceptance: code is pushed and documented.
- Launch Builder
- Builds and dry-runs launch_token.
- Acceptance: command prints Dry run OK.
- Mint Builder
- Builds and dry-runs mint_with_authority.
- Acceptance: command prints Dry run OK.
- Seed Pool Builder
- Builds and dry-runs seed_pool.
- Acceptance: command prints Dry run OK.
- Swap Builder
- Builds and dry-runs swap_a_for_b.
- Acceptance: command prints Dry run OK and shows expected output amount.
- State File
- Records created output cells after each step.
- Acceptance: JSON file contains outpoints for later commands.
- Documentation
- Setup, usage, and verification instructions.
- Acceptance: reviewer can follow commands without reading source code.
- Demo Video / Walkthrough
- Shows the tool running on local devnet.
- Acceptance: video or written walkthrough demonstrates launch through swap dry-run.
- Current State vs. Funded Work
Current State
Already completed:
- CellScript v0.16.2 local toolchain verified.
- launch_token ELF verified against deployed local devnet artifact.
- Cleaned script added: scripts/build_launch_tx.py.
- Script loads compiler-generated resource identities.
- Script reads paired funding token data from devnet.
- Script generates witness bytes with cellc entry-witness.
- Script computes CKB script hashes using Molecule-packed Script encoding.
- Script builds launch_token transaction outputs.
- Script dry-runs successfully.
Verified output:
Funding token: 10000 PAIR0001
Creator lock hash: 0x0abf028eb7f3927ac1ee9761fb650b60f16ea4c25e6a076db1cd94eff954b413
Pool type hash: 0xa952d9ec6d6bcb404c792eccccf398ee50a848f69ff7a3514118406690e6fb17
Output capacity: 820.0 CKB
Dry run OK: 49848 cycles
Current commit:
aeb0918 add devnet launch transaction builder
Funded Work
The Spark funding will cover the delta from launch-builder prototype to complete AMM builder demo:
- submit/index launch outputs;
- implement live-cell mint_with_authority;
- implement live-cell seed_pool;
- implement live-cell swap_a_for_b;
- build unified CLI;
- add reproducible docs and demo materials.
Clear Boundary
The current project proves the launch step.
The funded project completes the full AMM transaction-builder flow.
- CKB Alignment
This project is directly aligned with CKB’s unique architecture.
It depends on:
- Cell Model: transactions consume old cells and create new cells.
- Type Scripts: AMM and token rules are enforced by CellScript-generated scripts.
- Lock Scripts: output ownership is verified through script hashes.
- Cell Deps: deployed ELF artifacts must be referenced correctly.
- CKB-VM: CellScript compiles to RISC-V code executed by CKB-VM.
- CellScript: the project uses
resource-identity,entry-witness, builder manifests, and builder checks. - External Builder Pattern: the project demonstrates how CKB applications require off-chain transaction construction.
The wider ecosystem value is that this project is not only an AMM example. It is also an early reusable external-builder pattern for CellScript contracts.
Most CellScript applications will need similar builder logic:
- loading compiler metadata;
- generating canonical witnesses;
- resolving live cells;
- constructing full CKB transactions;
- attaching the correct cell deps and scripts;
- running dry-run checks before submission;
- keeping a reproducible state index between transaction steps.
The AMM flow is a concrete test case because it involves multiple real CKB concepts at once: token cells, pool cells, LP receipts, capacity handling, type scripts, lock scripts, and multi-step state transitions. If this builder pattern works for the AMM flow, it can serve as a practical reference for other CellScript-based protocols that need external builders.
So the project should be understood as both:
- a CellScript AMM transaction builder; and
- an early prototype of reusable CellScript external-builder infrastructure on CKB.
It exists specifically because CKB transactions are complete state transitions that must be built off-chain and verified on-chain. The goal is to make that builder pattern easier for future CKB developers to understand, reproduce, and extend.