tron-php開發套件適用於為PHP應用快速存取TRX、TRC20數位資產的支援能力,即支援使用自有Tron區塊鏈節點的應用場景,也支援基於Tron官方公共API服務的輕量級部署場景。
【推薦學習:PHP影片教學】
tron-php Github位址: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();
以上是PHP呼叫實現波場互動[支援TRX/TRC20]的詳細內容。更多資訊請關注PHP中文網其他相關文章!