I am developing a android application for TRON blockchain. I'm using Trust wallet library.
implementation 'com.trustwallet:wallet-core:2.3.9'
Sign transaction is almost done but for broadcasting I need raw_data_hex
data .How can I get it.
code
val privateStr = "privatekey"
val privateBytes: ByteArray = fromHexString(privateStr)
val trc = Tron.TransferContract.newBuilder()
.setOwnerAddress("owner_address")
.setToAddress("toadress")
.setAmount(1000000L)
val transaction = Tron.Transaction.newBuilder()
.setTransfer(trc)
.build()
val signingInput = Tron.SigningInput.newBuilder()
.setTransaction(transaction)
.setPrivateKey(ByteString.copyFrom(privateBytes))
val output = AnySigner.sign(signingInput.build(), CoinType.TRON, Tron.SigningOutput.parser())
println("*****signing_output${output.json}")
and output json is
{"raw_data":{"contract":[{"parameter":{"type_url":"type.googleapis.com/protocol.TransferContract","value":{"amount":1000000,"owner_address":"419c84ec90ef46e68530893cf3229a1dd695b8b457","to_address":"41105e58ce5d754034475f24149ab910f9602bc141"}},"type":"TransferContract"}],"expiration":1608078105411,"ref_block_bytes":"0000","ref_block_hash":"9afbf4c8996fb924","timestamp":1608042105411},"signature":["7204dd578e610164d415f30e57eeb07cab2028a82992c6986f932271796d14b810f85e7b634e0606eefcfe9c76a85663f68a076be8efe7f2355fdb2dc5986f2801"],"txID":"6f3027995c380950442a0f9479ccf31948c7d1134314e333d4b3688799f3d4d1"}