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

Error: No signatures for this pubkey #1

Open
chironjit-neoswap opened this issue Apr 27, 2023 · 0 comments
Open

Error: No signatures for this pubkey #1

chironjit-neoswap opened this issue Apr 27, 2023 · 0 comments

Comments

@chironjit-neoswap
Copy link

Hi, i am trying to sign a psbt for an ordinal but i keep getting this error:

PSBT generator:

async function generatePSBTForSale(ordinalUtxoTxId, ordinalUtxoVout, price, paymentAddress) {
    let psbt = new bitcoin.Psbt({ network });

    const tx = bitcoin.Transaction.fromHex(await getTxHexById(ordinalUtxoTxId))
    for (const output in tx.outs) {
        try { tx.setWitness(parseInt(output), []) } catch { }
    }

    const input = {
        hash: ordinalUtxoTxId,
        index: parseInt(ordinalUtxoVout),
        nonWitnessUtxo: tx.toBuffer(),
        witnessUtxo: tx.outs[ordinalUtxoVout],
        sighashType: bitcoin.Transaction.SIGHASH_SINGLE | bitcoin.Transaction.SIGHASH_ANYONECANPAY,
    }

    psbt.addInput(input);

    psbt.addOutput({
        address: paymentAddress,
        value: price,
    });

    return psbt.toBase64();
}

const formattedPsbt = await generatePSBTForSale("7c60d897c2637c1d811eec393f3c2c5d120cf9bb5502ad17e76c96acdd961a89", 0, 10000, segwitAddress1)

PSBT formatting and signing:

const wallet = new Wallet(key1, NetworkType.MAINNET, AddressType.P2TR);
const bufferPsbt = Buffer.from(formattedPsbt, 'base64')
const hexpsbt = bufferPsbt.toString('hex')

const signedPsbtHex = await wallet.signPsbt(hexpsbt, [
    {
      index: 0,
      publicKey: await wallet.getPublicKey(),
      sighashTypes: [
        bitcoin.Transaction.SIGHASH_SINGLE | bitcoin.Transaction.SIGHASH_ANYONECANPAY,
      ],
    },
  ]);

I however get this error when trying to sign:

if (!allHashses.length) throw new Error('No signatures for this pubkey');
                                  ^

Error: No signatures for this pubkey

May i ask if this an issue with my formatting or is this an issue with the local wallet?

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

1 participant