### Installing Dependencies and Starting Frontend App (Shell) Source: https://github.com/ckb-devrel/offckb/blob/master/templates/v3/remix-vite-template/README.md 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. ```Shell npm i && npm run dev ``` -------------------------------- ### Starting Frontend Project Development Server Source: https://github.com/ckb-devrel/offckb/blob/master/README.md 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. ```sh npm i & npm run dev ``` -------------------------------- ### Installing OffCKB CLI with npm Source: https://github.com/ckb-devrel/offckb/blob/master/README.md 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. ```sh npm install -g @offckb/cli ``` -------------------------------- ### Starting Frontend Dapp Development Server Source: https://github.com/ckb-devrel/offckb/blob/master/templates/v3/next-js-template/README.md 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. ```sh npm i && npm run dev ``` -------------------------------- ### Starting Remix Application in Production (Shell) Source: https://github.com/ckb-devrel/offckb/blob/master/templates/v3/remix-vite-template/frontend/README.md 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. ```sh npm start ``` -------------------------------- ### Starting Frontend Dapp for Testnet (Shell) Source: https://github.com/ckb-devrel/offckb/blob/master/templates/v3/remix-vite-template/README.md 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. ```Shell cd frontend NETWORK=testnet npm run dev ``` -------------------------------- ### Running Development Server for Next.js Project (Bash) Source: https://github.com/ckb-devrel/offckb/blob/master/templates/v3/next-js-template/frontend/README.md 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. ```bash npm run dev # or yarn dev # or pnpm dev # or bun dev ``` -------------------------------- ### Starting Next.js Development Server (Bash) Source: https://github.com/ckb-devrel/offckb/blob/master/templates/v3/js-script-next-js/packages/frontend/README.md 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. ```bash npm run dev # or yarn dev # or pnpm dev # or bun dev ``` -------------------------------- ### Starting Frontend App for Configured Network Source: https://github.com/ckb-devrel/offckb/blob/master/templates/v3/js-script-next-js/README.md 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. ```bash cd frontend pnpm dev ``` -------------------------------- ### Building and Starting the CKB JS VM Application (Bash) Source: https://github.com/ckb-devrel/offckb/blob/master/templates/v3/js-script-next-js/packages/on-chain-script/README.md 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. ```bash pnpm build pnpm start ``` -------------------------------- ### Starting CKB Devnet with Default Version Source: https://github.com/ckb-devrel/offckb/blob/master/README.md 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. ```sh offckb node ``` -------------------------------- ### Starting Frontend Dapp for Testnet Development Source: https://github.com/ckb-devrel/offckb/blob/master/templates/v3/next-js-template/README.md 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. ```sh cd frontend npm run dev ``` -------------------------------- ### Navigating to Frontend Directory (Shell) Source: https://github.com/ckb-devrel/offckb/blob/master/templates/v3/remix-vite-template/README.md 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. ```Shell cd frontend ``` -------------------------------- ### Installing OffCKB CLI with pnpm Source: https://github.com/ckb-devrel/offckb/blob/master/README.md 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. ```sh pnpm install -g @offckb/cli ``` -------------------------------- ### Setting CKB Network and Starting Frontend (Shell - Export) Source: https://github.com/ckb-devrel/offckb/blob/master/templates/v3/remix-vite-template/README.md 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. ```Shell export NETWORK=devnet # or testnet, mainnet npm run dev ``` -------------------------------- ### Installing Project Dependencies with pnpm Source: https://github.com/ckb-devrel/offckb/blob/master/templates/v3/js-script-next-js/README.md 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. ```bash pnpm i ``` -------------------------------- ### Managing Dependencies and npm-shrinkwrap with pnpm Source: https://github.com/ckb-devrel/offckb/blob/master/docs/develop.md 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. ```sh pnpm add // run the following to keep npm-shrinkwrap consistent with out pnpm-lock.json npm shrinkwrap ``` -------------------------------- ### Building Remix Application for Production (Shell) Source: https://github.com/ckb-devrel/offckb/blob/master/templates/v3/remix-vite-template/frontend/README.md 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. ```sh npm run build ``` -------------------------------- ### Starting Frontend Development Server with pnpm Source: https://github.com/ckb-devrel/offckb/blob/master/templates/v3/js-script-next-js/README.md This command launches the Next.js development server for the dApp frontend. It allows for local development and testing of the application. ```sh pnpm dev ``` -------------------------------- ### Setting CKB Network and Starting Frontend (Shell - Inline) Source: https://github.com/ckb-devrel/offckb/blob/master/templates/v3/remix-vite-template/README.md 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. ```Shell NETWORK=devnet npm run dev ``` -------------------------------- ### Running Vite Development Server (Shell) Source: https://github.com/ckb-devrel/offckb/blob/master/templates/v3/remix-vite-template/frontend/README.md 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. ```shellscript npm run dev ``` -------------------------------- ### Creating a New Full-stack CKB Project Source: https://github.com/ckb-devrel/offckb/blob/master/README.md 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. ```sh offckb create ``` -------------------------------- ### Starting CKB Devnet with Specific Version Source: https://github.com/ckb-devrel/offckb/blob/master/README.md 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. ```sh offckb node 0.117.0 ``` -------------------------------- ### Example Debug Output for CKB Transaction Source: https://github.com/ckb-devrel/offckb/blob/master/README.md 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. ```Shell 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) ``` -------------------------------- ### Starting OffCKB REPL Mode Source: https://github.com/ckb-devrel/offckb/blob/master/README.md 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. ```Shell offckb repl --network Welcome to OffCKB REPL! [[ Default Network: devnet, enableProxyRPC: false ]] Type 'help()' to learn how to use. OffCKB > ``` -------------------------------- ### Navigating to Frontend Workspace Source: https://github.com/ckb-devrel/offckb/blob/master/templates/v3/next-js-template/README.md 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. ```sh cd frontend ``` -------------------------------- ### Navigating to Frontend Workspace Source: https://github.com/ckb-devrel/offckb/blob/master/templates/v3/js-script-next-js/README.md 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. ```sh cd frontend ``` -------------------------------- ### Setting Default CKB Version for Devnet Source: https://github.com/ckb-devrel/offckb/blob/master/README.md 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. ```sh offckb config set ckb-version 0.117.0 offckb node ``` -------------------------------- ### Resolving Node.js Module Permission Issues for OffCKB Source: https://github.com/ckb-devrel/offckb/blob/master/README.md 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. ```Shell sudo chown -R $(whoami) /usr/local/lib/node_modules npm install -g @offckb/cli ``` -------------------------------- ### Adding New Smart Contract (Shell) Source: https://github.com/ckb-devrel/offckb/blob/master/templates/v3/remix-vite-template/README.md 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. ```Shell make generate ``` -------------------------------- ### Getting and Setting CKB Version Configuration Source: https://github.com/ckb-devrel/offckb/blob/master/README.md 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. ```Shell offckb config get ckb-version > 0.113.0 offckb config set ckb-version 0.117.0 offckb config get ckb-version > 0.117.0 ``` -------------------------------- ### Starting Standalone CKB RPC Proxy Server Source: https://github.com/ckb-devrel/offckb/blob/master/README.md 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. ```sh offckb proxy-rpc --ckb-rpc http://localhost:8114 --port 9000 --network devnet ``` -------------------------------- ### Starting CKB Devnet Without RPC Proxy Source: https://github.com/ckb-devrel/offckb/blob/master/README.md 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. ```sh offckb node --no-proxy ``` -------------------------------- ### Configuring CKB Network Target (Bash) Source: https://github.com/ckb-devrel/offckb/blob/master/templates/v3/js-script-next-js/packages/frontend/README.md 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. ```bash NEXT_PUBLIC_NETWORK=devnet # devnet, testnet or mainnet ``` -------------------------------- ### Updating Built-in Scripts with Make Source: https://github.com/ckb-devrel/offckb/blob/master/docs/develop.md 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. ```sh make all ``` -------------------------------- ### Managing Network Proxy Configuration in OffCKB Source: https://github.com/ckb-devrel/offckb/blob/master/README.md 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. ```Shell 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. ``` -------------------------------- ### Configuring CKB Network Target in Next.js (Bash) Source: https://github.com/ckb-devrel/offckb/blob/master/templates/v3/next-js-template/frontend/README.md 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. ```bash NEXT_PUBLIC_NETWORK=devnet # devnet, testnet or mainnet ``` -------------------------------- ### Retrieving Account Balance in OffCKB REPL Source: https://github.com/ckb-devrel/offckb/blob/master/README.md 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. ```JavaScript OffCKB > let myClient = Client.fromUrl(networks.testnet.rpc_url, 'testnet'); OffCKB > await myClient.getBalanceSingle(accounts[0].lockScript); 60838485293944n OffCKB > ``` -------------------------------- ### Displaying OffCKB REPL Help Information Source: https://github.com/ckb-devrel/offckb/blob/master/README.md 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). ```JavaScript 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 ``` -------------------------------- ### Deploying Smart Contracts to Devnet with offckb (Shell) Source: https://github.com/ckb-devrel/offckb/blob/master/templates/v3/remix-vite-template/README.md 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. ```Shell cd frontend offckb deploy --network devnet ``` -------------------------------- ### Deploying Smart Contracts to Testnet with offckb (Shell) Source: https://github.com/ckb-devrel/offckb/blob/master/templates/v3/remix-vite-template/README.md 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. ```Shell cd frontend offckb deploy --network testnet ``` -------------------------------- ### Displaying OffCKB CLI Usage and Commands Source: https://github.com/ckb-devrel/offckb/blob/master/README.md 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. ```sh 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 ``` -------------------------------- ### Building Smart Contract (Shell) Source: https://github.com/ckb-devrel/offckb/blob/master/templates/v3/remix-vite-template/README.md 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. ```Shell make build ``` -------------------------------- ### Deploying Smart Contracts to Devnet with offckb Source: https://github.com/ckb-devrel/offckb/blob/master/templates/v3/next-js-template/README.md 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. ```sh cd frontend offckb deploy --network devnet ``` -------------------------------- ### Listing All OffCKB Configuration Settings Source: https://github.com/ckb-devrel/offckb/blob/master/README.md 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. ```Shell offckb config list ``` -------------------------------- ### Deploying Smart Contracts to CKB Testnet with offckb Source: https://github.com/ckb-devrel/offckb/blob/master/templates/v3/js-script-next-js/README.md 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. ```sh cd frontend offckb deploy --network testnet ``` -------------------------------- ### Deploying Smart Contracts to Testnet with offckb Source: https://github.com/ckb-devrel/offckb/blob/master/templates/v3/next-js-template/README.md 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. ```sh cd frontend offckb deploy --network testnet ``` -------------------------------- ### Running Smart Contract Tests (Shell) Source: https://github.com/ckb-devrel/offckb/blob/master/templates/v3/remix-vite-template/README.md 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. ```Shell make test ``` -------------------------------- ### Listing Predefined System Scripts Source: https://github.com/ckb-devrel/offckb/blob/master/README.md 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. ```sh offckb system-scripts ``` -------------------------------- ### Building CKB Smart Contracts with pnpm Source: https://github.com/ckb-devrel/offckb/blob/master/templates/v3/js-script-next-js/README.md This command compiles the on-chain smart contracts, preparing them for deployment or testing. The smart contract project is powered by ckb-js-vm. ```bash pnpm build ``` -------------------------------- ### Building Smart Contracts with Make Source: https://github.com/ckb-devrel/offckb/blob/master/templates/v3/next-js-template/README.md This command compiles the smart contracts using `make`, preparing them for deployment or testing. It orchestrates the Rust compilation process for the `riscv64` target. ```sh make build ``` -------------------------------- ### Deploying Smart Contracts to CKB Devnet with offckb Source: https://github.com/ckb-devrel/offckb/blob/master/templates/v3/js-script-next-js/README.md 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'. ```sh cd frontend offckb deploy --network devnet ``` -------------------------------- ### Building CKB Smart Contract Project Source: https://github.com/ckb-devrel/offckb/blob/master/README.md 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. ```sh make build ``` -------------------------------- ### Creating a New Script-Only CKB Project Source: https://github.com/ckb-devrel/offckb/blob/master/README.md 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. ```sh offckb create --script ``` -------------------------------- ### Listing OffCKB Devnet Configuration Details Source: https://github.com/ckb-devrel/offckb/blob/master/README.md 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. ```sh offckb config list ``` -------------------------------- ### Running Smart Contract Tests with Make Source: https://github.com/ckb-devrel/offckb/blob/master/templates/v3/next-js-template/README.md This command executes the tests for the smart contracts using `make`. It's essential for verifying the correctness and functionality of the developed contracts. ```sh make test ``` -------------------------------- ### Running Tests for CKB Project - Bash Source: https://github.com/ckb-devrel/offckb/blob/master/templates/v3/js-script-next-js/packages/on-chain-script-tests/README.md 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. ```Bash pnpm test ``` -------------------------------- ### Building and Sending CKB Transactions in REPL Source: https://github.com/ckb-devrel/offckb/blob/master/README.md 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. ```JavaScript 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' ``` -------------------------------- ### Configuring Frontend Network to Testnet Source: https://github.com/ckb-devrel/offckb/blob/master/templates/v3/next-js-template/README.md 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. ```bash NEXT_PUBLIC_NETWORK=testnet # devnet, testnet or mainnet ``` -------------------------------- ### Deploying CKB Script from Frontend Directory Source: https://github.com/ckb-devrel/offckb/blob/master/README.md 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. ```sh cd frontend && offckb deploy --network ``` -------------------------------- ### Testing CKB Smart Contracts with pnpm Source: https://github.com/ckb-devrel/offckb/blob/master/templates/v3/js-script-next-js/README.md 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. ```bash pnpm test ``` -------------------------------- ### Configuring Frontend for CKB Testnet Source: https://github.com/ckb-devrel/offckb/blob/master/templates/v3/js-script-next-js/README.md 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. ```bash NEXT_PUBLIC_NETWORK=testnet # devnet, testnet or mainnet ``` -------------------------------- ### Running Smart Contract Tests with Debug Logs (Shell) Source: https://github.com/ckb-devrel/offckb/blob/master/templates/v3/remix-vite-template/README.md 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. ```Shell cargo test -- --nocapture ``` -------------------------------- ### Configuring Frontend Network to Devnet Source: https://github.com/ckb-devrel/offckb/blob/master/templates/v3/next-js-template/README.md 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. ```bash NEXT_PUBLIC_NETWORK=devnet # devnet, testnet or mainnet ``` -------------------------------- ### Exporting System Scripts in Lumos JSON Format Source: https://github.com/ckb-devrel/offckb/blob/master/README.md 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. ```sh offckb system-scripts --export-style lumos ``` -------------------------------- ### Replacing Script Binary for Single Cell Debugging Source: https://github.com/ckb-devrel/offckb/blob/master/README.md 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. ```Shell offckb debug --single-script --bin ``` -------------------------------- ### Generating Moleculec Bindings for Multiple Schema Files Source: https://github.com/ckb-devrel/offckb/blob/master/README.md 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. ```Shell offckb mol --schema --output-folder --lang ``` -------------------------------- ### Generating Moleculec Bindings for Single Schema File Source: https://github.com/ckb-devrel/offckb/blob/master/README.md 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. ```Shell offckb mol --schema --output --lang ``` -------------------------------- ### Deploying CKB Script with Explicit Config Path Source: https://github.com/ckb-devrel/offckb/blob/master/README.md 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. ```sh offckb deploy --network --config ``` -------------------------------- ### Creating a New dApp-Only CKB Project Source: https://github.com/ckb-devrel/offckb/blob/master/README.md 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. ```sh offckb create --dapp # or -d ``` -------------------------------- ### Adding a New Smart Contract with Make Source: https://github.com/ckb-devrel/offckb/blob/master/templates/v3/next-js-template/README.md 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. ```sh make generate ``` -------------------------------- ### Configuring CKB Network in .env Source: https://github.com/ckb-devrel/offckb/blob/master/templates/v3/js-script-next-js/README.md 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. ```bash NEXT_PUBLIC_NETWORK=devnet # devnet, testnet or mainnet ``` -------------------------------- ### Debugging CKB Transactions with OffCKB CLI Source: https://github.com/ckb-devrel/offckb/blob/master/README.md 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. ```Shell offckb debug ``` -------------------------------- ### Exporting System Scripts in CCC Style Source: https://github.com/ckb-devrel/offckb/blob/master/README.md 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. ```sh offckb system-scripts --export-style ccc ``` -------------------------------- ### Deploying Upgradable CKB Script with Type ID Source: https://github.com/ckb-devrel/offckb/blob/master/README.md 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. ```sh cd frontend && offckb deploy --type-id --network ``` -------------------------------- ### Checking Deployed CKB Scripts Information Source: https://github.com/ckb-devrel/offckb/blob/master/README.md 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. ```sh offckb my-scripts --network ``` -------------------------------- ### Debugging Single Cell Scripts in CKB Transactions Source: https://github.com/ckb-devrel/offckb/blob/master/README.md 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. ```Shell offckb debug --single-script ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.