1

I'm trying to understand how we can sign unsigned transaction in hex format. We use TrustWalletCore, I receive an unsigned tx in hex format, then we decode it to data with

let dataToSign = Data(hex: unsignedTxHex)

then sign it with wallet core method:

`coinPrivateKey`.sign(digest: dataToSign, curve: .secp256k1)

and I tried:

`coinPrivateKey`.signAsDER(digest: dataToSign)

then covert it to hex again:

let signedStr = signedData?.toHexString()

And I tried to decode it using this service

And receive error: "error": "Cannot read slice out of bounds"

How I can resolve this problem? Thanks a lot for your comments and answers

0

Your Answer

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

Browse other questions tagged or ask your own question.