Pages:
Author

Topic: Help a newbie; why is hashing not done once but twice during Bitcoin transaction - page 7. (Read 1669 times)

legendary
Activity: 3290
Merit: 16489
Thick-Skinned Gang Leader and Golden Feather 2021
Before implementing BIP30, transactions could have the same ID.

The coinbase transactions on blocks number 91,722 and 91,880 have the same transaction ID.
The coinbase transactions on blocks number 91,812 and 91,842 have the same transaction ID.
I didn't know this. Does this mean the 50 Bitcoin created by the second transaction basically don't exist?
legendary
Activity: 2268
Merit: 18748
BIP30 doesn't allow a block to include a transaction with a same ID as an existing transaction in the blockchain.
Not quite. BIP30 doesn't allow a transaction to have the same ID as a not-fully-spent transaction. So if all the outputs from a given transaction are spent, then that transaction ID can indeed be duplicated in the future. While it is still incredibly unlikely that such an event would ever happen, without this wording it would be impossible to run pruned nodes, since all nodes would have keep a record of every transaction ever made to ensure any current transaction was not duplicating a previous one.
full member
Activity: 303
Merit: 136
Defend Bitcoin and its PoW: bitcoincleanup.com
My question now is since   during hashing bytes sequence are required what happens when one forgets to pack the hexadecimal strings to bytes?
I'll need you to elaborate. What you do mean one forgets to pack strings to bytes?
Thanks for concern.
My question is since the hash function accepts data in binary form, as I read it should be in bytes. What happens when one forgets to change the strings in hexadecimal to its respective bytes, will the result still be the same
My question now is since   during hashing bytes sequence are required what happens when one forgets to pack the hexadecimal strings to bytes?
I'll need you to elaborate. What you do mean one forgets to pack strings to bytes?

Secondly why is hashing not done once but twice in Bitcoin?
That is a good question. It turns out that it has to do with the so-called length extension attack. I have never seen this been discussed back in the early days, though, so there may be another reason.

Thirdly can two transactions have same TXID?
Theoretically, there could be a collision. Realistically effectively, it can't. It's 1 in 2^256 which is a stupidly large range of numbers.
Secondly why is hashing not done once but twice in Bitcoin?
That is a good question. It turns out that it has to do with the so-called length extension attack. I have never seen this been discussed back in the early days, though, so there may be another reason.

Thirdly can two transactions have same TXID?
Theoretically, there could be a collision. Realistically effectively, it can't. It's 1 in 2^256 which is a stupidly large range of numbers.
[/quote]
legendary
Activity: 2380
Merit: 5213
Theoretically, there could be a collision. Realistically effectively, it can't. It's 1 in 2^256 which is a stupidly large range of numbers.
Even in theory, that's impossible. BIP30 doesn't allow a block to include a transaction with a same ID as an existing a not-fully-spent transaction.
(The post has been edited. Thanks o_e_l_e_o for the correction.)

Quote from: bip-0030.mediawiki
Blocks are not allowed to contain a transaction whose identifier matches that of an earlier, not-fully-spent transaction in the same chain.

Before implementing BIP30, transactions could have the same ID.

The coinbase transactions on blocks number 91,722 and 91,880 have the same transaction ID.
The coinbase transactions on blocks number 91,812 and 91,842 have the same transaction ID.

For more information, visit learnmeabitcoin.
legendary
Activity: 1512
Merit: 7340
Farewell, Leo
My question now is since   during hashing bytes sequence are required what happens when one forgets to pack the hexadecimal strings to bytes?
I'll need you to elaborate. What you do mean one forgets to pack strings to bytes?

Secondly why is hashing not done once but twice in Bitcoin?
That is a good question. It turns out that it has to do with the so-called length extension attack. I have never seen this been discussed back in the early days, though, so there may be another reason.

Thirdly can two transactions have same TXID?
Theoretically, there could be a collision. Realistically effectively, it can't. It's 1 in 2^256 which is a stupidly large range of numbers.
hero member
Activity: 1554
Merit: 880
pxzone.online
I don' have enough technical knowledge about the two, but I can give an answer for this

Thirdly can two transactions have same TXID?
Bitcoin already has +700 millions transactions[1] since then yet there's no single case of the same txid happened (someone correct me if im wrong). Although there's no centralized database to check if there is already existing txid but with the hashing method used, there's almost zero chance that a transaction will have the same txid.

[1] https://www.blockchain.com/charts/n-transactions-total
full member
Activity: 303
Merit: 136
Defend Bitcoin and its PoW: bitcoincleanup.com
Hash SHA256 are said to be a good ID numbers (TXID) since they can accept any long type of data string and generate a short but unique data.
This TXID which can also be use when an output is required to be use for a transaction input.

My question now is since   during hashing bytes sequence are required what happens when one forgets to pack the hexadecimal strings to bytes?

Secondly why is hashing not done once but twice in Bitcoin?

Thirdly can two transactions have same TXID?
Pages:
Jump to: