Bitcoin

bitcoin core – How to create BitcoinSigningInput from hexadecimal (WalletCore)

Hello everyone!

We are looking to implement BTC/LTC/DOGE transfers through the backend of our mobile app. Before that I used the WalletCore library.

The previous steps are as follows:

  1. to make BitcoinUnspentTransaction.
  2. to make BitcoinSigningInput with BitcoinUnspentTransaction It’s in the utxos parameter.
  3. signature BitcoinSigningInput.
  4. broadcast.

The current new trends are as follows:

  1. The backend asks for input.
  2. Sign your input.
  3. Send all required data to the backend (enter amount, signature).
  4. Broadcast using a backend.

So I took input from the backend and ran into some issues. I need BitcoinSigningInput (WalletCore class). Therefore, I think I must create. BitcoinSigningInput From input received from the backend. However, I don’t understand at all how to convert these inputs (received in HEX format) to: BitcoinSigningInput These are the types that can be signed using WalletCore.

I’m trying a few different methods. The final method is as follows:

let data = Data(hex:utxosBackend)
let input = try BitcoinSigningInput(serializedData: data)

But this causes an error: truncated

Thank you so much for your help!

Related Articles

Back to top button