### Example: Generating Native Simulator for a Specific Crate - Shell Source: https://github.com/cryptape/ckb-script-templates/blob/main/README.md Provides a concrete example of using the `make generate-native-simulator` command to build the native simulator specifically for the `example_crate` subproject. ```Shell make generate-native-simulator CRATE=example_crate ``` -------------------------------- ### Installing cargo-generate Source: https://github.com/cryptape/ckb-script-templates/blob/main/README.md Installs the `cargo-generate` tool, a cargo subcommand used for generating projects from templates. This tool is essential for creating projects based on the `ckb-script-templates`. ```Shell cargo install cargo-generate ``` -------------------------------- ### Installing Clang on Archlinux Source: https://github.com/cryptape/ckb-script-templates/blob/main/README.md Installs the Clang compiler using the `pacman` package manager on Archlinux. Clang is a necessary dependency for building CKB contracts. ```Shell sudo pacman --noconfirm -Syu clang ``` -------------------------------- ### Running CKB Contract Tests with Make - Shell Source: https://github.com/cryptape/ckb-script-templates/blob/main/README.md Demonstrates how to execute the tests defined within the `tests` crate or similar test setups provided by the template using the simple `make test` command. ```Shell make test ``` -------------------------------- ### Installing CKB Rust Target Source: https://github.com/cryptape/ckb-script-templates/blob/main/README.md Adds the `riscv64imac-unknown-none-elf` target to your Rust installation using `rustup`. This is the required target for compiling code to run on the CKB-VM. ```Shell rustup target add riscv64imac-unknown-none-elf ``` -------------------------------- ### Building CKB Contracts with Make - Shell Source: https://github.com/cryptape/ckb-script-templates/blob/main/README.md Provides examples of using the `make build` command to compile CKB contracts with different configurations, including debug mode, custom rust flags, additional cargo arguments, building a specific contract, controlling build directory cleanup, and specifying the Clang version for C code. ```Shell make build make build MODE=debug make build CUSTOM_RUSTFLAGS="" make build CARGO_ARGS="--verbose" make build CONTRACT=second-contract make build CLEAN_BUILD_DIR_FIRST=false make build CLANG=clang-17 ``` -------------------------------- ### Installing Clang on Fedora Source: https://github.com/cryptape/ckb-script-templates/blob/main/README.md Installs the Clang compiler using the `dnf` package manager on Fedora 39+ systems. Clang is required for compiling parts of the CKB contracts or dependencies. ```Shell sudo dnf -y install clang ``` -------------------------------- ### Installing Clang/Yasm on Windows (Scoop) Source: https://github.com/cryptape/ckb-script-templates/blob/main/README.md Installs the Clang compiler and Yasm assembler using the Scoop package manager on Windows. These are required dependencies for building CKB contracts on Windows. ```Shell scoop install llvm yasm ``` -------------------------------- ### Installing Clang on macOS Source: https://github.com/cryptape/ckb-script-templates/blob/main/README.md Installs the Clang compiler version 18 using the Homebrew package manager on macOS. Clang is required for building CKB contracts. ```Shell brew install llvm@18 ``` -------------------------------- ### Installing Clang 18+ on Debian/Ubuntu Source: https://github.com/cryptape/ckb-script-templates/blob/main/README.md Downloads and executes a script to install Clang version 18 or newer on Debian or Ubuntu systems. This is one of the required dependencies for building CKB contracts. ```Shell wget https://apt.llvm.org/llvm.sh && chmod +x llvm.sh && sudo ./llvm.sh 18 && rm llvm.sh ``` -------------------------------- ### Updating CKB Rust Flags in Makefile Source: https://github.com/cryptape/ckb-script-templates/blob/main/README.md Shows an example line for modifying the `FULL_RUSTFLAGS` variable in a Makefile. This configuration ensures the correct RISC-V target features are enabled while disabling the atomic extension (`-a`) which might not be supported by CKB-VM, especially relevant when using crates like `bytes` with `dummy-atomic`. ```Makefile FULL_RUSTFLAGS := -C target-feature=+zba,+zbb,+zbc,+zbs,-a $(CUSTOM_RUSTFLAGS) ``` -------------------------------- ### Building and Testing Standalone Contracts with Make - Shell Source: https://github.com/cryptape/ckb-script-templates/blob/main/README.md Provides commands to build, test, check, and run clippy for a standalone CKB contract project generated using the `standalone-contract` template. ```Shell cd standalone-first-contract make build make test make check make clippy ``` -------------------------------- ### Generating Native Simulator with Make - Shell Source: https://github.com/cryptape/ckb-script-templates/blob/main/README.md Explains the command to generate a native simulator for a specific contract subproject using `make generate-native-simulator`, highlighting that the `CRATE` parameter is mandatory and must specify an existing subproject name. ```Shell make generate-native-simulator CRATE= ``` -------------------------------- ### Performing Reproducible Build with Docker Script - Shell Source: https://github.com/cryptape/ckb-script-templates/blob/main/README.md Shows how to use the `./scripts/reproducible_build_docker` script to perform reproducible builds leveraging a Docker container with locked compiler versions, including options to update checksums, skip cleaning intermediate files, and configure proxy settings for crate downloads. ```Shell ./scripts/reproducible_build_docker ./scripts/reproducible_build_docker --update ./scripts/reproducible_build_docker --no-clean ./scripts/reproducible_build_docker --proxy "..." ``` -------------------------------- ### Generating CKB Workspace with Prompt Source: https://github.com/cryptape/ckb-script-templates/blob/main/README.md Uses `cargo-generate` to create a new workspace project from the `ckb-script-templates` repository. This command prompts the user for the project name. ```Shell cargo generate gh:cryptape/ckb-script-templates workspace ``` -------------------------------- ### Listing Workspace Directory Structure Source: https://github.com/cryptape/ckb-script-templates/blob/main/README.md Uses the `tree` command to display the directory structure of the newly generated CKB workspace, showing the initial files and folders like `Cargo.toml`, `Makefile`, `scripts`, and `tests`. ```Shell tree . ``` -------------------------------- ### Using Alias for Workspace Generation Source: https://github.com/cryptape/ckb-script-templates/blob/main/README.md Executes the previously defined shell alias `create-ckb-scripts` to generate a CKB workspace, demonstrating how the alias simplifies the command. ```Shell create-ckb-scripts ``` -------------------------------- ### Generating Contract Crate in Workspace Source: https://github.com/cryptape/ckb-script-templates/blob/main/README.md Runs the `make generate` command from the workspace root to create a new contract crate within the `contracts` sub-folder. This command prompts for the contract crate name. ```Shell make generate ``` -------------------------------- ### Adding lib-dummy-atomics Git Submodule Source: https://github.com/cryptape/ckb-script-templates/blob/main/README.md Adds the `lib-dummy-atomics` library as a Git submodule in the `deps` directory. This specific library might be required by certain templates, like `atomics-contract`, to provide dummy atomic operations. ```Shell git submodule add https://github.com/xxuejie/lib-dummy-atomics deps/lib-dummy-atomics ``` -------------------------------- ### Generating CKB Workspace with Name Source: https://github.com/cryptape/ckb-script-templates/blob/main/README.md Uses `cargo-generate` to create a new workspace project from the `ckb-script-templates` repository, specifying the project name directly using the `--name` flag to skip the prompt. ```Shell cargo generate gh:cryptape/ckb-script-templates workspace --name my-first-contract-workspace ``` -------------------------------- ### Generating Standalone Contract Project with Cargo - Shell Source: https://github.com/cryptape/ckb-script-templates/blob/main/README.md Illustrates the use of `cargo generate` with the specified GitHub template to create a standalone CKB contract project outside of the default workspace structure. ```Shell cargo generate gh:cryptape/ckb-script-templates standalone-contract ``` -------------------------------- ### Generating Named Contract Crate Source: https://github.com/cryptape/ckb-script-templates/blob/main/README.md Runs the `make generate` command, specifying the contract crate name using the `CRATE` variable. This avoids the prompt and creates the crate directly in the `contracts` folder. ```Shell make generate CRATE=second-contract ``` -------------------------------- ### Adding ckb-stack-reorg-bootloader Git Submodule Source: https://github.com/cryptape/ckb-script-templates/blob/main/README.md Adds the `ckb-stack-reorg-bootloader` library as a Git submodule in the `deps` directory. This is a dependency for the `stack-reorder-contract` template. ```Shell git submodule add https://github.com/xxuejie/ckb-stack-reorg-bootloader deps/ckb-stack-reorg-bootloader ``` -------------------------------- ### Generating Crate with Custom Template/Dest Source: https://github.com/cryptape/ckb-script-templates/blob/main/README.md Executes the `make generate` command, specifying both a different template (`c-wrapper-crate`) using `TEMPLATE` and a different destination directory (`crates`) using `DESTINATION`. This allows generating non-contract crates or contracts in custom locations. ```Shell make generate TEMPLATE=c-wrapper-crate DESTINATION=crates ``` -------------------------------- ### Generating Crate in Custom Directory Source: https://github.com/cryptape/ckb-script-templates/blob/main/README.md Runs the `make generate` command, specifying a different destination directory (e.g., `crates`) using the `DESTINATION` variable. By default, this will use the `contract` template. ```Shell make DESTINATION=crates ``` -------------------------------- ### Creating Shell Alias for Workspace Gen Source: https://github.com/cryptape/ckb-script-templates/blob/main/README.md Defines a shell alias `create-ckb-scripts` to shorten the command for generating a CKB workspace using `cargo-generate`. This simplifies repeated use. ```Shell alias create-ckb-scripts="cargo generate gh:cryptape/ckb-script-templates workspace" ``` -------------------------------- ### Generating Contract with Custom Template Source: https://github.com/cryptape/ckb-script-templates/blob/main/README.md Executes the `make generate` command, specifying a different template (e.g., `atomics-contract`) using the `TEMPLATE` variable instead of the default `contract` template. The crate is still created in the `contracts` subfolder. ```Shell make generate TEMPLATE=atomics-contract ``` -------------------------------- ### Adding ckb-c-stdlib Git Submodule Source: https://github.com/cryptape/ckb-script-templates/blob/main/README.md Adds the `ckb-c-stdlib` library as a Git submodule in the `deps` directory. This library is required for C code used in CKB contracts, particularly for templates like `c-wrapper-crate`. ```Shell git submodule add https://github.com/nervosnetwork/ckb-c-stdlib deps/ckb-c-stdlib ``` -------------------------------- ### Navigating into Workspace Directory Source: https://github.com/cryptape/ckb-script-templates/blob/main/README.md Changes the current directory to the newly created CKB workspace directory. This is necessary before generating contract crates within the workspace. ```Shell cd my-first-contract-workspace ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.