I am making an attempt to broadcast a transaction to my RPC supplier:
curl https://my-quicknode-rpc-provider/
-X POST
-H "Content material-Kind: software/json"
--data '{"methodology": "sendrawtransaction", "params": ["02000000000101cc0fc61320a04525c8dabf30241fe9a64b3f8c28ebf61a9700b8a57a76306bac0000000000ffffffff01ea100000000000002251208dace6f04076ca1ea4eb168dcdad6ad61f695ca1c16a3df6b9586cdca1c71db8034025871482b0c7bb14b8c72d5ac44ce069991505a1aeca1c4de5b8d1857831ca87e6f43a3e784c755595574c798892ecf58c7ae525bccba441cdf46862dd405bb47e208dace6f04076ca1ea4eb168dcdad6ad61f695ca1c16a3df6b9586cdca1c71db8ac0063036f7264010118746578742f706c61696e3b636861727365743d7574662d3800387b2270223a226272632d3230222c226f70223a227472616e73666572222c227469636b223a2270657065222c22616d74223a22313030227d6821c18dace6f04076ca1ea4eb168dcdad6ad61f695ca1c16a3df6b9586cdca1c71db800000000"]}'
however I hold getting this error response from the RPC:
{"end result":null,"error":{"code":-26,"message":"non-mandatory-script-verify-flag (Witness program hash mismatch)"},"id":null}
I’ve verified a number of instances that I am signing with the proper non-public key. On high of that, this happens when broadcasting to the community, not throughout signing my PSBT inputs so I have been having bother debugging.
For some context, I am making an attempt to connect a Taproot script to my enter UTXO. Here’s a code snippet of what I am doing:
const hexData = Buffer.from(
`{"p":"brc-20","op":"switch","tick":"${tick}","amt":"${quantity.toString()}"}`
).toString("hex");
const publicKeyHex = toXOnly(tweakedSigner.publicKey).toString("hex");
let inscribeLockScript = bitcoin.script.fromASM(
`${publicKeyHex} OP_CHECKSIG OP_0 OP_IF ${Buffer.from("ord").toString(
"hex"
)} OP_1 ${Buffer.from("textual content/plain;charset=utf-8").toString(
"hex"
)} OP_0 ${splitByNChars(hexData, 1040).be part of(" ")} OP_ENDIF`
);
inscribeLockScript = Buffer.from(
inscribeLockScript.toString("hex").substitute("6f726451", "6f72640101"),
"hex"
);
const scriptTree: Taptree = {
output: inscribeLockScript,
};
const inscribeLockRedeem = {
output: inscribeLockScript,
redeemVersion: 192,
};
const inscribeP2tr = bitcoin.funds.p2tr({
internalPubkey: toXOnly(tweakedSigner.publicKey),
scriptTree,
community: bitcoin.networks.bitcoin,
redeem: inscribeLockRedeem,
});
const tapLeafScript = ;
psbt.addInput({
hash: utxo.hash,
index: utxo.index,
witnessUtxo: {
script: inscribeP2tr.output!,
worth: utxo.worth,
},
tapInternalKey: toXOnly(tweakedSigner.publicKey),
tapLeafScript: [tapLeafScript],
});
I am pretty new to this so any assist can be appreciated!