Fenguoz / tron-php

Support TRON's TRX and TRC20, which include functions such as address creation, balance query, transaction transfer, query the latest blockchain, query information based on the blockchain, and query information based on the transaction hash
MIT License
200 stars 72 forks source link
php rpc trc20 tron trx

English | 中文

TRON-PHP

Stable Version Php Version tron-php License Total Downloads

Introduction

Support TRON's TRX and TRC20, which include functions such as address creation, balance query, transaction transfer, query the latest blockchain, query information based on the blockchain, and query information based on the transaction hash

Advantage

  1. One set of scripts is compatible with all TRX currencies and TRC20 certifications in the TRON network
  2. Interface methods can be added or subtracted flexibly

Support Method

Quick Start

Install

PHP8

composer require fenguoz/tron-php

or PHP7

composer require fenguoz/tron-php ~1.3

Interface

use GuzzleHttp\Client;

$uri = 'https://api.trongrid.io';// mainnet
// $uri = 'https://api.shasta.trongrid.io';// shasta testnet
$api = new \Tron\Api(new Client(['base_uri' => $uri]));

$trxWallet = new \Tron\TRX($api);
$addressData = $trxWallet->generateAddress();
// $addressData->privateKey
// $addressData->address

$config = [
    'contract_address' => 'TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t',// USDT TRC20
    'decimals' => 6,
];
$trc20Wallet = new \Tron\TRC20($api, $config);
$addressData = $trc20Wallet->generateAddress();

Plan

Package

Name description Scenes
Fenguoz/tron-api TRON official document recommends PHP extension package TRON basic API

🌟🌟

Stargazers over time

Cooperate

Contact