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.
TRON RPC endpoint: endpoint URLs, plans and pricing.
Address Validation
Dwellir's TRON infrastructure provides fast address validation with format checking and encoding verification. Ensure address validity before processing transactions or queries.
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
| Format | Prefix | Length | Example |
|---|---|---|---|
| Base58 | T | 34 chars | TNPdqto8HiuMzoG7Vv9wyyYhWzCojLeHAF |
| Hex | 41 | 42 chars | 41E552F6487585C2B58BC2C9BB4492BC1F17132CD0 |
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
{
"address": "TNPdqto8HiuMzoG7Vv9wyyYhWzCojLeHAF",
"visible": true
}Implementation Examples
# 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 ""
doneResponse Examples
Valid Address Response
{
"result": true,
"message": "Valid address"
}Invalid Address Response
{
"result": false,
"message": "Invalid address format"
}Malformed Address Response
{
"result": false,
"message": "Illegal address"
}Common Use Cases
1. Form Input Validation
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
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
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
- Cache Results - Cache validation results for 60 seconds
- Format Check First - Validate format locally before API call
- Debounce Input - Debounce validation on user input
- Batch Validation - Validate multiple addresses in parallel
- Error Handling - Gracefully handle validation failures
Related Methods
- wallet/getaccount - Get account information
- wallet/getaccountbalance - Get account balance
- wallet/createtransaction - Create TRX transfer (validate addresses first)
wallet/getaccountnet
Get detailed bandwidth (net) information for a TRON account including free and staked bandwidth via Dwellir's RPC endpoint.
wallet/createtransaction
Create TRX transfer transactions on TRON network with optimized bandwidth usage and fee estimation via Dwellir's high-performance RPC endpoints.