Bit-Wasp / bitcoin-lib-php

PHP libraries implementing bitcoin key functions, as well as BIP32 and electrum.
The Unlicense
136 stars 86 forks source link

TX rejected (code -22) #76

Closed coingeek closed 9 years ago

coingeek commented 9 years ago

Is there any way to know this errore I test the first transaction it works, then i create another one based in the last previous transaction hash. it not works and get this error. Can any one help in that?

rubensayshi commented 9 years ago

could you share the raw hex data of the transaction that you tried to send?

coingeek commented 9 years ago

Sure,

sendrawtransaction 01000000018f3f46efd0b933e4076f95b4d048ab9742e0d0deffe21beb5071fd8a630a4dfb1b0000006b483045022100fa22c73fabdea3204d20935b02e79fd32c2de7cf05b247917e5d3fbac95c8cd902203837abec93abec2548d3eeb0c661eb2a9e3a30fa62cf867ef00ef00b3ed284c50121028f10e917f4f197eb3ebb5e5b9422d783d7fa6786df19bd8eafd3377c8da8a71effffffff0108460200000000001976a9148eb5eb48c373db22e6bd6f6e5c2c5ad3460f791f88ac00000000 TX rejected (code -22)


this result of decoderawtransaction

{ "txid" : "55b2fa6febe8cdddc32a22eaff087514909fdc0f3975777518e40d057aff50f2", "version" : 1, "locktime" : 0, "vin" : [ { "txid" : "fb4d0a638afd7150eb1be2ffded0e04297ab48d0b4956f07e433b9d0ef463f8f", "vout" : 27, "scriptSig" : { "asm" : "3045022100fa22c73fabdea3204d20935b02e79fd32c2de7cf05b247917e5d3fbac95c8cd902203837abec93abec2548d3eeb0c661eb2a9e3a30fa62cf867ef00ef00b3ed284c501 028f10e917f4f197eb3ebb5e5b9422d783d7fa6786df19bd8eafd3377c8da8a71e", "hex" : "483045022100fa22c73fabdea3204d20935b02e79fd32c2de7cf05b247917e5d3fbac95c8cd902203837abec93abec2548d3eeb0c661eb2a9e3a30fa62cf867ef00ef00b3ed284c50121028f10e917f4f197eb3ebb5e5b9422d783d7fa6786df19bd8eafd3377c8da8a71e" }, "sequence" : 4294967295 } ], "vout" : [ { "value" : 0.00149000, "n" : 0, "scriptPubKey" : { "asm" : "OP_DUP OP_HASH160 8eb5eb48c373db22e6bd6f6e5c2c5ad3460f791f OP_EQUALVERIFY OP_CHECKSIG", "hex" : "76a9148eb5eb48c373db22e6bd6f6e5c2c5ad3460f791f88ac", "reqSigs" : 1, "type" : "pubkeyhash", "addresses" : [ "FJqhLzywMxh5xywBLPQKH7Na1M29szuVvD" ] } } ] }

rubensayshi commented 9 years ago

for which coin is this?

coingeek commented 9 years ago

this for my own altcoin, this all for teaching the block chain approach.

coingeek commented 9 years ago

I sent you an email can you ssee it.

coingeek commented 9 years ago

I really tried to know the problem, but i do not?

rubensayshi commented 9 years ago

-22 is failed to decode transaction.
but the transaction seems fine to me, so it's probably got something to do with your coin ..

coingeek commented 9 years ago

I think it a about transaction fees. How to set it.

rubensayshi commented 9 years ago

doubt it, but to 'set it'...

the amount of fee is the total of the inputs - the total of outputs.
so 'set it' you just create an output to send the coins, another output for the change, and make sure that there's some satoshis left over for fees

coingeek commented 9 years ago

Can you write example for that.

coingeek commented 9 years ago

I saw in sample Sendrawtransaction There is no value for input only for out put

rubensayshi commented 9 years ago

example: https://github.com/blocktrail/bitcoin-lib-php/blob/full-tx-example/examples/full_transaction.php

rubensayshi commented 9 years ago

you know the value of the input by looking at the previous output which you're spending

afk11 commented 9 years ago

"There is no value for input only for output" this is true - your transactions spends EVERYTHING at the input you refer to. and amounts that you don't explicitly send somewhere go to miners as a fee.

If you have a blockexplorer and can tell me the version of btc you forked it would go a long way. Is your code up online?

afk11 commented 9 years ago

Did you have any luck with this?

coingeek commented 9 years ago

VerifySignature failed

2015-04-01 09:50:45 ERROR: CScriptCheck() : fa80639f1a716de577e2e908a3f149b9b91bd70b0b5dd9b99f85dae6e17a0bef VerifySignature failed 2015-04-01 09:50:45 ERROR: CScriptCheck() : fa80639f1a716de577e2e908a3f149b9b91bd70b0b5dd9b99f85dae6e17a0bef VerifySignature failed 2015-04-01 09:50:45 ERROR: CTxMemPool::accept() : ConnectInputs failed fa80639f1a716de577e2e908a3f149b9b91bd70b0b5dd9b99f85dae6e17a0bef

afk11 commented 9 years ago

Can I close this?

coingeek commented 9 years ago

Yes. The problem was to get the valid unspent transaction. Sent from my Samsung device

-------- Original message -------- From: Thomas Kerin notifications@github.com Date: 04/13/2015 11:42 PM (GMT+02:00) To: Bit-Wasp/bitcoin-lib-php bitcoin-lib-php@noreply.github.com Cc: coingeek coingeek@hotmail.com Subject: Re: [bitcoin-lib-php] TX rejected (code -22) (#76)

Can I close this?

— Reply to this email directly or view it on GitHub.