4

Im php developer and trying to broadcast tron transaction. pls do not advice to me java libs. i think this operation can be made by API calls.

im understand 3 steps: create, sign and broadcast

step 1: use https://api.trongrid.io/wallet/createtransaction and get raw_data_hex result: 0a02df8d22080ffa79d7279ecb2a40a88bc8d9ba2e5a65080112610a2d747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e5472616e73666572436f6e747261637412300a1541e3b634e89a3edd652651b5c775870fc364cf2a061215413131e7dd9fe0ce528f9d86036fcfef56967d8807180170ecc8c4d9ba2e

step 2: create sign by steps from https://developers.tron.network/docs/account#signature result: 6bca53954ac706ddf59745e0e9d09e7c3709e58d1bdf35a06d0b974c1eaa0eca695d7b2aecd7200988f415a447e70064939ba56a6dd3c71725c547f3452ffaef00

and "Add this signature back into the transaction": 0a02df8d22080ffa79d7279ecb2a40a88bc8d9ba2e5a65080112610a2d747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e5472616e73666572436f6e747261637412300a1541e3b634e89a3edd652651b5c775870fc364cf2a061215413131e7dd9fe0ce528f9d86036fcfef56967d8807180170ecc8c4d9ba2e6bca53954ac706ddf59745e0e9d09e7c3709e58d1bdf35a06d0b974c1eaa0eca695d7b2aecd7200988f415a447e70064939ba56a6dd3c71725c547f3452ffaef00

step 3: broadcast this by https://api.trongrid.io/wallet/broadcasthex result: {"Error":"class com.google.protobuf.InvalidProtocolBufferException : While parsing a protocol message, the input ended unexpectedly in the middle of a field. This could mean either that the input has been truncated or that an embedded message misreported its own length."}

that i did wrong?

also i tryed to use https://api.trongrid.io/wallet/gettransactionsign with only two parameters raw_data_hex and privateKey (i think this enought to sign) but got error: {"Error":"class java.lang.NullPointerException : null"}

im confused...

P.S. MAIN question is: how to prepare/build data to pass to API /wallet/broadcasthex ?

1

1 Answer 1

0

Protobuf must be handled by protobuf libs. Use field getting/setting method. Not Binary Concat.

1
  • Why not? This working good in other cryptocurrencies. Can you show example of proper data for this API (broadcasthex)? Aug 12, 2020 at 18:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.