Bitcoin Forum
June 07, 2024, 06:03:26 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Cancel Invalid Raw Transaction  (Read 1501 times)
BradZimdack (OP)
Member
**
Offline Offline

Activity: 87
Merit: 12


View Profile
November 15, 2012, 12:48:04 AM
 #1

Let's suppose I create, sign, and send a raw transaction but I fail to give it enough in fees to be relayed (let's say it's for a small amount that would require at least 0.0005).  This bad tx will now be stuck in my memory pool.  If I use the command "getrawmempool", I'll see the txid for my transaction that will never be relayed and my client will think the inputs for that transaction have been spent.  Basically, those inputs will be "stuck".  I won't even be able to make a new raw transaction that spends those same inputs with a higher fee because the client thinks they've been spent and it will reject any attempt to send a new raw tx that uses them.

Is there some way I can remove or cancel a poorly crafted raw transaction to unfreeze its inputs?
Stephen Gornick
Legendary
*
Offline Offline

Activity: 2506
Merit: 1010


View Profile
November 15, 2012, 01:12:49 AM
 #2

Is there some way I can remove or cancel a poorly crafted raw transaction

You can perform wallet surgery to remove a transaction so that the client will not attempt to re-broadcast it.  Pywallet gives a delete transaction option.

to unfreeze its inputs?

If the transaction did get relayed by other nodes, your client will probably discover that transaction and thus those inputs will again be locked.  But eventually this transaction will get included in a block.

You can check Blockchain.info to see if your transaction was relayed to a node that they listen to.
 - http://www.Blockchain.info

There are free relay nodes which will relay your transaction regardless of whether or not a fee was paid.
 - https://en.bitcoin.it/wiki/Free_transaction_relay_policy

The right solution is the "child pays for parent", in which another transaction can be made (by the recipient of the transaction) and the fee paid in the second transaction will help cause the "parent" to be included in a block as well.  This is not yet available in a Bitcoin release.
 - https://github.com/bitcoin/bitcoin/pull/1647

Unichange.me

            █
            █
            █
            █
            █
            █
            █
            █
            █
            █
            █
            █
            █
            █
            █
            █


DeathAndTaxes
Donator
Legendary
*
Offline Offline

Activity: 1218
Merit: 1079


Gerald Davis


View Profile
November 15, 2012, 01:14:45 AM
Last edit: November 15, 2012, 01:28:23 AM by DeathAndTaxes
 #3

Not easily.  You can use tool like pywallet to delete the "bad" tx.  If you are going to "play" around with raw tx I would recommend backing up your wallet frequently.   If you have a recent backup you can simply restore from a backup prior to when you added the defective tx to the memory pool.  WARNING: irrecoverable loss of funds could occur if you backup is old enough to not include all keys in your current keypool. Backup your current "broken" wallet before EITHER using pywallet tool or restoring from a previous backup.

To answer your next questions (I already know what it is Wink ...  Yes
"Shouldn't there be an easier way to cancel tx which haven't been included in a block?  At least for power users from the command-line?"
MoonShadow
Legendary
*
Offline Offline

Activity: 1708
Merit: 1007



View Profile
November 15, 2012, 01:22:04 AM
 #4

If it was a valid transaction, then it will be relayed regardless of how much of a transaction fee you provided for it.  If it's invalid, you would have had to use some low level command tools to create it, because your client wouldn't do it.

Even if you sent it without any fee whatever, it will eventually make it into a block.

Time-locked (and thus retractable) transactions are part of the scripted transaction set, but are not presently honored by the network.  Those will come someday.

"The powers of financial capitalism had another far-reaching aim, nothing less than to create a world system of financial control in private hands able to dominate the political system of each country and the economy of the world as a whole. This system was to be controlled in a feudalist fashion by the central banks of the world acting in concert, by secret agreements arrived at in frequent meetings and conferences. The apex of the systems was to be the Bank for International Settlements in Basel, Switzerland, a private bank owned and controlled by the world's central banks which were themselves private corporations. Each central bank...sought to dominate its government by its ability to control Treasury loans, to manipulate foreign exchanges, to influence the level of economic activity in the country, and to influence cooperative politicians by subsequent economic rewards in the business world."

- Carroll Quigley, CFR member, mentor to Bill Clinton, from 'Tragedy And Hope'
BradZimdack (OP)
Member
**
Offline Offline

Activity: 87
Merit: 12


View Profile
November 15, 2012, 01:24:08 AM
 #5

Thanks.  I'll check out pywallet and hope to avoid situations like these.

(It looks like it's also possible to create stuck coins with a tx that accidentally tries to double spend an input.)
MoonShadow
Legendary
*
Offline Offline

Activity: 1708
Merit: 1007



View Profile
November 15, 2012, 01:26:01 AM
 #6

Thanks.  I'll check out pywallet and hope to avoid situations like these.

(It looks like it's also possible to create stuck coins with a tx that accidentally tries to double spend an input.)

Ah, yeah.  That's one of those 'invalid' conditions I was talking about.  What were you doing, coding the transaction by hand?

"The powers of financial capitalism had another far-reaching aim, nothing less than to create a world system of financial control in private hands able to dominate the political system of each country and the economy of the world as a whole. This system was to be controlled in a feudalist fashion by the central banks of the world acting in concert, by secret agreements arrived at in frequent meetings and conferences. The apex of the systems was to be the Bank for International Settlements in Basel, Switzerland, a private bank owned and controlled by the world's central banks which were themselves private corporations. Each central bank...sought to dominate its government by its ability to control Treasury loans, to manipulate foreign exchanges, to influence the level of economic activity in the country, and to influence cooperative politicians by subsequent economic rewards in the business world."

- Carroll Quigley, CFR member, mentor to Bill Clinton, from 'Tragedy And Hope'
BradZimdack (OP)
Member
**
Offline Offline

Activity: 87
Merit: 12


View Profile
November 15, 2012, 01:43:15 AM
 #7

What were you doing, coding the transaction by hand?

Yes, I was.  I was using listunspent to find available inputs, then using those to create raw transactions.  Somehow, I was shown unspents that had actually been spent an hour earlier.  I think it may have been due to an odd combination of factors including switching out wallet files, a big time gap between blocks, and difficulty establishing more than 2-3 connections to other nodes.  I can't fully explain how it happened, but being blighted with a broken transaction appears to be my punishment.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!