Bitcoin Forum
May 11, 2024, 05:09:52 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: How is a bitcoin transaction serialised so that it is ready for signing?  (Read 150 times)
Anonymous Kid (OP)
Member
**
Offline Offline

Activity: 183
Merit: 25


View Profile
October 07, 2018, 01:00:57 PM
 #1

What are the exact technical steps to serialize a transactions so that it is ready to be signed and the resulting signature is valid?
Even if you use Bitcoin through Tor, the way transactions are handled by the network makes anonymity difficult to achieve. Do not expect your transactions to be anonymous unless you really know what you're doing.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
AdolfinWolf
Legendary
*
Offline Offline

Activity: 1946
Merit: 1427


View Profile
October 07, 2018, 01:29:41 PM
Last edit: October 07, 2018, 02:07:39 PM by AdolfinWolf
 #2

What are the exact technical steps to serialize a transactions so that it is ready to be signed and the resulting signature is valid?
You mean something like this? https://bitcoin.stackexchange.com/a/32695

This answer is also pretty constructive (And is what the above answer is based on). https://bitcoin.stackexchange.com/questions/3374/how-to-redeem-a-basic-tx?noredirect=1&lq=1

The above answer also links an article which is defnitely worth a read. See http://www.righto.com/2014/02/bitcoins-hard-way-using-raw-bitcoin.html

I'd be very much interested in seeing a segwit version of this aswell. especially one which uses bech adresses. (If anyone has any links!)

Anonymous Kid (OP)
Member
**
Offline Offline

Activity: 183
Merit: 25


View Profile
October 07, 2018, 04:15:15 PM
 #3

What are the exact technical steps to serialize a transactions so that it is ready to be signed and the resulting signature is valid?
You mean something like this? https://bitcoin.stackexchange.com/a/32695

This answer is also pretty constructive (And is what the above answer is based on). https://bitcoin.stackexchange.com/questions/3374/how-to-redeem-a-basic-tx?noredirect=1&lq=1

The above answer also links an article which is defnitely worth a read. See http://www.righto.com/2014/02/bitcoins-hard-way-using-raw-bitcoin.html

I'd be very much interested in seeing a segwit version of this aswell. especially one which uses bech adresses. (If anyone has any links!)

Why does the hex transaction need to be decoded?
Code:
HEX_TRANSACTION="010000000126c07ece0bce7cda0ccd14d99e205f118cde27e83dd75da7b141fe487b5528fb000000008b48304502202b7e37831273d74c8b5b1956c23e79acd660635a8d1063d413c50b218eb6bc8a022100a10a3a7b5aaa0f07827207daf81f718f51eeac96695cf1ef9f2020f21a0de02f01410452684bce6797a0a50d028e9632be0c2a7e5031b710972c2a3285520fb29fcd4ecfb5fc2bf86a1e7578e4f8a305eeb341d1c6fc0173e5837e2d3c7b178aade078ffffffff02b06c191e010000001976a9143564a74f9ddb4372301c49154605573d7d1a88fe88ac00e1f505000000001976a914010966776006953d5567439e5e39f86a0d273bee88ac00000000"

tx_data=HEX_TRANSACTION.decode('hex_codec')
tx_hash=double_sha256(tx_data)

wouldnt the whole process work just as fine as
Code:
tx_hash = double_sha256(HEX_TRANSACTION)
. Whats the reasoning for adding this extra step?
BrewMaster
Legendary
*
Offline Offline

Activity: 2114
Merit: 1292


There is trouble abrewing


View Profile
October 07, 2018, 04:44:44 PM
Merited by ABCbits (1)
 #4

Why does the hex transaction need to be decoded?

wouldnt the whole process work just as fine as
Code:
tx_hash = double_sha256(HEX_TRANSACTION)
. Whats the reasoning for adding this extra step?

you have to go look at what "double_sha256" method is doing under the hood. that function only understands an array of bytes. it can not understand a "string" which happens to be a hexadecimal one in this case. so you first "translate" it by calling "decode"

There is a FOMO brewing...
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!