-
Notifications
You must be signed in to change notification settings - Fork 117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to create transaction with API then sign a transaction offline and then broadcast using API #135
Comments
@CoticiGabi |
Hello @endiaoekoe , I tried following the doc that you gave me, i created and signed the transaction using ApiWrapper class. But the signature is in ByteString format, when i transform it in hex and then call the Trongrid API to broadcast with the provided signature I keep getting the following error :
Can I use ApiWrapper with an API like Trongrid ? I see that it has constructors only for grpc full nodes. |
@CoticiGabi |
I want to create a transaction by using api call https://api.nile.trongrid.io/wallet/createtransaction , which gives me this response for example :
Then I want to sign the transaction offline using the trident library. From what I saw in other closed issues, you recommend to use this :
public Chain.Transaction signTransaction(Response.TransactionExtention txnExt, KeyPair keyPair) {
byte[] txid = txnExt.getTxid().toByteArray();
byte[] signature = KeyPair.signTransaction(txid, keyPair);
Chain.Transaction signedTxn = txnExt.getTransaction().toBuilder().addSignature(ByteString.copyFrom(signature)).build();
return signedTxn;
}
Which uses a TransactionExtension object, that i do not get from the /createtransaction API response, and I didn't find a way to construct it from the API response.
My question is : How can I create a trasnaction using the API , then sign it using the trident sdk and then broadcast it using the API ?
The text was updated successfully, but these errors were encountered: