Author

Topic: Transaction not showing up on network, but exists on local client (Read 1009 times)

legendary
Activity: 3416
Merit: 1912
The Concierge of Crypto
There's also a zapwallettx command as of 0.9.0+
member
Activity: 112
Merit: 10
Do you moo?
So here's the latest.  bitcoind getinfo shows a balance of 0.44858058
Adding up the amounts of the listunspent outputs is 0.40257368
The discrepancy is 0.0460069
I just did a sendtoaddress for the sum of the unspent outputs (0.40257368), and everything worked.

Here is my current output:
$ bitcoind getinfo
{
    "version" : 80600,
    "protocolversion" : 70001,
    "walletversion" : 60000,
    "balance" : 0.04610690,
    "blocks" : 299627,
    "timeoffset" : 0,
    "connections" : 8,
    "proxy" : "",
    "difficulty" : 8000872135.96816349,
    "testnet" : false,
    "keypoololdest" : 1392649428,
    "keypoolsize" : 10001,
    "paytxfee" : 0.00000000,
    "unlocked_until" : 1399520348,
    "errors" : ""
}
$ bitcoind listunspent
[
    {
        "txid" : "cf60d44bf5f22c3367968e9ee728b09045334780610739fed5fa3ff8db877dfe",
        "vout" : 0,
        "address" : "1QGvXsj4XAELiXiAi198JjKKsf2dNLKfF1",
        "account" : "437ff94080e78804f502929d94d6662f527e18bf89089af41914c2d056e4c5d6",
        "scriptPubKey" : "76a914ff4dd1a8f3728da21d981b6e587ec467dce9616588ac",
        "amount" : 0.00002000,
        "confirmations" : 13069
    }
]

Thank you SO much for the help.  I'm a happy camper now that I at least have the funds out of the wallet.  I wish I knew what caused it, or why there is still a discrepancy between the unspent outputs and the balance.
member
Activity: 112
Merit: 10
Do you moo?
Restored an old wallet.  Ran listunspentoutputs and checked each against the blockchain to verify it was unspent.  Everything looked good.
I did sendtoaddress on .1 btc to test, and everything went great.

I tried to sendtoaddress on the rest, and it died again.  So weird.
I deleted the transaction, started bitcoind with -rescan, and again it shows a 0 balance for the wallet and does not show the erroneous transaction.  SO weird.

I'm going to restore the old wallet again, rescan, and listunspentoutputs one more time, and verify them against the blockchain one more time to make sure I'm not crazy.

donator
Activity: 1218
Merit: 1079
Gerald Davis
Yeah that is very weird.

One way to figure out what is the difference is to run listunpsentoutputs in the debug window after launching the client with the old (unmodified) wallet.

Balance is just the sum of the value of the outputs you have available to spend.  So listunspentoutputs should show a list of one or more outputs with a combined value of 0.5 btc.  Checking them in the blockchain may shed some light on why they are "gone" from the modified wallet.
member
Activity: 112
Merit: 10
Do you moo?
Oh and real quick:  Thanks for the help  Smiley

member
Activity: 112
Merit: 10
Do you moo?
Yep - I have backups, so I'm not worried about any of these changes.

Balance before I tried to use sendtoaddress was around .5 btc.
After I sent everything out of the wallet, getinfo showed 0.0 btc, and listtransactions showed the "stuck" transaction that contained the already spent outputs.  It sat that way for a few days.

I went to pywallet and deleted the "stuck" transaction and restarted bitcoind with the -rescan parameter.  After that, listtransactions no longer showed the "stuck" transaction, but the wallet balance was still 0 btc.
Interestingly, a listaccounts showed all of my accounts with positive balances, hence my observation that the getinfo balance isn't simply a sum of the listaccounts balances.

I agree that accounts are sub-optimal.  I don't think they belong in a consumer wallet, and any implementation of them for a business wallet should be outside of the core.
donator
Activity: 1218
Merit: 1079
Gerald Davis
You sure you deleted the transaction not the private key?  What was your balance prior to removing the tx?  Personally I find accounts totally worthless and devs are looking to remove them in future versions of the client.  What was the overall balance before and after using pywallet?  Hopefully you created a backup before using pywallet.
member
Activity: 112
Merit: 10
Do you moo?
I removed the transaction with pywallet, and started the daemon with -rescan.  Good new is that the botched transaction is no longer shown in the wallet.
Bad news is that getinfo shows a balance of 0 even though my accounts have positive balances.  Not sure how the balance is calculated, but it's definitely not the sum of the accounts.
I'm going to dump keys, create a new wallet, and import keys to see if that works.
donator
Activity: 1218
Merit: 1079
Gerald Davis
I wouldn't say scary.  Frustrating, not exactly user friendly especially if the wallet can't auto recover but there was never any risk of losing funds (even without a backup).  The client was "confused" and unaware that the output in question had been spent (back in Feb).  How or why I am not sure but for lack of a better term it was trying to spend money you didn't have.  The rest of the network reacted correctly by dropping the transaction as invalid.  The recipient could never have been defrauded and you couldn't lose what wasn't your to spend.

The challenge for developers is how to handle these edge cases in a way which allows the wallet to recover cleanly.  Currently when the client finds itself in these edge cases it will remain there and while not a security risk can be confusing to the user.
member
Activity: 112
Merit: 10
Do you moo?
Kind of scary that the mainline 80600 command line client can get itself into this situation!
I have backups of the wallet every 1/2 * keypoolsize.  I'll give pywallet and rescan a go.

Thanks!
donator
Activity: 1218
Merit: 1079
Gerald Davis
Well I am not sure how it happened.  I don't think the QT client will ever delete a tx even one that later turns out to be invalid.  To do that would require a tool like pywallet.  You want to delete the tx not the private key.  Always make a backup.

Once you do that replace the modified wallet.dat with the unmodified one and restart with a -rescan option.   The client should be aware that the output in question has been spent.

One way to verify is from the debug console use "listunspent" this will show all the unspent outputs.  There should be no entry for txid c5e5c330e8943f9eef2fa940adf51fd352384818d564d7667b7803e6113cc1ed.  Note if you do this now the txid will not be there but that is because the client doesn't see it as an unspent output because the unconfirmed tx spending it "exists".   So this is only a test once the bad transaction is removed from the client.
member
Activity: 112
Merit: 10
Do you moo?
Got it.  Thanks for the explanation.

So, how do I fix this?  I'm assuming after some time, my client will realize that the transaction isn't happening and will "reclaim" the erroneous transaction?
If so, how do I get it to realize that the outputs are spent for that transaction?

Thanks!
donator
Activity: 1218
Merit: 1079
Gerald Davis
It doesn't mean the output of your transaction.  All INPUTS reference a prior unspent output.  So when the error says the output has been spent it means "the transaction you are creating has one or more inputs which reference outputs that are already spent.  Only unspent outputs can be referenced by inputs so the created transaction is invalid"


Per your transaction:

Quote
 "inputs":[
      {
         "prev_out":{
            "index":1,
            "hash":"c5e5c330e8943f9eef2fa940adf51fd352384818d564d7667b7803e6113cc1ed"
         },
         "script":"493046022100ffe7d367ae2cff45db200b1377ab023d3eaa989e21f7c9bd8791c11222799b35022 100bb906cbe08559d46c44f4f8ccea094787f37d0479b49fe7331d417de214f3df60121020c12d1 27683f84315d701832383a41fc063502cc50fd4d8b56c68176df1903b4"
      }
   ]

Index is zero based as index 1 means the second output.  Per blockchain.info it that output has already been spent in another transaction.  Outputs can only be spent once.  For some reason your client believed that output was unspent and thus tried to spend it in a new transaction.  It can't and that is why you are getting an error.

https://blockchain.info/tx/c5e5c330e8943f9eef2fa940adf51fd352384818d564d7667b7803e6113cc1ed

You are attempting to double spend that output and it was already spent and included in a block 3 months ago.  
member
Activity: 112
Merit: 10
Do you moo?
This appears to be the root of the problem.  My client has this transaction:
39445bebc8b69dbfb020d437dd3738a8fc66681b507a75363729919ef47c3e02

Here is the output of getrawtransaction:
0100000001edc13c11e603787b66d764d518483852d31ff5ad40a92fef9e3f94e830c3e5c501000 0006c493046022100ffe7d367ae2cff45db200b1377ab023d3eaa989e21f7c9bd8791c11222799b 35022100bb906cbe08559d46c44f4f8ccea094787f37d0479b49fe7331d417de214f3df60121020 c12d127683f84315d701832383a41fc063502cc50fd4d8b56c68176df1903b4ffffffff02723346 00000000001976a914b69925f93434c2fa296c7f2e994df5b0c2bfd56488ac580f0200000000001 976a914e1acf118a792ad15264b6e4543d66afbc9372c7b88ac00000000

On decode, it shows this:
 "lock_time":0,
   "inputs":[
      {
         "prev_out":{
            "index":1,
            "hash":"c5e5c330e8943f9eef2fa940adf51fd352384818d564d7667b7803e6113cc1ed"
         },
         "script":"493046022100ffe7d367ae2cff45db200b1377ab023d3eaa989e21f7c9bd8791c11222799b35022 100bb906cbe08559d46c44f4f8ccea094787f37d0479b49fe7331d417de214f3df60121020c12d1 27683f84315d701832383a41fc063502cc50fd4d8b56c68176df1903b4"
      }
   ],
   "vout_sz":2,
   "hash":"39445bebc8b69dbfb020d437dd3738a8fc66681b507a75363729919ef47c3e02",
   "vin_sz":1,
   "out":[
      {
         "address":"1HeVSr4fY9vHsNYQW54Ln6dvqBdACtrZzg",
         "script_string":"OP_DUP OP_HASH160 b69925f93434c2fa296c7f2e994df5b0c2bfd564 OP_EQUALVERIFY OP_CHECKSIG",
         "value":4600690,
         "script":"76a914b69925f93434c2fa296c7f2e994df5b0c2bfd56488ac"
      },
      {
         "address":"1MaGDNKRsbaTFPZ37xEVrxW722ZnHFyhwX",
         "script_string":"OP_DUP OP_HASH160 e1acf118a792ad15264b6e4543d66afbc9372c7b OP_EQUALVERIFY OP_CHECKSIG",
         "value":135000,
         "script":"76a914e1acf118a792ad15264b6e4543d66afbc9372c7b88ac"
      }
   ],
   "size":227,
   "version":1


When I try to push it to the network, I get:
An outpoint is already spent in [DBBitcoinTx [txIndex=47534292,  getEstimatedBTCSent()=0, isGeneratedBlockReward()=false, getTotalBTCSent()=0, getHash()=518fc4bf6cfbe142c29fd54f2d623807ce02c19d88c48d0185bc16f8e14fa41a, getVersion()=1, getSize()=231, toString()=BitcoinTx{hash=518fc4bf6cfbe142c29fd54f2d623807ce02c19d88c48d0185bc16f8e14fa41a, version=1, lockTime=0, in=[], out=[]}, getClass()=class piuk.blockchain_db.DBBitcoinTx]] [(47477784, 1)]

How can an output already be spent if the transactionId doesn't show up on the blockchain?
member
Activity: 112
Merit: 10
Do you moo?
Interesting.  Here's what I get:
"Could not find all input transactions, you might have referenced some input transactions that are not in network"
jr. member
Activity: 56
Merit: 1
Use getrawtransaction 52d7d2d0a32a5be2c819a168ccf36ca7fbec21007351a43c18491c9c823db8e5 to see if your client has remembered the transaction.

If it hasn't you will have to send the transaction from scratch. If it has, it will return a raw transaction which you can paste into here https://blockchain.info/pushtx or here http://blockr.io/tx/push to get the network to see it.
member
Activity: 112
Merit: 10
Do you moo?
Hiya,
I used SendToAddress to send some btc from my wallet to a blockain.info wallet.  bitcoind returned a txid, so I'm assuming it was "successful".
Unfortunately, the txid doesn't show up on the blockchain.info explorer, even after 12 hours.  The local wallet has 8 network connections, and has an up to date blockchain count.

Any thoughts?

Here's the txid: 52d7d2d0a32a5be2c819a168ccf36ca7fbec21007351a43c18491c9c823db8e5
Here's the blockchain.info explorer not finding it:  https://blockchain.info/search/52d7d2d0a32a5be2c819a168ccf36ca7fbec21007351a43c18491c9c823db8e5
Here's the local client listtransactions:
    {
        "account" : "",
        "address" : "1oooooFphUFL6GSY7aukZyELK2Z36Roim",
        "category" : "send",
        "amount" : -0.54838058,
        "fee" : -0.00020000,
        "confirmations" : 0,
        "txid" : "52d7d2d0a32a5be2c819a168ccf36ca7fbec21007351a43c18491c9c823db8e5",
        "time" : 1399248101,
        "timereceived" : 1399248101
    }

Jump to: