Docs

wallet/validateaddress - Validate TRON Address

Validate TRON address format and encoding, check if address is valid Base58 or Hex format via Dwellir's reliable RPC endpoint.

Address Validation

Dwellir's TRON infrastructure provides fast address validation with format checking and encoding verification. Ensure address validity before processing transactions or queries.

Start validating addresses

Validate a TRON address to check if it's properly formatted and valid on the network. Supports both Base58 (T-prefix, 34 characters) and Hexadecimal (41-prefix, 42 characters) address formats. This is a native TRON wallet API endpoint with no EVM-compatible JSON-RPC equivalent.

TRON Address Formats

FormatPrefixLengthExample
Base58T34 charsTNPdqto8HiuMzoG7Vv9wyyYhWzCojLeHAF
Hex4142 chars41E552F6487585C2B58BC2C9BB4492BC1F17132CD0

Both formats represent the same underlying 21-byte address. The EVM-compatible JSON-RPC layer uses standard 20-byte hex addresses (without the 41 prefix).

Use Cases

wallet/validateaddress is essential for:

  • Input Validation - Verify user-provided addresses
  • Transaction Safety - Validate recipient before sending
  • Form Validation - Real-time address checking in UIs
  • API Security - Validate addresses in API requests
  • Data Integrity - Ensure address validity in databases

Request Parameters

Request
addressstring

TRON address to validate (Base58 or Hex)

visibleboolean

Format type - true for Base58, false for Hex (default: true)

Response Body

Response
resultboolean

Whether the address is valid

messagestring

Validation result message

Error Responses

Errors
Error 1

Invalid address format

Error 2

Wrong address length

Error 3

Invalid characters

Error 4

API connection failed

Implementation Examples

Bash
# Validate Base58 address
curl -X POST "https://api-tron-mainnet.n.dwellir.com/YOUR_API_KEY/wallet/validateaddress" \
  -H "Content-Type: application/json" \
  -d '{
    "address": "TNPdqto8HiuMzoG7Vv9wyyYhWzCojLeHAF",
    "visible": true
  }'

# Validate Hex address
curl -X POST "https://api-tron-mainnet.n.dwellir.com/YOUR_API_KEY/wallet/validateaddress" \
  -H "Content-Type: application/json" \
  -d '{
    "address": "41E552F6487585C2B58BC2C9BB4492BC1F17132CD0",
    "visible": false
  }'

# Validate invalid address
curl -X POST "https://api-tron-mainnet.n.dwellir.com/YOUR_API_KEY/wallet/validateaddress" \
  -H "Content-Type: application/json" \
  -d '{
    "address": "InvalidAddress123",
    "visible": true
  }'

# Validate and parse result with jq
curl -s -X POST "https://api-tron-mainnet.n.dwellir.com/YOUR_API_KEY/wallet/validateaddress" \
  -H "Content-Type: application/json" \
  -d '{
    "address": "TNPdqto8HiuMzoG7Vv9wyyYhWzCojLeHAF",
    "visible": true
  }' | jq '{
    is_valid: .result,
    validation_message: .message
  }'

# Batch validation script
#!/bin/bash
API_KEY="YOUR_API_KEY"
ADDRESSES=(
  "TNPdqto8HiuMzoG7Vv9wyyYhWzCojLeHAF"
  "TJmmqjb1DK9TTZbQXzRQ2AuA94z4gKAPFh"
  "InvalidAddress"
)

for addr in "${ADDRESSES[@]}"; do
  echo "Validating: $addr"
  curl -s -X POST "https://api-tron-mainnet.n.dwellir.com/$API_KEY/wallet/validateaddress" \
    -H "Content-Type: application/json" \
    -d "{\"address\": \"$addr\", \"visible\": true}" | \
    jq -r 'if .result then "✓ Valid" else "✗ Invalid: " + .message end'
  echo ""
done

Response Examples

Valid Address Response

JSON
{
  "result": true,
  "message": "Valid address"
}

Invalid Address Response

JSON
{
  "result": false,
  "message": "Invalid address format"
}

Malformed Address Response

JSON
{
  "result": false,
  "message": "Illegal address"
}

Common Use Cases

1. Form Input Validation

JavaScript
function setupAddressValidation() {
  const input = document.getElementById('addressInput');
  const submitBtn = document.getElementById('submitBtn');
  const feedback = document.getElementById('feedback');
  
  let isValid = false;
  
  input.addEventListener('input', async (e) => {
    const address = e.target.value.trim();
    
    if (!address) {
      feedback.textContent = '';
      submitBtn.disabled = true;
      return;
    }
    
    // Quick format check
    if (!address.startsWith('T') || address.length !== 34) {
      feedback.textContent = '❌ Invalid format';
      feedback.className = 'error';
      submitBtn.disabled = true;
      return;
    }
    
    // API validation
    try {
      const result = await validateAddress(address);
      
      if (result.result) {
        feedback.textContent = '✓ Valid address';
        feedback.className = 'success';
        isValid = true;
      } else {
        feedback.textContent = '' + result.message;
        feedback.className = 'error';
        isValid = false;
      }
      
      submitBtn.disabled = !isValid;
    } catch (error) {
      feedback.textContent = '⚠️ Validation error';
      feedback.className = 'warning';
      submitBtn.disabled = true;
    }
  });
}

2. Transaction Pre-validation

JavaScript
async function sendTransaction(toAddress, amount) {
  // Validate address before sending
  const validation = await validateAddress(toAddress);
  
  if (!validation.result) {
    throw new Error(`Invalid recipient address: ${validation.message}`);
  }
  
  // Proceed with transaction
  return createTransaction(toAddress, amount);
}

3. Bulk Address Import

JavaScript
async function importAddresses(addressList) {
  const results = {
    valid: [],
    invalid: []
  };
  
  for (const address of addressList) {
    const validation = await validateAddress(address);
    
    if (validation.result) {
      results.valid.push(address);
    } else {
      results.invalid.push({
        address,
        reason: validation.message
      });
    }
  }
  
  return results;
}

Best Practices

  1. Cache Results - Cache validation results for 60 seconds
  2. Format Check First - Validate format locally before API call
  3. Debounce Input - Debounce validation on user input
  4. Batch Validation - Validate multiple addresses in parallel
  5. Error Handling - Gracefully handle validation failures