Skip to content

Adressinformationen

Dieser Endpunkt gibt die Ressourcen (Energie, Bandbreite) und Token-Guthaben (TRX, USDT) für eine angegebene TRON-Adresse zurück.

POST /v1/address-info

Anfrage

Anfrage-Parameter

ParameterTypErforderlichBeschreibung
addressstringJaAbzufragende TRON-Adresse
bash
#!/bin/bash
API_TOKEN="your_api_token"
API_SECRET="your_api_secret"
REQUEST_BODY='{"address":"TKuV4gsNRCqEZwS8zRuHJHnCgvNBce7MPe"}'

# Signatur berechnen
SIGNATURE=$(echo -n "${REQUEST_BODY}${API_SECRET}" | sha256sum | cut -d' ' -f1)

# API-Anfrage senden
curl -X POST "https://api.tronzap.com/v1/address-info" \
  -H "Authorization: Bearer ${API_TOKEN}" \
  -H "X-Signature: ${SIGNATURE}" \
  -H "Content-Type: application/json" \
  -d "${REQUEST_BODY}"
javascript
const crypto = require('crypto');
const axios = require('axios');

const apiToken = 'your_api_token';
const apiSecret = 'your_api_secret';
const requestBody = JSON.stringify({
  address: 'TKuV4gsNRCqEZwS8zRuHJHnCgvNBce7MPe'
});

// Signatur berechnen
const signature = crypto
  .createHash('sha256')
  .update(requestBody + apiSecret)
  .digest('hex');

// API-Anfrage senden
axios({
  method: 'post',
  url: 'https://api.tronzap.com/v1/address-info',
  headers: {
    'Authorization': `Bearer ${apiToken}`,
    'X-Signature': signature,
    'Content-Type': 'application/json'
  },
  data: requestBody
})
.then(response => console.log(response.data))
.catch(error => console.error(error));
php
<?php
$apiToken = 'your_api_token';
$apiSecret = 'your_api_secret';
$requestBody = json_encode([
  'address' => 'TKuV4gsNRCqEZwS8zRuHJHnCgvNBce7MPe'
]);

// Signatur berechnen
$signature = hash('sha256', $requestBody . $apiSecret);

// API-Anfrage senden
$ch = curl_init('https://api.tronzap.com/v1/address-info');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $requestBody);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
  'Authorization: Bearer ' . $apiToken,
  'X-Signature: ' . $signature,
  'Content-Type: application/json'
]);

$response = curl_exec($ch);
curl_close($ch);

echo $response;
?>
python
import hashlib
import json
import requests

api_token = 'your_api_token'
api_secret = 'your_api_secret'
request_body = json.dumps({
  'address': 'TKuV4gsNRCqEZwS8zRuHJHnCgvNBce7MPe'
})

# Signatur berechnen
signature = hashlib.sha256((request_body + api_secret).encode()).hexdigest()

# API-Anfrage senden
headers = {
  'Authorization': f'Bearer {api_token}',
  'X-Signature': signature,
  'Content-Type': 'application/json'
}

response = requests.post(
  'https://api.tronzap.com/v1/address-info',
  headers=headers,
  data=request_body
)

print(response.json())

Antwort

Die Antwort liefert die aktuellen Ressourcen und Token-Guthaben für die angegebene TRON-Adresse.

Antwort-Felder

FeldTypBeschreibung
codeintegerAntwortcode (0 = Erfolg)
request_idstringEindeutiger Anfrage-Bezeichner
resultobjectAntwortdaten
result.resourcesobjectAdress-Ressourcen
result.resources.energyintegerVerfügbare Energie
result.resources.bandwidthintegerVerfügbare Bandbreite
result.balancesobjectToken-Guthaben
result.balances.TRXfloatTRX-Guthaben
result.balances.USDTfloatUSDT-Guthaben

Beispiel-Antwort

json
{
  "code": 0,
  "request_id": "bbf74bcd-fb36-4df8-adc8-25f2bacd087b",
  "result": {
    "resources": {
      "energy": 131000,
      "bandwidth": 600
    },
    "balances": {
      "TRX": 10,
      "USDT": 2
    }
  }
}

Mögliche Fehler

FehlercodeKeyBeschreibung
1authAuthentifizierungsfehler (falscher Token oder Signatur)
10invalid_tron_addressUngültige TRON-Adresse
500internal_server_errorInterner Server-Fehler

Tron Energy API Documentation