Welcome to HandyHooks, a collection of pre-built Xahau Hooks for the Xahau Network. This repository hosts Hooks designed for production use on Mainnet, alongside the educational Xahau Hooks 101 series. All Hooks are written in C, compiled to WebAssembly (WASM) using the Xahau Hooks Builder starter template, and available for anyone to use, edit, and distribute. Each Hook includes its own README
with installation instructions and detailed information.
Xahau is a decentralized blockchain platform that enables secure, efficient, and transparent transactions. Its immutable ledger ensures data integrity, making it ideal for financial and automated applications.
Hooks are compact, efficient C programs attached to Xahau accounts, allowing users to automate actions based on specific conditions or events. Examples include forwarding payments, enforcing transaction rules, or managing state. Hooks are executed on the Xahau Network, extending its functionality for both Testnet and Mainnet applications.
Xahau Hooks Builder is a user-friendly, web-based tool for creating, testing, and deploying Hooks. It simplifies development with:
- A code editor for writing C Hooks.
- A simulated Testnet environment for testing.
- One-click deployment to Testnet or Mainnet accounts.
All Hooks in this repository are compiled using the Hooks Builder starter template, ensuring Mainnet compatibility.
Use these online tools to work with HandyHooks—no local setup required:
- Xahau Hooks Builder: Write, compile, and deploy Hooks using the starter template.
- XRPLWin Xahau Testnet Tools: Create and test transactions on the Testnet.
- XRPLWin Hook Management: Deploy and manage Hooks (replace
YOUR_WALLET_RADDRESS_HERE
with your account, e.g.,rTest123...
). - Xahau Testnet Faucet: Fund Testnet accounts.
- Xahau Explorer: Verify transactions and Hook details.
The repository is organized into directories based on Hook purpose:
- Xahau-Hooks-101: Contains the Xahau Hooks 101 series, a collection of educational Hooks for learning Xahau Hook development. See the Xahau-Hooks-101 README for details on these beginner-friendly examples.
- Production Hooks: Includes Hooks designed for real-world use, such as
ForwardSplit
. Each Hook has its own directory andREADME
with specific instructions.
- Purpose: Forwards incoming XAH payments to three predefined accounts, distributing a percentage of the payment based on specified parameters.
- Hook Parameters:
DEST1
,DEST2
,DEST3
: Destination account addresses.PCT1
,PCT2
,PCT3
: Percentage splits (e.g., 50%, 30%, 20%).
- Installation:
- Open
ForwardSplit.c
in Xahau Hooks Builder. - Compile with the starter template.
- Deploy via Hooks Builder or XRPLWin Hook Management.
- Open
- Details: See the ForwardSplit README for full instructions and test cases.
- Setup Accounts:
- Fund a Testnet account (e.g.,
rTest123...
) using the Testnet Faucet.
- Fund a Testnet account (e.g.,
- Deploy Hooks:
- Compile in Xahau Hooks Builder and deploy via Hooks Builder or XRPLWin Hook Management.
- Test Transactions:
- Send Payments (e.g., XAH or IOU) using XRPLWin Tools.
- Verify:
- Check results in Xahau Explorer or Hooks Builder logs (
TRACESTR
/TRACEHEX
).
- Check results in Xahau Explorer or Hooks Builder logs (
- Logs: Use
TRACESTR
andTRACEHEX
to track execution. - Xahau Explorer: Verify
TransactionType
,Amount
, andHookHash
. - Common Issues:
Execution failure (no exit type specified)
: Caused by invalidsfAmount
access. Useuint8_t amount[48]
and checkotxn_field
returns.- Non-Payment transactions: Ensure Hooks are set for
ttPayment
.
Explore the Hooks, integrate them into your projects, or contribute new ones! Submit issues or PRs to enhance HandyHooks. For educational Hooks, check out the Xahau Hooks 101 subfolder.