The example code for psbt.addOutput() with address '1KRMKfeZcmosxALVYESdPNez1AP1mEtywp' works as expected. But if I change this to an testnet address I get this error: ' has no matching script'. I expect I need to specify testnet somewhere, but do not know where.

    const psbt = new bitcoin.Psbt();
        hash: 'b881ecef041a7396f3c225644507955732ae98d4a736de7b9ac235c69e1eb182',  
        nonWitnessUtxo: Buffer.from(


      //address: '1KRMKfeZcmosxALVYESdPNez1AP1mEtywp', <- works
      address: 'mhm89vYkAjmU3MWUtyCUcsYYUvkgXT1FAw',
      value: 7240446,     //was 7250446

  • 1
    Ok found it: const psbt = new bitcoin.Psbt({ network: testnet })
    – NoudS
    Sep 27 '19 at 12:07

you need to be passing the network parameter as the tuple and thus you forgot to put the {} on them . the link on github repo (https://github.com/bitcoinjs/bip174) explains the proposition in correct way.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.