Bitcoin Forum
May 06, 2024, 08:10:19 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: How to purge pending tx from bitcoind or forward it to network  (Read 743 times)
GCInc. (OP)
Hero Member
*****
Offline Offline

Activity: 566
Merit: 500


View Profile WWW
February 20, 2014, 01:08:15 PM
 #1

Our bitcoind has been serving us well, but recently some transactions have been stuck.

Consider this example:

Code:
{
    "amount" : -2.95800000,
    "fee" : -0.00040000,
    "confirmations" : 0,
    "txid" : "310791a1863c7a61b460795bfd76bda8adf1b1d309c91e489392b90e12c82e99",
    "time" : 1392745775,
    "timereceived" : 1392745775,
    "details" : [
        {
            "account" : "",
            "address" : "1FdYW7LvSmP9xejrdVKp6Fpe37WKRpoGKv",
            "category" : "send",
            "amount" : -2.95800000,
            "fee" : -0.00040000
        }
    ]
}

Nothing special there, yet the transaction sits on our daemon, the amount deducted from available balance yet it does not get to reach the blockchain. How should we go to resolve this?

1714983019
Hero Member
*
Offline Offline

Posts: 1714983019

View Profile Personal Message (Offline)

Ignore
1714983019
Reply with quote  #2

1714983019
Report to moderator
1714983019
Hero Member
*
Offline Offline

Posts: 1714983019

View Profile Personal Message (Offline)

Ignore
1714983019
Reply with quote  #2

1714983019
Report to moderator
"Bitcoin: the cutting edge of begging technology." -- Giraffe.BTC
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714983019
Hero Member
*
Offline Offline

Posts: 1714983019

View Profile Personal Message (Offline)

Ignore
1714983019
Reply with quote  #2

1714983019
Report to moderator
1714983019
Hero Member
*
Offline Offline

Posts: 1714983019

View Profile Personal Message (Offline)

Ignore
1714983019
Reply with quote  #2

1714983019
Report to moderator
fbueller
Sr. Member
****
Offline Offline

Activity: 412
Merit: 266


View Profile
February 20, 2014, 03:31:54 PM
 #2

Do:
getrawtransaction 310791a1863c7a61b460795bfd76bda8adf1b1d309c91e489392b90e12c82e99
and paste the output here.

Also you should try taking the output, and doing this to resubmit it to the network:
sendrawtransaction <raw transaction hex obtained from above>

And we'll see if it makes it into a block! If it doesn't work we can try craft a raw transaction to double spend this, but it'd be good to identify why the first failed before attempting again.

Bitwasp Developer.
Sydboy
Full Member
***
Offline Offline

Activity: 196
Merit: 100


View Profile
February 23, 2014, 05:43:17 PM
 #3

Fbueller - Feris is that you !! ?

Can you or anyone else  please explain how to send the transaction. I just picked a random txid from blockchain.info that popped up just now. Here is the output. Can you tell me which bit I need to put in the sendrawtransaction or do I put all of the output from getrawtx in sendrawtx ?


04:40:29

getrawtransaction b7e1bb3eb3312daee50a1244502bfc8ceaa316c3791a7cad368b6d12e642dc27


04:40:29

0100000002a2bd9f05008468d6ea437291fd4de326968e3623a1a4bb3c217f0d6b4a59790004000 0008b483045022100f4a686bcd6c0247a330eec4b3e59f6f0759a98abf46421ef0af1247099191c e902205d0b3bde4094ee868c13a68121c6fad5e1ac49e4eef9cc2625f1c5b8e6a9159f0141041e1 b18ca5b3fb040a040c82c3b5c4eb30231ce281fb6fd4381f6f41c94f199c374816c5c953118aa14 dc3d698123c03831ef719c6ea9e25d8ec4ac28ca8c76b9ffffffff559a05a610a93364593e7ba4f 05aa9040e039f9100e9818c562d04ff07f34da9020000008b483045022100ef182fab85ead6741f c23b5dce6b86e9dd56fdf71a7d2b8b7b19fa8c210b1d3b022033680d644310c7987c1c4108dc135 b6a8115a436d071e8e6ef441f4b24e3b77d014104d29969496de2fa22cf609d71eb6ab67cf25465 39c520b181c2d1fd30aa23640ec32d21bfde6b88c15cfc833c5819c9cbac8adea2468241fb41426 e6dc232dc22ffffffff0330750000000000001976a9149441a6bf98fa2af2f1291a418325022b65 3584ad88acdebd8206000000001976a9147838c4328592d38b148beb1a7ec822544002a7a588ac2 e051300000000001976a91419c8dc5d5395c474e395bfc158e292ab849fb81588ac00000000

thanks
DannyHamilton
Legendary
*
Offline Offline

Activity: 3388
Merit: 4616



View Profile
February 23, 2014, 06:15:20 PM
 #4

Fbueller - Feris is that you !! ?

Can you or anyone else  please explain how to send the transaction. I just picked a random txid from blockchain.info that popped up just now. Here is the output. Can you tell me which bit I need to put in the sendrawtransaction or do I put all of the output from getrawtx in sendrawtx ?


This is the part that is used with sendrawtransaction:


0100000002a2bd9f05008468d6ea437291fd4de326968e3623a1a4bb3c217f0d6b4a59790004000 0008b483045022100f4a686bcd6c0247a330eec4b3e59f6f0759a98abf46421ef0af1247099191c e902205d0b3bde4094ee868c13a68121c6fad5e1ac49e4eef9cc2625f1c5b8e6a9159f0141041e1 b18ca5b3fb040a040c82c3b5c4eb30231ce281fb6fd4381f6f41c94f199c374816c5c953118aa14 dc3d698123c03831ef719c6ea9e25d8ec4ac28ca8c76b9ffffffff559a05a610a93364593e7ba4f 05aa9040e039f9100e9818c562d04ff07f34da9020000008b483045022100ef182fab85ead6741f c23b5dce6b86e9dd56fdf71a7d2b8b7b19fa8c210b1d3b022033680d644310c7987c1c4108dc135 b6a8115a436d071e8e6ef441f4b24e3b77d014104d29969496de2fa22cf609d71eb6ab67cf25465 39c520b181c2d1fd30aa23640ec32d21bfde6b88c15cfc833c5819c9cbac8adea2468241fb41426 e6dc232dc22ffffffff0330750000000000001976a9149441a6bf98fa2af2f1291a418325022b65 3584ad88acdebd8206000000001976a9147838c4328592d38b148beb1a7ec822544002a7a588ac2 e051300000000001976a91419c8dc5d5395c474e395bfc158e292ab849fb81588ac00000000
GCInc. (OP)
Hero Member
*****
Offline Offline

Activity: 566
Merit: 500


View Profile WWW
February 23, 2014, 08:05:12 PM
 #5

getrawtransaction 310791a1863c7a61b460795bfd76bda8adf1b1d309c91e489392b90e12c82e99
and paste the output here.
Hey thanks for the quick reply. I was not so quick to follow up... here's the raw tx:

01000000068f87cfb194736c9a88e8a805256c33932b9caf0ff274bed8f29c602ec4083f0500000 0006c493046022100a9ceb6be431eea2eae54bc5e50d5ebd1a7e523d8d5388e59b4628c043ba2da 23022100e4ca749521441b70d1d997873950ce4f92354c02b095ee2b38396f7717c809700121029 c887a6fa7ce1fbfbaa76d918bd628207c3da1170f29dd099e63d1b7f60a7346ffffffff4796e272 db2234e3172f272dc148c73da865a0ad89ed738782c9d97c6bf73995010000006a4730440220417 7b148a1594a0d48a7c9364f2b47bf7c33178c4cd885b94e89f3098c901c13022016ca32f85f3f03 99c4f0a70b17fb64a190a5b00992b441b0fa13c85ca84f635e0121023e7c94bb31195eaee142465 8aa080536382c42d88ed9765f6f2b51501fb07354ffffffff05651e7f539d78305a0a8f5d20e3ce d6ca6f2d72135860ff7ce125bcaf7901ad000000006b483045022100a9d20e95940a1a679eb4cd1 7f861ba0c3fa147ae4c05af29dec068c34d90474a0220517775544fbce956ea4a06b78be801ddac c19b04a12178df594275c50e9df24a0121033843a36e2826afe5072f06b60cb0def352f3746d92a 4cc3aeb13aa0be1f1ce63ffffffff2300b9b2ab6a570f027b6469a54c6b2d8ee87ab46280e3dbc0 819f046e98336f010000006a47304402207f14dc8545d9714152c371ec6d73f658c50deb55f3ebb 0b934ee31a07498e43c022012dad55855e2592e1da9bf3acf14a94d829cc8bc5ca2f8207fe2fb04 9b1a3fff012103090c9dc501285b1649f56bcfa2fb8784d1e5615ed7329e4babda63273fb124ccf fffffffc7d39bce806ae2a7b296c41a15f47e021ed8818a1544136a7ceb967f7974470f00000000 6c493046022100850628a14fd7f5a4ddbbca0b95644c2ab5039210b536b9eac59f7693a6a08abb0 22100861f8214cbd0e90807b8f62d3bcd0661549111f62e88ffb4597f87b3d2074f44012103b136 c3373b97dac86a584db2142c36bf16cbe4d5bc64f3066698592aab2edf81ffffffffeffc0082251 506e471634102fc8a28ec2261c9ba0e7a8dbd7dc296fbd7ada27f000000006b4830450220575d12 99902a2b3e160414ff44be1cd445ea686ed624067a40eadf0b3c0717a9022100a3aeac8b8cbead9 4a6542c82f531a423c18dce05b22b6adee456bf2080ec910401210209e99d61cbc83f4b6d50e6ef 69a3c084904382a6cbe6c244c8f11694c3ad2c51ffffffff029f470f00000000001976a914d1617 7d3f0135568376cff9e68cc4e170bd738c188acc08ca111000000001976a914a07b08343ec10640 5365332850b320f87accc4a488ac00000000

What do you do with that now?

DannyHamilton
Legendary
*
Offline Offline

Activity: 3388
Merit: 4616



View Profile
February 23, 2014, 09:14:54 PM
 #6

What do you do with that now?

We use decoderawtransaction to get the following:

Code:
"txid" : "310791a1863c7a61b460795bfd76bda8adf1b1d309c91e489392b90e12c82e99",
"version" : 1,
"locktime" : 0,
"vin" : [
    {
        "txid" : "053f08c42e609cf2d8be74f20faf9c2b93336c2505a8e8889a6c7394b1cf878f",
        "vout" : 0,
        "scriptSig" : { . . . },
        "sequence" : 4294967295
    }, {
        "txid" : "9539f76b7cd9c9828773ed89ada065a83dc748c12d272f17e33422db72e29647",
        "vout" : 1,
        "scriptSig" : { . . . },
        "sequence" : 4294967295
    }, {
        "txid" : "ad0179afbc25e17cff605813722d6fcad6cee3205d8f0a5a30789d537f1e6505",
        "vout" : 0,
        "scriptSig" : { . . . },
        "sequence" : 4294967295
    }, {
        "txid" : "6f33986e049f81c0dbe38062b47ae88e2d6b4ca569647b020f576aabb2b90023",
        "vout" : 1,
        "scriptSig" : { . . . },
        "sequence" : 4294967295
    }, {
        "txid" : "0f4774797f96eb7c6a1344158a81d81e027ef4151ac496b2a7e26a80ce9bd3c7",
        "vout" : 0,
        "scriptSig" : { . . . },
        "sequence" : 4294967295
    }, {
        "txid" : "7fa2add7fb96c27dbd8d7a0ebac96122ec288afc02416371e40615258200fcef",
        "vout" : 0,
        "scriptSig" : { . . . },
        "sequence" : 4294967295
    }
],
"vout" : [
    {
        "value" : 0.01001375,
        "n" : 0,
        "scriptPubKey" : {
            "asm" : "OP_DUP OP_HASH160 d16177d3f0135568376cff9e68cc4e170bd738c1 OP_EQUALVERIFY OP_CHECKSIG",
            "hex" : "76a914d16177d3f0135568376cff9e68cc4e170bd738c188ac",
            "reqSigs" : 1,
            "type" : "pubkeyhash",
            "addresses" : [
                "1L66zJ1ixBpkVL57kg3w7dZbUUbxTvcJ29"
            ]
        }
    }, {
        "value" : 2.95800000,
        "n" : 1,
        "scriptPubKey" : {
            "asm" : "OP_DUP OP_HASH160 a07b08343ec106405365332850b320f87accc4a4 OP_EQUALVERIFY OP_CHECKSIG",
            "hex" : "76a914a07b08343ec106405365332850b320f87accc4a488ac",
            "reqSigs" : 1,
            "type" : "pubkeyhash",
            "addresses" : [
                "1FdYW7LvSmP9xejrdVKp6Fpe37WKRpoGKv"
            ]
        }
    }
]

Where we see that this transaction is attempting to spend the following 5 valid outputs:

https://blockchain.info/tx-index/113393756/0
"txid" : "053f08c42e609cf2d8be74f20faf9c2b93336c2505a8e8889a6c7394b1cf878f",
"vout" : 0,

https://blockchain.info/tx-index/113394651/1
"txid" : "9539f76b7cd9c9828773ed89ada065a83dc748c12d272f17e33422db72e29647",
"vout" : 1,

https://blockchain.info/tx-index/113342441/0
"txid" : "ad0179afbc25e17cff605813722d6fcad6cee3205d8f0a5a30789d537f1e6505",
"vout" : 0,

https://blockchain.info/tx-index/113368281/0
"txid" : "0f4774797f96eb7c6a1344158a81d81e027ef4151ac496b2a7e26a80ce9bd3c7",
"vout" : 0,

https://blockchain.info/tx-index/113390455/0
"txid" : "7fa2add7fb96c27dbd8d7a0ebac96122ec288afc02416371e40615258200fcef",
"vout" : 0,


We also see that the transaction is attempting to spend the following invalid output:

"txid" : "6f33986e049f81c0dbe38062b47ae88e2d6b4ca569647b020f576aabb2b90023",
"vout" : 1,

Looking at the blockchain we see that there is an identical transaction with a different transaction ID:

https://blockchain.info/tx/cf2dfcbf2b15eacf2272fb0f19b5760b7069f6dfff2165f68606a3f21eee4681

But the outputs from that transaction are all already spent.

It appears that you received (or created) transaction ID 6f33986e049f81c0dbe38062b47ae88e2d6b4ca569647b020f576aabb2b90023 but tried to spend the 0.01002837 BTC before it had received any confirmations.  Due to the "transaction malleability" that has been widely discussed recently, someone on the bitcoin network modified the transaction ID of the 6f33986e049f81c0dbe38062b47ae88e2d6b4ca569647b020f576aabb2b90023 to be cf2dfcbf2b15eacf2272fb0f19b5760b7069f6dfff2165f68606a3f21eee4681 instead.

Unfortunately, your software was unaware of the modified transaction ID. (It would have learned about it once the transaction was confirmed, but by then you had already created and attempted to broadcast the 310791...c82e99 transaction that you are asking about). Eventually, the cf2dfc...ee4681 transaction confirmed, and the 6f3398...b90023 transaction ID ceased to exist.  Your new transaction 310791...c82e99 is therefore attempting to spend a non-existent output.

Meanwhile somewhere else in your system, once the cf2dfc...ee4681 transaction confirmed, you've created transaction ID cd27f67d71a9d05cdaafefaa8e52f57119f48b71f7b898bb6a75781e7e5ffeff which spends the same 0.01002837 BTC output that you were trying to spend in the 6f3398...b90023 transaction.  Therefore the 0.01002837 BTC is no longer available to fund the transaction attempting to send to 0.01001375 BTC to 1L66zJ1ixBpkVL57kg3w7dZbUUbxTvcJ29 and 2.958 BTC to 1FdYW7LvSmP9xejrdVKp6Fpe37WKRpoGKv

To prevent such problems, don't spend transactions that haven't yet confirmed (since there is no guarantee that they will ever confirm, and since transaction malleability means that you can't count on the transactionID of an unconfirmed transaction).
GCInc. (OP)
Hero Member
*****
Offline Offline

Activity: 566
Merit: 500


View Profile WWW
February 23, 2014, 09:30:39 PM
 #7

I see.

Quote
To prevent such problems, don't spend transactions that haven't yet confirmed (since there is no guarantee that they will ever confirm, and since transaction malleability means that you can't count on the transactionID of an unconfirmed transaction).

That's easier said than done. You'd need to check all inputs for every transaction?

Anyhow, thanks for the explanation - now how do we remove the pending tx from our daemon and release most of the 2.958 BTC that the daemon has removed from the available balance?

DannyHamilton
Legendary
*
Offline Offline

Activity: 3388
Merit: 4616



View Profile
February 23, 2014, 11:00:29 PM
 #8

now how do we remove the pending tx from our daemon and release most of the 2.958 BTC that the daemon has removed from the available balance?

pywallet
GCInc. (OP)
Hero Member
*****
Offline Offline

Activity: 566
Merit: 500


View Profile WWW
February 23, 2014, 11:38:55 PM
 #9

pywallet
Thanks. To the previous question of how to not send unconfirmed tx's from our extensive wallet, I guess it's not possible when using the sendtoaddress API call (no possibility to send from only confirmed sources)? That's what we have been using and got all the trouble.

DannyHamilton
Legendary
*
Offline Offline

Activity: 3388
Merit: 4616



View Profile
February 23, 2014, 11:49:53 PM
 #10

pywallet
Thanks. To the previous question of how to not send unconfirmed tx's from our extensive wallet, I guess it's not possible when using the sendtoaddress API call (no possibility to send from only confirmed sources)? That's what we have been using and got all the trouble.

I'm not sure if any "best practices" have been developed around the transaction malleability issue yet.

You can try reading through some of the malleability threads, or try creating a new thread asking for the best way to keep bitcoind from using unconfirmed change when creating a transaction with sendtoaddress (or if there is a better API call to be making).
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!