Home > Article > Backend Development > PHP calls to realize wave field interaction [supports TRX/TRC20]
tron-php development kit is suitable for quickly accessing TRX and TRC20 digital assets for PHP applications. It supports application scenarios using its own Tron blockchain nodes and also supports services based on Tron’s official public API. lightweight deployment scenarios.
[Recommended learning: PHP video tutorial]
tron-php Github address: https://github.com/Fenguoz/tron-php
generateAddress()
validateAddress(Address $address)
privateKeyToAddress(string $privateKeyHex)
balance(Address $address)
transfer(Address $from, Address $to, float $amount)
blockNumber()
blockByNumber(int $blockID)
transactionReceipt(string $txHash)
composer require fenguoz/tron-php
use GuzzleHttp\Client; $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, $this->config); $addressData = $trc20Wallet->generateAddress();
The above is the detailed content of PHP calls to realize wave field interaction [supports TRX/TRC20]. For more information, please follow other related articles on the PHP Chinese website!