Author

Topic: Bitcoin RAW TX and SegWit (Read 186 times)

sr. member
Activity: 322
Merit: 363
39twH4PSYgDSzU7sLnRoDfthR6gWYrrPoD
April 16, 2018, 02:59:48 PM
#2
The Bitcoin Core developer guide for segwit wallets is a good place to start.
member
Activity: 392
Merit: 41
This text is irrelevant
April 16, 2018, 02:46:55 PM
#1
I am writing Python script that should be able to generate raw TX messages. I understand there are libraries to do it, but I'd like to learn this from the ground up myself. As an example I took this great tutorial:

http://www.righto.com/2014/02/bitcoins-hard-way-using-raw-bitcoin.html

and BTC Tx specifications https://en.bitcoin.it/wiki/Protocol_specification#tx

After some time I have finally figured that to specify INPUT in my tx i need to take DOUBLE sha256 (this does not seem clearly stated in specs, it only says "hash") of FULL PREVIOUS TX (not just output section as it say in some of the articles that I won't link here because it took me hours to figure this out after following those).

My questions are following:

Tx generation method in the above tutorial is fairly old and simple (single input, single output).

  • AFAIK SegWit tx message have slightly different structure. What should I change to make my TX with multiple outputs a SegWit TX?
  • Are SegWit Inputs any different from non-SegWit Inputs (i.e. if i have received my coins as SegWit TX will it change how my spending TX look like)
  • To sum up  the question - Is current specs here https://en.bitcoin.it/wiki/Protocol_specification#tx  are universal and can be applied to any and all BTC transaction?

Any links/tutorials/literature on the subject will be greatly appriciated.
Thanks.
Jump to: