Author

Topic: subject deleted (Read 1146 times)

hero member
Activity: 574
Merit: 523
October 22, 2014, 03: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.
member
Activity: 102
Merit: 10
October 22, 2014, 02:50:39 AM
#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?
hero member
Activity: 574
Merit: 523
October 20, 2014, 07:52:02 AM
#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.
sr. member
Activity: 475
Merit: 252
October 20, 2014, 07:50:50 AM
#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.
hero member
Activity: 574
Merit: 523
October 20, 2014, 07:01:48 AM
#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.
sr. member
Activity: 475
Merit: 252
October 20, 2014, 06:14:46 AM
#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
}
hero member
Activity: 574
Merit: 523
October 20, 2014, 04: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.
legendary
Activity: 1039
Merit: 1005
October 20, 2014, 03: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
hero member
Activity: 574
Merit: 523
October 20, 2014, 03: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.
member
Activity: 102
Merit: 10
October 20, 2014, 03: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.
hero member
Activity: 574
Merit: 523
October 20, 2014, 02: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.
member
Activity: 102
Merit: 10
October 20, 2014, 02:45:02 AM
#1
subject deleted

Jump to: