I will just quote this here, because it answers the question and will get lost in the other thread.
Thanks, dooglus, I was helping FreeHealthCare to deposit a paper wallet and so I pushed the tx through your page and I wanted to be able to tell him, "here ya go: TXID". I ended up finding it by using a block explorer and looking for his/her deposit address. Just that that's what prompted the question. Thanks again for the explanation. I actually went and asked about how to calculate it in the Technical Discussion board, perhaps someone there can explain why its not coming out the way you expected.
It's because you don't just sha256 it, you sha256 it twice, then reverse the result!
$ clamd getrawtransaction 512f2e27b233eee9c28ac0f12a653ca1b6e1ef76b8214915d7865dda0b51dfc0 |
xxd -r -p | # convert hex to binary
sha256sum | # hash it
xxd -r -p | # convert hex to binary
sha256sum | # hash it
awk '{print $1}' | # keep just the hash: 01234567
rev | # reverse it: 76543210
sed -E 's/(.)(.)/\2\1/g' # switch adjacent bytes: 67452301
512f2e27b233eee9c28ac0f12a653ca1b6e1ef76b8214915d7865dda0b51dfc0
Edit: I learned this from
https://en.bitcoin.it/wiki/Dump_format#General_note_about_hashes - and found that page by googling for 9a538906e6466ebd2617d321f71bc94e56056ce213d366773699e28158e00614, which is what Bitcoin gives when you hash a single 00 byte (which is what I got when I serialized an empty string).