Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add tron network(TRX) address support #38

Open
bolpol opened this issue Jun 7, 2020 · 0 comments
Open

add tron network(TRX) address support #38

bolpol opened this issue Jun 7, 2020 · 0 comments

Comments

@bolpol
Copy link

bolpol commented Jun 7, 2020

Tron is not token yet.

This code return valid tron address. Please update your code to was possible get address from a box.

./hd-wallet-derive/hd-wallet-derive.php --coin=ETH --mnemonic="mnemonic" --mnemonic-pw="password" --path="m/44'/195'/0'/0/0"  -g  --numderive=1 --format=csv
use BitcoinPHP\BitcoinECDSA\BitcoinECDSA;
use IEXBase\TronAPI\Support\Utils as TronUtils;
use IEXBase\TronAPI\Tron;

$fullNode = new HttpProvider('https://api.trongrid.io');
$solidityNode = new HttpProvider('https://api.trongrid.io');
$eventServer = new HttpProvider('https://api.trongrid.io');
$blockchain =  new Tron($fullNode, $solidityNode, $eventServer);

function getTronAddress($privateKey)
{
    $bitcoinECDSA = new BitcoinECDSA();
    $bitcoinECDSA->setPrivateKey($privateKey);
    $publicKey = $bitcoinECDSA->getUncompressedPubKey();
    $address = TronUtils::pubKeyToAddress($publicKey);
    return $blockchain ->hexString2Address($address);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant