Author

Topic: About Raw Transactions (Read 546 times)

full member
Activity: 227
Merit: 100
Exciting Cryptocurrency of Future!
April 27, 2017, 03:32:52 AM
#5
Yes, I am using "tx_hash_big_endian" already
Ah, I missed that.

(also, if this helps, tx is not yet confirmed)
That is the problem. I just checked with my node. The transaction has been dropped from my node, so it has likely been dropped from most nodes on the network (block explorers being the exception). You will need to first broadcast the unconfirmed transaction which you are spending from and then broadcast your spending transaction.

Besides that, it looks like you are using the wrong public key as it does not match the hash specified in the output script you are spending from. You are probably using the wrong private key.

Omg it was all about private key how I missed it... I thought it was correct private key, I wasted 4 hours fixing this Cheesy
Thank you so much man, sending a little tip!
staff
Activity: 3458
Merit: 6793
Just writing some code
April 26, 2017, 02:07:26 PM
#4
Yes, I am using "tx_hash_big_endian" already
Ah, I missed that.

(also, if this helps, tx is not yet confirmed)
That is the problem. I just checked with my node. The transaction has been dropped from my node, so it has likely been dropped from most nodes on the network (block explorers being the exception). You will need to first broadcast the unconfirmed transaction which you are spending from and then broadcast your spending transaction.

Besides that, it looks like you are using the wrong public key as it does not match the hash specified in the output script you are spending from. You are probably using the wrong private key.
full member
Activity: 227
Merit: 100
Exciting Cryptocurrency of Future!
April 26, 2017, 01:11:26 PM
#3
The "missing inputs" error has nothing to do with input scripts. The problem is because you have the wrong txid. For some reason, the tx_hash given by blockchain.info is in little endian but basically everything takes the txid as a big endian argument. You should use "tx_hash_big_endian":"c54ffd2b302b03f81342fe0c2c42960dd160d6b1ad8db7d3539f83a1ca8cb5d5", for the txid of the transaction that you are spending from.

Yes, I am using "tx_hash_big_endian" already

(also, if this helps, tx is not yet confirmed)
staff
Activity: 3458
Merit: 6793
Just writing some code
April 26, 2017, 01:02:51 PM
#2
The "missing inputs" error has nothing to do with input scripts. The problem is because you have the wrong txid. For some reason, the tx_hash given by blockchain.info is in little endian but basically everything takes the txid as a big endian argument. You should use "tx_hash_big_endian":"c54ffd2b302b03f81342fe0c2c42960dd160d6b1ad8db7d3539f83a1ca8cb5d5", for the txid of the transaction that you are spending from.
full member
Activity: 227
Merit: 100
Exciting Cryptocurrency of Future!
April 26, 2017, 12:15:43 PM
#1
I have the private key, and its unspent outputs.

Address: 18hxCUw1SYXoaeQtbZvNiM79h6hQk1HU6F

I am getting unspent outputs from here: https://blockchain.info/unspent?active=18hxCUw1SYXoaeQtbZvNiM79h6hQk1HU6F
and running this command (pycoin):


Code:
root@server:~# tx c54ffd2b302b03f81342fe0c2c42960dd160d6b1ad8db7d3539f83a1ca8cb5d5/0/76a9145487988c725c2181dd1c9e78cf6a8cf290adc05e88ac/77174 18hxCUw1SYXoaeQtbZvNiM79h6hQk1HU6F -F 30000
warning: transaction fees recommendations casually calculated and estimates may be incorrect
warning: transaction fee of 0.3 exceeds expected value of 0.1 mBTC
Version:  1  tx hash c33a9c444a5ca6244b1df8d6886876e1eab90ace3c7b57d16e602138ef8ed8b5  85 bytes
TxIn count: 1; TxOut count: 1
Lock time: 0 (valid anytime)
Input:
   0: 18hxCUw1SYXoaeQtbZvNiM79h6hQk1HU6F from c54ffd2b302b03f81342fe0c2c42960dd160d6b1ad8db7d3539f83a1ca8cb5d5:0         0.77174 mBTC  BAD SIG
Output:
   0: 18hxCUw1SYXoaeQtbZvNiM79h6hQk1HU6F receives      0.47174 mBTC
Total input       0.77174 mBTC
Total output      0.47174 mBTC
Total fees        0.30000 mBTC
including unspents in hex dump since transaction not fully signed
0100000001d5b58ccaa1839f53d3b78dadb1d660d10d96422c0cfe4213f8032b302bfd4fc50000000000ffffffff0146b80000000000001976a9145487988c725c2181dd1c9e78cf6a8cf290adc05e88ac00000000762d0100000000001976a9145487988c725c2181dd1c9e78cf6a8cf290adc05e88ac

*** can't validate source transactions as untampered: hash id c54ffd2b302b03f81342fe0c2c42960dd160d6b1ad8db7d3539f83a1ca8cb5d5 not in tx_db
warning: no service providers found for tx_for_tx_hash; consider setting environment variable PYCOIN_BTC_PROVIDERS
root@server:~#


Here I got raw transaction. I sign it with pybtctool:

Code:
root@server:~# pybtctool sign 0100000001d5b58ccaa1839f53d3b78dadb1d660d10d96422c0cfe4213f8032b302bfd4fc50000000000ffffffff0146b80000000000001976a9145487988c725c2181dd1c9e78cf6a8cf290adc05e88ac00000000762d0100000000001976a9145487988c725c2181dd1c9e78cf6a8cf290adc05e88ac 0 [i]PRIVATE_KEY[/i]


0100000001d5b58ccaa1839f53d3b78dadb1d660d10d96422c0cfe4213f8032b302bfd4fc5000000008b483045022100d6a5589b65607f7f6698b6aa47223a46e9892089f04419a6d856721f85dffb2f022001061847f0e4c5ab15c2b4ccd3f22f9977218aa01c084d08450e9b3d3a22fbd80141043fcc0663bca106863ebdae80cc7ceca39775c8978c7de706f613a7e68e490e19e675395bb26778cb372177db42d0b496d2e335a5476214d093e897b25bee8f9fffffffff0146b80000000000001976a9145487988c725c2181dd1c9e78cf6a8cf290adc05e88ac00000000

I have the signed transaction, but when I try to broadcast it I am getting this error
"Missing inputs"

I saw that in raw transaction does not have script of input even though I give script


I also tried creating TX with pybtctool (it does not ask for transaction script);
Code:
root@server:~# pybtctool mktx c54ffd2b302b03f81342fe0c2c42960dd160d6b1ad8db7d3539f83a1ca8cb5d5:0 18hxCUw1SYXoaeQtbZvNiM79h6hQk1HU6F:57174
0100000001d5b58ccaa1839f53d3b78dadb1d660d10d96422c0cfe4213f8032b302bfd4fc50000000000ffffffff0156df0000000000001976a9145487988c725c2181dd1c9e78cf6a8cf290adc05e88ac00000000

And it still does not show script when I decode it, so I can't broadcast it.


So I have few questions;
  • Can I broadcast without input script?
  • How can I create raw input with transaction script? (I don't want to download whole blockchain)
  • How can I directly pay from private key?

Thanks!
Jump to: