A template project for developing Xahau Hooks. Write hooks in C language, compile them to WASM, and execute them on the Xahau network.
This template provides a basic setup for developing and testing Xahau Hooks. The current hook implementation is a simple example that accepts all transactions.
- Node.js 18 or higher
- pnpm
- Docker
- xrpld-netgen
- pip install xrpld-netgen
Install dependencies:
pnpm installchooks-template/
├── contracts/ # C language hook source code
│ ├── index.c # Main hook implementation
│ └── utils/ # Utility header files
│ ├── hookapi.h # Hook API definitions
│ ├── macro.h # Macro definitions
│ ├── extern.h # External function definitions
│ └── ...
├── build/ # Compiled WASM files
├── test/ # Test files
│ └── index.test.ts # Hook integration tests
└── package.json # Project configuration
Compile C language source code to WASM:
pnpm buildThe compiled WASM file will be output to build/index.wasm.
Run hook tests:
pnpm testTests will automatically compile the hook and deploy it on a local Xahau network for execution.
Start a local Xahau network using xrpld-netgen:
pnpm xrpld:startStop the local Xahau network:
pnpm xrpld:stopView hook execution logs in real-time:
pnpm traceTransaction builder Binary visualizer
For detailed Hook API documentation, refer to:
ISC