Book a free call

XRPL Smart Contracts: How They Work and How to Deploy

XRPL smart contracts run on the EVM sidechain, not the main ledger. Learn how they work, what you can build, and how to deploy one safely.

Hertiv engineering teamReviewed by a senior engineer
7 min read
XRPL Smart Contracts: How They Work and How to Deploy
On this page

Short answer

XRPL smart contracts are programs that run on the XRP Ledger ecosystem through the EVM sidechain, which supports Solidity contracts, and through Hooks, which are still in development. The sidechain lets developers automate payments, escrow and token rules with XRP, using familiar Ethereum tooling and low fees.

What are XRPL smart contracts?

XRPL smart contracts are programs that run on the XRP Ledger ecosystem and carry out agreed actions automatically, such as releasing a payment when a condition is met or enforcing the rules of a token. The XRP Ledger itself does not run general-purpose smart contracts the way Ethereum does, so the work happens through two routes: the XRPL EVM sidechain and Hooks.

The XRPL EVM sidechain is a separate chain that connects to the XRP Ledger and runs the Ethereum Virtual Machine, so developers can write contracts in Solidity and use familiar Ethereum tooling. It launched on mainnet in 2025 and uses XRP as its gas token, with a bridge that moves XRP between the main ledger and the sidechain.

Hooks are the second route. A Hook is a small program that would run directly on the XRP Ledger itself, attached to an account, and fire when a transaction touches that account. Hooks are still in development as a proposed amendment, so they are not a way to deploy contracts on the main ledger today. For now, the EVM sidechain is the practical route for smart contract work on XRPL.

How does the XRPL EVM sidechain work?

The XRPL EVM sidechain works as a bridge-connected chain: XRP moves from the main ledger to the sidechain, contracts execute there, and value can move back. The sidechain keeps its own blocks and validators, while the bridge locks XRP on one side and mints the matching amount on the other.

A typical flow looks like this:

  1. A user sends XRP to the bridge, which locks it on the XRP Ledger.
  2. The same amount appears as wrapped XRP on the EVM sidechain.
  3. A smart contract runs on the sidechain, using that XRP for payments, escrow or trading.
  4. When the user is done, the wrapped XRP is burned and the original XRP is released on the main ledger.

Because the sidechain is EVM-compatible, developers can deploy contracts with Hardhat or Remix and connect wallets such as MetaMask. Fees on the sidechain are paid in XRP and are usually small, which suits payment-heavy applications. Teams building payment products can read how cryptocurrency creation works before choosing a chain for their token.

What can you build with XRPL smart contracts?

You can build payment automation, token rules and settlement logic with XRPL smart contracts, and the strongest use cases sit close to what the XRP Ledger already does well: fast, low-cost value transfer. A contract adds conditions and logic on top of that transfer.

Use caseWhat the contract doesWho uses it
EscrowHolds funds and releases them on delivery or approvalFreelancers, marketplaces
Token rulesEnforces transfer limits, vesting or lock-upsToken issuers, funds
Automated payoutsSplits incoming payments between several partiesCreators, affiliates
DeFi lendingLends against collateral and liquidates on defaultLenders, traders
NFT royaltiesPays creators a share on each resaleArtists, marketplaces
Recurring billingPulls a set amount on a schedule with user consentSubscription services

Escrow and automated payouts are the most practical starting points, because they map directly onto payment flows that already run on XRPL. Token rules matter for issuers who need vesting schedules or transfer limits written into the token itself rather than enforced by an off-chain service. DeFi lending and royalties are possible too, but they need more testing and audit work before real money flows through them.

How do you deploy a smart contract on XRPL?

You deploy a smart contract on XRPL by writing it in Solidity, testing it on the EVM sidechain testnet, getting it audited, and then deploying it to the sidechain mainnet. The process follows the same shape as deploying on any EVM chain, with the bridge step added.

  1. Write the contract in Solidity. Keep the logic small and focused on one job, such as escrow or a token sale.
  2. Test on the sidechain testnet. Run the full flow with test XRP, including failure cases such as a missed deadline or a rejected payment.
  3. Get an independent audit. A second pair of eyes checks for re-entrancy, access control and arithmetic errors before real funds are involved.
  4. Bridge XRP to the sidechain. Move the funds the contract needs, and keep a separate amount for gas.
  5. Deploy and verify the source. Publish the contract and verify its source code so anyone can read what it does.
  6. Monitor after launch. Watch events, balances and failed transactions, and keep an upgrade or pause path ready.

Testing on the testnet is the step teams most often rush. A contract that handles money should be tested with the same cases it will face in production, including edge cases such as zero amounts, duplicate calls and expired deadlines. The deployment guide for smart contract development covers the same sequence in more detail.

Example (hypothetical): an escrow contract for freelance work

Example (hypothetical): a small design studio hires a freelance illustrator for a 2,000 XRP project, paid in two milestones. Instead of paying upfront or chasing invoices, the studio locks 2,000 XRP in an escrow contract when the work starts.

Milestone one is a set of draft illustrations. When the studio approves the drafts, the contract releases 1,200 XRP to the illustrator and keeps 800 XRP locked. Milestone two is the final files. When those are approved, the contract releases the remaining 800 XRP, so the illustrator receives 1,200 + 800 = 2,000 XRP in total.

If the studio does not approve the drafts within 30 days, the contract returns the 2,000 XRP to the studio, minus a small gas fee. If the illustrator delivers and the studio never responds, the contract releases the funds after the deadline passes.

The arithmetic is simple, but the point is that neither side has to trust the other: the contract enforces the agreed terms, and both sides can read the code before they commit funds.

What are the costs and limits?

The costs of XRPL smart contracts are low compared with many other chains, but there are limits worth knowing before you build. Sidechain gas fees are paid in XRP and are usually a fraction of a cent per transaction, so high-volume payment logic is affordable. The main costs are development time, the audit, and the XRP reserve needed to keep the contract funded.

The limits matter more than the fees. The EVM sidechain is a separate chain from the XRP Ledger, so a contract cannot read main-ledger state directly; it only sees what the bridge brings across. Bridging takes time, so contracts that need instant settlement with main-ledger assets must plan around that delay.

Hooks, which would run directly on the ledger, are not live yet, so any design that depends on them is a plan for the future rather than something you can ship today. And as with any chain, a contract bug can lock or lose funds, which is why an audit is a cost to budget for rather than a step to skip.

Token mechanics also interact with regulation, so teams should read the rules that apply to their use case before launch. The guide to MiCA regulation explains the framework that covers many token projects in Europe.

What are the common mistakes?

The most common XRPL smart contract mistakes are assuming the main ledger runs contracts, skipping the audit, and designing for Hooks that are not live yet.

  • Assuming the main ledger runs Solidity. The XRP Ledger does not run EVM contracts; they run on the sidechain, and the bridge is part of the design.
  • Skipping the audit. A contract that holds funds needs an independent review. Small bugs in access control or arithmetic can lock money permanently.
  • Building on Hooks too early. Hooks are still in development, so a product that needs them today has no deployment path.
  • Ignoring bridge delays. Moving XRP across the bridge takes time, so flows that need instant settlement must be designed around it.
  • No pause or upgrade path. If a bug is found after launch, the team needs a way to stop the contract or move funds safely.
  • Forgetting the reserve. Accounts and contracts on XRPL need a minimum XRP reserve, so the budget should include it.

Key takeaways

  • XRPL itself does not run general-purpose smart contracts; the EVM sidechain does
  • The EVM sidechain runs Solidity contracts and uses XRP for gas
  • Escrow, token rules and automated payouts are the strongest use cases
  • Deploy on the testnet first, audit, then deploy to mainnet
  • Hooks would run on the ledger itself but are still in development

Frequently asked questions

What is the difference between XRPL and the XRPL EVM sidechain?

The XRP Ledger is the main chain for fast, low-cost payments and does not run general-purpose smart contracts. The XRPL EVM sidechain is a separate, EVM-compatible chain connected by a bridge, where developers deploy Solidity contracts that use XRP for gas.

Do I need XRP to use XRPL smart contracts?

Yes. XRP is the gas token on the EVM sidechain, and you bridge XRP from the main ledger to the sidechain before interacting with contracts. Contracts and accounts also need a small XRP reserve, so keep some aside for fees and reserves.

What is a Hook on XRPL?

A Hook is a small program that would run directly on the XRP Ledger, attached to an account, and fire when a transaction touches that account. Hooks are a proposed amendment still in development, so they cannot be deployed on the main ledger today.

Are XRPL smart contracts safe to use?

They carry the same risks as smart contracts on any chain: bugs can lock or lose funds. The main protections are testing on the testnet, an independent audit, a pause or upgrade path, and starting with small amounts before scaling up.

What can I build with XRPL smart contracts?

The strongest use cases are escrow, automated payouts, token rules such as vesting, NFT royalties and recurring billing. These build on the XRP Ledger's strengths in payments, while more complex DeFi logic needs extra testing and audit work.

How much does it cost to deploy a contract on XRPL?

Sidechain gas fees are usually a fraction of a cent per transaction, so deployment itself is cheap. The real costs are development time, the audit and the XRP reserve, which vary with the size and risk of the contract. See the vendor site for current fee details.

Found this useful? Share it.
Hertiv engineering team

Written from projects we build for clients: blockchain systems in production. Every post is reviewed by a senior engineer before publishing and updated when practice changes.

About HertivHow we work

Building a payment product on XRPL? Talk to Hertiv.

A senior engineer replies within one business day. Or see our Smart Contract Development service.

Book a free call

Keep reading

All posts

Tell us what you want to build

A senior engineer reads every request and replies within one business day with questions, a rough range, or a call link.

  • NDA on request before any details
  • You own all code, models and IP
  • US, UK and EU time-zone overlap

Your email app should open with your message ready to send. If it does not, write to [email protected].

Prefer email? Write to [email protected]
Estimate costBook a call