### Install OffCKB CLI Globally Source: https://docs.nervos.org/docs/getting-started/quick-start Installs the OffCKB command-line interface globally, enabling quick setup of a local CKB Devnet with pre-funded test accounts and built-in scripts like Omnilock and Spore-contract. ```Shell npm install -g @offckb/cli ``` -------------------------------- ### Nervos Devnet Startup Output Source: https://docs.nervos.org/docs/dapp/create-token Example output displayed when starting the Nervos Devnet, showing the installation of CKB, initialization of the Devnet configuration, and CKB version information. ```Bash /bin/sh: /Users/nervosDocs/.nvm/versions/node/v18.12.1/lib/node_modules/@offckb/cli/target/ckb/ckb: No such file or directory /Users/nervosDocs/.nvm/versions/node/v18.12.1/lib/node_modules/@offckb/cli/target/ckb/ckb not found, download and install the new version 0.113.1.. CKB installed successfully. init Devnet config folder: /Users/nervosDocs/.nvm/versions/node/v18.12.1/lib/node_modules/@offckb/cli/target/devnet modified /Users/nervosDocs/.nvm/versions/node/v18.12.1/lib/node_modules/@offckb/cli/target/devnet/ckb-miner.toml CKB output: 2024-03-20 07:56:44.765 +00:00 main INFO sentry sentry is disabled CKB output: 2024-03-20 07:56:44.766 +00:00 main INFO ckb_bin::helper raise_fd_limit newly-increased limit: 61440 CKB output: 2024-03-20 07:56:44.854 +00:00 main INFO ckb_bin::subcommand::run ckb version: 0.113.1 (95ad24b 2024-01-31) CKB output: 2024-03-20 07:56:45.320 +00:00 main INFO ckb_db_migration Init database version 20230206163640 CKB output: 2024-03-20 07:56:45.329 +00:00 main INFO ckb_launcher Touch chain spec hash: Byte32(0x3036c73473a371f3aa61c588c38924a93fb8513e481fa7c8d884fc4cf5fd368a) ``` -------------------------------- ### Run Nervos dApp Example Source: https://docs.nervos.org/docs/dapp/create-token Installs Node.js dependencies using `yarn` and then starts the dApp example, specifying `devnet` as the network. This command launches the application, typically making it accessible via a local server. ```Bash yarn && NETWORK=devnet yarn start ``` -------------------------------- ### Install Dependencies and Run dApp Development Server Source: https://docs.nervos.org/docs/getting-started/quick-start This command first installs all necessary Node.js dependencies for the dApp's frontend using `npm i`, and then starts the development server with `npm run dev`. The dApp will then be accessible via `localhost:3000`. ```bash npm i && npm run dev ``` -------------------------------- ### Nervos dApp Example Startup Output Source: https://docs.nervos.org/docs/dapp/create-token Output from starting the dApp example, indicating that Parcel is bundling the `index.html` and the development server is running, typically at `http://localhost:1234`. ```Bash $ parcel index.html Server running at http://localhost:1234 ✨ Built in 66ms ``` -------------------------------- ### Setup ckb-js-vm Source: https://docs.nervos.org/docs/getting-started/installation-guide Set up ckb-js-vm, which is built from the QuickJS engine, to enable writing and executing JavaScript Scripts within the CKB-VM environment. This involves cloning the repository, updating submodules, and building the project. ```bash git clone https://github.com/nervosnetwork/ckb-js-vm cd ckb-js-vm git submodule update --init make all ``` -------------------------------- ### Start CKB Devnet with offckb Source: https://docs.nervos.org/docs/getting-started/quick-start This command initiates a local CKB blockchain development network. It handles the download and installation of CKB if not found, and then starts the node, making the RPC endpoint available at `localhost:8114`. ```bash offckb node ``` -------------------------------- ### Start Nervos Devnet with offckb CLI Source: https://docs.nervos.org/docs/dapp/create-token Initiates the Nervos Devnet using the `offckb node` command. This step is crucial for interacting with the dApp and requires the `@offckb/cli` package to be installed. ```Bash offckb node ``` -------------------------------- ### Install Scoop Package Manager (Windows) Source: https://docs.nervos.org/docs/getting-started/installation-guide Install Scoop, a command-line installer for Windows, by first enabling script execution and then running the Scoop installation script. Scoop simplifies the installation of development tools on Windows. ```powershell Set-ExecutionPolicy RemoteSigned -Scope CurrentUser iwr -useb get.scoop.sh | iex ``` -------------------------------- ### Omnilock-Metamask Project Setup and Execution Source: https://docs.nervos.org/docs/common-scripts/omnilock Commands to build, release, navigate to, and start the Omnilock-Metamask example project. ```Shell npm run build npm run build-release cd examples/omni-lock-metamask npm start ``` -------------------------------- ### Navigate to dApp Frontend Directory Source: https://docs.nervos.org/docs/getting-started/quick-start This command changes the current directory to the `frontend` workspace of the dApp project. This is a prerequisite step before installing dependencies and running the dApp. ```bash cd frontend ``` -------------------------------- ### offckb Project Creation Success Output Source: https://docs.nervos.org/docs/getting-started/quick-start This output confirms the successful cloning and setup of a new dApp project directory after selecting a template. It indicates the source of the template and its new location on the file system. ```console Cloning into '/Users/Desktop/offckb/templates/temp-clone-folder'... Folder examples/next-js-template downloaded successfully from https://github.com/nervosnetwork/docs.nervos.org and moved to /Users/nervosDocs/Desktop/offckb/my-dapp-project ``` -------------------------------- ### Run Example dApp with Yarn on Devnet Source: https://docs.nervos.org/docs/dapp/create-dob This snippet provides the command to install Node.js dependencies and start an example dApp, ensuring it connects to the local Devnet. It shows the `yarn` command for dependency management and starting the application, along with the output indicating the server is running and the build is complete. ```shell yarn && NETWORK=devnet yarn start ``` ```text $ parcel index.html Server running at http://localhost:1234 ✨ Built in 66ms ``` -------------------------------- ### Install Xcode Command Line Tools Source: https://docs.nervos.org/docs/getting-started/installation-guide This command initiates the installation of the Xcode command line developer tools, which are necessary for various development activities on macOS. ```shell xcode-select --install ``` -------------------------------- ### Install Cargo-generate (≥0.17.0) Source: https://docs.nervos.org/docs/getting-started/installation-guide Install cargo-generate, a Rust project templating tool, to quickly set up new Rust projects from pre-defined templates. This helps maintain consistent project structures. ```bash cargo install cargo-generate ``` -------------------------------- ### CKB Devnet Startup Output Source: https://docs.nervos.org/docs/getting-started/quick-start This output shows the detailed log of the `offckb node` command, including CKB installation, configuration initialization, and the CKB node's startup messages, confirming the devnet is active. ```console /bin/sh: /Users/nervosDocs/.nvm/versions/node/v18.12.1/lib/node_modules/@offckb/cli/target/ckb/ckb: No such file or directory /Users/nervosDocs/.nvm/versions/node/v18.12.1/lib/node_modules/@offckb/cli/target/ckb/ckb not found, download and install the new version 0.113.1.. CKB installed successfully. init Devnet config folder: /Users/nervosDocs/.nvm/versions/node/v18.12.1/lib/node_modules/@offckb/cli/target/devnet modified /Users/nervosDocs/.nvm/versions/node/v18.12.1/lib/node_modules/@offckb/cli/target/devnet/ckb-miner.toml CKB output: 2024-03-20 07:56:44.765 +00:00 main INFO sentry sentry is disabled CKB output: 2024-03-20 07:56:44.766 +00:00 main INFO ckb_bin::helper raise_fd_limit newly-increased limit: 61440 CKB output: 2024-03-20 07:56:44.854 +00:00 main INFO ckb_bin::subcommand::run ckb version: 0.113.1 (95ad24b 2024-01-31) CKB output: 2024-03-20 07:56:45.320 +00:00 main INFO ckb_db_migration Init database version 20230206163640 CKB output: 2024-03-20 07:56:45.329 +00:00 main INFO ckb_launcher Touch chain spec hash: Byte32(0x3036c73473a371f3aa61c588c38924a93fb8513e481fa7c8d884fc4cf5fd368a) ``` -------------------------------- ### Install OffCKB CLI Source: https://docs.nervos.org/docs/getting-started/installation-guide Installs the OffCKB command-line interface globally, which sets up a local CKB Devnet for testing dApps without connecting to the main network. We recommend using version ≥v0.3.0. Requires Node.js. ```Shell npm install -g @offckb/cli ``` -------------------------------- ### Install Git Version Control (≥2.40.0) Source: https://docs.nervos.org/docs/getting-started/installation-guide Install Git, a widely used version control system for tracking changes in source code during software development. Instructions are provided for macOS and Linux. ```bash brew install git ``` ```apt sudo apt install git ``` -------------------------------- ### Start Frontend Development Server for CKB Project Source: https://docs.nervos.org/docs/sdk-and-devtool/offckb Commands to navigate into the frontend directory of an OffCKB project, install dependencies, and start the development server. ```shell cd frontend && npm i & npm run dev ``` -------------------------------- ### Run dApp Example on Devnet Source: https://docs.nervos.org/docs/dapp/transfer-ckb Navigates to the project directory, installs Node.js dependencies using `yarn`, and starts the dApp example, configuring it to connect to the local Devnet. The application will then be accessible via a local server. ```shell yarn && NETWORK=devnet yarn start ``` ```text ``` -------------------------------- ### Install CKB CLI for dApp Development Source: https://docs.nervos.org/index This command installs the `@offckb/cli` globally using npm, allowing developers to immediately start building dApps on the CKB Devnet. ```shell npm install -g @offckb/cli ``` -------------------------------- ### Install CKB-Debugger (≥0.113.0) Source: https://docs.nervos.org/docs/getting-started/installation-guide Install CKB-Debugger, a command-line interface tool for off-chain CKB Script development and testing. This tool is essential for debugging CKB scripts outside the blockchain environment. ```bash cargo install --git https://github.com/nervosnetwork/ckb-standalone-debugger ckb-debugger ``` -------------------------------- ### Install Rust and Add riscv64 Target (≥v1.71.1) Source: https://docs.nervos.org/docs/getting-started/installation-guide Install the Rust programming language and add the 'riscv64imac-unknown-none-elf' target, which is essential for CKB development. Instructions are provided for macOS, Linux, and Windows using their respective package managers or installers. ```bash brew install rustup ``` ```bash curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh ``` ```powershell scoop install rust ``` ```bash rustup target add riscv64imac-unknown-none-elf ``` -------------------------------- ### Initialize Create React App with TypeScript Source: https://docs.nervos.org/docs/getting-started/quick-start Command to create a new React application using Create React App (CRA) with TypeScript template, demonstrating the initial setup for a frontend project. ```Bash npx create-react-app my-cra-dapp --template typescript ``` -------------------------------- ### Install Homebrew Package Manager (macOS/Linux) Source: https://docs.nervos.org/docs/getting-started/installation-guide Install Homebrew, a popular package manager for macOS and Linux, which is a prerequisite for installing many development tools. This command downloads and executes the Homebrew installation script. ```bash /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" ``` -------------------------------- ### Install Core Development Tools on Unix-based Systems Source: https://docs.nervos.org/docs/getting-started/installation-guide Installs essential development tools like Make, Sed, Bash, and coreutils using Homebrew on macOS, or apt/dnf/pacman on various Linux distributions. These tools are often pre-installed but are required for script development. Recommended versions: Make (≥v4.3), Sed (≥v4.7), Bash (≥v5.0), and sha256sum (≥v9.0). ```Shell /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" ``` ```Shell brew install make gnu-sed bash coreutils ``` ```Shell sudo apt install make sed bash coreutils # Debian/Ubuntu ``` ```Shell sudo dnf install make sed bash coreutils # Fedora ``` ```Shell sudo pacman -S make sed bash coreutils # ArchLinux ``` -------------------------------- ### Install Clang Compiler (≥v18) Source: https://docs.nervos.org/docs/getting-started/installation-guide Install Clang, a C/C++/Objective-C compiler, which is crucial for building and running CKB Scripts. This snippet provides installation commands for macOS, various Linux distributions, and Windows. ```bash brew install llvm@18 ``` ```bash wget https://apt.llvm.org/llvm.sh && chmod +x llvm.sh && sudo ./llvm.sh 18 && rm llvm.sh ``` ```dnf sudo dnf -y install clang ``` ```pacman sudo pacman --noconfirm -Syu clang ``` ```powershell scoop install llvm yasm ``` -------------------------------- ### Install CCC JavaScript SDK Packages Source: https://docs.nervos.org/docs/getting-started/installation-guide Installs the core CCC JavaScript SDK packages for interacting with CKB, helping you build transactions and interact with the blockchain. This documentation assumes a minimum version of ≥v0.0.14-alpha.0. ```Shell npm install @ckb-ccc/core ``` ```Shell npm install @ckb-ccc/ccc ``` ```Shell npm install @ckb-ccc/connector ``` ```Shell npm install @ckb-ccc/connector-react ``` -------------------------------- ### Start CKB Devnet using offckb Source: https://docs.nervos.org/docs/script/rust/rust-example-spawn-script This command initializes a local CKB Devnet instance, providing a realistic environment for testing CKB scripts and transactions. ```Shell offckb node ``` -------------------------------- ### Accept Xcode License Source: https://docs.nervos.org/docs/getting-started/installation-guide If you encounter permission or license errors after installing Xcode command line tools, run this command. You will be prompted to scroll through the license agreement and type 'agree' to accept it. ```shell sudo xcodebuild -license ``` -------------------------------- ### Install Yarn Package Manager (≥1.22.0) Source: https://docs.nervos.org/docs/getting-started/installation-guide Install Yarn, a fast and reliable package manager for JavaScript projects, globally using npm. Yarn helps manage project dependencies efficiently. ```bash npm install --global yarn ``` -------------------------------- ### Setting up HTLC Development Environment Source: https://docs.nervos.org/docs/script-course/intro-to-script-7 These commands guide the user through cloning a CKB Duktape template repository, navigating into it, installing dependencies, and building the project to prepare the development environment for HTLC script implementation. ```shell export TOP=$(pwd) git clone https://github.com/xxuejie/ckb-duktape-template htlc-template cd htlc-template npm install npm run build ``` -------------------------------- ### Start Nervos Devnet using offckb CLI Source: https://docs.nervos.org/docs/dapp/create-dob This snippet demonstrates how to initialize and start the Nervos Devnet using the `offckb` command-line interface. It shows the command to execute and the typical console output, including CKB installation, configuration, and version information, indicating a successful Devnet startup. ```shell offckb node ``` ```text /bin/sh: /Users/nervosDocs/.nvm/versions/node/v18.12.1/lib/node_modules/@offckb/cli/target/ckb/ckb: No such file or directory /Users/nervosDocs/.nvm/versions/node/v18.12.1/lib/node_modules/@offckb/cli/target/ckb/ckb not found, download and install the new version 0.113.1.. CKB installed successfully. init Devnet config folder: /Users/nervosDocs/.nvm/versions/node/v18.12.1/lib/node_modules/@offckb/cli/target/devnet modified /Users/nervosDocs/.nvm/versions/node/v18.12.1/lib/node_modules/@offckb/cli/target/devnet/ckb-miner.toml CKB output: 2024-03-20 07:56:44.765 +00:00 main INFO sentry sentry is disabled CKB output: 2024-03-20 07:56:44.766 +00:00 main INFO ckb_bin::helper raise_fd_limit newly-increased limit: 61440 CKB output: 2024-03-20 07:56:44.854 +00:00 main INFO ckb_bin::subcommand::run ckb version: 0.113.1 (95ad24b 2024-01-31) CKB output: 2024-03-20 07:56:45.320 +00:00 main INFO ckb_db_migration Init database version 20230206163640 CKB output: 2024-03-20 07:56:45.329 +00:00 main INFO ckb_launcher Touch chain spec hash: Byte32(0x3036c73473a371f3aa61c588c38924a93fb8513e481fa7c8d884fc4cf5fd368a) ``` -------------------------------- ### Start Nervos CKB Node Source: https://docs.nervos.org/docs/node/run-devnet-node This snippet demonstrates how to start the Nervos CKB node. It provides the command to execute and an example of the console output indicating the node has successfully started, initialized its database, and begun listening for network connections. ```Shell ckb run If you're using a Unix-like system, run `./ckb run` instead. ``` ```Shell 2020-06-05 11:25:31.433 +08:00 main INFO sentry sentry is disabled 2020-06-05 11:25:31.508 +08:00 main INFO ckb-db Initialize a new database 2020-06-05 11:25:31.590 +08:00 main INFO ckb-db Init database version 20191127135521 2020-06-05 11:25:31.604 +08:00 main INFO ckb-memory-tracker track current process: unsupported 2020-06-05 11:25:31.604 +08:00 main INFO main ckb version: 0.32.1 (9ebc9ce 2020-05-29) 2020-06-05 11:25:31.604 +08:00 main INFO main chain genesis hash: 0x823b2ff5785b12da8b1363cac9a5cbe566d8b715a4311441b119c39a0367488c 2020-06-05 11:25:31.604 +08:00 main INFO ckb-network Generate random key 2020-06-05 11:25:31.604 +08:00 main INFO ckb-network write random secret key to "/PATH/ckb_v0.32.1_x86_64-apple-darwin/data/network/secret_key" 2020-06-05 11:25:31.608 +08:00 NetworkRuntime INFO ckb-network p2p service event: ListenStarted { address: "/ip4/0.0.0.0/tcp/8115" } 2020-06-05 11:25:31.610 +08:00 NetworkRuntime INFO ckb-network Listen on address: /ip4/0.0.0.0/tcp/8115/p2p/QmcCGH7VeXbpV4jj7VgSEM7NANuud6TmGHV2DXPsSVrRkR 2020-06-05 11:25:31.612 +08:00 main INFO ckb-db Initialize a new database 2020-06-05 11:25:31.638 +08:00 main INFO ckb-db Init database version 20191201091330 ``` -------------------------------- ### Setting Up CKB Development Chain Source: https://docs.nervos.org/docs/script-course/intro-to-script-7 These shell commands guide the user through initializing and running a local CKB development chain. It involves setting the CKB binary path, checking its version, initializing a dev chain with specific block assembler arguments, and starting the CKB node. ```shell $ cd $TOP $ export CKB="" $ $CKB --version ckb 0.28.0 (728eff2 2020-02-04) # Block assembler args configured here correspond to the following private key: # 0x0a14c6fd7af6a3f13c9e2aacad80d78968de5d068a342828080650084bf20104 $ $CKB init -c dev -C ckb-data --ba-arg 0x5a7487f529b8b8fd4d4a57c12dc0c70f7958a196 $ $CKB run -C ckb-data ``` -------------------------------- ### Import and Use CKB Scripts in Frontend DApp Source: https://docs.nervos.org/docs/getting-started/quick-start Example TypeScript code demonstrating how to import `offckb.config` and access deployed script details like `cellDeps`, `codeHash`, `hashType`, and `args` for use in a CKB dApp frontend. ```TypeScript import offckb from "offckb.config"; const myScriptDeps: CellDep[] = offCKB.myScripts["YOUR_SCRIPT_NAME"]!.cellDeps; const myScript: Script = { codeHash: offCKB.myScripts["hash-lock"]!.codeHash, hashType: offCKB.myScripts["hash-lock"]!.hashType, args: lockArgs, }; ``` -------------------------------- ### Clean CKB Devnet Chain Data Source: https://docs.nervos.org/docs/getting-started/quick-start This command removes all existing chain data for the local CKB devnet. It is used when a fresh blockchain state is required, for example, to start development from scratch. ```bash offckb clean ``` -------------------------------- ### Run create-ccc-app generated project Source: https://docs.nervos.org/docs/integrate-wallets/ccc-wallet Steps to navigate into the newly created project directory, install its dependencies, and start the development server to run the CCC-enabled dApp locally. ```shell cd my-ckb-app ``` ```shell pnpm install ``` ```shell pnpm run dev ``` -------------------------------- ### Start offckb REPL for Transaction Construction Source: https://docs.nervos.org/docs/script/rust/rust-example-spawn-script Initiates the `offckb` REPL (Read-Eval-Print Loop) in raw mode. This provides an interactive command-line environment for constructing and sending CKB transactions, essential for testing deployed scripts. ```Shell offckb repl -r ``` ```Shell Welcome to OffCKB REPL! [[ Default Network: devnet, enableProxyRPC: true, CCC SDK: 0.0.16-alpha.3 ]] Type 'help()' to learn how to use. OffCKB > ``` -------------------------------- ### Initialize offckb Configuration in Frontend Project Source: https://docs.nervos.org/docs/getting-started/quick-start Commands to navigate into a dApp directory and initialize the `offckb` configuration file, making deployed script information available for frontend use. ```Bash cd my-cra-dapp offckb inject-config ``` -------------------------------- ### Create Full-Stack dApp Project with offckb Source: https://docs.nervos.org/docs/getting-started/quick-start This command initializes a new full-stack dApp project using the `offckb` CLI. Users are prompted to select a frontend framework like Next.js or Remix-Vite, which sets up a boilerplate with CKB script templates. ```bash offckb create ``` -------------------------------- ### Setup Development Environment for WASM to RISC-V Compilation Source: https://docs.nervos.org/docs/script-course/intro-to-script-8 This snippet provides a sequence of shell commands to clone necessary repositories (AssemblyScript, wabt, WAVM, wavm-aot-generator, ckb-standalone-debugger, ckb-binary-patcher, ckb-c-stdlib) and build them. It prepares the environment for compiling WebAssembly to RISC-V native code using WAVM and related tools. Ensure LLVM 9+ is installed and its path is correctly set for WAVM compilation. ```shell $ export TOP=$(pwd) $ git clone https://github.com/AssemblyScript/assemblyscript.git $ cd assemblyscript $ git checkout b433bc425633c3df6a4a30c735c91c78526a9eb7 $ npm install $ cd $TOP $ git clone --recursive https://github.com/WebAssembly/wabt $ cd wabt $ git checkout bec78eafbc203d81b9a6d1ce81f5a80dd7bf692a $ mkdir build $ cd build $ cmake .. $ cmake --build . $ cd $TOP $ git clone https://github.com/xxuejie/WAVM $ cd WAVM $ git checkout cb35225feeb4ba1b5a9c73cbbdb07f4cace9b359 $ mkdir build $ cd build # Make sure you are using LLVM 9+, you might need to tweak this path depending # on your environment $ cmake .. -DLLVM_DIR=/usr/lib/llvm-9/lib/cmake/llvm $ cmake --build . $ cd $TOP $ git clone https://github.com/xxuejie/wavm-aot-generator $ cd wavm-aot-generator $ git checkout 8c818747eb19494fc9c5e0289810aa7ad484a22e $ cargo build --release $ cd $TOP $ git clone https://github.com/xxuejie/ckb-standalone-debugger $ cd ckb-standalone-debugger $ git checkout 15e8813b8cb886e95e2c81bbee9f26d47a831850 $ cd bins $ cargo build --release $ cd $TOP $ git clone https://github.com/xxuejie/ckb-binary-patcher $ cd ckb-binary-patcher $ git checkout 930f0b468a8f426ebb759d9da735ebaa1e2f98ba $ cd ckb-binary-patcher $ cargo build --release $ cd $TOP $ git clone https://github.com/nervosnetwork/ckb-c-stdlib $ cd ckb-c-stdlib $ git checkout 693c58163fe37d6abd326c537447260a846375f0 ``` -------------------------------- ### Run Example DApp with Yarn and Parcel Source: https://docs.nervos.org/docs/dapp/store-data-on-cell Commands to install Node.js dependencies and start the example dApp, specifying the 'devnet' network, using Yarn and Parcel for local development. ```Shell yarn && NETWORK=devnet yarn start ``` ```CLI Output $ parcel index.html Server running at http://localhost:1234 ✨ Built in 66ms ``` -------------------------------- ### Start CKB Node2 Source: https://docs.nervos.org/docs/node/node-config Initiates the "node2" CKB instance, starting its operation using the configuration and data located in the "node2" directory. ```bash ckb -C node2 run ``` -------------------------------- ### Build Lumos for Omnilock-Metamask Example Setup Source: https://docs.nervos.org/docs/common-scripts/omnilock Provides initial shell commands to clone and build the Lumos library, including dependency installation and a check for its functionality, as a prerequisite for the Omnilock-Metamask example. ```Shell # Build Lumos git clone https://github.com/ckb-js/lumos.git cd lumos pnpm install pnpm run build # Check if it is working npx ts-node misc/config-manager.ts ``` -------------------------------- ### Start CKB Node1 Source: https://docs.nervos.org/docs/node/node-config Initiates the "node1" CKB instance, starting its operation using the configuration and data located in the "node1" directory. ```bash ckb -C node1 run ``` -------------------------------- ### Clone Nervos dApp Tutorial Repository Source: https://docs.nervos.org/docs/dapp/create-token Clones the `docs.nervos.org` repository from GitHub and navigates into the `examples/xudt` directory, preparing the environment for the dApp tutorial. ```Bash git clone https://github.com/nervosnetwork/docs.nervos.org.git cd docs.nervos.org/examples/xudt ``` -------------------------------- ### Create Script-Only Project with offckb Source: https://docs.nervos.org/docs/getting-started/quick-start This command creates a new project focused exclusively on CKB Script development, without any frontend components. It utilizes the `ckb-script-templates` tool for initialization. ```bash offckb create --script ``` -------------------------------- ### Script Development Commands for CKB dApps Source: https://docs.nervos.org/docs/getting-started/quick-start This section lists essential `make` commands for managing CKB dApp scripts, including adding new scripts, building them, and running unit tests. ```Bash make generate make build make test ``` -------------------------------- ### offckb Project Template Selection Output Source: https://docs.nervos.org/docs/getting-started/quick-start This snippet shows the interactive prompt for selecting a bare template when creating a new dApp project with `offckb`. It highlights the options available, such as Remix-Vite and Next.js, along with a description of the selected template. ```console ? Select a bare template Remix-Vite Bare Templates > Next.js Bare Templates --- A full-stack template with Next.js framework and ckb-script-templates, [next.js,tailwindcss,ckb-script-templates,typescript,rust] ``` -------------------------------- ### Deploy CKB Scripts to Testnet Source: https://docs.nervos.org/docs/getting-started/quick-start Command to deploy compiled CKB scripts to the CKB Testnet blockchain from the frontend workspace using `offckb`. ```Bash offckb deploy --network testnet ``` -------------------------------- ### Synchronize Deployed Script Information with Frontend Source: https://docs.nervos.org/docs/getting-started/quick-start Command to update the `offckb.config.ts` file in the frontend root path with the latest deployed script information after a deployment. ```Bash offckb sync-scripts ``` -------------------------------- ### Deploy CKB Scripts to Devnet Source: https://docs.nervos.org/docs/getting-started/quick-start Command to deploy compiled CKB scripts to the CKB Devnet blockchain from the frontend workspace using `offckb`. ```Bash offckb deploy --network devnet ``` -------------------------------- ### Install npm (Node.js v20.18.0 LTS) Source: https://docs.nervos.org/docs/getting-started/installation-guide Install Node.js LTS (Long Term Support) version 20.18.0, which includes npm (Node Package Manager). npm is crucial for managing JavaScript project dependencies. ```bash brew install node@20.18.0 ``` ```bash curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash - sudo apt install -y nodejs ``` -------------------------------- ### Initialize CKB-SDK-Go Client Source: https://docs.nervos.org/docs/sdk-and-devtool/go Demonstrates how to import the CKB-SDK-Go RPC package and establish a connection to a CKB node, showing example URLs for Testnet, Devnet, and Mainnet. ```go import ( "github.com/nervosnetwork/ckb-sdk-go/v2/rpc" ) testnetURL := "https://testnet.ckb.dev" // Testnet devnetURL := "http://127.0.0.1:8114" // Devnet mainnetURL := "https://mainnet.ckb.dev/rpc" // Mainnet // Connect to Testnet ckbClient, err := rpc.Dial(testnetURL) ``` -------------------------------- ### Build and Run Lumos Omnilock-Solana Example Source: https://docs.nervos.org/docs/common-scripts/omnilock Provides shell commands to clone, build, and run the Lumos library and the Omnilock-Solana example project. It includes steps for dependency installation and verification. ```Shell # Build Lumos git clone https://github.com/ckb-js/lumos.git cd lumos pnpm install pnpm run build # Check if it is working npx ts-node misc/config-manager.ts # Start to work on Omnilock-Solana npm run build cd examples/omni-lock-solana npm start ``` -------------------------------- ### Initialize CKB Script Project with offckb Source: https://docs.nervos.org/docs/script/rust/rust-example-spawn-script Initializes a new CKB script project named 'spawn-script' using the `offckb create` command. This sets up the basic directory structure and configuration for the project. ```Bash offckb create --script spawn-script ``` ```Shell Output ⚠️ Favorite `gh:cryptape/ckb-script-templates` not found in config, using it as a git repository: https://github.com/cryptape/ckb-script-templates.git 🤷 Project Name: spawn-script 🔧 Destination: /tmp/spawn-script ... 🔧 project-name: spawn-script ... 🔧 Generating template ... 🔧 Moving generated files into: `/tmp/spawn-script`... 🔧 Initializing a fresh Git repository ✨ Done! New project created /tmp/spawn-script ``` -------------------------------- ### Verify CKB and CKB-CLI Installation and Output Source: https://docs.nervos.org/docs/node/run-devnet-node This snippet provides the command to check installed CKB and CKB-CLI versions, along with an example of the expected output. This is crucial for confirming a successful installation and identifying current software versions, including handling macOS security prompts. ```Shell ./ckb --version ./ckb-cli --version ``` ```Shell ckb 0.115.0 (d845cbf 2024-04-01) ckb-cli 1.8.0-rc1 (cf4159b 2024-03-28) ``` -------------------------------- ### Set Up Working Directory for CKB Light Client Source: https://docs.nervos.org/docs/node/run-light-client-node This snippet outlines the commands to create a dedicated folder, copy the compiled CKB light client binary and its mainnet configuration file into it, and navigate into the new directory. This organizes the necessary files for running the light client. ```Shell mkdir ~/light-client cp target/release/ckb-light-client ~/light-client/ cp config/mainnet.toml ~/light-client/ cd ~/light-client ``` -------------------------------- ### Underlying CKB Contract Build Steps Source: https://docs.nervos.org/docs/script/js/js-quick-start Shows the individual commands executed during the `pnpm build` process. This includes TypeScript type checking (`tsc`), JavaScript bundling and minification (`esbuild`), and compilation of JavaScript to CKB-VM bytecode (`ckb-debugger`) for better performance and lower cycle consumption. ```Shell tsc --noEmit esbuild --platform=neutral --minify --bundle --external:@ckb-js-std/bindings --target=es2022 src/index.ts --outfile=dist/index.js ckb-debugger --read-file dist/index.js --bin node_modules/ckb-testtool/src/unittest/defaultScript/ckb-js-vm -- -c dist/index.bc ``` -------------------------------- ### Start Nervos CKB Miner Source: https://docs.nervos.org/docs/node/run-devnet-node This snippet shows how to start the CKB miner in a separate terminal. It includes the command to initiate mining and an example of the console output, which displays 'Found!' messages indicating successful block discoveries. ```Shell ckb miner If you're using a Unix-like system, run `./ckb miner` instead. ``` ```Shell 2020-06-05 11:25:37.867 +08:00 main INFO sentry sentry is disabled EaglesongSimple-Worker-0 ⠁ [00:00:00] 2020-06-05 11:25:37.870 +08:00 main INFO ckb-memory-tracker track current proceFound! #1 0x57e6ad0f15bacc4f30e53811d488d895e6619c17222981eca5484f0115f84acd Found! #2 0xe5831f39f928dca599a02e490c482a881ccdc47a2376371dec4e440e363fa5c0 Found! #3 0x605b3e6449954c2daa996c06b2412bbf60b8231763149742119fb623f9de27b2 Found! #4 0x64064e7257ea4589e8cb177cf119c68ab1b4559de005a20dc13ef3d42949e04b ``` -------------------------------- ### Debug a full CKB transaction with offckb CLI Source: https://docs.nervos.org/docs/getting-started/quick-start Use the `offckb debug` command to verify all scripts within a transaction and print detailed execution information. This is particularly useful for debugging failed transactions when using the `offckb` dApp template. The output provides insights into script execution, cycle consumption, and event logs. ```Shell offckb debug ``` ```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) ``` -------------------------------- ### Internal Implementation Example of `default_alloc!` Source: https://docs.nervos.org/docs/script/rust/rust-api-entry This Rust code provides a simplified example of how the `default_alloc!` macro might be implemented internally. It declares a `#[global_allocator]` using `buddy_alloc` with fixed and dynamic heap regions, demonstrating the underlying memory management setup for CKB scripts. ```Rust #[global_allocator] static ALLOC: buddy_alloc::NonThreadsafeAlloc = unsafe { #[repr(align(64))] struct _AlignedHeap([u8; N]); const FIXED_BLOCK_HEAP_SIZE: usize = 4 * 1024; const HEAP_SIZE: usize = 516 * 1024; const MIN_BLOCK_SIZE: usize = 64; static mut _BUDDY_HEAP: _AlignedHeap = _AlignedHeap([0u8; HEAP_SIZE]); static mut _FIXED_BLOCK_HEAP: _AlignedHeap = _AlignedHeap([0u8; FIXED_BLOCK_HEAP_SIZE]); use buddy_alloc::{BuddyAllocParam, FastAllocParam, NonThreadsafeAlloc}; #[allow(static_mut_refs)] NonThreadsafeAlloc::new( FastAllocParam::new(_FIXED_BLOCK_HEAP.0.as_ptr(), FIXED_BLOCK_HEAP_SIZE), BuddyAllocParam::new_with_zero_filled( _BUDDY_HEAP.0.as_ptr(), HEAP_SIZE, MIN_BLOCK_SIZE, ), ) }; ``` -------------------------------- ### List Pre-funded Nervos Devnet Accounts Source: https://docs.nervos.org/docs/dapp/create-token Executes the `offckb accounts` command to display a list of pre-funded accounts available on the Devnet. This output includes private keys, public keys, lock scripts, and addresses, which can be copied for later use in the dApp. ```Bash offckb accounts ``` -------------------------------- ### Demonstrate CKB VM State Dumping and Reuse Source: https://docs.nervos.org/docs/script-course/intro-to-script-9 This snippet shows how to use `ckb-standalone-debugger` to dump a CKB VM's initialized state and then reuse it. The first command executes `dump_load0` which performs setup and calls a dump syscall, saving the VM state to `dump0.bin`. The second command then executes `dump0.bin` directly, demonstrating a significant reduction in total cycles consumed by skipping the initialization. ```bash $ cd $TOP $ RUST_LOG=debug ./runner.rb ckb-duktape/build/dump_load0 ckb-duktape-template/build/duktape.js dump0.bin Executing: ckb-standalone-debugger/bins/target/release/ckb-debugger --tx-file tx.json --script-group-type lock -i 0 -e input -d dump0.bin DEBUG:: script group: Byte32(0xb5656359cbcd52cfa68e163cdd217657f0cfc533c909d13a1fdd8032f6b4f1f0) DEBUG OUTPUT: 0x32e555f3ff8e135cece1351a6a2971518392c1e30375c1e006ad0ce8eac07947c219351b150b900e50a7039f1e448b844110927e5fd9bd30425806cb8ddff1fd970dd9a8 Run result: Ok(0) Total cycles consumed: 20199104 Transfer cycles: 67352, running cycles: 20131752 $ RUST_LOG=debug ./runner.rb dump0.bin ckb-duktape-template/build/duktape.js Executing: ckb-standalone-debugger/bins/target/release/ckb-debugger --tx-file tx.json --script-group-type lock -i 0 -e input DEBUG:: script group: Byte32(0x51959c6288a1cfba0d7f7dc8c5a90cf9a84bf5b58f1d5ed3b355497d119fba16) DEBUG OUTPUT: 0x32e555f3ff8e135cece1351a6a2971518392c1e30375c1e006ad0ce8eac07947c219351b150b900e50a7039f1e448b844110927e5fd9bd30425806cb8ddff1fd970dd9a8 Run result: Ok(0) Total cycles consumed: 16249542 Transfer cycles: 96998, running cycles: 16152544 ``` -------------------------------- ### Get Live Cell using CKB-CLI RPC Source: https://docs.nervos.org/docs/sdk-and-devtool/ckb-cli An example of using `ckb-cli` to invoke the `get_live_cell` RPC method, querying a specific cell by its transaction hash and output index. ```Shell ckb-cli rpc get_live_cell --tx-hash 0x4ec75b5a8de8d180853d5046760a99285c73283a5dc528f81d6ee056f5335172 --index 0 ``` -------------------------------- ### Execute CKB Contract Bytecode Source: https://docs.nervos.org/docs/script/js/js-quick-start Command to execute the compiled CKB contract bytecode (`.bc` file) using `ckb-debugger`. It demonstrates loading the bytecode file and running it with `ckb-js-vm`, showing the output and cycle consumption, highlighting the performance benefits of bytecode. ```Shell ckb-debugger --read-file dist/hello-world.bc --bin deps/ckb-js-vm -- -r ``` ```Output Script log: Run from file, local access enabled. For Testing only. Script log: Hello World! Run result: 0 All cycles: 3579033(3.4M) ``` -------------------------------- ### Start Nervos CKB Devnet Source: https://docs.nervos.org/docs/dapp/store-data-on-cell Command to initialize and run the local CKB Devnet using the @offckb/cli tool, along with its expected output, including installation and initialization logs. ```Shell offckb node ``` ```CLI Output /bin/sh: /Users/nervosDocs/.nvm/versions/node/v18.12.1/lib/node_modules/@offckb/cli/target/ckb/ckb: No such file or directory /Users/nervosDocs/.nvm/versions/node/v18.12.1/lib/node_modules/@offckb/cli/target/ckb/ckb not found, download and install the new version 0.113.1.. CKB installed successfully. init Devnet config folder: /Users/nervosDocs/.nvm/versions/node/v18.12.1/lib/node_modules/@offckb/cli/target/devnet modified /Users/nervosDocs/.nvm/versions/node/v18.12.1/lib/node_modules/@offckb/cli/target/devnet/ckb-miner.toml CKB output: 2024-03-20 07:56:44.765 +00:00 main INFO sentry sentry is disabled CKB output: 2024-03-20 07:56:44.766 +00:00 main INFO ckb_bin::helper raise_fd_limit newly-increased limit: 61440 CKB output: 2024-03-20 07:56:44.854 +00:00 main INFO ckb_bin::subcommand::run ckb version: 0.113.1 (95ad24b 2024-01-31) CKB output: 2024-03-20 07:56:45.320 +00:00 main INFO ckb_db_migration Init database version 20230206163640 CKB output: 2024-03-20 07:56:45.329 +00:00 main INFO ckb_launcher Touch chain spec hash: Byte32(0x3036c73473a371f3aa61c588c38924a93fb8513e481fa7c8d884fc4cf5fd368a) ``` -------------------------------- ### Get Current Process ID (Rust API) Source: https://docs.nervos.org/docs/script/rust/rust-api-spawn Retrieves the current process ID. The root process ID is 0. Each script in a transaction is treated as a separate process, starting from ID `0`. ```APIDOC pub fn process_id() -> u64 Parameters: None Returns: Process ID ``` -------------------------------- ### Get CKB Block Information with Java SDK Source: https://docs.nervos.org/docs/sdk-and-devtool/java This example demonstrates how to use the `ckb-sdk-java` client to call CKB RPC APIs. Specifically, it shows a simple method to retrieve block information by providing a block hash. ```Java byte[] blockHash = Numeric.hexStringToByteArray("0x77fdd22f6ae8a717de9ae2b128834e9b2a1424378b5fc95606ba017aab5fed75"); Block block = ckbApi.getBlock(blockHash); System.out.println("Block: " + block); ``` -------------------------------- ### Execute JavaScript with ckb-debugger Source: https://docs.nervos.org/docs/script/js/js-quick-start Demonstrates how to run a simple JavaScript snippet directly using `ckb-debugger` and `ckb-js-vm`. It shows the command-line arguments for specifying the VM binary and passing JavaScript code for execution, along with the expected output. ```Shell ckb-debugger --bin ckb-js-vm -- -e "console.log(\"hello, ckb-js-script!\");" ``` ```Output Script log: hello, ckb-js-script! Run result: 0 All cycles: 3013129(2.9M) ``` -------------------------------- ### Build CKB-VM Contract Project Source: https://docs.nervos.org/docs/script/js/js-quick-start Command to build the CKB-VM contract project using `pnpm build`. This command triggers the pre-configured build process, including type validation, bundling, and bytecode compilation for optimized performance. ```Shell pnpm build ``` -------------------------------- ### List All OffCKB Configuration Settings Source: https://docs.nervos.org/docs/sdk-and-devtool/offckb Provides the command to display all available OffCKB configuration options and the path to the settings JSON file. ```Shell offckb config list ``` -------------------------------- ### Get CKB Block Information by Number in Rust Source: https://docs.nervos.org/docs/sdk-and-devtool/rust This example illustrates how to fetch block information from a CKB node using the previously set up CkbRpcClient. It retrieves the genesis block (block number 0) and prints its details in a pretty-formatted JSON string. ```Rust let block = ckb_client.get_block_by_number(0.into()).unwrap(); println!("block: {}", serde_json::to_string_pretty(&block).unwrap()); ``` -------------------------------- ### Setup CKB Duktape and Standalone Debugger Source: https://docs.nervos.org/docs/script-course/intro-to-script-9 This snippet provides shell commands to clone and build the `ckb-duktape` project within a Docker container, and then clone and build the `ckb-standalone-debugger`. These steps prepare the necessary tools for running and debugging CKB scripts. ```Shell $ cd $TOP $ git clone --recursive https://github.com/xxuejie/ckb-duktape $ cd ckb-duktape $ git checkout d6241938247b402ec56c7af218acfc9049ac753d $ docker run --rm -it -v `pwd`:/code nervos/ckb-riscv-gnu-toolchain:bionic-20191209 bash root@0d31cad7a539:~# cd /code root@0d31cad7a539:/code# make root@0d31cad7a539:/code# exit exit $ cd $TOP $ git clone https://github.com/xxuejie/ckb-standalone-debugger $ cd ckb-standalone-debugger/bins $ git checkout 3c503b95962e29057b248aeed4f639180c132fff $ cargo build --release ``` -------------------------------- ### Clone the Simple Lock DApp Repository Source: https://docs.nervos.org/docs/dapp/simple-lock Commands to clone the `docs.nervos.org` repository and navigate into the `examples/simple-lock` directory, which contains the tutorial's dApp source code. ```Bash git clone https://github.com/nervosnetwork/docs.nervos.org.git cd docs.nervos.org/examples/simple-lock ``` -------------------------------- ### Query CKB Tip Block Number via WebSocket RPC Source: https://docs.nervos.org/docs/dapp/rpcs Example of sending a JSON RPC request to get the current tip block number of the CKB chain and its corresponding response, demonstrating a basic RPC call over WebSocket. ```JSON > {"id": 2, "jsonrpc": "2.0", "method": "get_tip_block_number", "params": []} < {"jsonrpc":"2.0","result":"0x76887","id":2} ``` -------------------------------- ### Run Nervos DApp Frontend Source: https://docs.nervos.org/docs/dapp/simple-lock This command navigates to the dApp's frontend directory, installs necessary Node.js dependencies using `npm i`, and then starts the development server with `npm run dev`. The dApp will then be accessible via a local URL, typically http://localhost:3000. ```Shell cd frontend && npm i && npm run dev ``` ```Console > frontend@0.1.0 dev > next dev ▲ Next.js 14.2.3 - Local: http://localhost:3000 - Environments: .env ✓ Starting... ✓ Ready in 1631ms ``` -------------------------------- ### Nervos Devnet Account List Output Source: https://docs.nervos.org/docs/dapp/create-token Example JSON output showing pre-funded accounts on the Nervos Devnet. Each account is funded with 42,000,000,000 CKB capacity in the genesis block and includes details like private key, public key, lock script, and address. ```JSON Print account list, each account is funded with 42_000_000_00000000 capacity in the genesis block. [ { privkey: '0x6109170b275a09ad54877b82f7d9930f88cab5717d484fb4741ae9d1dd078cd6', pubkey: '0x02025fa7b61b2365aa459807b84df065f1949d58c0ae590ff22dd2595157bffefa', lockScript: { codeHash: '0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8', hashType: 'type', args: '0x8e42b1999f265a0078503c4acec4d5e134534297' }, address: 'ckt1qzda0cr08m85hc8jlnfp3zer7xulejywt49kt2rr0vthywaa50xwsqvwg2cen8extgq8s5puft8vf40px3f599cytcyd8', args: '0x8e42b1999f265a0078503c4acec4d5e134534297' }, { privkey: '0x9f315d5a9618a39fdc487c7a67a8581d40b045bd7a42d83648ca80ef3b2cb4a1', pubkey: '0x026efa0579f09cc7c1129b78544f70098c90b2ab155c10746316f945829c034a2d', lockScript: { codeHash: '0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8', hashType: 'type', args: '0x758d311c8483e0602dfad7b69d9053e3f917457d' }, address: 'ckt1qzda0cr08m85hc8jlnfp3zer7xulejywt49kt2rr0vthywaa50xwsqt435c3epyrupszm7khk6weq5lrlyt52lg48ucew', args: '0x758d311c8483e0602dfad7b69d9053e3f917457d' }, #... ] ``` -------------------------------- ### Implement Hello World CKB Contract Source: https://docs.nervos.org/docs/script/js/js-quick-start Example TypeScript code for a simple 'Hello World' CKB contract. It demonstrates the basic structure, including importing `bindings` and using `bindings.exit` to return the contract's execution result, which is a mandatory step for CKB contracts. ```TypeScript import * as bindings from "@ckb-js-std/bindings"; function main(): number { console.log("Hello World!"); return 0; } bindings.exit(main()); ``` -------------------------------- ### Compose CKB Transaction for CKB Transfer (JavaScript) Source: https://docs.nervos.org/docs/sdk-and-devtool/ccc This JavaScript example demonstrates how to compose a CKB transaction using `ccc.Transaction`. It covers setting transaction outputs, completing inputs based on capacity, specifying a transaction fee rate, and sending the transaction to get its hash. Requires a connected signer. ```JavaScript const tx = ccc.Transaction.from({ outputs: [{ lock: toLock, capacity: ccc.fixedPointFrom(amount) }], }); // Instruct CCC to complete the transaction await tx.completeInputsByCapacity(signer); await tx.completeFeeBy(signer, 1000); // Specify the transaction fee rate const txHash = await signer.sendTransaction(tx); // Send and get the transaction hash ``` -------------------------------- ### Create New Java Project with Gradle Source: https://docs.nervos.org/docs/sdk-and-devtool/java Initializes a new Java project directory and sets up a basic Gradle project structure, preparing the environment for CKB-SDK-Java integration. ```bash mkdir ckb-java-example cd ckb-java-example gradle init ``` -------------------------------- ### Start OffCKB Node.js REPL for CKB Development Source: https://docs.nervos.org/docs/sdk-and-devtool/offckb Launch the OffCKB custom Node.js REPL, which comes pre-configured with built-in variables and functions tailored for CKB development. This interactive environment is ideal for quick script testing and direct interaction with the CKB blockchain, minimizing setup effort. ```shell offckb repl --network ``` -------------------------------- ### APIDOC: Table Data Type Serialization Example Source: https://docs.nervos.org/docs/serialization/encoding-specs Provides a detailed serialization example for a `MixedType` table, showing the full size, offsets, and serialized bytes for various field types. ```APIDOC # the full size is 43 (0x2b) bytes 2b 00 00 00 # five offsets (20 bytes in total) 18 00 00 00, 1c 00 00 00, 1d 00 00 00, 21 00 00 00, 24 00 00 00 # five items (19 bytes in total) 00 00 00 00 ab 23 01 00 00 45 67 89 03 00 00 00, ab cd ef ```