Introduction

Hooks add smart contract functionality to the XRP Ledger: layer one custom code to influence the behaviour and flow of transactions. Hooks are small, efficient pieces of code being defined on an XRPL account, allowing logic to be executed before and/or after XRPL transactions.

The XRP ledger is known and is being appreciated for its transaction throughput, speed and the low fees. Combined with available advanced transaction types like multi sign, escrows, payment channels and even a decentralized exchange (all on ledger, out of the box, without requiring smart contracts) the XRPL has a lot to offer businesses and (creative) developers.

Hooks add smart contract functionality to the XRP Ledger: layer one custom code to influence the behaviour and flow of transactions. Hooks are small, efficient pieces of code being defined on an XRPL account, allowing logic to be executed before and/or after XRPL transactions. These Hooks can be really simple, like: “reject payments < 10 XRP”, or “for all outgoing payments, send 10% to my savings account” or more advanced.

By allowing Hooks to not only execute efficient logic but also to store small, simple data objects, one could define a Hook like: “for incoming payments transactions, check if the sending account is in a list maintained by another Hook, and if present: reject the transaction”.

Hooks are deliberately not Turing-Complete. While often touted as the holy grail of smart contracts, Turing-Completeness is actually inappropriate for smart contracts. (See Blog 2.)

Hooks are currently live on a public testnet. It's time for testing, coding, having fun & breaking things, so a future amendment to add Hooks to the XRP Ledger livenet can be drafted with confidence.

Guides

Terminology

Learn how to authenticate your API requests.

Read more

Compiling Hooks

Understand how to work with paginated responses.

Read more

Errors

Read about the different types of errors returned by the API.

Read more

Webhooks

Learn how to programmatically configure webhooks for your app.

Read more

Was this page helpful?