Skip to content
Samarth Patel edited this page Jan 27, 2026 · 1 revision

❓ FAQ (Frequently Asked Questions)

Common questions and answers about validator0x.


General Questions

What is validator0x?

validator0x is a lightweight, zero-dependency TypeScript library for validating blockchain wallet addresses. It supports multiple blockchains including Ethereum, Polygon, Solana, and Bitcoin.

Why use validator0x instead of other validators?

  • Zero dependencies: No bloat, just pure validation logic
  • Multi-chain support: One library for multiple blockchains
  • TypeScript-first: Full type safety and IntelliSense
  • Lightweight: Minimal bundle size impact
  • Active maintenance: Built by Web3 developers for Web3 developers

Which blockchains are supported?

Currently supported:

  • Ethereum (Mainnet & Testnet)
  • Polygon (Mainnet & Testnet)
  • Solana (Mainnet & Devnet)
  • Bitcoin (Mainnet & Testnet)

More chains coming soon! Check our roadmap.


Installation & Setup

How do I install validator0x?

npm install validator0x

Does it work with JavaScript projects?

Yes! While built with TypeScript, validator0x works perfectly in JavaScript projects:

const { validateAddress } = require('validator0x');

const result = validateAddress('0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb', 'ethereum');
console.log(result.valid);

Can I use it in the browser?

Yes! validator0x is compatible with all modern browsers. It's commonly used in:

  • React/Vue/Angular apps
  • Browser extensions
  • Web3 dApps

Does it work with Node.js?

Absolutely! Use it in:

  • Express/Fastify APIs
  • Next.js API routes
  • Serverless functions
  • CLI tools

Validation Questions

What's the difference between strict and non-strict mode?

Non-strict mode (default):

  • Checks basic format and structure
  • Accepts addresses with incorrect checksums
  • More permissive

Strict mode:

  • Enforces EIP-55 checksum for Ethereum/Polygon
  • Rejects addresses with wrong casing
  • Recommended for production
// Non-strict (default)
validateAddress('0x742d35cc...', 'ethereum'); // Valid

// Strict
validateAddress('0x742d35cc...', 'ethereum', { strict: true }); // Invalid (wrong checksum)

How do I validate testnet addresses?

Use the network option:

const result = validateAddress(
  'tb1qw508d6qejxtdg4y5r3zarvary0c5xw7kxpjzsx',
  'bitcoin',
  { network: 'testnet' }
);

Can it detect which blockchain an address belongs to?

Yes, use detectBlockchain():

const chains = detectBlockchain('0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb');
// Returns: ['ethereum', 'polygon']

Note: Some addresses are valid on multiple chains (e.g., Ethereum and Polygon use the same format).

Does it validate ENS names or other name services?

No, validator0x only validates raw addresses. ENS names must be resolved to addresses first using libraries like ethers.js or web3.js.


Format & Display

How do I format an address with proper checksum?

const formatted = formatAddress(
  '0x742d35cc6634c0532925a3b844bc9e7595f0beb',
  'ethereum',
  { checksum: true }
);
// Returns: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb'

How do I shorten addresses for UI display?

const shortened = formatAddress(
  '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb',
  'ethereum',
  { shorten: true, shortenLength: 6 }
);
// Returns: '0x742d35...5f0bEb'

Performance

Is it fast enough for real-time validation?

Yes! All validations are synchronous and highly optimized. Typical validation takes < 1ms.

Can I validate multiple addresses at once?

Yes, just map over your address array:

const addresses = ['0x...', '0x...', '0x...'];
const results = addresses.map(addr => 
  validateAddress(addr, 'ethereum')
);

Does it make network requests?

No! All validation happens locally using cryptographic algorithms. No API calls, no internet required.


TypeScript

How do I get proper TypeScript types?

Types are included automatically:

import {
  validateAddress,
  ValidationResult,
  BlockchainType,
  ValidationOptions
} from 'validator0x';

const blockchain: BlockchainType = 'ethereum';
const result: ValidationResult = validateAddress(address, blockchain);

What TypeScript version is required?

TypeScript 4.0 or higher is recommended, but it works with older versions too.


Errors & Troubleshooting

Why does my valid address show as invalid?

Common reasons:

  1. Wrong blockchain: Make sure you're validating against the correct chain
  2. Incorrect checksum in strict mode: Use { strict: false } or fix the checksum
  3. Extra spaces: Trim the address string first
  4. Wrong format: Bitcoin has multiple formats (legacy, SegWit, etc.)
// Debug validation
const result = validateAddress(address, blockchain);
console.log(result);
// Check result.error and result.details.errorCode for specific issues

What are the different error codes?

See the ValidationError enum in the API Reference:

  • INVALID_FORMAT: Wrong structure
  • INVALID_CHECKSUM: Checksum mismatch
  • INVALID_LENGTH: Too short/long
  • INVALID_CHARACTERS: Contains invalid characters
  • UNSUPPORTED_CHAIN: Blockchain not supported
  • BURN_ADDRESS: Zero/burn address
  • UNSAFE_INPUT: Potential security issue

How do I handle burn/zero addresses?

validator0x detects common burn addresses (like 0x0000...0000):

const result = validateAddress('0x0000000000000000000000000000000000000000', 'ethereum');
// result.valid = false
// result.details.errorCode = 'BURN_ADDRESS'

Security

Is it safe to use in production?

Yes! validator0x:

  • Has zero dependencies (no supply chain attacks)
  • Uses battle-tested validation algorithms
  • Includes input sanitization
  • Is regularly updated

Does it protect against malicious input?

Yes, it includes checks for:

  • Overly long inputs
  • Special characters
  • Injection attempts

Should I validate on both frontend and backend?

Yes, always!

  • Frontend validation improves UX
  • Backend validation ensures security

Never trust client-side validation alone.


Contributing & Support

How can I request a new blockchain?

Open an issue with the blockchain name and documentation links.

I found a bug, how do I report it?

Please open an issue with:

  • The address being validated
  • The blockchain type
  • Expected vs actual behavior
  • Your environment (Node version, browser, etc.)

Can I contribute code?

Absolutely! Check our Contributing Guide for details.

How do I support the project?

  • ⭐ Star the GitHub repository
  • πŸ› Report bugs and suggest features
  • πŸ’» Contribute code
  • β˜• Buy me a coffee
  • πŸ’° Donate crypto: 0xEe4055Dd5E4896aC50f308eE7846037490482F1f

Common Use Cases

Wallet Connection Validation

function validateWalletConnection(address: string, expectedChain: BlockchainType) {
  const result = validateAddress(address, expectedChain, { strict: true });

  if (!result.valid) {
    throw new Error(`Invalid wallet address: ${result.error}`);
  }

  return true;
}

Form Validation

See our React examples for complete form validation patterns.

Airdrop/Whitelist Verification

See our production use cases for batch validation examples.


Still have questions?


← Back to Home

validator0x

npm


⚑ Quick Start

npm install validator0x

πŸ’– Support


v0.1.1 | MIT License

Clone this wiki locally