Came across an issue where I was given the message:

"Error: The transaction was rejected. This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here."

It appears that the 2nd amount was deducted from my total balance even though it still sits at 0/unconfirmed status days later even though the unconfirmed transaction has disappeared from the blockchain.

Any suggestions? I've also installed Python and tried running a script provided by someone else (within Windows 7) and cannot seem to get the script to run properly.

Any help is greatly appreciated.

  • 2
    At some point this will be something that can be handled by the client. Currently, the only method to purge that double spend is a manual process. Commented May 13, 2012 at 22:40

3 Answers 3


The problem is that the Bitcoin wallet implementation is written with the assumption that the transactions it created itself are always valid. If they do not get confirmed, it simply keeps trying to submit then to the network until they get confirmed.

However, since the introduction of dumpprivkey and wallet tools, it's easy enough to create other wallets with the ability to spend from the same key, resulting in potential double spends.

The current best solution is removing the double transaction from the wallet (maybe via a wallet tool, or by dumping the bdb file, removing the transaction line, and importing it again). On a slightly longer term, we plan to make wallets detect transactions that conflict with the block chain, and consider them rejected.


Apparently to get the RPC command removeprivkey you'll need a build of the Bitcoin client which includes pull #220 (which has been merged into main). The latest version (currently v0.12.1) contains this feature.

Here are the instructions to do that:

Step 1. Back up your wallet. You are performing wallet surgery here, ... and doing things you might not have intended.

Run Bitcoin as a server, e.g.,

$ ./bitcoin-qt -server


If you've encrypted your wallet you'll need to open it for RPC

$ ./bitcoind walletpassphrase [passphrase] 1000


$ ./bitcoind dumpprivkey [bitcoin address]

Then copy and paste the private key it provides. Then

$ ./bitcoind removeprivkey [bitcoin private key]

Then close bitcoin-qt.

After that

$ ./bitcoind -rescan

  • 2
    I don't understand. I'm not familiar with the 'removeprivkey' command, but it sounds like it might remove a private key from the wallet. Wouldn't this cause funds to be lost? Maybe you missed a step where you add the private key back in again? Commented May 14, 2012 at 20:41
  • I added a step to make a backup first. Maybe I'm wrong on this, I saw this method described as to how to get the client to not show the 0/unconfirmed transaction. I'm assuming this masks the problem as if the key isn't in the wallet, then the transaction won't show? If you import the key right back in, I don't know if that causes the 0/unconfirmed to reappear or not. Commented May 17, 2012 at 23:57
  • I agree with Chris that there seems to be a step missing to import the private key back in again. There appear to be instructions here: en.bitcoin.it/wiki/How_to_import_private_keys Commented Aug 15, 2012 at 5:23
  • Oh, you can run Bitcoin as a server? Cool... I wonder what that offers me... Commented Sep 17, 2012 at 21:47

You could simply send your coins to a new wallet and abandon this one which now has a perennial 0/unconfirmed transaction in it.

[Edit: Though there still could be some funds locked up due to the double spend.

PyWallet can be used to remove all transactions and then rescan, which would cause any funds that might have been locked up in th eunconfirmed transactions to reappear and be available for spending.]

  • Uh? He said the problem was that those coins were marked as spent.
    – o0'.
    Commented May 14, 2012 at 7:23
  • That shows how to abandon the wallet and to take along any remaining balance that exists. Double spends don't just happen, you've had to do something wrong (like multiple copies of the wallet running simultaneously, spending the same coins at the same time). Bitcoin does not yet have a method to recover from this. Abandoning a wallet showing a double spend by forwarding the funds to a new wallet is still possible and resolves the issue. Commented May 18, 2012 at 0:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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