Skip to content
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

Signing a TX - input: legacy - Output: native segwit #151

Open
davestaxcp opened this issue Jul 28, 2023 · 5 comments
Open

Signing a TX - input: legacy - Output: native segwit #151

davestaxcp opened this issue Jul 28, 2023 · 5 comments

Comments

@davestaxcp
Copy link

Below was mentioned as an issue with signing Tx's by @openstamp_support on Telegram:

Hi. We have an issue when try to use freewallet to sign a transaction with a legacy address as input and a native segwit address as output.

We create an unsigned transaction using bitcoinjs.Transaction in lib 'bitcoinjs-lib'. The sign process works fine with freewallet in the following three cases:

  1. Input: legacy address, Output: legacy address
  2. Input: native segwit address, Output: native segwit address
  3. Input: native segwit address, Output: legacy address

But freewallet has no response when click 'sign' in the following case:

Input: legacy address, Output: native segwit address

Any ideas about this? Appreciate for your help.

@btcopenstamp
Copy link

btcopenstamp commented Jul 28, 2023

Part of the code as follows,

import * as bitcoinjs from 'bitcoinjs-lib';

export function createRawTx(sender, utxos, recipient, change){
    try{
        const txb = new bitcoinjs.Transaction();
        txb.version = 2
        for (let utxo of utxos) {
            txb.addInput(utxo.hash, utxo.vout, 0xfffffffd, Buffer.from(utxo.script, 'hex'))
        }
        txb.addOutput(bitcoinjs.address.toOutputScript(recipient), 547);

        if(change >= 546) {
            txb.addOutput(bitcoinjs.address.toOutputScript(sender), change);
        }
        txRaw = txb.toHex();
        // try to sign 'txRaw' with FreeWallet, but failed when sender starts with 1 and recipient starts with bc1q
  
    }catch(e) {
      console.log(e)
    }
  }

@pataegrillo
Copy link
Contributor

Hi, i created a transaction legacy ----> segwit and signed it with freewallet and it worked. Perhaps, there is something wrong with the transaction built. In this case I would need to check the unsigned tx to know what's happening.

@btcopenstamp
Copy link

Hi @pataegrillo. Please help check the following two unsigned txs:

  1. Tx without bare multi-sig:

02000000018e1ec7a8f09cd94e0cbf6b0bb379f1688fad639c9cb0c628866757cce193d4a2000000001976a9144cb70be9830de47ab66d4a81b8a96109ab53603f88acfdffffff02230200000000000016001440769a48db8ca9d44b7d025fe42b8edea4cb52a8c5258900000000001976a9144cb70be9830de47ab66d4a81b8a96109ab53603f88ac00000000

  1. Tx with bare multi-sig:

02000000018e1ec7a8f09cd94e0cbf6b0bb379f1688fad639c9cb0c628866757cce193d4a2000000001976a9144cb70be9830de47ab66d4a81b8a96109ab53603f88acfdffffff04230200000000000016001440769a48db8ca9d44b7d025fe42b8edea4cb52a81c0300000000000069512102c3f5eeb228edff520e04f5aceb26e20b14597cd78bcf72147804669811ba634721028740c339eb16edda66135fe8491e00aa516fbfda2c4e5118c5ae16d7f06aa09d2102222222222222222222222222222222222222222222222222222222222222222253ae1c0300000000000069512102db5e5bed72dc192587b980ce9a91249c5c150ac0600ddf351f3e9ddc002ec0eb2102a81d2177de73a70a2a2fffda0fd09c1e3bbb332c43006336850a184867b9e08d2102020202020202020202020202020202020202020202020202020202020202020253aec5258900000000001976a9144cb70be9830de47ab66d4a81b8a96109ab53603f88ac00000000

@pataegrillo
Copy link
Contributor

Hi, sorry for the delay, i'm been very busy. I saw you already spent that utxo. Did you solve the problem? do you still have issues with that?

@btcopenstamp
Copy link

Still have the issue. The UTXO was spent in another way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants