title: TRON blockchain: create, sign and broadcast transaction via API of public node
body: <p>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.</p>
  <p>im understand 3 steps: create, sign and broadcast</p>
  <p><strong>step 1</strong>: use <a href="https://api.trongrid.io/wallet/createtransaction" rel="nofollow noreferrer">https://api.trongrid.io/wallet/createtransaction</a>
  and get raw_data_hex
  result: <code>0a02df8d22080ffa79d7279ecb2a40a88bc8d9ba2e5a65080112610a2d747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e5472616e73666572436f6e747261637412300a1541e3b634e89a3edd652651b5c775870fc364cf2a061215413131e7dd9fe0ce528f9d86036fcfef56967d8807180170ecc8c4d9ba2e</code></p>
  <p><strong>step 2</strong>: create sign by steps from <a href="https://developers.tron.network/docs/account#signature" rel="nofollow noreferrer">https://developers.tron.network/docs/account#signature</a>
  result: <code>6bca53954ac706ddf59745e0e9d09e7c3709e58d1bdf35a06d0b974c1eaa0eca695d7b2aecd7200988f415a447e70064939ba56a6dd3c71725c547f3452ffaef00</code></p>
  <p>and &quot;Add this signature back into the transaction&quot;:
  <code>0a02df8d22080ffa79d7279ecb2a40a88bc8d9ba2e5a65080112610a2d747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e5472616e73666572436f6e747261637412300a1541e3b634e89a3edd652651b5c775870fc364cf2a061215413131e7dd9fe0ce528f9d86036fcfef56967d8807180170ecc8c4d9ba2e6bca53954ac706ddf59745e0e9d09e7c3709e58d1bdf35a06d0b974c1eaa0eca695d7b2aecd7200988f415a447e70064939ba56a6dd3c71725c547f3452ffaef00</code></p>
  <p><strong>step 3</strong>: broadcast this by <a href="https://api.trongrid.io/wallet/broadcasthex" rel="nofollow noreferrer">https://api.trongrid.io/wallet/broadcasthex</a>
  result:
  <code>{&quot;Error&quot;:&quot;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.&quot;}</code></p>
  <p>that i did wrong?</p>
  <p>also i tryed to use <a href="https://api.trongrid.io/wallet/gettransactionsign" rel="nofollow noreferrer">https://api.trongrid.io/wallet/gettransactionsign</a> with only two parameters raw_data_hex and privateKey (i think this enought to sign)
  but got error:
  <code>{&quot;Error&quot;:&quot;class java.lang.NullPointerException : null&quot;}</code></p>
  <p>im confused...</p>
  <p>P.S. MAIN question is:
  how to prepare/build data to pass to API <a href="https://developers.tron.network/reference#broadcasthex" rel="nofollow noreferrer">/wallet/broadcasthex</a> ?</p>