PHP calls to realize wave field interaction [supports TRX/TRC20]

藏色散人
Release: 2023-04-09 21:32:01
forward
6100 people have browsed it

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

Supported methods

  • Generate addressgenerateAddress()
  • Validate addressvalidateAddress(Address $address)
  • Get the address based on the private keyprivateKeyToAddress(string $privateKeyHex)
  • Query balancebalance(Address $address)
  • Transaction transfer (Offline signature) transfer(Address $from, Address $to, float $amount)
  • Query the latest blockblockNumber()
  • According to Blockchain query informationblockByNumber(int $blockID)
  • Query information based on transaction hashtransactionReceipt(string $txHash)

Quick Start

Installation

composer require fenguoz/tron-php
Copy after login

Interface call

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();
Copy after login

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!

Related labels:
source:learnku.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template