tron-api icon indicating copy to clipboard operation
tron-api copied to clipboard

signTransaction method has bug with the second param "message"

Open jackyxie opened this issue 4 years ago • 7 comments

As the example of transactionbuilder shows, I set the second param "message" to something. Finally, sendRawTransaction returning sigerror with

validate signature error xxxxxx is signed by xxxxxx but it is not contained of permission.

https://github.com/iexbase/tron-api/blob/fafeab39c4a7344aee8e8d222ce8f796c74d1df4/src/Tron.php#L711

here is the partial of my code:

$transaction = $tron->getTransactionBuilder()->sendTrx($dest_address, 300.0);

$signedtxs = $tron->signTransaction($transaction, $msg);
//die(print_r($signedtxs));

try {
    $response = $tron->sendRawTransaction($signedtxs);
}catch (\IEXBase\TronAPI\Exception\TronException $e) {
    exit($e->getMessage());
}

if (isset($response['code']) && $response['code'] === 'SIGERROR') {
    exit(hex2bin($response['message']));
}

die(print_r($response));

jackyxie avatar Oct 21 '20 14:10 jackyxie

It worked online, I need to fix it for offline signature mode

serderovsh avatar Oct 27 '20 05:10 serderovsh

It worked online, I need to fix it for offline signature mode

can this lib support trc20-usdt transaction?

ijry avatar Nov 24 '20 05:11 ijry

It worked online, I need to fix it for offline signature mode

can this lib support trc20-usdt transaction?

hi i have made up an article about how to send with trc20 token with use of this library, kindly refer to here https://www.btcschools.net/tron/tron_create_trc20_tx.php

Atlas Chiew btcschools.net

atlaschiew avatar Jan 08 '21 04:01 atlaschiew

I got same error, when public key generated from private has 63 bytes length

androzd avatar Mar 25 '21 07:03 androzd

Has anyone else encountered this problem and know how to solve it?

powerbyme avatar Jun 25 '21 17:06 powerbyme

I got same error, when public key generated from private has 63 bytes length

My private has 64 bytes length, so ...

powerbyme avatar Jun 25 '21 17:06 powerbyme

Need to request for update the transaction,and got a new $transaction['txID']

		if (!is_null($message)) {
			$transaction['raw_data']['data'] = $this->stringUtf8toHex($message);
			//更新数据
			$response = $this->manager->request(
				'wallet/getsignweight',
				$transaction
			);
			$transaction = $response['transaction']['transaction'];
		}

kerwin-cn avatar Sep 30 '21 21:09 kerwin-cn