0

It seems that when someone wants to send Bitcoins, he creates a transaction and the transaction_id will be transaction's hash. after block confirmation this id will be change and we can find out this id in the transaction explorers, I want to access the transaction id created by sender(first id) to verify the transaction by r, s and sender's public key that saved in block chain, but to verify this transaction I need the hash that created by sender, there is too many references that I can use to calculate the final transaction id but I need the id that created by sender to verify transaction. I wrote some implementation according to Bitcoin's wiki but it was wrong.

I need an exact reference or a function that shows how to calculate the transaction id that calculated by sender.

for example in a random transaction with id adb1b4723f24841b671b1e979571929f7fc1db9f3884eee2e3fec782bb3ff0a6 we can find the r = 0x0082a19fd532b25c79831c8a8e4802cd35ccabe41469c1c46386ce3fa9f60fde and the s = 0x04fa4e1593c94c130b0ebb1a57d390367d797191af0cb201b3a68fe683bc393b the public key of sender is pub = (0x6bb502c0eb0a69caec1d649259f5ec3286bef74e2d1cf4cf2b3657be7242d5f9, 0x63f0ab38e0cb9399dcb386e64a67188d0acdc49363583893190e3f950fae5c38) if we run the verification algorithm it will return false if we take h = tx_id = 0xadb1b4723f24841b671b1e979571929f7fc1db9f3884eee2e3fec782b because r_prime = 0x9fc47f1afdb0f2012e373bb6e55e7f208afd5c162d538f36d6420daaf800f21 and it is not equals the r! I test this senario with other transactions but the results was the same!

6
  • Hi Mohsen, a transaction does not change by being confirmed. There are some ways how third parties can modify the hash of a transaction with non-segwit inputs, but I suspect that your problem may stem from the misunderstanding that a transaction id always changes by getting included in a block. Could you please edit your post to clarify your question in light of this information?
    – Murch
    Commented Mar 26 at 15:34
  • Hi @Murch thanks for the comment. the post is updated. Commented Mar 26 at 15:53
  • It is not clear what you are trying to do in your example. It sounds to me as if you assume that the message signed by a signature is the txid, but that is not the case.
    – Murch
    Commented Mar 26 at 17:00
  • @Murch, maybe it is because of my misunderstanding. I should read the documentation of Transaction of bitcoin with more details. Thanks for your comments BTW. Commented Mar 26 at 21:18
  • 1
    Perhaps the chapter on signatures in the recently published 3rd Edition of Mastering Bitcoin can clarify: github.com/bitcoinbook/bitcoinbook/blob/… (the whole book is available in that repository).
    – Murch
    Commented Mar 26 at 21:41

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.