Skip to content

Cross-chain Bridge ​

Bridges connect XRPL to external networks (EVM chains, Cosmos, Solana, etc.). The wallet kit signs XRPL-side transactions — bridge protocol logic, destination-chain interactions, and claim flows are handled by the bridge's own SDK.

This guide targets XRPL, not the Kit's Xahau runtime. Xahau support does not automatically add support for XChainCommit or EscrowCreate.

Common Patterns ​

Most XRPL bridges use one of three mechanisms:

  • Lock-and-mint via Payment — send XRP or IOU to a bridge custodial address; the bridge mints wrapped tokens on the destination chain
  • XLS-38 bridges — use native cross-chain transactions where the selected bridge actually implements that protocol; do not assume every EVM bridge uses XLS-38
  • Escrow / HTLC — EscrowCreate with a cryptographic condition, released by the bridge when the destination-chain leg is confirmed

Lock-and-Mint: Payment to Bridge ​

ts
const evmRecipient = "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045";

await manager.signAndSubmit({
  txJson: {
    TransactionType: "Payment",
    Account: manager.getSession()?.account.address,
    Destination: "<bridge_custodial_address>",
    Amount: "10000000",    // 10 XRP in drops
    DestinationTag: 0,     // check the bridge docs — many require a specific tag
    Memos: [
      {
        Memo: {
          MemoType: Buffer.from("destination_address").toString("hex").toUpperCase(),
          MemoData: Buffer.from(evmRecipient).toString("hex").toUpperCase(),
        },
      },
    ],
  },
});

Memo format varies by bridge protocol. Always consult the bridge's integration docs before constructing Memo fields.

XLS-38 Bridge Transactions ​

The following is an XLS-38 transaction shape, not a universal EVM bridge integration. Obtain the bridge definition and XRPL-format destination account from that bridge's SDK; do not place an EVM 0x address in an AccountID field.

ts
// Step 1: Create a claim ID on the destination chain first (bridge SDK call)
// Step 2: Commit assets on the XRPL mainchain

await manager.signAndSubmit({
  txJson: {
    TransactionType: "XChainCommit",
    Account: manager.getSession()?.account.address,
    XChainBridge: {
      LockingChainDoor:   "<mainchain_door_account>",
      LockingChainIssue:  { currency: "XRP" },
      IssuingChainDoor:   "<sidechain_door_account>",
      IssuingChainIssue:  { currency: "XRP" },
    },
    XChainClaimID:        "<claim_id>",        // obtained from bridge SDK
    Amount:               "5000000",           // 5 XRP in drops
    OtherChainDestination: "<destination_classic_address>",
  },
});

Escrow-based Bridge (HTLC) ​

ts
// Step 1: Create time-locked escrow on XRPL
import { unixTimeToRippleTime } from "xrpl";
const now = Date.now(); // unixTimeToRippleTime accepts milliseconds
await manager.signAndSubmit({
  txJson: {
    TransactionType: "EscrowCreate",
    Account: manager.getSession()?.account.address,
    Destination: "<bridge_address>",
    Amount: "10000000",                                    // 10 XRP in drops
    Condition: "<crypto_condition_hex>",                   // PREIMAGE-SHA-256
    FinishAfter: unixTimeToRippleTime(now + 3_600_000), // Release no earlier than 1 hour
    CancelAfter: unixTimeToRippleTime(now + 7_200_000), // Refund possible after 2 hours
  },
});

// Step 2: Bridge monitors the ledger, confirms destination chain, then releases
// EscrowFinish is called by the bridge (or user if bridge fails, after CancelAfter)

Adapter Compatibility ​

AdapterPaymentXChainCommitEscrowCreateNotes
Xaman✅✅✅
GemWallet✅✅✅
Crossmark✅✅✅
DropFi✅✅✅
WalletConnect✅⚠️✅XChainCommit support depends on the connected wallet app
XRPL Snap✅✅✅
Ledger✅Wallet dependentWallet dependentCheck XRP app version and fields
GhostSig✅Wallet dependentWallet dependentGeneric XRPL signing
Xyra✅Wallet dependentWallet dependentGeneric XRPL signing
Joey Wallet✅Wallet dependentWallet dependentGeneric XRPL signing

Tips ​

These examples sign the XRPL side only. Kit also supports Xahau, but does not implement EVM signing or bridge-specific claims. Keep those in the bridge SDK.

Always verify DestinationTag requirements before sending. Sending to a bridge custodial address without the correct tag may result in permanently lost funds. The bridge documentation will specify the required tag value.

Set a CancelAfter on escrow to ensure funds are recoverable if the bridge fails to complete the destination-chain leg. After CancelAfter, the creator can reclaim via EscrowCancel.

Test on Testnet first. Bridge contracts on testnets are available for most major XRPL bridges. Validate the full round-trip before going live.

Next Steps ​

Released under the MIT License.