/tron-api

A PHP API for interacting with Tron (TRX)

Primary LanguagePHPMIT LicenseMIT

TRON API

A PHP API for interacting with the Tron Protocol

Latest Stable Version Software License Build Status Issues Pull Requests Contributors

Install

> composer require iexbase/tron-api

Requirements

The following versions of PHP are supported by this version.

  • PHP 7.1
  • PHP 7.2

Example Usage

use IEXBase\TronAPI\Tron;

$tron = new Tron();

//Change node address
$fullNode = new HttpProvider('https://api.trongrid.io:8090');
$solidityNode = new HttpProvider('https://api.trongrid.io:8091');
$tron - new Tron($fullNode, $solidityNode);

//alternative way to enter a private key
$tron->setPrivateKey('private_key');

//Balance
$tron->fromTron($tron->getBalance());

// Transfer Trx
var_dump($tron->sendTransaction('from', 'to', 'amount'));

//Generate Address
var_dump($tron->generateAddress());

//Get Last Blocks
var_dump($tron->getLatestBlocks(2));

//Change account name (only once)
var_dump($tron->changeAccountName('address', 'NewName'));

Testing

$ vendor/bin/phpunit

Donations

Tron(TRX): TRWBqiqoFZysoAeyR1J35ibuyc8EvhUAoY