Author

Topic: how to figure out transaction in values from addresses (Read 1348 times)

brand new
Activity: 0
Merit: 0
Have a look there . I know it's easy to use.
administrator
Activity: 5222
Merit: 13032
thanks..  that makes sense..  I was thinking that the values in the transaction IN added up to the values in the transaction out, but in the example I gave you, this is not the case..  Most of the time the aggregate values in tx_in was equal to the values of the tx_out..

All of the input values do add up to the output values in that block. Are you counting all of the outputs of the input transactions, perhaps?

I forgot to answer part of your original question: you can get the actual addresses by parsing the scriptSig/scriptPubKey. My tools are useful for doing the necessary conversions:
http://blockexplorer.com/q/hashpubkey
http://blockexplorer.com/q/hashtoaddress
http://blockexplorer.com/q/addresstohash

Transactions to addresses use:
scriptPubKey: OP_DUP OP_HASH160 OP_EQUALVERIFY OP_CHECKSIG
scriptSig:

Various other less usual transactions use:
scriptPubKey: OP_CHECKSIG
scriptSig:

You can put pubKeyHash through hashtoaddress to get the address, or you can put pubKey through hashpubkey+hashtoaddress.

Addresses can't be easily determined for non-standard transactions such as this:
http://blockexplorer.com/testnet/tx/802b9e557161b9bffdc2e12cc755eb4379f88014f288c2484bb39b831bb9938e#o1
Hal
vip
Activity: 314
Merit: 4276
The sum of the IN values has to be greater than or equal to the sum of the OUT values. If it is greater, the difference is a transaction fee, collectable by whoever generates the block that includes this transaction.
newbie
Activity: 11
Merit: 0
thanks..  that makes sense..  I was thinking that the values in the transaction IN added up to the values in the transaction out, but in the example I gave you, this is not the case..  Most of the time the aggregate values in tx_in was equal to the values of the tx_out..
administrator
Activity: 5222
Merit: 13032
You need to follow the prev_out. It's not specified in the transaction. Looking at this transaction, locate output #1 in transaction b8983967c707 to get the value. It's the second "out" here. The index ("n") starts at 0.

The difficulty of processing this by hand is one of the main reasons I wrote BBE. Previously I output all of the blocks to a file and then searched it for hashes, but I had to go back and forth dozens of times just to figure out the total value of a transaction.
newbie
Activity: 11
Merit: 0
how to figure out transaction IN values from addresses?  I've been looking at the output of a transaction, and I can't figure out how blockexplorer figures out the transaction in values for each bc address.

For example,  see http://blockexplorer.com/b/104777  , the second transaction has 9 inputs with different values.   How are these derived from the raw block?

Thanks..
Jump to: