Bitcoin Forum
November 13, 2024, 05:09:20 PM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Bitcoin RAW TX and SegWit  (Read 185 times)
Colorblind (OP)
Member
**
Offline Offline

Activity: 392
Merit: 41

This text is irrelevant


View Profile
April 16, 2018, 07: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.
Xynerise
Sr. Member
****
Offline Offline

Activity: 322
Merit: 363

39twH4PSYgDSzU7sLnRoDfthR6gWYrrPoD


View Profile
April 16, 2018, 07:59:48 PM
 #2

The Bitcoin Core developer guide for segwit wallets is a good place to start.
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!