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

Have I understood the concept of address, account and wallet correctly and how the wallet balance is calculated?

Good morning everyone!

We are trying to implement BTC/LTC/DOGE sending through our backend in our mobile app. Before that, we used the WalletCore library.

Our previous steps were:

  1. Creating BitcoinUnspentTransaction.
  2. Creating BitcoinSigningInput with BitcoinUnspentTransaction in utxos params.
  3. Signing BitcoinSigningInput.
  4. Broadcasting.

At this moment, our new flow is:

  1. Requesting inputs from the backend.
  2. Signing inputs.
  3. Sending all necessary data to the backend (amount, signing inputs).
  4. Broadcasting using the backend.

So, I received inputs from the backend and encountered some issues. I need BitcoinSigningInput (a WalletCore class) to sign it. Therefore, I think that I should create BitcoinSigningInput from the inputs which I receive from our backend. However, I completely don’t understand how to convert these inputs (which I receive in HEX format) to BitcoinSigningInput type, which I can sign using WalletCore.

I’m trying some different ways, the last one:

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

but this produce error : truncated

Thanks a lot for your help!

Source link

What do you think?

Written by BTC Artist

Leave a Reply

Your email address will not be published. Required fields are marked *

GIPHY App Key not set. Please check settings

Philippine central bank to introduce CBDC without blockchain technology

Philippine central bank to introduce CBDC without blockchain technology


Mystery Whale’s $112M Accumulation Spree