Pages:
Author

Topic: understanding transactions - page 2. (Read 2479 times)

full member
Activity: 129
Merit: 100
August 06, 2014, 08:56:50 AM
#8
Thanks!

So I'm signing the transaction:

signrawtransaction 0100000001a8d0102b1fa655a282996d839a199478276625baa454b4743bbd5d7f10dbe5d801000 00000ffffffff0180841e00000000001976a914b7f7543883c4fd010aeb1ef63b5e888487dd08ae 88ac00000000

result is OK, and after decoding I have:

{
   "lock_time":0,
   "inputs":[
      {
         "prev_out":{
            "index":1,
            "hash":"d8e5db107f5dbd3b74b454a4ba2566277894199a836d9982a255a61f2b10d0a8"
         },
         "script":"473044022031e60b2d340e350d871809492f3d0b4d7dda2eae11c4e729be648a9c87b2fc1802207 bd0fbd9614dc08f14b9092559de106417373a8a1d9353767874a95aa302973b012102d9c1d8bc28 62f6946ea055743551abb385492069da38bdc0ec8e3e875ec87875" //question 0: this is again scriptSig, this time signed, right? But why can't be it "decoded" just like scriptPubKey below?
      }
   ],
   "vout_sz":1,
   "hash":"7f850e2a177fb494492d3ad7707cceaa410106b3c6ce0385f876d24acad653ab",//question 1: I thought this is transaction ID, then why did it change after signing it?
   "vin_sz":1,
   "out":[
      {
         "address":"1Hmiwpos8p7dijjmKmuMcEJBJeuaQzY3Mv",
         "script_string":"OP_DUP OP_HASH160 b7f7543883c4fd010aeb1ef63b5e888487dd08ae OP_EQUALVERIFY OP_CHECKSIG",//question 3: this is the same as in above, but I forgot to ask, this is the scriptPubKey, right?
         "value":2000000,
         "script":"76a914b7f7543883c4fd010aeb1ef63b5e888487dd08ae88ac"
      }
   ],
   "size":191,
   "version":1
}
legendary
Activity: 1260
Merit: 1019
August 06, 2014, 08:26:09 AM
#7
Quote
Quote
Blockchain.info site decodes this transaction as for mainnet.
Ouch Embarrassed But can I assume that everything except for this receiving address is OK?
Yes
full member
Activity: 129
Merit: 100
August 06, 2014, 08:21:56 AM
#6
Quote
Well, I have no idea. I'm working entirely in testnet mode. I did run mainnet before but it's closed now. Do you have an idea?
Of course. You have said above:
Quote
After decoding it at https://blockchain.info/decode-tx I have (questions inside):
Blockchain.info site decodes this transaction as for mainnet.

Quote
I found out that this "hash160" is a ripemd160(sha256(address)) is this correct?
No.
Your public key is long array of bytes (64 bytes to be correct)
It is too long to be used as an address and it does not have checksums for error handling
So, there is a hash function which converts public key to 20 bytes (there are 2 ways to do it)
b7f7543883c4fd010aeb1ef63b5e888487dd08ae - is the result of this written in hex digits
This line is also bad for using as your address - it is still too long and also does not have error-cheching
So, there is base58check function which converts 20 bytes to bitcoin address

read this
https://en.bitcoin.it/wiki/Technical_background_of_Bitcoin_addresses
https://en.bitcoin.it/wiki/Base58Check_encoding



Thanks. I was going to ask you if I also have to fully understand addresses to understand transactions, then I saw last two lines of your answer:)

So thanks. I'll read it.

Quote
Blockchain.info site decodes this transaction as for mainnet.
Ouch Embarrassed But can I assume that everything except for this receiving address is OK?
newbie
Activity: 13
Merit: 0
August 06, 2014, 08:12:19 AM
#5
i dont know about thats maybe some error system on it .
 Huh Huh
legendary
Activity: 1260
Merit: 1019
August 06, 2014, 08:07:15 AM
#4
Quote
Well, I have no idea. I'm working entirely in testnet mode. I did run mainnet before but it's closed now. Do you have an idea?
Of course. You have said above:
Quote
After decoding it at https://blockchain.info/decode-tx I have (questions inside):
Blockchain.info site decodes this transaction as for mainnet.

Quote
I found out that this "hash160" is a ripemd160(sha256(address)) is this correct?
No.
Your public key is long array of bytes (64 bytes to be correct)
It is too long to be used as an address and it does not have checksums for error handling
So, there is a hash function which converts public key to 20 bytes (there are 2 ways to do it)
b7f7543883c4fd010aeb1ef63b5e888487dd08ae - is the result of this written in hex digits
This line is also bad for using as your address - it is still too long and also does not have error-cheching
So, there is base58check function which converts 20 bytes to bitcoin address

read this
https://en.bitcoin.it/wiki/Technical_background_of_Bitcoin_addresses
https://en.bitcoin.it/wiki/Base58Check_encoding

full member
Activity: 129
Merit: 100
August 06, 2014, 07:36:15 AM
#3
Thank you!

Quote
Quote
 "address":"1Hmiwpos8p7dijjmKmuMcEJBJeuaQzY3Mv",//question 3: is this a receiving address created by the wallet? Or something else?
Yes. But why does it starts with "1" Huh Seems to me thay you have decoded your transaction for mainnet, not for testnet! Be careful!

Well, I have no idea. I'm working entirely in testnet mode. I did run mainnet before but it's closed now. Do you have an idea?

Quote
Quote
"script_string":"OP_DUP OP_HASH160 b7f7543883c4fd010aeb1ef63b5e888487dd08ae OP_EQUALVERIFY OP_CHECKSIG",//question 4: where did this b7f7543883... came from?
         "value":2000000,
         "script":"76a914b7f7543883c4fd010aeb1ef63b5e888487dd08ae88ac"
This is another representation of your destination address

I found out that this "hash160" is a ripemd160(sha256(address)) is this correct? Because when I do this I get a completely different result... even considering this endianness craziness it doesn't match.


legendary
Activity: 1260
Merit: 1019
August 06, 2014, 07:20:39 AM
#2
Quote
(mxHgEstqwqYtVrDP3LsjS9WWAeWHQyatck is another address of mine)
Is that OK?
Yes

Quote
"script":"" //question 0: This is scriptSig right? It's empty because I haven't signed the transfer yes?
Yes

Quote
"vout_sz":1,//question 1: What is it?
This is the number of outputs (vector-output-size?). You can send to several "addresses" your funds. This transaction sends to one address.

Quote
  "vin_sz":1,//question 2: What is it?
This is the number of inputs. You can spend several inputs in one transaction. Your particular transaction spends only one

Quote
  "address":"1Hmiwpos8p7dijjmKmuMcEJBJeuaQzY3Mv",//question 3: is this a receiving address created by the wallet? Or something else?
Yes. But why does it starts with "1" Huh Seems to me thay you have decoded your transaction for mainnet, not for testnet! Be careful!

Quote
"script_string":"OP_DUP OP_HASH160 b7f7543883c4fd010aeb1ef63b5e888487dd08ae OP_EQUALVERIFY OP_CHECKSIG",//question 4: where did this b7f7543883... came from?
         "value":2000000,
         "script":"76a914b7f7543883c4fd010aeb1ef63b5e888487dd08ae88ac"
This is another representation of your destination address
http://test.webbtc.com/address/mxHgEstqwqYtVrDP3LsjS9WWAeWHQyatck
full member
Activity: 129
Merit: 100
August 06, 2014, 07:04:05 AM
#1
Hi,

I'm trying to understand transactions, so I'm playing with raw transactions in bitcoin-qt on testnet.

I'm not sure about a few things, even after reading https://en.bitcoin.it/wiki/Transactions (I supposed I missed something)

After listunspent I have this transaction among others:

{
"txid" : "d8e5db107f5dbd3b74b454a4ba2566277894199a836d9982a255a61f2b10d0a8",
"vout" : 1,
"address" : "msmhYhrXtYAxerUCNfDAXu97xwaZ3JqxH6",
"scriptPubKey" : "76a914866b70364391e0ba5514cc30cb45f12291bc6cf788ac",
"amount" : 0.33900000,
"confirmations" : 65
},

I want to send 0.02 BTC, So I do:
createrawtransaction [{\"txid\":\"d8e5db107f5dbd3b74b454a4ba2566277894199a836d9982a255a61f2b10d0a8\",\"vout\":1}] {\"mxHgEstqwqYtVrDP3LsjS9WWAeWHQyatck\":0.02}

(mxHgEstqwqYtVrDP3LsjS9WWAeWHQyatck is another address of mine)

Is that OK?

Result is:

0100000001a8d0102b1fa655a282996d839a199478276625baa454b4743bbd5d7f10dbe5d801000 00000ffffffff0180841e00000000001976a914b7f7543883c4fd010aeb1ef63b5e888487dd08ae 88ac00000000


After decoding it at https://blockchain.info/decode-tx I have (questions inside):
{
   "lock_time":0,
   "inputs":[
      {
         "prev_out":{
            "index":1,
            "hash":"d8e5db107f5dbd3b74b454a4ba2566277894199a836d9982a255a61f2b10d0a8"
         },
         "script":"" //question 0: This is scriptSig right? It's empty because I haven't signed the transfer yes?
      }
   ],
   "vout_sz":1,//question 1: What is it?
   "hash":"d231eab0bcee0ab3e2e2c08aa9f2eefa4f2e0d42ce225540fd2287ade62e0cdb",
   "vin_sz":1,//question 2: What is it?
   "out":[
      {
         "address":"1Hmiwpos8p7dijjmKmuMcEJBJeuaQzY3Mv",//question 3: is this a receiving address created by the wallet? Or something else?
         "script_string":"OP_DUP OP_HASH160 b7f7543883c4fd010aeb1ef63b5e888487dd08ae OP_EQUALVERIFY OP_CHECKSIG",//question 4: where did this b7f7543883... come from?
         "value":2000000,
         "script":"76a914b7f7543883c4fd010aeb1ef63b5e888487dd08ae88ac"
      }
   ],
   "size":85,
   "version":1
}

I will soon sign the transfer, but can you answer the questions above first please?

btw. should I ask these kind of questions here or in Development & Technical Discussion maybe?
Pages:
Jump to: