| Crates.io | craft |
| lib.rs | craft |
| version | 0.5.1 |
| created_at | 2025-08-06 23:13:49.614133+00 |
| updated_at | 2025-08-08 17:50:03.265914+00 |
| description | Command-line tool for building, testing, and deploying XRPL smart contracts in WASM |
| homepage | https://github.com/XRPLF/craft |
| repository | https://github.com/XRPLF/craft |
| max_upload_size | |
| id | 1784432 |
| size | 318,418 |
craftAn interactive CLI tool for building and testing WASM modules for the XRP Ledger.
cargo install --path .
To update the tool, use the same command.
Docker is required to run the rippled server. You have two options:
Colima is a lightweight, open-source Docker runtime that craft can install automatically:
craft docker install # Installs Colima via Homebrew
Colima uses less memory and CPU, starts quickly, and works seamlessly with standard Docker commands. It is free to use, requires no login, and has no licensing restrictions.
Traditional option with GUI:
After installation, ensure Docker is running before using rippled-related commands.
Use specific commands:
craft
Or, run the tool without any arguments for an interactive experience:
craft
craft start-rippled # Start rippled in Docker container
craft list-rippled # List rippled Docker containers
craft stop-rippled # Stop the rippled container
craft advance-ledger # Advance the ledger in stand-alone mode
craft docker # Manage Docker runtime (install/start/stop/status)
craft open-explorer # Open the XRPL Explorer
Currently, the craft tool primarily uses interactive prompts to gather information such as build mode, optimization level, and project selection.
Build: Non-interactive build with options:
craft build [project-name] [--mode <debug|release>] [--opt <none|small|aggressive>]
Options:
project-name Name of the project subfolder under projects/ (positional argument).--mode, -m Build mode (debug or release). Default: release.--opt, -O Optimization level (none, small, aggressive). Default: small.Example:
craft build notary --mode debug --opt aggressive
The test command supports direct command-line options:
craft test --function <name> # Test a specific function in your WASM module
For scripting purposes, you may want to specify options directly without interactive prompts. If there are specific options you'd like to set via command line (for example: craft build --mode release --opt-level small), please open a GitHub issue to let us know which interactive prompts you'd like to bypass.
The test command provides an interactive environment for testing your WASM modules:
craft test
Organize your WASM modules in the projects directory:
.
├── projects/
│ └── helloworld/ # Example
│ ├── Cargo.toml
│ └── src/
│ └── lib.rs
└── ...
The tool automatically detects WASM projects in the projects directory.
This tool provides a testing environment for XLS-100d compliant WebAssembly modules. It simulates the host environment that will execute escrow finish conditions on the XRPL.
The wasm-host tool:
finish function as specified in XLS-100dTest fixtures must be placed in projects/<project>/fixtures/<test_case>/
This convention co-locates each project's test data with its source code, making projects self-contained.
Each test case directory can contain:
tx.json: Transaction dataledger_object.json: Current ledger object being testedledger_header.json: Ledger header informationledger.json: Full ledger datanfts.json: NFT data (if applicable)The notary project includes test fixtures for validating escrow finish conditions:
projects/notary/fixtures/success/): Tests when the escrow finish condition is met (transaction with the correct notary account)projects/notary/fixtures/failure/): Tests when the escrow finish condition is not met (transaction with an incorrect notary account)The host_functions_test project includes fixtures for testing various host function capabilities:
projects/host_functions_test/fixtures/success/): Tests successful execution of 26 host functionsTo clone this repository, use:
git clone git@github.com:ripple/craft.git
The craft tool uses Docker to manage a rippled instance. If Docker is not installed, craft can automatically install Colima (a lightweight Docker runtime) for you:
# Check Docker status and install if needed
craft docker # Shows status
craft docker install # Installs Colima (lightweight Docker)
craft docker start # Starts Colima
craft docker stop # Stops Colima
# Once Docker is running, manage rippled:
craft start-rippled # Start rippled container (background mode)
craft start-rippled --foreground # With visible console output
craft list-rippled # List running rippled containers
craft stop-rippled # Stop the rippled container
The tool uses the Docker image legleux/rippled_smart_escrow:bb9bb5f5 which includes support for smart escrows.
Note: If Docker is not installed when you run craft start-rippled, it will offer to install Colima automatically.
You can also manage the container directly with Docker:
# View logs
docker logs -f craft-rippled
# Stop container
docker stop craft-rippled
# Remove container
docker rm craft-rippled
http://localhost:6006localhost:51235localhost:5005The craft tool includes commands to open the XRPL Explorer:
# Open the Explorer
craft open-explorer
From the wasm-host directory:
# Run with success test case
cargo run -- --wasm-file ../path/to/your/module.wasm --test-case success
# Run with failure test case
cargo run -- --wasm-file ../path/to/your/module.wasm --test-case failure
From any workspace directory:
cargo run -p wasm-host -- --wasm-file path/to/your/module.wasm --test-case success --project <project_name>
--wasm-file <PATH>: Path to the WebAssembly module to test--wasm-path <PATH>: (Alias for --wasm-file for backward compatibility)--test-case <CASE>: Test case to run (defaults to success)--project <NAME>: Project name (required)--verbose: Enable detailed logging-h, --help: Show help informationTo see detailed execution information, including memory allocation, data processing, and function execution steps, use the --verbose flag:
cargo run -p wasm-host -- --wasm-file path/to/module.wasm --test-case success --verbose
The verbose output may include:
Example verbose output:
[INFO wasm_host] Starting Wasm host application
[INFO wasm_host] Loading WASM module from: path/to/module.wasm
[INFO wasm_host] Target function: finish (XLS-100d)
[INFO wasm_host] Using test case: success
[DEBUG wasm_host] Initializing WasiModule
[DEBUG wasm_host] WasiModule initialized successfully
[INFO wasm_host::vm] Executing WASM function: finish
[DEBUG wasm_host::vm] TX data size: 610 bytes, LO data size: 919 bytes
[INFO wasm_host::vm] Allocating memory for transaction data
[DEBUG wasm_host::vm] Allocated memory at address: 0x110008
...
craftThe wasm-host tool is typically used through the craft test command, which provides an interactive interface for selecting test cases:
# Test a WASM module
craft test
# Test with verbose output
RUST_LOG=debug craft test
The interactive interface will prompt you to select:
The tool provides test data that simulates:
This data is used to test the module's finish function implementation.
To add new test cases to a project:
projects/<project>/fixtures/<test_case>/tx.json: Transaction dataledger_object.json: Ledger object being testedledger_header.json: Ledger header informationledger.json: Full ledger datanfts.json: NFT data (if applicable)craft test <project> --case <test_case>If the WebAssembly module execution fails, the tool will:
Example error output:
-------------------------------------------------
| WASM FUNCTION EXECUTION ERROR |
-------------------------------------------------
| Function: finish |
| Test Case: failure |
| Error: WASM function execution error |
-------------------------------------------------