TITLE: Creating a New Full-stack CKB Project DESCRIPTION: This command generates a new full-stack dApp project from predefined boilerplates, including both smart contract and frontend components. It provides a complete starting point for CKB dApp development. SOURCE: https://github.com/ckb-devrel/offckb/blob/master/README.md#_snippet_12 LANGUAGE: sh CODE: ``` offckb create ``` ---------------------------------------- TITLE: Deploying Smart Contracts to Devnet with offckb DESCRIPTION: These commands navigate to the frontend directory and then use the `offckb` tool to deploy smart contracts to the CKB `devnet`. `offckb` reads configuration from `offckb.config.ts` to manage the deployment process. SOURCE: https://github.com/ckb-devrel/offckb/blob/master/templates/v3/next-js-template/README.md#_snippet_6 LANGUAGE: sh CODE: ``` cd frontend offckb deploy --network devnet ``` ---------------------------------------- TITLE: Installing OffCKB CLI with npm DESCRIPTION: This command globally installs the OffCKB command-line interface using npm, making it available for use from any directory in the terminal. It's the recommended way to get started with OffCKB. SOURCE: https://github.com/ckb-devrel/offckb/blob/master/README.md#_snippet_0 LANGUAGE: sh CODE: ``` npm install -g @offckb/cli ``` ---------------------------------------- TITLE: Deploying CKB Script from Frontend Directory DESCRIPTION: This command deploys the compiled CKB script to the specified network (devnet or testnet) from within the frontend folder, where the offckb.config.ts file is typically located. It automates the process of publishing the contract on-chain. SOURCE: https://github.com/ckb-devrel/offckb/blob/master/README.md#_snippet_16 LANGUAGE: sh CODE: ``` cd frontend && offckb deploy --network ``` ---------------------------------------- TITLE: Deploying Upgradable CKB Script with Type ID DESCRIPTION: This command deploys the CKB script to the specified network, enabling upgradability by passing the --type-id option. This allows for future updates to the deployed contract without changing its address. SOURCE: https://github.com/ckb-devrel/offckb/blob/master/README.md#_snippet_18 LANGUAGE: sh CODE: ``` cd frontend && offckb deploy --type-id --network ``` ---------------------------------------- TITLE: Installing Dependencies and Starting Frontend App (Shell) DESCRIPTION: This command first installs all necessary Node.js dependencies for the frontend application using `npm i`, and then starts the development server using `npm run dev`. This prepares and launches the Dapp's user interface. SOURCE: https://github.com/ckb-devrel/offckb/blob/master/templates/v3/remix-vite-template/README.md#_snippet_5 LANGUAGE: Shell CODE: ``` npm i && npm run dev ``` ---------------------------------------- TITLE: Building and Sending CKB Transactions in REPL DESCRIPTION: This JavaScript snippet demonstrates how to construct, complete, and send a CKB transaction within the OffCKB REPL. It utilizes `ccc` for fixed-point calculations and transaction creation, `SignerCkbPrivateKey` for signing, and `completeInputsByCapacity` and `completeFeeBy` methods to finalize the transaction before sending. SOURCE: https://github.com/ckb-devrel/offckb/blob/master/README.md#_snippet_29 LANGUAGE: JavaScript CODE: ``` OffCKB > let amountInCKB = ccc.fixedPointFrom(63); OffCKB > let tx = ccc.Transaction.from({ ... outputs: [ ... { ... capacity: ccc.fixedPointFrom(amountInCKB), ... lock: accounts[0].lockScript, ... }, ... ], ... }); OffCKB > let signer = new ccc.SignerCkbPrivateKey(client, accounts[0].privkey); OffCKB > await tx.completeInputsByCapacity(signer); 2 OffCKB > await tx.completeFeeBy(signer, 1000); [ 0, true ] OffCKB > await mySigner.sendTransaction(tx) '0x50fbfa8c47907d6842a325e85e48d5da6917e16ca7e2253ec3bd5bcdf8da99ce' ``` ---------------------------------------- TITLE: Running Vite Development Server (Shell) DESCRIPTION: This command initiates the Vite development server for a Remix application. It enables features like hot module replacement and live reloading, which are crucial for an efficient development workflow. SOURCE: https://github.com/ckb-devrel/offckb/blob/master/templates/v3/remix-vite-template/frontend/README.md#_snippet_0 LANGUAGE: shellscript CODE: ``` npm run dev ``` ---------------------------------------- TITLE: Starting CKB Devnet with Default Version DESCRIPTION: This command initiates a local CKB blockchain development network using the default CKB version. It's the simplest way to get a devnet up and running for development and testing. SOURCE: https://github.com/ckb-devrel/offckb/blob/master/README.md#_snippet_3 LANGUAGE: sh CODE: ``` offckb node ``` ---------------------------------------- TITLE: Deploying Smart Contracts to CKB Devnet with offckb DESCRIPTION: These commands navigate to the frontend directory and then deploy smart contracts to the CKB 'devnet' using the 'offckb' tool. This process automates deployment and updates script information based on 'offckb.config.ts'. SOURCE: https://github.com/ckb-devrel/offckb/blob/master/templates/v3/js-script-next-js/README.md#_snippet_6 LANGUAGE: sh CODE: ``` cd frontend offckb deploy --network devnet ``` ---------------------------------------- TITLE: Deploying Smart Contracts to Devnet with offckb (Shell) DESCRIPTION: This command first navigates to the `frontend` directory and then uses `offckb deploy --network devnet` to deploy the smart contracts to the CKB devnet. `offckb` reads configuration from `offckb.config.ts` to manage the deployment process and update script infos. SOURCE: https://github.com/ckb-devrel/offckb/blob/master/templates/v3/remix-vite-template/README.md#_snippet_8 LANGUAGE: Shell CODE: ``` cd frontend offckb deploy --network devnet ``` ---------------------------------------- TITLE: Configuring Frontend Network to Testnet DESCRIPTION: This configuration line in the `.env` file sets the public network for the frontend dApp to `testnet`. This ensures the dApp interacts with the CKB test network after deployment. SOURCE: https://github.com/ckb-devrel/offckb/blob/master/templates/v3/next-js-template/README.md#_snippet_8 LANGUAGE: bash CODE: ``` NEXT_PUBLIC_NETWORK=testnet # devnet, testnet or mainnet ``` ---------------------------------------- TITLE: Configuring Frontend for CKB Testnet DESCRIPTION: This snippet demonstrates how to update the '.env' file to explicitly target the CKB 'testnet'. This ensures the frontend application interacts with the correct network after contracts have been deployed to it. SOURCE: https://github.com/ckb-devrel/offckb/blob/master/templates/v3/js-script-next-js/README.md#_snippet_8 LANGUAGE: bash CODE: ``` NEXT_PUBLIC_NETWORK=testnet # devnet, testnet or mainnet ``` ---------------------------------------- TITLE: Installing Project Dependencies with pnpm DESCRIPTION: This command installs all necessary project dependencies using pnpm, a fast and efficient package manager. It is a crucial first step before building or running the CKB Dapp template. SOURCE: https://github.com/ckb-devrel/offckb/blob/master/templates/v3/js-script-next-js/README.md#_snippet_0 LANGUAGE: bash CODE: ``` pnpm i ``` ---------------------------------------- TITLE: Deploying Smart Contracts to CKB Testnet with offckb DESCRIPTION: These commands navigate to the frontend directory and then deploy smart contracts to the CKB 'testnet' using the 'offckb' tool. This automates the deployment process for the testnet environment, updating relevant script information. SOURCE: https://github.com/ckb-devrel/offckb/blob/master/templates/v3/js-script-next-js/README.md#_snippet_7 LANGUAGE: sh CODE: ``` cd frontend offckb deploy --network testnet ``` ---------------------------------------- TITLE: Deploying Smart Contracts to Testnet with offckb DESCRIPTION: These commands navigate to the frontend directory and then use the `offckb` tool to deploy smart contracts to the CKB `testnet`. This is used for testing dApps in a public test environment before mainnet deployment. SOURCE: https://github.com/ckb-devrel/offckb/blob/master/templates/v3/next-js-template/README.md#_snippet_7 LANGUAGE: sh CODE: ``` cd frontend offckb deploy --network testnet ``` ---------------------------------------- TITLE: Configuring Frontend Network to Devnet DESCRIPTION: This configuration line in the `.env` file sets the public network for the frontend dApp to `devnet`. This allows the dApp to connect and interact with the CKB development network. SOURCE: https://github.com/ckb-devrel/offckb/blob/master/templates/v3/next-js-template/README.md#_snippet_5 LANGUAGE: bash CODE: ``` NEXT_PUBLIC_NETWORK=devnet # devnet, testnet or mainnet ``` ---------------------------------------- TITLE: Configuring CKB Network in .env DESCRIPTION: This snippet shows how to configure the target CKB blockchain network (devnet, testnet, or mainnet) by editing the '.env' file. This setting determines which network the dApp will interact with. SOURCE: https://github.com/ckb-devrel/offckb/blob/master/templates/v3/js-script-next-js/README.md#_snippet_5 LANGUAGE: bash CODE: ``` NEXT_PUBLIC_NETWORK=devnet # devnet, testnet or mainnet ``` ---------------------------------------- TITLE: Setting Default CKB Version for Devnet DESCRIPTION: These commands first set a default CKB version (e.g., 0.117.0) for future offckb node commands, and then start the devnet using that configured version. This streamlines starting the devnet with a consistent CKB version. SOURCE: https://github.com/ckb-devrel/offckb/blob/master/README.md#_snippet_5 LANGUAGE: sh CODE: ``` offckb config set ckb-version 0.117.0 offckb node ``` ---------------------------------------- TITLE: Generating Moleculec Bindings for Single Schema File DESCRIPTION: This command generates Moleculec bindings for a single `.mol` schema file. It requires specifying the input schema file, the desired output file path, and the target programming language (e.g., `ts`, `js`, `c`, `rs`, `go`) for the generated bindings. SOURCE: https://github.com/ckb-devrel/offckb/blob/master/README.md#_snippet_25 LANGUAGE: Shell CODE: ``` offckb mol --schema --output --lang ``` ---------------------------------------- TITLE: Configuring CKB Network Target in Next.js (Bash) DESCRIPTION: This snippet shows how to configure the target CKB network (devnet, testnet, or mainnet) by setting the NEXT_PUBLIC_NETWORK environment variable in the .env file. This is crucial for connecting the application to the correct CKB blockchain instance. SOURCE: https://github.com/ckb-devrel/offckb/blob/master/templates/v3/next-js-template/frontend/README.md#_snippet_1 LANGUAGE: bash CODE: ``` NEXT_PUBLIC_NETWORK=devnet # devnet, testnet or mainnet ``` ---------------------------------------- TITLE: Configuring CKB Network Target (Bash) DESCRIPTION: This snippet demonstrates how to configure the target CKB network (devnet, testnet, or mainnet) by setting the `NEXT_PUBLIC_NETWORK` environment variable in the `.env` file. This allows the Next.js application to connect to different CKB instances. SOURCE: https://github.com/ckb-devrel/offckb/blob/master/templates/v3/js-script-next-js/packages/frontend/README.md#_snippet_1 LANGUAGE: bash CODE: ``` NEXT_PUBLIC_NETWORK=devnet # devnet, testnet or mainnet ``` ---------------------------------------- TITLE: Starting Frontend Dapp Development Server DESCRIPTION: This command first installs all necessary Node.js dependencies (`npm i`) and then starts the development server for the Next.js frontend application (`npm run dev`). This allows local development and testing of the dApp. SOURCE: https://github.com/ckb-devrel/offckb/blob/master/templates/v3/next-js-template/README.md#_snippet_4 LANGUAGE: sh CODE: ``` npm i && npm run dev ``` ---------------------------------------- TITLE: Starting Frontend Project Development Server DESCRIPTION: These commands first install the necessary npm dependencies and then start the development server for the frontend project. This allows developers to interact with their dApp's user interface in a local environment. SOURCE: https://github.com/ckb-devrel/offckb/blob/master/README.md#_snippet_20 LANGUAGE: sh CODE: ``` npm i & npm run dev ``` ---------------------------------------- TITLE: Starting CKB Devnet with Specific Version DESCRIPTION: This command starts a local CKB blockchain development network using a specified CKB version (e.g., 0.117.0). This is useful for testing against a particular CKB release or for compatibility reasons. SOURCE: https://github.com/ckb-devrel/offckb/blob/master/README.md#_snippet_4 LANGUAGE: sh CODE: ``` offckb node 0.117.0 ``` ---------------------------------------- TITLE: Checking Deployed CKB Scripts Information DESCRIPTION: This command displays information about the contracts that have been deployed to the specified network (devnet or testnet). It provides a summary of the deployed scripts, including their addresses and other relevant details. SOURCE: https://github.com/ckb-devrel/offckb/blob/master/README.md#_snippet_19 LANGUAGE: sh CODE: ``` offckb my-scripts --network ``` ---------------------------------------- TITLE: Starting Next.js Development Server (Bash) DESCRIPTION: This snippet provides commands to start the Next.js development server using various package managers. It allows developers to run the application locally, typically accessible at `http://localhost:3000`, with hot-reloading enabled for `app/page.tsx` modifications. SOURCE: https://github.com/ckb-devrel/offckb/blob/master/templates/v3/js-script-next-js/packages/frontend/README.md#_snippet_0 LANGUAGE: bash CODE: ``` npm run dev # or yarn dev # or pnpm dev # or bun dev ``` ---------------------------------------- TITLE: Running Development Server for Next.js Project (Bash) DESCRIPTION: This snippet provides commands to start the Next.js development server using various package managers. It allows developers to run the application locally for development and testing purposes. SOURCE: https://github.com/ckb-devrel/offckb/blob/master/templates/v3/next-js-template/frontend/README.md#_snippet_0 LANGUAGE: bash CODE: ``` npm run dev # or yarn dev # or pnpm dev # or bun dev ``` ---------------------------------------- TITLE: Starting Frontend Development Server with pnpm DESCRIPTION: This command launches the Next.js development server for the dApp frontend. It allows for local development and testing of the application. SOURCE: https://github.com/ckb-devrel/offckb/blob/master/templates/v3/js-script-next-js/README.md#_snippet_4 LANGUAGE: sh CODE: ``` pnpm dev ``` ---------------------------------------- TITLE: Retrieving Account Balance in OffCKB REPL DESCRIPTION: This JavaScript snippet shows how to get the balance of a CKB account using the `Client` object within the OffCKB REPL. It demonstrates creating a client instance connected to a specific network (e.g., testnet) and then calling `getBalanceSingle` with the account's lock script. SOURCE: https://github.com/ckb-devrel/offckb/blob/master/README.md#_snippet_30 LANGUAGE: JavaScript CODE: ``` OffCKB > let myClient = Client.fromUrl(networks.testnet.rpc_url, 'testnet'); OffCKB > await myClient.getBalanceSingle(accounts[0].lockScript); 60838485293944n OffCKB > ``` ---------------------------------------- TITLE: Deploying Smart Contracts to Testnet with offckb (Shell) DESCRIPTION: This command first navigates to the `frontend` directory and then uses `offckb deploy --network testnet` to deploy the smart contracts to the CKB testnet. This allows testing the deployed contracts in a public test environment. SOURCE: https://github.com/ckb-devrel/offckb/blob/master/templates/v3/remix-vite-template/README.md#_snippet_9 LANGUAGE: Shell CODE: ``` cd frontend offckb deploy --network testnet ``` ---------------------------------------- TITLE: Starting Frontend Dapp for Testnet Development DESCRIPTION: After configuring the frontend to target the `testnet` via the `.env` file, these commands navigate to the frontend directory and start the development server. This allows local testing of the dApp against the CKB Testnet. SOURCE: https://github.com/ckb-devrel/offckb/blob/master/templates/v3/next-js-template/README.md#_snippet_9 LANGUAGE: sh CODE: ``` cd frontend npm run dev ``` ---------------------------------------- TITLE: Starting OffCKB REPL Mode DESCRIPTION: This command starts the OffCKB Node.js REPL (Read-Eval-Print Loop), providing a convenient interactive environment for CKB development. Users can specify the network to connect to (devnet, testnet, or mainnet), with devnet as the default. SOURCE: https://github.com/ckb-devrel/offckb/blob/master/README.md#_snippet_27 LANGUAGE: Shell CODE: ``` offckb repl --network Welcome to OffCKB REPL! [[ Default Network: devnet, enableProxyRPC: false ]] Type 'help()' to learn how to use. OffCKB > ``` ---------------------------------------- TITLE: Adding a New Smart Contract with Make DESCRIPTION: This command uses the `make` utility to generate a new smart contract, leveraging the `ckb-script-templates` functionality. It simplifies the process of adding new contract boilerplate. SOURCE: https://github.com/ckb-devrel/offckb/blob/master/templates/v3/next-js-template/README.md#_snippet_0 LANGUAGE: sh CODE: ``` make generate ``` ---------------------------------------- TITLE: Adding New Smart Contract (Shell) DESCRIPTION: This command uses `make generate` to add a new smart contract to the project. It leverages the underlying `ckb-scripts-template` to scaffold a new contract, streamlining the initial setup process for contract development. SOURCE: https://github.com/ckb-devrel/offckb/blob/master/templates/v3/remix-vite-template/README.md#_snippet_0 LANGUAGE: Shell CODE: ``` make generate ``` ---------------------------------------- TITLE: Starting Frontend App for Configured Network DESCRIPTION: These commands first navigate to the frontend directory and then start the development server. This sequence is typically executed after configuring the target CKB network in the '.env' file to ensure the dApp connects to the desired blockchain. SOURCE: https://github.com/ckb-devrel/offckb/blob/master/templates/v3/js-script-next-js/README.md#_snippet_9 LANGUAGE: bash CODE: ``` cd frontend pnpm dev ``` ---------------------------------------- TITLE: Building Remix Application for Production (Shell) DESCRIPTION: This command compiles and optimizes the Remix application for production deployment. It generates the necessary client and server bundles, typically located in the `build/client` and `build/server` directories, ready for a production environment. SOURCE: https://github.com/ckb-devrel/offckb/blob/master/templates/v3/remix-vite-template/frontend/README.md#_snippet_1 LANGUAGE: sh CODE: ``` npm run build ``` ---------------------------------------- TITLE: Starting Frontend Dapp for Testnet (Shell) DESCRIPTION: This command first navigates to the `frontend` directory and then starts the Dapp, explicitly setting the `NETWORK` environment variable to `testnet`. This ensures the frontend connects and interacts with the CKB Testnet. SOURCE: https://github.com/ckb-devrel/offckb/blob/master/templates/v3/remix-vite-template/README.md#_snippet_10 LANGUAGE: Shell CODE: ``` cd frontend NETWORK=testnet npm run dev ``` ---------------------------------------- TITLE: Debugging CKB Transactions with OffCKB CLI DESCRIPTION: This command initiates the debugging process for a CKB transaction using its hash. It verifies all scripts within the transaction and outputs detailed information to the terminal, useful for analyzing failed transactions recorded by the proxy RPC server. SOURCE: https://github.com/ckb-devrel/offckb/blob/master/README.md#_snippet_21 LANGUAGE: Shell CODE: ``` offckb debug ``` ---------------------------------------- TITLE: Installing OffCKB CLI with pnpm DESCRIPTION: This command globally installs the OffCKB command-line interface using pnpm, an alternative package manager. It provides the same functionality as the npm installation but might be preferred by users already using pnpm. SOURCE: https://github.com/ckb-devrel/offckb/blob/master/README.md#_snippet_1 LANGUAGE: sh CODE: ``` pnpm install -g @offckb/cli ``` ---------------------------------------- TITLE: Running Smart Contract Tests with Debug Logs (Shell) DESCRIPTION: This command runs the smart contract tests with detailed debug logs enabled by passing `--nocapture` to `cargo test`. This is useful for in-depth debugging and inspecting contract behavior during execution. SOURCE: https://github.com/ckb-devrel/offckb/blob/master/templates/v3/remix-vite-template/README.md#_snippet_3 LANGUAGE: Shell CODE: ``` cargo test -- --nocapture ``` ---------------------------------------- TITLE: Building CKB Smart Contracts with pnpm DESCRIPTION: This command compiles the on-chain smart contracts, preparing them for deployment or testing. The smart contract project is powered by ckb-js-vm. SOURCE: https://github.com/ckb-devrel/offckb/blob/master/templates/v3/js-script-next-js/README.md#_snippet_1 LANGUAGE: bash CODE: ``` pnpm build ``` ---------------------------------------- TITLE: Building Smart Contract (Shell) DESCRIPTION: This command compiles the smart contracts using `make build`. It's part of the `ckb-scripts-template` workflow, preparing the Rust-based contracts for deployment by generating the necessary binaries. SOURCE: https://github.com/ckb-devrel/offckb/blob/master/templates/v3/remix-vite-template/README.md#_snippet_1 LANGUAGE: Shell CODE: ``` make build ``` ---------------------------------------- TITLE: Creating a New Script-Only CKB Project DESCRIPTION: This command creates a new project focused solely on CKB smart contracts, without a frontend. It's ideal for developers who only need to develop and test on-chain script logic. SOURCE: https://github.com/ckb-devrel/offckb/blob/master/README.md#_snippet_13 LANGUAGE: sh CODE: ``` offckb create --script ``` ---------------------------------------- TITLE: Building Smart Contracts with Make DESCRIPTION: This command compiles the smart contracts using `make`, preparing them for deployment or testing. It orchestrates the Rust compilation process for the `riscv64` target. SOURCE: https://github.com/ckb-devrel/offckb/blob/master/templates/v3/next-js-template/README.md#_snippet_1 LANGUAGE: sh CODE: ``` make build ``` ---------------------------------------- TITLE: Building CKB Smart Contract Project DESCRIPTION: This command, executed in the root of a monorepo project, builds the CKB smart contract component. It compiles the script code, preparing it for deployment to the CKB network. SOURCE: https://github.com/ckb-devrel/offckb/blob/master/README.md#_snippet_15 LANGUAGE: sh CODE: ``` make build ``` ---------------------------------------- TITLE: Creating a New dApp-Only CKB Project DESCRIPTION: This command generates a new dApp project without the CKB smart contract component. It's useful for developers who want to build a frontend for existing CKB scripts or don't require custom on-chain logic. SOURCE: https://github.com/ckb-devrel/offckb/blob/master/README.md#_snippet_14 LANGUAGE: sh CODE: ``` offckb create --dapp # or -d ``` ---------------------------------------- TITLE: Running Tests for CKB Project - Bash DESCRIPTION: This command executes the test suite for the `src/index.ts` file within the CKB project, typically using pnpm. It is the standard way to verify the functionality of the application. SOURCE: https://github.com/ckb-devrel/offckb/blob/master/templates/v3/js-script-next-js/packages/on-chain-script-tests/README.md#_snippet_0 LANGUAGE: Bash CODE: ``` pnpm test ``` ---------------------------------------- TITLE: Starting Remix Application in Production (Shell) DESCRIPTION: This command executes the built Remix application in production mode. It serves the optimized bundles created during the build process, making the application ready for live traffic and deployment to a chosen host. SOURCE: https://github.com/ckb-devrel/offckb/blob/master/templates/v3/remix-vite-template/frontend/README.md#_snippet_2 LANGUAGE: sh CODE: ``` npm start ``` ---------------------------------------- TITLE: Testing CKB Smart Contracts with pnpm DESCRIPTION: This command executes the test suite for the on-chain smart contracts. It verifies the functionality and correctness of the contract logic developed with ckb-js-vm. SOURCE: https://github.com/ckb-devrel/offckb/blob/master/templates/v3/js-script-next-js/README.md#_snippet_2 LANGUAGE: bash CODE: ``` pnpm test ``` ---------------------------------------- TITLE: Running Smart Contract Tests (Shell) DESCRIPTION: This command executes the smart contract tests using `make test`. It's a convenient way to verify the functionality and correctness of the Rust-based CKB smart contracts. SOURCE: https://github.com/ckb-devrel/offckb/blob/master/templates/v3/remix-vite-template/README.md#_snippet_2 LANGUAGE: Shell CODE: ``` make test ``` ---------------------------------------- TITLE: Running Smart Contract Tests with Make DESCRIPTION: This command executes the tests for the smart contracts using `make`. It's essential for verifying the correctness and functionality of the developed contracts. SOURCE: https://github.com/ckb-devrel/offckb/blob/master/templates/v3/next-js-template/README.md#_snippet_2 LANGUAGE: sh CODE: ``` make test ``` ---------------------------------------- TITLE: Building and Starting the CKB JS VM Application (Bash) DESCRIPTION: This snippet provides the commands to build and start the CKB JavaScript VM application. The `pnpm build` command compiles the project, and `pnpm start` executes the compiled application. SOURCE: https://github.com/ckb-devrel/offckb/blob/master/templates/v3/js-script-next-js/packages/on-chain-script/README.md#_snippet_0 LANGUAGE: bash CODE: ``` pnpm build pnpm start ``` ---------------------------------------- TITLE: Starting Standalone CKB RPC Proxy Server DESCRIPTION: This command launches the OffCKB RPC proxy server in a separate terminal, allowing for better monitoring of logs. It proxies requests from a specified port (e.g., 9000) to the CKB RPC server (e.g., http://localhost:8114) for a given network. SOURCE: https://github.com/ckb-devrel/offckb/blob/master/README.md#_snippet_7 LANGUAGE: sh CODE: ``` offckb proxy-rpc --ckb-rpc http://localhost:8114 --port 9000 --network devnet ``` ---------------------------------------- TITLE: Deploying CKB Script with Explicit Config Path DESCRIPTION: This command deploys the compiled CKB script to the specified network, explicitly providing the path to the offckb.config.ts file. This is useful when the command is not executed from the default frontend directory. SOURCE: https://github.com/ckb-devrel/offckb/blob/master/README.md#_snippet_17 LANGUAGE: sh CODE: ``` offckb deploy --network --config ``` ---------------------------------------- TITLE: Setting CKB Network and Starting Frontend (Shell - Export) DESCRIPTION: This command sets the `NETWORK` environment variable to `devnet` (or `testnet`, `mainnet`) and then starts the frontend application. This configures the Dapp to connect to a specific CKB blockchain network for development or testing. SOURCE: https://github.com/ckb-devrel/offckb/blob/master/templates/v3/remix-vite-template/README.md#_snippet_6 LANGUAGE: Shell CODE: ``` export NETWORK=devnet # or testnet, mainnet npm run dev ``` ---------------------------------------- TITLE: Setting CKB Network and Starting Frontend (Shell - Inline) DESCRIPTION: This command sets the `NETWORK` environment variable inline to `devnet` and then starts the frontend application. This provides a concise way to specify the target CKB blockchain network for the Dapp's execution. SOURCE: https://github.com/ckb-devrel/offckb/blob/master/templates/v3/remix-vite-template/README.md#_snippet_7 LANGUAGE: Shell CODE: ``` NETWORK=devnet npm run dev ``` ---------------------------------------- TITLE: Displaying OffCKB REPL Help Information DESCRIPTION: Executing `help()` within the OffCKB REPL displays a list of available global variables and functions. This includes `ccc` (CKB Javascript SDK), `client` (CCC client instance), `Client` (CCC client class wrapper), `accounts` (test accounts), and `networks` (network configs). SOURCE: https://github.com/ckb-devrel/offckb/blob/master/README.md#_snippet_28 LANGUAGE: JavaScript CODE: ``` OffCKB > help() OffCKB Repl, a Nodejs REPL with CKB bundles. Global Variables to use: - ccc, cccA, imported from CKB Javascript SDK CCC - client, a CCC client instance bundle with current network - Client, a Wrap of CCC client class, you can build new client with const myClient = Client.new('devnet' | 'testnet' | 'mainnet'); // or const myClient = Client.fromUrl('', 'devnet' | 'testnet' | 'mainnet'); - accounts, test accounts array from OffCKB - networks, network information configs - help, print this help message ``` ---------------------------------------- TITLE: Navigating to Frontend Workspace DESCRIPTION: This command changes the current directory to the 'frontend' workspace. This step is required before performing any frontend-specific operations, such as starting the development server or deploying the dApp. SOURCE: https://github.com/ckb-devrel/offckb/blob/master/templates/v3/js-script-next-js/README.md#_snippet_3 LANGUAGE: sh CODE: ``` cd frontend ``` ---------------------------------------- TITLE: Navigating to Frontend Workspace DESCRIPTION: This command changes the current directory to the `frontend` workspace, which is the first step before performing any frontend-related operations like starting the application or deploying. SOURCE: https://github.com/ckb-devrel/offckb/blob/master/templates/v3/next-js-template/README.md#_snippet_3 LANGUAGE: sh CODE: ``` cd frontend ``` ---------------------------------------- TITLE: Displaying OffCKB CLI Usage and Commands DESCRIPTION: This snippet shows the general usage syntax for the offckb command, along with a list of available options and subcommands. It serves as a quick reference for all functionalities provided by the OffCKB CLI. SOURCE: https://github.com/ckb-devrel/offckb/blob/master/README.md#_snippet_2 LANGUAGE: sh CODE: ``` 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 [options] [your-project-name] Create a new dApp from bare templates node [options] [CKB-Version] Use the CKB to start devnet proxy-rpc [options] Start the rpc proxy server clean Clean the devnet data, need to stop running the chain first accounts Print account list info list-hashes [CKB-Version] Use the CKB to list blockchain scripts hashes inject-config Add offckb.config.ts to your frontend workspace sync-scripts Sync scripts json files in your frontend workspace deposit [options] [toAddress] [amountInCKB] Deposit CKB tokens to address, only devnet and testnet transfer [options] [toAddress] [amountInCKB] Transfer CKB tokens to address, only devnet and testnet transfer-all [options] [toAddress] Transfer All 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 my-scripts [options] Show deployed contracts info on different networks, only supports devnet and testnet config [item] [value] do a configuration action debug [options] CKB Debugger for development system-scripts [options] Output system scripts of the local devnet mol [options] Generate CKB Moleculec binding code for development repl [options] A custom Nodejs REPL environment bundle for CKB. help [command] display help for command ``` ---------------------------------------- TITLE: Getting and Setting CKB Version Configuration DESCRIPTION: These commands demonstrate how to retrieve and update the configured CKB version. `offckb config get ckb-version` fetches the current version, while `offckb config set ckb-version ` allows users to specify a new CKB version for OffCKB operations. SOURCE: https://github.com/ckb-devrel/offckb/blob/master/README.md#_snippet_32 LANGUAGE: Shell CODE: ``` offckb config get ckb-version > 0.113.0 offckb config set ckb-version 0.117.0 offckb config get ckb-version > 0.117.0 ``` ---------------------------------------- TITLE: Replacing Script Binary for Single Cell Debugging DESCRIPTION: This command extends single-cell script debugging by allowing users to replace the script with a custom binary file. The `--bin` option specifies the path to the binary, enabling testing of modified or experimental script versions during the debug session. SOURCE: https://github.com/ckb-devrel/offckb/blob/master/README.md#_snippet_24 LANGUAGE: Shell CODE: ``` offckb debug --single-script --bin ``` ---------------------------------------- TITLE: Starting CKB Devnet Without RPC Proxy DESCRIPTION: This command starts the local CKB blockchain devnet, bypassing the optional RPC proxy server. This is useful if you prefer to interact directly with the CKB RPC server at http://localhost:8114 without the proxy's logging or debugging features. SOURCE: https://github.com/ckb-devrel/offckb/blob/master/README.md#_snippet_6 LANGUAGE: sh CODE: ``` offckb node --no-proxy ``` ---------------------------------------- TITLE: Debugging Single Cell Scripts in CKB Transactions DESCRIPTION: This command allows debugging a specific cell script within a CKB transaction. The `--single-script` option takes a formatted string (`[].`) to pinpoint the exact script for isolated debugging, useful for granular analysis. SOURCE: https://github.com/ckb-devrel/offckb/blob/master/README.md#_snippet_23 LANGUAGE: Shell CODE: ``` offckb debug --single-script ``` ---------------------------------------- TITLE: Managing Dependencies and npm-shrinkwrap with pnpm DESCRIPTION: These commands manage project dependencies using `pnpm` and ensure consistency with `npm-shrinkwrap.json`. First, `pnpm add ` installs a new package. Subsequently, `npm shrinkwrap` generates or updates the `npm-shrinkwrap.json` file, which is crucial for `npm` users to maintain consistent dependency versions, especially before publishing a new version. SOURCE: https://github.com/ckb-devrel/offckb/blob/master/docs/develop.md#_snippet_1 LANGUAGE: sh CODE: ``` pnpm add // run the following to keep npm-shrinkwrap consistent with out pnpm-lock.json npm shrinkwrap ``` ---------------------------------------- TITLE: Updating Built-in Scripts with Make DESCRIPTION: This command is used to update and build the built-in scripts after updating the `ckb` submodule. It ensures all necessary components are compiled and up-to-date for the development environment. Prerequisites include Rust/Cargo, Capsule, and Docker. SOURCE: https://github.com/ckb-devrel/offckb/blob/master/docs/develop.md#_snippet_0 LANGUAGE: sh CODE: ``` make all ``` ---------------------------------------- TITLE: Generating Moleculec Bindings for Multiple Schema Files DESCRIPTION: This command generates Moleculec bindings for multiple `.mol` schema files located within a specified folder. It requires providing the input schema folder, the output folder for the generated bindings, and the target programming language. SOURCE: https://github.com/ckb-devrel/offckb/blob/master/README.md#_snippet_26 LANGUAGE: Shell CODE: ``` offckb mol --schema --output-folder --lang ``` ---------------------------------------- TITLE: Listing OffCKB Devnet Configuration Details DESCRIPTION: This command displays the current configuration settings for the OffCKB devnet, including the RPC URL, configuration path, and data path. This information is crucial for locating and modifying devnet files. SOURCE: https://github.com/ckb-devrel/offckb/blob/master/README.md#_snippet_11 LANGUAGE: sh CODE: ``` offckb config list ``` ---------------------------------------- TITLE: Exporting System Scripts in Lumos JSON Format DESCRIPTION: This command exports the system scripts information into a Lumos-compatible JSON file. This format is useful for integrating the script definitions with Lumos-based dApp development. SOURCE: https://github.com/ckb-devrel/offckb/blob/master/README.md#_snippet_9 LANGUAGE: sh CODE: ``` offckb system-scripts --export-style lumos ``` ---------------------------------------- TITLE: Listing Predefined System Scripts DESCRIPTION: This command displays information about all the predefined system scripts available for the local CKB blockchain. It helps developers understand the built-in scripts that can be utilized in their dApps. SOURCE: https://github.com/ckb-devrel/offckb/blob/master/README.md#_snippet_8 LANGUAGE: sh CODE: ``` offckb system-scripts ``` ---------------------------------------- TITLE: Managing Network Proxy Configuration in OffCKB DESCRIPTION: These commands illustrate how to set, retrieve, and remove a network proxy configuration. `offckb config set proxy ` configures a proxy, `offckb config get proxy` checks the current proxy, and `offckb config rm proxy` removes any existing proxy setting. SOURCE: https://github.com/ckb-devrel/offckb/blob/master/README.md#_snippet_33 LANGUAGE: Shell CODE: ``` offckb config set proxy http://127.0.0.1:1086 > save new settings offckb config get proxy > http://127.0.0.1:1086 offckb config rm proxy > save new settings offckb config get proxy > No Proxy. ``` ---------------------------------------- TITLE: Example Debug Output for CKB Transaction DESCRIPTION: This example demonstrates the detailed output provided by the `offckb debug` command when debugging a specific transaction hash. It shows script verification results, cycle consumption, and other relevant transaction details for both input and output scripts. SOURCE: https://github.com/ckb-devrel/offckb/blob/master/README.md#_snippet_22 LANGUAGE: Shell CODE: ``` offckb debug --tx-hash 0x64c936ee78107450d49e57b7453dce9031ce68b056b2f1cdad5c2218ab7232ad Dump transaction successfully ****************************** ****** Input[0].Lock ****** hello, this is new add! Hashed 1148 bytes in sighash_all sighash_all = 5d9b2340738ee28729fc74eba35e6ef969878354fe556bd89d5b6f62642f6e50 event = {"pubkey":"45c41f21e1cf715fa6d9ca20b8e002a574db7bb49e96ee89834c66dac5446b7a","tags":[["ckb_sighash_all","5d9b2340738ee28729fc74eba35e6ef969878354fe556bd89d5b6f62642f6e50"]],"created_at":1725339769,"kind":23334,"content":"Signing a CKB transaction\n\nIMPORTANT: Please verify the integrity and authenticity of connected Nostr client before signing this message\n","id":"90af298075ac878901282e23ce35b24e584b7727bc545e149fc259875a23a7aa","sig":"b505e7d5b643d2e6b1f0e5581221bbfe3c37f17534715e51eecf5ff97a2e1b828a3d767eb712555c78a8736e9085b4960458014fa171d5d169a1b267b186d2f3"} verify_signature costs 3654 k cycles Run result: 0 Total cycles consumed: 4013717(3.8M) Transfer cycles: 44947(43.9K), running cycles: 3968770(3.8M) ****************************** ****** Output[0].Type ****** verify_signature costs 3654 k cycles Run result: 0 Total cycles consumed: 3916670(3.7M) Transfer cycles: 43162(42.2K), running cycles: 3873508(3.7M) ``` ---------------------------------------- TITLE: Exporting System Scripts in CCC Style DESCRIPTION: This command prints the system scripts information in a CCC (CKB Contract Compiler) style format. This format might be preferred for specific tooling or development workflows that align with CCC conventions. SOURCE: https://github.com/ckb-devrel/offckb/blob/master/README.md#_snippet_10 LANGUAGE: sh CODE: ``` offckb system-scripts --export-style ccc ``` ---------------------------------------- TITLE: Listing All OffCKB Configuration Settings DESCRIPTION: This command displays all current configuration settings managed by the OffCKB CLI. It provides an overview of the active settings, which can include CKB version, network proxy, and other customizable parameters. SOURCE: https://github.com/ckb-devrel/offckb/blob/master/README.md#_snippet_31 LANGUAGE: Shell CODE: ``` offckb config list ``` ---------------------------------------- TITLE: Resolving Node.js Module Permission Issues for OffCKB DESCRIPTION: These commands provide a solution for `sudo` permission problems encountered during OffCKB installation or usage. The `chown` command grants the current user write access to the `node_modules` directory, followed by `npm install -g` to globally install the OffCKB CLI. SOURCE: https://github.com/ckb-devrel/offckb/blob/master/README.md#_snippet_34 LANGUAGE: Shell CODE: ``` sudo chown -R $(whoami) /usr/local/lib/node_modules npm install -g @offckb/cli ``` ---------------------------------------- TITLE: Navigating to Frontend Directory (Shell) DESCRIPTION: This command changes the current directory to the `frontend` workspace. This is a prerequisite for running any frontend-specific commands, such as installing dependencies or starting the development server. SOURCE: https://github.com/ckb-devrel/offckb/blob/master/templates/v3/remix-vite-template/README.md#_snippet_4 LANGUAGE: Shell CODE: ``` cd frontend ```