bitcoin core – The way to create a double spend to prioritize a brand new transaction over a earlier unconfirmed transaction?


I might wish to generate a double spend transaction and enhance the gasoline charges over the earlier, unconfirmed transaction that has been caught for per week. I do know there’s different solutions relating to double spend however I am searching for extra of a technical reply particular to my thought course of and pattern code.

I perceive the overall premise is to recreate the originating transaction in its entirety. I’ve began by using bitcore-lib to carry out a getRawTransaction of my at present caught transaction. From right here, I am iterating over the vin and performing a getRawTransaction of the vin’s txid to retrieve the mother or father. I am then parsing the mother or father, iterating over every vout and searching for vout.n to match the earlier vin.vout. As soon as I discover a match, I am producing a utxo which successfully appears to be like like this:

const utxo = {
    handle: output.scriptPubKey.addresses[0],
    txId: vin.txid,
    outputIndex: vin.vout,
    script: output.scriptPubKey,
    satoshis: output.worth

I then use these utxos to generate and signal the transaction as follows (sorry for lack of full class, however the precise means of signing transactions is absolutely practical):

const transaction = new Bitcore.Transaction();

targets.forEach((goal) => {, this.amountToSatoshis(goal.quantity));

So my questions are…

  1. Is my thought course of appropriate in how I may go about regenerating the unique transaction for submission by bitcore?
  2. Is there a better method to regenerate the transaction and enhance the charges than how I am attempting to do it?
  3. When making an attempt to copy/duplicate the earlier utxos, would I need to additionally present the sequence quantity within the utxo?
  4. Will this even work or will I even be capable to submit this transaction to my identical core node?
  5. If it will not work, would it not work if I ran -zapwallettxes on the core node first?

Supply hyperlink

Leave a reply