Bitcoin Forum
May 29, 2024, 09:27:00 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: subject deleted  (Read 1114 times)
Eric2013 (OP)
Member
**
Offline Offline

Activity: 102
Merit: 10


View Profile
October 20, 2014, 07:45:02 AM
Last edit: October 30, 2014, 03:21:59 PM by Eric2013
 #1

subject deleted

bee7
Hero Member
*****
Offline Offline

Activity: 574
Merit: 523


View Profile
October 20, 2014, 07:53:07 AM
 #2

It tells you why:

Quote
"message": "18: bad-txns-inputs-spent"

You are trying to submit transaction that spend an input that is already spent.
Eric2013 (OP)
Member
**
Offline Offline

Activity: 102
Merit: 10


View Profile
October 20, 2014, 08:13:02 AM
 #3

It tells you why:

Quote
"message": "18: bad-txns-inputs-spent"

You are trying to submit transaction that spend an input that is already spent.


The problem is that we didnt try to submit transaction that spend an input that is already spent.

We have more than enough DOGE in the account. and we use listunspent to list the unspent transations.
bee7
Hero Member
*****
Offline Offline

Activity: 574
Merit: 523


View Profile
October 20, 2014, 08:46:36 AM
 #4

It tells you why:

Quote
"message": "18: bad-txns-inputs-spent"

You are trying to submit transaction that spend an input that is already spent.


The problem is that we didnt try to submit transaction that spend an input that is already spent.

We have more than enough DOGE in the account. and we use listunspent to list the unspent transations.

Yes, indeed. Would you mind to post command you use to create the tx with parameters.
OnkelPaul
Legendary
*
Offline Offline

Activity: 1039
Merit: 1004



View Profile
October 20, 2014, 08:56:10 AM
 #5

I don't have any experience with creating transactions using the API but it seems to me that there's a step missing between 1 and 2.
By listing the unspent transactions, you get to know which inputs you can use in your new transaction.
But your next step is to call "createrawtransaction" - don't you need to build a transaction first that uses the output of the transaction you identified in step 1?
I can't see if you just created a raw transaction from the existing unspent transaction (which is already executed, so sending it again would constitute a double-spend) or if you created a new transaction to spend the unspent output.

Onkel Paul

bee7
Hero Member
*****
Offline Offline

Activity: 574
Merit: 523


View Profile
October 20, 2014, 09:01:15 AM
 #6

I don't have any experience with creating transactions using the API but it seems to me that there's a step missing between 1 and 2.
By listing the unspent transactions, you get to know which inputs you can use in your new transaction.
But your next step is to call "createrawtransaction" - don't you need to build a transaction first that uses the output of the transaction you identified in step 1?
I can't see if you just created a raw transaction from the existing unspent transaction (which is already executed, so sending it again would constitute a double-spend) or if you created a new transaction to spend the unspent output.

Onkel Paul

No, it will be a redundant step consisting of three substeps: createrawtransaction, signrawtransaction, sendrawtransaction.

The procedure in the OP is correct. The only optional thing there is the first step as you may obtain an unspent txout by other means.
dabura667
Sr. Member
****
Offline Offline

Activity: 475
Merit: 252


View Profile
October 20, 2014, 11:14:46 AM
Last edit: October 20, 2014, 04:18:55 PM by dabura667
 #7

Second, i usd createrawtransaction to creat the transation:
{
  "result": "0100000001022095d74c74d16041cab1c7a4cab5f4a56dbe982428668c891ab96f4b9f964f00000 00000ffffffff027ef9062a000000001976a91465dc2a40b96081ec8d4e846c115d21201f37276e88ace 6c21a1e000000001976a914245a83c7a236a1d223314a11f2455af7541ce6e288ac00000000",
  "error": null,
  "id": null
}

You are signing a 0x00 byte, you should be signing a utxo.

You need to input ALL the necessary info from the utxo, including the scriptpubkey from the prevout.

use the help command to learn what information is needed for createrawtransaction.

Edit: Also, I just looked at the dogechain, your vout is not 0, it's 1... this is why you got "already spent"... the first out is already spent.

Edit:
Try signing this instead:

Code:
1976a914245a83c7a236a1d223314a11f2455af7541ce6e288ac

Replaced the 00 with it here: (Edit: and I changed the vout to 1)

Code:
{
  "result": "0100000001022095d74c74d16041cab1c7a4cab5f4a56dbe982428668c891ab96f4b9f964f010000001976a914245a83c7a236a1d223314a11f2455af7541ce6e288acffffffff027ef9062a000000001976a91465dc2a40b96081ec8d4e846c115d21201f37276e88ace6c21a1e000000001976a914245a83c7a236a1d223314a11f2455af7541ce6e288ac00000000",
  "error": null,
  "id": null
}

My Tip Address:
1DXcHTJS2DJ3xDoxw22wCt11FeAsgfzdBU
bee7
Hero Member
*****
Offline Offline

Activity: 574
Merit: 523


View Profile
October 20, 2014, 12:01:48 PM
 #8


You need to input ALL the necessary info from the utxo, including the scriptpubkey from the prevout.


This is not true unless you have some specific requirements on keys or keys are not available in a wallet.

So,

Code:
createrawtransaction '[{"txid":"4f969f4b6fb91a898c66282498be6da5f4b5caa4c7b1ca4160d1744cd7952002","vout":1}]' '{"Dddddestaddr":14.10170468}'
is completely fine in the OP's case provided that necessary tx fee is deducted from amount.

See https://en.bitcoin.it/wiki/Raw_Transactions for details.
dabura667
Sr. Member
****
Offline Offline

Activity: 475
Merit: 252


View Profile
October 20, 2014, 12:50:50 PM
 #9

This is not true unless you have some specific requirements on keys or keys are not available in a wallet.

Well, he must be doing something wrong if the raw tx is spitting out 00 for the scriptPubkey.

I have next to no experience with Core RPC and 0 experience with Dogecoin, but I have written/reviewed code in many languages to sign raw transactions... and putting a 00 in there would indicate to me either 1. sloppy coding, or 2. incomplete info from the user.

I would hope 1 is not true... so I lean to 2.

My Tip Address:
1DXcHTJS2DJ3xDoxw22wCt11FeAsgfzdBU
bee7
Hero Member
*****
Offline Offline

Activity: 574
Merit: 523


View Profile
October 20, 2014, 12:52:02 PM
 #10

This is not true unless you have some specific requirements on keys or keys are not available in a wallet.

Well, he must be doing something wrong if the raw tx is spitting out 00 for the scriptPubkey.

I have next to no experience with Core RPC and 0 experience with Dogecoin, but I have written/reviewed code in many languages to sign raw transactions... and putting a 00 in there would indicate to me either 1. sloppy coding, or 2. incomplete info from the user.

I would hope 1 is not true... so I lean to 2.

This is why I asked to show the complete command.
Eric2013 (OP)
Member
**
Offline Offline

Activity: 102
Merit: 10


View Profile
October 22, 2014, 07:50:39 AM
Last edit: October 22, 2014, 08:21:57 AM by Eric2013
 #11

hey guys, thanks for your kind reply.

Currently, I did it using bitcoind's RPC interface, calling it from a shell script and checking the output with command line tools like 'cut' and 'grep'.  and at the beginning it works alright for the new address, its controllable. but after some time, it is not working again. "18: bad-txns-inputs-spent"

I believe that it happens because the time when we don't try to control the transaction id, there are many addresses for change created.  and next time we try to control again, its spent.

therefore , could we set up the address for change as the sending address? and how to set it up plz?
bee7
Hero Member
*****
Offline Offline

Activity: 574
Merit: 523


View Profile
October 22, 2014, 08:40:06 AM
 #12

hey guys, thanks for your kind reply.

Currently, I did it using bitcoind's RPC interface, calling it from a shell script and checking the output with command line tools like 'cut' and 'grep'.  and at the beginning it works alright for the new address, its controllable. but after some time, it is not working again. "18: bad-txns-inputs-spent"

I believe that it happens because the time when we don't try to control the transaction id, there are many addresses for change created.  and next time we try to control again, its spent.

therefore , could we set up the address for change as the sending address? and how to set it up plz?

Using raw transaction api you must always take care yourself about change and change address. Everything that remains unspent in the tx, i.e. has no explicit output, is considered as a tx fee.
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!