Bitcoin Forum
May 26, 2024, 01:02:33 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Where is witness part in SegWit transaction?  (Read 1125 times)
Aleš Janda (OP)
Newbie
*
Offline Offline

Activity: 9
Merit: 2



View Profile WWW
May 11, 2016, 02:44:38 PM
Merited by ABCbits (2)
 #1

Hi,

I'm trying to understand how SegWit transaction looks like.

In article Segregated Witness, Part 1 on BitcoinMagazine.com is written

Quote
from the perspective of Bitcoin nodes that don't use Segregated Witness (lets call them “old nodes”), some newly created outputs might soon use a strange type of scriptPubKeys. Strange, because these scriptPubKeys can hardly be considered a lock at all. Commonly referred to as an “Anyone can spend,” these scriptPubKeys basically proclaim they don't require a signature. Additionally, they will include some meaningless text.
(embolden by me)

So I tried to send some segnet bitcoin from faucet to my address. The transaction outputs look like

Code:
  "outputs": [
    {
...
      "script_pub_key": {
        "asm": "OP_DUP OP_HASH160 b94d3e2318aa7265f5c75be6275c5af35a3751bf OP_EQUALVERIFY OP_CHECKSIG",
...
      },
...
    },
    {
...
      "script_pub_key": {
        "asm": "OP_DUP OP_HASH160 b5255516286472ed5b15833da1d9ea97c8d3f05c OP_EQUALVERIFY OP_CHECKSIG",
...
      },
...
    }
  ],

This looks like standard transaction to me. When I pick random transaction from current blockchain, let's say https://blockchain.info/tx/a569b7a41c9a2567b4a4bad4ed59f5e846cc30d652b448ff6430018fe0bf3128, I see:

Code:
OP_DUP OP_HASH160 ed1fd913ec4f7f1b5699fc77ca9dc9604a840600 OP_EQUALVERIFY OP_CHECKSIG

on output, so the same format.

Also when I get transaction from segwit in hexadecimal and try to decode it in current Bitcoin version, it is the same (except the addresses because address version).

Please, can someone enlighten me what is different on SegWit? Where I can see the witness part? I'm definitely missing something… Smiley

Thanks a lot Smiley

achow101
Moderator
Legendary
*
expert
Offline Offline

Activity: 3402
Merit: 6657


Just writing some code


View Profile WWW
May 11, 2016, 03:32:31 PM
 #2

You need to spend from segwit outputs, which are not created by default. To do so, you need to create an address for segwit; there's an RPC command for it. Then spend from that address and you will see a segwit transaction.
You should also read the BIPs for segwit.

Aleš Janda (OP)
Newbie
*
Offline Offline

Activity: 9
Merit: 2



View Profile WWW
May 12, 2016, 08:30:05 AM
 #3

That is the thing! Thank you!

I created address by standard way, then in console
Code:
addwitnessaddress ADDRESS
creates new witness address from it. And transaction from has "txinwitness" part and so on.
Another good tool with examples is https://blockchainprogramming.azurewebsites.net/checktx

Thank you again.

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!