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

Overpaying fees error (duplicate of 1971) #2017

Closed
tanzile789 opened this issue Dec 29, 2023 · 5 comments
Closed

Overpaying fees error (duplicate of 1971) #2017

tanzile789 opened this issue Dec 29, 2023 · 5 comments

Comments

@tanzile789
Copy link

tanzile789 commented Dec 29, 2023

  const p2wpkhSender = bitcoin.payments.p2wpkh({
    pubkey: keyPair.publicKey,
    network
  });
  
  const p2wpkhReceiver = bitcoin.payments.p2wpkh({
    address: receiverAddress,
    network
  });

  const psbt = new bitcoin.Psbt({ network: network })
    .addInput({
      hash: lastTransaction.txid,
      index: lastTransaction.vout,
      // nonWitnessUtxo: reconstructedTx.toBuffer(),
      witnessUtxo: {
        script: p2wpkhSender.output,
        value: lastTransaction.satoshi
      }
    })
    .addOutput({
      address: p2wpkhReceiver.address,
      value: 10000
    })
    .signInput(0, keyPair)
    .finalizeInput(0)
    .extractTransaction();

  console.log(" ============================= this is newww ");
  console.log(psbt.toHex());
@junderw
Copy link
Member

junderw commented Dec 29, 2023

The code looks fine. What's the issue?

@tanzile789
Copy link
Author

I thought it worked, but it didn't generate pbt.tohex (),Unable to console

@junderw
Copy link
Member

junderw commented Dec 29, 2023

I can't see anything wrong with your code.

I would need more information to diagnose this issue.

@junderw junderw closed this as completed Dec 29, 2023
@junderw junderw changed the title Network used testnet,Wallet used p2wpkh Until the last step, they couldn't generate it,I don't know what the problem is Please help me, I'm a novice Troubleshooting an unknown issue. toHex does not output anything. Dec 29, 2023
@tanzile789
Copy link
Author

I think I got the question.,witnessUtxo.script is error
It suggests Warning: You are paying around 0.01722930 in fees, which is 15663 satoshi per byte for a transaction with a VSize of 110 bytes (segwit counted as 0.25 byte per byte). Use setMaximumFeeRate method to raise your threshold, or pass true to the first arg of extractTransaction

@junderw junderw changed the title Troubleshooting an unknown issue. toHex does not output anything. Overpaying fees error Dec 29, 2023
@junderw
Copy link
Member

junderw commented Dec 29, 2023

Please search for existing issues first:

Locking as duplicate: #1971

@bitcoinjs bitcoinjs locked as resolved and limited conversation to collaborators Dec 29, 2023
@junderw junderw changed the title Overpaying fees error Overpaying fees error (duplicate of 1971) Dec 29, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants