l3utterfly
l3utterfly

Reputation: 2186

TronGrid API Get Transaction Sign not found

I'm using the TronGrid API to sign/broadcast my transaction, following the docs here: https://developers.tron.network/docs/api-sign-flow

However, when I try to sign my transaction using the API: https://api.trongrid.io/wallet/gettransactionsign API, I get 404 Not Found.

Even using their API explorer "try it" feature, I still get 404:

enter image description here

Anyone know why this is?

Upvotes: 1

Views: 3437

Answers (2)

Alexandr Vinogradov
Alexandr Vinogradov

Reputation: 1

That method is deprecated under api.trongrid.io for security reasons, please use wallet/gettransactionsign with local node, or sign transaction programmatically:

For PHP, example:

Firstly: $transaction -> "/wallet/createtransaction"

Then:

$signature = Support\Secp::sign($transaction['txID'], $this->privateKey);   
 
public static function sign(string $message, string $privateKey): string
    {
        $secp = new Secp256k1();        
        /** @var Signature $sign */
        $sign = $secp->sign($message, $privateKey, ['canonical' => false]);        
        return $sign->toHex() . bin2hex(implode('', array_map('chr', [$sign->getRecoveryParam()])));
    }

Finally: $result -> "/wallet/broadcasttransaction"

Upvotes: 0

l3utterfly
l3utterfly

Reputation: 2186

I have found the root cause. The problem is with their API documentation. Their Chinese version explains it perfectly, but I assume they are having some trouble translating it in English.

Essentially, this API is deprecated because it's not secure. To use this API, you have to run a Full Node yourself, then call this API on the full node server.

Upvotes: 1

Related Questions