> For the complete documentation index, see [llms.txt](https://docs.0xprocessing.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.0xprocessing.com/quick-start/match-crypto-wallet-addresses.md).

# Match Crypto Wallet Addresses

Verify and match wallet addresses for seamless crypto payment processing, enhancing security and reliability for your transactions.

The following information explains how to check the wallet address entered in the withdrawal form. To avoid failed withdrawal requests, the Merchant should check that the wallet address format matches the selected currency and network. For example, a Tron wallet address should not be used when the selected withdrawal currency belongs to the BNB Chain network.

These regular expressions validate only the basic wallet address format and help check whether the address matches the selected network format. They do not validate the address checksum, destination tag or memo, token contract, whether the address exists, or whether it can receive the selected asset.

{% hint style="info" %}
For Bech32 and CashAddr formats marked with an asterisk, apply the regex to a string converted to lowercase. Do not apply a global case-insensitive flag to the whole expression, because it may allow invalid characters in legacy address branches.
{% endhint %}

## Regular expressions

| Network                                | Regex                                                                         |
| -------------------------------------- | ----------------------------------------------------------------------------- |
| Ethereum / EVM                         | `/^0x[a-fA-F0-9]{40}$/`                                                       |
| Bitcoin (legacy)                       | `/^[13][a-km-zA-HJ-NP-Z1-9]{25,34}$/`                                         |
| Bitcoin (bech32) \*                    | `/^bc1[qpzry9x8gf2tvdw0s3jn54khce6mua7l]{11,71}$/`                            |
| Bitcoin Lightning (BOLT11 invoice)     | `/^(lightning:)?lnbc[0-9]+[munp]?1[qpzry9x8gf2tvdw0s3jn54khce6mua7l]{111,}$/` |
| Bitcoin Cash (CashAddr) \*             | `/^(?:bitcoincash:)?[qp][qpzry9x8gf2tvdw0s3jn54khce6mua7l]{41}$/`             |
| Bitcoin Cash (legacy)                  | `/^[13][a-km-zA-HJ-NP-Z1-9]{25,34}$/`                                         |
| Dash                                   | `/^[X7][1-9A-HJ-NP-Za-km-z]{33}$/`                                            |
| Tron                                   | `/^T[1-9A-HJ-NP-Za-km-z]{33}$/`                                               |
| Dogecoin                               | `/^[D9A][1-9A-HJ-NP-Za-km-z]{33}$/`                                           |
| Litecoin (legacy)                      | `/^[LM][a-km-zA-HJ-NP-Z1-9]{26,33}$/`                                         |
| Litecoin (bech32) \*                   | `/^ltc1[qpzry9x8gf2tvdw0s3jn54khce6mua7l]{11,71}$/`                           |
| XRP (classic)                          | `/^r[1-9A-HJ-NP-Za-km-z]{24,34}$/`                                            |
| XRP (X-address)                        | `/^X[1-9A-HJ-NP-Za-km-z]{45,46}$/`                                            |
| Solana                                 | `/^[1-9A-HJ-NP-Za-km-z]{32,44}$/`                                             |
| TON (user-friendly, mainnet basechain) | `/^(?:EQ\|UQ)[A-Za-z0-9_-]{46}$/`                                             |
| TON (raw)                              | `/^-?\d+:[a-fA-F0-9]{64}$/`                                                   |
| Sui                                    | `/^0x[0-9a-fA-F]{1,64}$/`                                                     |
| Monero (standard / subaddress)         | `/^[48][0-9AB][1-9A-HJ-NP-Za-km-z]{93}$/`                                     |
| Monero (integrated)                    | `/^4[0-9AB][1-9A-HJ-NP-Za-km-z]{104}$/`                                       |

## Bitcoin Lightning withdrawals

For a Bitcoin Lightning withdrawal, use a BOLT11 invoice instead of an on-chain wallet address.

1. Ask the recipient to create a mainnet Lightning invoice with the exact withdrawal amount and send it to you.
2. Check the invoice against the Bitcoin Lightning regex, then use the invoice as the withdrawal destination. The withdrawal amount in the request must match the amount encoded in the invoice.
3. When the withdrawal is created, the Merchant balance is charged the invoice amount plus the fixed withdrawal fee. 0xProcessing covers the Lightning routing fee.

The invoice must:

* include a fixed amount; "any amount" invoices are not accepted;
* be unexpired and remain valid for at least 3 minutes;
* use the Bitcoin mainnet (`lnbc`);
* be used for only one withdrawal. A paid or previously used invoice is rejected.

{% hint style="warning" %}
The regex checks only the basic BOLT11 invoice format. It does not verify the invoice checksum, encoded amount, expiration time, remaining validity, payment status, or whether the invoice has already been used. Validate these conditions separately before creating the withdrawal.
{% endhint %}

## JavaScript

```js
const ADDRESS_PATTERNS = {
  evm:            /^0x[a-fA-F0-9]{40}$/,
  btcLegacy:      /^[13][a-km-zA-HJ-NP-Z1-9]{25,34}$/,
  btcBech32:      /^bc1[qpzry9x8gf2tvdw0s3jn54khce6mua7l]{11,71}$/,
  btcLightning:   /^(lightning:)?lnbc[0-9]+[munp]?1[qpzry9x8gf2tvdw0s3jn54khce6mua7l]{111,}$/,
  bchCashAddr:    /^(?:bitcoincash:)?[qp][qpzry9x8gf2tvdw0s3jn54khce6mua7l]{41}$/,
  bchLegacy:      /^[13][a-km-zA-HJ-NP-Z1-9]{25,34}$/,
  dash:           /^[X7][1-9A-HJ-NP-Za-km-z]{33}$/,
  tron:           /^T[1-9A-HJ-NP-Za-km-z]{33}$/,
  doge:           /^[D9A][1-9A-HJ-NP-Za-km-z]{33}$/,
  ltcLegacy:      /^[LM][a-km-zA-HJ-NP-Z1-9]{26,33}$/,
  ltcBech32:      /^ltc1[qpzry9x8gf2tvdw0s3jn54khce6mua7l]{11,71}$/,
  xrpClassic:     /^r[1-9A-HJ-NP-Za-km-z]{24,34}$/,
  xrpX:           /^X[1-9A-HJ-NP-Za-km-z]{45,46}$/,
  solana:         /^[1-9A-HJ-NP-Za-km-z]{32,44}$/,
  tonFriendly:    /^(?:EQ|UQ)[A-Za-z0-9_-]{46}$/,
  tonRaw:         /^-?\d+:[a-fA-F0-9]{64}$/,
  sui:            /^0x[0-9a-fA-F]{1,64}$/,
  xmr:            /^[48][0-9AB][1-9A-HJ-NP-Za-km-z]{93}$/,
  xmrIntegrated:  /^4[0-9AB][1-9A-HJ-NP-Za-km-z]{104}$/,
};
```

## C\#

```csharp
public static class AddressPatterns
{
    private const RegexOptions Opt = RegexOptions.Compiled | RegexOptions.CultureInvariant;

    public static readonly Regex Evm           = new(@"^0x[a-fA-F0-9]{40}$", Opt);
    public static readonly Regex BtcLegacy     = new(@"^[13][a-km-zA-HJ-NP-Z1-9]{25,34}$", Opt);
    public static readonly Regex BtcBech32     = new(@"^bc1[qpzry9x8gf2tvdw0s3jn54khce6mua7l]{11,71}$", Opt);
    public static readonly Regex BtcLightning = new(@"^(lightning:)?lnbc[0-9]+[munp]?1[qpzry9x8gf2tvdw0s3jn54khce6mua7l]{111,}$", Opt);
    public static readonly Regex BchCashAddr   = new(@"^(?:bitcoincash:)?[qp][qpzry9x8gf2tvdw0s3jn54khce6mua7l]{41}$", Opt);
    public static readonly Regex BchLegacy     = new(@"^[13][a-km-zA-HJ-NP-Z1-9]{25,34}$", Opt);
    public static readonly Regex Dash          = new(@"^[X7][1-9A-HJ-NP-Za-km-z]{33}$", Opt);
    public static readonly Regex Tron          = new(@"^T[1-9A-HJ-NP-Za-km-z]{33}$", Opt);
    public static readonly Regex Doge          = new(@"^[D9A][1-9A-HJ-NP-Za-km-z]{33}$", Opt);
    public static readonly Regex LtcLegacy     = new(@"^[LM][a-km-zA-HJ-NP-Z1-9]{26,33}$", Opt);
    public static readonly Regex LtcBech32     = new(@"^ltc1[qpzry9x8gf2tvdw0s3jn54khce6mua7l]{11,71}$", Opt);
    public static readonly Regex XrpClassic    = new(@"^r[1-9A-HJ-NP-Za-km-z]{24,34}$", Opt);
    public static readonly Regex XrpX          = new(@"^X[1-9A-HJ-NP-Za-km-z]{45,46}$", Opt);
    public static readonly Regex Solana        = new(@"^[1-9A-HJ-NP-Za-km-z]{32,44}$", Opt);
    public static readonly Regex TonFriendly   = new(@"^(?:EQ|UQ)[A-Za-z0-9_-]{46}$", Opt);
    public static readonly Regex TonRaw        = new(@"^-?\d+:[a-fA-F0-9]{64}$", Opt);
    public static readonly Regex Sui           = new(@"^0x[0-9a-fA-F]{1,64}$", Opt);
    public static readonly Regex Xmr           = new(@"^[48][0-9AB][1-9A-HJ-NP-Za-km-z]{93}$", Opt);
    public static readonly Regex XmrIntegrated = new(@"^4[0-9AB][1-9A-HJ-NP-Za-km-z]{104}$", Opt);
}
```
