uncooked transaction – testnet output handle has no matching Script?

0
103


Right here is my code to create a PSBT on the testnet:

const bitcoin = require("bitcoinjs-lib")

const privKey1 = "..."
const address1 = "mkVPHMR5euGTcvpFj6tfyVERstDdH4RtQs"

const theKeyPair = bitcoin.ECPair.fromWIF(privKey1, bitcoin.networks.testnet)

const psbt = new bitcoin.Psbt({ community: bitcoin.networks.testnet })

psbt.addInput({
  hash: "c77821e0565d17e857994b1e026d2cf382ef84b53fca76d1d4b63ce9ee645290",
  index: 0,
  nonWitnessUtxo: Buffer.from("02000000000101170e07c2351440cb0938947c3a41dddbbbe8aa80d44cdcaf6ea0f2b385abf9d20000000000feffffff02400d0300000000001976a914368ca7e5ed3e4c362cc89d65ea5377e4500a797988ac0c235b7500000000160014b31af8dfde1e14e2ac989fc8b166d8132e510d1a0247304402200cbcbdc329254f8bb179b994a60adba7b6015902eb88a7ee805db679f9538ee40220755a3ed40edcf94a31f13af9f30e84179eb5e672f0d7b2aeb2c6e0b46578c037012103c4f71eb5e4d36c44e6551d874bae0948cc7c06685c7198b174ce298538232c13f56a2200", "hex")
})

psbt.addInput({
  hash: "194e0a0bdb2d0ff22ede8c4eefe6b84419064c919b08ea5e656582e8d12c1b42",
  index: 1,
  nonWitnessUtxo: Buffer.from("0200000001f690b8dfd90ee3a8cf146b51c1f5d3180f2a58e997c2fd5aa10428f46b0fcd6d000000006b483045022100ae38259cf1643e8092ea2eade8de51bbbe0c48cac958f450619fa109616e85c0022046f57444fa3b6e05cb14499d302f19172f1a9db0af380ff1c8a36a6c0bb67e5e012102bc65de8691ff3a63c032aa3bde43acc4b22302a28d4554035a1e5791affd28bbffffffff0288130000000000001976a9140a27eeaabbb78515d92ac4237de4c75d5a7e047c88ac905f0100000000001976a914368ca7e5ed3e4c362cc89d65ea5377e4500a797988ac00000000", "hex")
})

psbt.addOutput({
  handle: "cQqgBiALkRLfbc17BUJWjUSpKJzgumLP1utkZNJE5yiUcrAa6",
  worth: 289000
})

psbt.signInput(0, theKeyPair)
psbt.validateSignaturesOfInput(0)
psbt.signInput(1, theKeyPair)
psbt.validateSignaturesOfInput(1)
psbt.finalizeAllInputs()

psbt.extractTransaction().toHex()

When I attempt to run the code I get the error under:

  throw new Error(handle + ' has no matching Script');
  ^

Error: cQqgBiALkRLfbc17BUJWjUSpKJzgumLP1utkZNJE5yiUcrAa6 has no matching Script

Any assist? Might or not it’s the way in which I instantiate my key pair?

LEAVE A REPLY

Please enter your comment!
Please enter your name here