Bitcoin Forum
April 26, 2024, 04:05:01 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: [TECHNICAL] how are transactions hashes created?  (Read 979 times)
browep (OP)
Newbie
*
Offline Offline

Activity: 46
Merit: 0


View Profile WWW
August 16, 2011, 07:27:24 PM
 #1

Could someone explain how a transaction hash is created?  Or maybe point me to a resource that has a good technical rundown of bitcoin.  I am finding it pretty hard to find good technical documentation.

Whoever mines the block which ends up containing your transaction will get its fee.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714104301
Hero Member
*
Offline Offline

Posts: 1714104301

View Profile Personal Message (Offline)

Ignore
1714104301
Reply with quote  #2

1714104301
Report to moderator
Kansattica
Member
**
Offline Offline

Activity: 112
Merit: 10


Don't get eaten by wolves!


View Profile WWW
August 17, 2011, 02:53:32 AM
 #2

Have you tried the Wikipedia page on Bitcoins?

http://en.wikipedia.org/wiki/Bitcoin

Shocking, obligatory charity code:
1Gimmiec4KSrcKR3t6xoReJd4rNGt8zM58

Free BTC every hour:
http://mycryptcoin.com/?rid=1CccBJE7BCTJEvRN9Uxfgwbr11fSaUvjFe

And why not free Bitcoins?
https://bitcointalk.org/index.php?topic=83057

Great (read: best) old computer games for BTC:
https://bitcointalk.org/index.php?topic=85347.0
browep (OP)
Newbie
*
Offline Offline

Activity: 46
Merit: 0


View Profile WWW
August 17, 2011, 03:41:47 AM
 #3

thats the closest I have come to  a technical spec for how the transaction hash is created.  Thanks.  Is there anything more technical like a white paper or anything like that?
Kansattica
Member
**
Offline Offline

Activity: 112
Merit: 10


Don't get eaten by wolves!


View Profile WWW
August 17, 2011, 04:16:20 AM
 #4

The wiki has a collection of technical specs (https://en.bitcoin.it/wiki/Category:Technical), but I can't vouch for their thoroughness.

Shocking, obligatory charity code:
1Gimmiec4KSrcKR3t6xoReJd4rNGt8zM58

Free BTC every hour:
http://mycryptcoin.com/?rid=1CccBJE7BCTJEvRN9Uxfgwbr11fSaUvjFe

And why not free Bitcoins?
https://bitcointalk.org/index.php?topic=83057

Great (read: best) old computer games for BTC:
https://bitcointalk.org/index.php?topic=85347.0
Meni Rosenfeld
Donator
Legendary
*
Offline Offline

Activity: 2058
Merit: 1054



View Profile WWW
August 17, 2011, 04:38:09 AM
 #5

Try https://en.bitcoin.it/wiki/Protocol_specification and https://en.bitcoin.it/wiki/Protocol_rules. Though it's possible that for some things the code is the de facto documentation.

1EofoZNBhWQ3kxfKnvWkhtMns4AivZArhr   |   Who am I?   |   bitcoin-otc WoT
Bitcoil - Exchange bitcoins for ILS (thread)   |   Israel Bitcoin community homepage (thread)
Analysis of Bitcoin Pooled Mining Reward Systems (thread, summary)  |   PureMining - Infinite-term, deterministic mining bond
jackjack
Legendary
*
Offline Offline

Activity: 1176
Merit: 1233


May Bitcoin be touched by his Noodly Appendage


View Profile
August 18, 2011, 01:31:52 PM
 #6

I never found the answer when I was looking for it
It's the Hash (ie sha256^2) of the transaction in little-endian

For example, the Hash of
Quote
010000000130395068e54c83864c17e0d04467956e67229066c60b3e4e3500dfae8524a6e400000 0008c493046022100e564071d42b5e7ce069b5d864c3f151e2121b5216cd77599e82c83f4b21e43 7a022100fd83c972dbe5fdbdb11c8457c7d42504c5f8fc7c93aad16468681a35b66a6713014104e 2f81f840e109d8cfad3b31040b4d674c36de4e28d3566061f6bb119f0c210d6b6c29cf23b21443b b25044eae5647a6ebc1e4a8b66e93c851a20f3d73f50580fffffffff02e679bdb7030000001976a 9149e8607eb634e1819413a51685423fb2a2144062888ac40420f00000000001976a914ec752339 9bfff0e1e1be93377a3b0253fe9d4f1a88ac00000000
is f3bb27c3733258fb49f377fc189a839e9eafc4cbdde88aacf1ffa1d2bcebc95b, so its hash is 5bc9ebbcd2a1fff1ac8ae8ddcbc4af9e9e839a18fc77f349fb583273c327bbf3

Own address: 19QkqAza7BHFTuoz9N8UQkryP4E9jHo4N3 - Pywallet support: 1AQDfx22pKGgXnUZFL1e4UKos3QqvRzNh5 - Bitcointalk++ script support: 1Pxeccscj1ygseTdSV1qUqQCanp2B2NMM2
Pywallet: instructions. Encrypted wallet support, export/import keys/addresses, backup wallets, export/import CSV data from/into wallet, merge wallets, delete/import addresses and transactions, recover altcoins sent to bitcoin addresses, sign/verify messages and files with Bitcoin addresses, recover deleted wallets, etc.
Jimmy2011
Hero Member
*****
Offline Offline

Activity: 589
Merit: 500



View Profile
September 08, 2011, 11:49:24 AM
 #7

Try https://en.bitcoin.it/wiki/Protocol_specification and https://en.bitcoin.it/wiki/Protocol_rules. Though it's possible that for some things the code is the de facto documentation.

I have the same question on how to calculate transaction hash. From https://en.bitcoin.it/wiki/Dump_format, I can't understand how  the following 2d7f4d is calculated out.

Quote
CTransaction(hash=2d7f4d, ver=1, vin.size=1, vout.size=1, nLockTime=0)
    CTxIn(COutPoint(000000, -1), coinbase 0418ba001c02ce03)
    CTxOut(nValue=50.00000000, scriptPubKey=0x4FE11D72F988AEA611F026)
Sekioh
Full Member
***
Offline Offline

Activity: 181
Merit: 100



View Profile
September 08, 2011, 01:00:45 PM
 #8

That's because it's not showing the full block, just that transaction block, so the example is incomplete. If you read the line under that it's the 'truncated' first few bytes of the whole transaction hash. If they showed that whole block I'm sure you'd be able to piece together the information of which combines to make that.

I never found the answer when I was looking for it
It's the Hash (ie sha256^2) of the transaction in little-endian

For example, the Hash of
Quote
010000000130395068e54c83864c17e0d04467956e67229066c60b3e4e3500dfae8524a6e400000 0008c493046022100e564071d42b5e7ce069b5d864c3f151e2121b5216cd77599e82c83f4b21e43 7a022100fd83c972dbe5fdbdb11c8457c7d42504c5f8fc7c93aad16468681a35b66a6713014104e 2f81f840e109d8cfad3b31040b4d674c36de4e28d3566061f6bb119f0c210d6b6c29cf23b21443b b25044eae5647a6ebc1e4a8b66e93c851a20f3d73f50580fffffffff02e679bdb7030000001976a 9149e8607eb634e1819413a51685423fb2a2144062888ac40420f00000000001976a914ec752339 9bfff0e1e1be93377a3b0253fe9d4f1a88ac00000000
is f3bb27c3733258fb49f377fc189a839e9eafc4cbdde88aacf1ffa1d2bcebc95b, so its hash is 5bc9ebbcd2a1fff1ac8ae8ddcbc4af9e9e839a18fc77f349fb583273c327bbf3

I imagine for this transaction hash for example is shortened to like 5bc9eb then hashed with the previous block, (read farther down on that wiki page, theres the merkle tree root information there, it takes the previous blocks Merkle and hashes it with the transaction. So say the merkle for this block was "hashMerkleRoot=e81287" (which is the hash of the previous blocks transactions, to provide a chain order?) and our transaction is "hash=5bc9eb", the hash of the two of those is the actual "hash=" that is stored in the block you see which could be "hash=2d7f4d"

<OPEN MONEY | Powering Blockchain Acceptance [ICO]
███████████████    ▬▬▬▬▬▬ Blockchain Meets Mainstream! ▬▬▬▬▬▬    ███████████████
Whitepaper  ●  Slack  ●  Facebook  ●  Twitter  ●  Reddit  ●  Telegram>
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!