RetricSu / offckb

CKB local development network for your first try.
https://www.npmjs.com/package/@offckb/cli
MIT License
5 stars 2 forks source link
ckb ckb-dapp cli

OffCKB

npm CI npm npm node

CKB local development network for your first try.

Start building on Nervos blockchain, right now, right away!

Table of Contents

Install

npm install -g @offckb/cli

We recommand using LTS version of Node to run offckb

Usage

Usage: offckb [options] [command]

ckb development network for your first try

Options:
  -V, --version                                     output the version number
  -h, --help                                        display help for command

Commands:
  create [your-project-name]                        Create a new dApp from bare templates
  node                                              Use the CKB to start devnet
  clean                                             Clean the devnet data, need to stop running the chain first
  accounts                                          Print account list info
  list-hashes                                       Use the CKB to list blockchain scripts hashes
  inject-config                                     Add offckb.config.ts to your workspace
  sync-config                                       sync offckb.config.ts in your workspace
  deposit [options] [toAddress] [amountInShannon]   Deposit CKB tokens to address, only devnet and testnet
  transfer [options] [toAddress] [amountInShannon]  Transfer CKB tokens to address, only devnet and testnet
  balance [options] [toAddress]                     Check account balance, only devnet and testnet
  deploy [options]                                  Deploy contracts to different networks, only supports devnet and testnet
  deployed-scripts [options]                        Show deployed contracts info on networks, only supports devnet and testnet
  help [command]                                    display help for command

Use offckb [command] -h to learn more about a specific command.

Sometimes you might encounter sudo permission problems. Granting the current user write access to the node_modules directory can resolve the problem.

sudo chown -R $(whoami) /usr/local/lib/node_modules
npm install -g @offckb/cli

Get started

Create a full-stack Project

Create a new project from predefined boilerplates.

offckb create <your-project-name, eg:my-first-ckb-project>

The boilerplate can be targeting on different CKB networks. Check README.md in the project to get started.

Create a script-only Project

You can create a new script project without a frontend. This is useful when you only want to develop smart contracts for CKB.

offckb create <your-project-name> --script

Note: you need to have rust/cargo/cargo-generate/clang 16+ installed in your environment to use this command. offckb doesn't do anything really, it just call ckb-script-template to do all the magic.

Built-in scripts

Accounts

offckb comes with 20 accounts, each account is funded with 42_000_000_00000000 capacity in the genesis block.

all the private keys are recorded in the account/keys file. detail informations about each account are recorded in the account/account.json file.

:warning: DO NOT SEND REAL ASSETS INTO ALL THESE ACCOUNTS, YOU CAN LOOSE YOUR MONEY :warning:

About Lumos

offckb uses Lumos as the CKB dApp framework to build the template projects.

Contributing

check development doc