Skip to content

Introduction

The Evelar.Energy API is designed to enable seamless interaction with TRON energy market.

The API allows users to retrieve balances, calculate order prices, manage orders, and more.

Current API Version

Version: 1.1.1

Release Date: 2024-12-23

View Changelog

Endpoints

For production: https://api.evelar.energy/v1

For development: https://dev-api.evelar.energy/v1

Required Headers

Every request must include these headers:

  • Content-Type: application/json
  • Accept: application/json
  • Authorization: Bearer {TOKEN}
  • X-Txc-Signature: {SIGN}

Notes:

  • {TOKEN} is a unique token provided by us. It has no expiration but can be replaced via the API.
  • {SIGN} is a SHA256 hash generated from the request body concatenated with a secret key (provided by us).

Authentication

Generating the Signature

The X-Txc-Signature header ensures request integrity. Here's how to generate it using different programming languages:

Input Example

json
{
  "amount": 30000,
  "duration": 7
}

Empty Body Requests

For POST requests with an empty body, use "{}" as the body during signature calculation.

Code Samples

Python
Python
import hashlib

json_data = '{"amount":30000,"duration":7}'
secret = 'MYSECRET'
sign = hashlib.sha256((json_data + secret).encode('utf-8')).hexdigest()

print("Signature:", sign)
PHP
PHP
$jsonData = '{"amount":30000,"duration":7}';
$secret = 'MYSECRET';
$sign = hash('sha256', $jsonData . $secret);

echo "Signature: " . $sign;
Node.js
javascript
const crypto = require('crypto');

const jsonData = '{"amount":30000,"duration":7}';
const secret = 'MYSECRET';
const sign = crypto.createHash('sha256').update(jsonData + secret).digest('hex');

console.log("Signature:", sign);
Bash
bash
json_data='{"amount":30000,"duration":7}'
secret='MYSECRET'
sign=$(echo -n "$json_data$secret" | openssl dgst -sha256 -hex | awk '{print $2}')

echo "Signature: $sign"