nervosnetwork / nervosnetwork/ckb-cli

Feature Request: Improve Script Deployment with Two-Step Process and Support for Type-ID + Multisig

Open
#636 0 comments 0 reactions 1 assignee View on GitHub

@eval-exec is already working on this.

Since Jun 26, 2025.

Dominant language
Rust
Stars
63
Forks
40
PR merge metrics
No merged PRs in 30d

Description

Description

In the Nervos CKB blockchain, deploying scripts is a key functionality. Currently, ckb-cli requires users to specify all deployment parameters in a single command. This approach can be error-prone and inefficient, particularly for complex deployments involving type-id (a unique script identifier) and multisig (multi-signature) lock configurations. If a deployment fails due to incorrect parameters, users must restart the process from scratch, which becomes increasingly cumbersome as deployment options grow in complexity.

To address this, we propose enhancing ckb-cli with a two-step deployment process, inspired by Ethereum's deployment tools like Truffle or Hardhat:

  1. Generate Deployment Spec: A command to create a deployment specification file (e.g., JSON) encapsulating all deployment details.
    2 .Execute Deployment: A command to read the spec file and deploy the script.

Additionally, the feature should include support for deploying scripts using type-id combined with multisig, streamlining these advanced configurations.

Proposed Solution

Introduce two new subcommands under ckb-cli deploy:

  1. generate-spec: Generates a deployment spec file based on user-provided parameters.
  2. execute: Executes the deployment using the spec file.
Example Usage
  1. Generate the spec file:
ckb-cli deploy generate-spec \
  --script-path /path/to/script.bin \
  --args 0x... \
  --type type-id \
  --lock multisig --required-signatures 2 --public-keys 0xpubkey1,0xpubkey2,0xpubkey3 \
  --capacity 100000000 \
  --dependencies tx_hash:0:code \
  --output spec.json
  1. Review and edit spec.json as needed.
  2. Execute the deployment:
ckb-cli deploy execute --spec spec.json
Spec File Structure

An example spec.json:

{
  "script": {
    "code_hash": "0x...",
    "hash_type": "data",
    "args": "0x..."
  },
  "type": {
    "type": "type-id"
  },
  "lock": {
    "type": "multisig",
    "required_signatures": 2,
    "public_keys": ["0xpubkey1", "0xpubkey2", "0xpubkey3"]
  },
  "capacity": "100000000",
  "dependencies": [
    {
      "out_point": {
        "tx_hash": "0x...",
        "index": 0
      },
      "dep_type": "code"
    }
  ]
}

Benefits

Error Reduction: Reviewing the spec before deployment helps catch mistakes early.

Efficiency: Eliminates the need to re-enter parameters after a failed deployment.

Complexity Management: Simplifies handling of intricate deployments with multiple settings.

Reusability: Spec files can be saved, reused, or modified for future deployments.

Enhanced Security: Multisig support adds a layer of security to deployed scripts.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.