Bitcoin Forum
April 26, 2024, 10:23:20 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Segwit and decoderawtransaction  (Read 201 times)
TheArchaeologist (OP)
Sr. Member
****
Offline Offline

Activity: 310
Merit: 727


---------> 1231006505


View Profile WWW
August 27, 2018, 09:33:23 AM
 #1

Am I right to assume when the response of a the bitcoin-cli request for decoderawtransaction contains at least one txinwitness in the input section ("vin") the transaction is a segwit transaction? And the other way around: when there is no txinwitness in the vin-section it should not be considered a segwit transaction?

Any input is appreciated!

Sooner or later you're going to realize, just as I did, that there's a difference between knowing the path and walking the path
1714127000
Hero Member
*
Offline Offline

Posts: 1714127000

View Profile Personal Message (Offline)

Ignore
1714127000
Reply with quote  #2

1714127000
Report to moderator
1714127000
Hero Member
*
Offline Offline

Posts: 1714127000

View Profile Personal Message (Offline)

Ignore
1714127000
Reply with quote  #2

1714127000
Report to moderator
1714127000
Hero Member
*
Offline Offline

Posts: 1714127000

View Profile Personal Message (Offline)

Ignore
1714127000
Reply with quote  #2

1714127000
Report to moderator
There are several different types of Bitcoin clients. The most secure are full nodes like Bitcoin Core, which will follow the rules of the network no matter what miners do. Even if every miner decided to create 1000 bitcoins per block, full nodes would stick to the rules and reject those blocks.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714127000
Hero Member
*
Offline Offline

Posts: 1714127000

View Profile Personal Message (Offline)

Ignore
1714127000
Reply with quote  #2

1714127000
Report to moderator
1714127000
Hero Member
*
Offline Offline

Posts: 1714127000

View Profile Personal Message (Offline)

Ignore
1714127000
Reply with quote  #2

1714127000
Report to moderator
HCP
Legendary
*
Offline Offline

Activity: 2086
Merit: 4316

<insert witty quote here>


View Profile
August 28, 2018, 01:23:14 AM
 #2

That is a fairly safe assumption.

If there are no "txinwitness" blocks, then none of the inputs being used are "SegWit" inputs... therefore, it isn't a SegWit "transaction"... or more correctly, it doesn't contain any SegWit data.

█████████████████████████
████▐██▄█████████████████
████▐██████▄▄▄███████████
████▐████▄█████▄▄████████
████▐█████▀▀▀▀▀███▄██████
████▐███▀████████████████
████▐█████████▄█████▌████
████▐██▌█████▀██████▌████
████▐██████████▀████▌████
█████▀███▄█████▄███▀█████
███████▀█████████▀███████
██████████▀███▀██████████
█████████████████████████
.
BC.GAME
▄▄░░░▄▀▀▄████████
▄▄▄
██████████████
█████░░▄▄▄▄████████
▄▄▄▄▄▄▄▄▄██▄██████▄▄▄▄████
▄███▄█▄▄██████████▄████▄████
███████████████████████████▀███
▀████▄██▄██▄░░░░▄████████████
▀▀▀█████▄▄▄███████████▀██
███████████████████▀██
███████████████████▄██
▄███████████████████▄██
█████████████████████▀██
██████████████████████▄
.
..CASINO....SPORTS....RACING..
█░░░░░░█░░░░░░█
▀███▀░░▀███▀░░▀███▀
▀░▀░░░░▀░▀░░░░▀░▀
░░░░░░░░░░░░
▀██████████
░░░░░███░░░░
░░█░░░███▄█░░░
░░██▌░░███░▀░░██▌
░█░██░░███░░░█░██
░█▀▀▀█▌░███░░█▀▀▀█▌
▄█▄░░░██▄███▄█▄░░▄██▄
▄███▄
░░░░▀██▄▀


▄▄████▄▄
▄███▀▀███▄
██████████
▀███▄░▄██▀
▄▄████▄▄░▀█▀▄██▀▄▄████▄▄
▄███▀▀▀████▄▄██▀▄███▀▀███▄
███████▄▄▀▀████▄▄▀▀███████
▀███▄▄███▀░░░▀▀████▄▄▄███▀
▀▀████▀▀████████▀▀████▀▀
TheArchaeologist (OP)
Sr. Member
****
Offline Offline

Activity: 310
Merit: 727


---------> 1231006505


View Profile WWW
August 28, 2018, 06:40:02 AM
 #3

That is a fairly safe assumption.

If there are no "txinwitness" blocks, then none of the inputs being used are "SegWit" inputs... therefore, it isn't a SegWit "transaction"... or more correctly, it doesn't contain any SegWit data.
Thanks for your input! Good to know I didn't make a false assumption.

BTW: I will use this to check the number transactions containing Segwit data vs number of transactions without Segwit data in a block.

Sooner or later you're going to realize, just as I did, that there's a difference between knowing the path and walking the path
nc50lc
Legendary
*
Offline Offline

Activity: 2394
Merit: 5538


Self-proclaimed Genius


View Profile
August 28, 2018, 06:50:25 AM
 #4

BTW: I will use this to check the number transactions containing Segwit data vs number of transactions without Segwit data in a block.
In that case, start from block cluster (blk.dat files) blk00971.dat onwards.
Check for the dates, since SegWit was started on August 24, 2017, you might save some time by skipping the older blocks.  Wink

.
.HUGE.
▄██████████▄▄
▄█████████████████▄
▄█████████████████████▄
▄███████████████████████▄
▄█████████████████████████▄
███████▌██▌▐██▐██▐████▄███
████▐██▐████▌██▌██▌██▌██
█████▀███▀███▀▐██▐██▐█████

▀█████████████████████████▀

▀███████████████████████▀

▀█████████████████████▀

▀█████████████████▀

▀██████████▀▀
█▀▀▀▀











█▄▄▄▄
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
.
CASINSPORTSBOOK
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀▀█











▄▄▄▄█
TheArchaeologist (OP)
Sr. Member
****
Offline Offline

Activity: 310
Merit: 727


---------> 1231006505


View Profile WWW
August 28, 2018, 07:06:50 AM
 #5

In that case, start from block cluster (blk.dat files) blk00971.dat onwards.
Check for the dates, since SegWit was started on August 24, 2017, you might save some time by skipping the older blocks.  Wink
Thanks, I'm aware of when Segwit activated Wink I already marked all transactions from blocks prior to 481,824 being "Non segwit".   

Sooner or later you're going to realize, just as I did, that there's a difference between knowing the path and walking the path
Thirdspace
Hero Member
*****
Offline Offline

Activity: 1232
Merit: 738


Mixing reinvented for your privacy | chipmixer.com


View Profile
August 28, 2018, 10:09:46 AM
 #6

Code:
    "txid": "c7da009b85f48502023e5be467bef367092ed7d3ce25ce0b3b13f9a4945d932a",
    "hash": "7f8e80ea576384721538ead7ef47a3e6004171dbfb3b8e29cf191c39be5b8e51",
another thing that I notice on a segwit transaction is its txid differs from its (tx)hash
@TheArchaeologist you've done the "blockhash as private key" experiment on the other thread
while you're compiling data on segwit vs non-segwit txs in all blocks,
you should also do "private key" experiment on segwit txhashes too Grin
segwit tx has 2 possible hex numbers (txid and hash) that can be used as private keys

TheArchaeologist (OP)
Sr. Member
****
Offline Offline

Activity: 310
Merit: 727


---------> 1231006505


View Profile WWW
August 28, 2018, 12:15:28 PM
 #7

Code:
    "txid": "c7da009b85f48502023e5be467bef367092ed7d3ce25ce0b3b13f9a4945d932a",
    "hash": "7f8e80ea576384721538ead7ef47a3e6004171dbfb3b8e29cf191c39be5b8e51",
another thing that I notice on a segwit transaction is its txid differs from its (tx)hash
@TheArchaeologist you've done the "blockhash as private key" experiment on the other thread
while you're compiling data on segwit vs non-segwit txs in all blocks,
you should also do "private key" experiment on segwit txhashes too Grin
segwit tx has 2 possible hex numbers (txid and hash) that can be used as private keys
Good idea. I will add it to my list of things-to-do. I'm currently working on adding extra data to my database so it might be a while when I get to this. I will update in the other thread when I performed the experiment.

Sooner or later you're going to realize, just as I did, that there's a difference between knowing the path and walking the path
TheArchaeologist (OP)
Sr. Member
****
Offline Offline

Activity: 310
Merit: 727


---------> 1231006505


View Profile WWW
September 14, 2018, 11:58:24 AM
Last edit: September 14, 2018, 12:16:52 PM by TheArchaeologist
 #8

That is a fairly safe assumption.

If there are no "txinwitness" blocks, then none of the inputs being used are "SegWit" inputs... therefore, it isn't a SegWit "transaction"... or more correctly, it doesn't contain any SegWit data.
I am currently doing some more research into this and maybe there is at least one other scenario where a transaction is a "Segwit transaction" without a single "txwitness" block. That scenario is  when the coinbase reward is collected by a native Segwit address (bc1...).

An example:
Code:
bitcoin-cli getrawtransaction 2d531f2d4bf1227a6492656b4b340d36c810d313d94a413a965524ae71086bb9 1

Returns:
{
  "txid": "2d531f2d4bf1227a6492656b4b340d36c810d313d94a413a965524ae71086bb9",
  "hash": "157d1c3bf4860855a6f98792d459f83ad3bd8844cf729c8d9a6ec3accc5e2d7f",
  "version": 2,
  "size": 290,
  "vsize": 263,
  "locktime": 0,
  "vin": [
    {
      "coinbase": "039b4208045c2b9b5b642f4254432e434f4d2ffabe6d6d91102119a0522dda683a998f05620ba4beb1f5372a04689d07d47a291dbd25c20100000000000000653f93327a0200fd00000000",
      "sequence": 4294967295
    }
  ],
  "vout": [
    {
      "value": 12.50253935,
      "n": 0,
      "scriptPubKey": {
        "asm": "0 97cfc76442fe717f2a3f0cc9c175f7561b661997",
        "hex": "001497cfc76442fe717f2a3f0cc9c175f7561b661997",
        "reqSigs": 1,
        "type": "witness_v0_keyhash",
        "addresses": [
          "bc1qjl8uwezzlech723lpnyuza0h2cdkvxvh54v3dn"
        ]
      }
    },
    {
      "value": 0.00000000,
      "n": 1,
      "scriptPubKey": {
        "asm": "OP_RETURN aa21a9ed1892392fc479aa2479df651f83a83c625ae23d35876a9fac6d9c617c8d602d9f",
        "hex": "6a24aa21a9ed1892392fc479aa2479df651f83a83c625ae23d35876a9fac6d9c617c8d602d9f",
        "type": "nulldata"
      }
    },
    {
      "value": 0.00000000,
      "n": 2,
      "scriptPubKey": {
        "asm": "2 3 [error]",
        "hex": "52534b424c4f434b3ad1087f5ba5c0e6d2c0ebe90d2ef35033860dfa99aec1afe04dfd11fa70ebd1a2",
        "type": "nonstandard"
      }
    }
  ],
  "hex": "020000000001010000000000000000000000000000000000000000000000000000000000000000ffffffff4b039b4208045c2b9b5b642f4254432e434f4d2ffabe6d6d91102119a0522dda683a998f05620ba4beb1f5372a04689d07d47a291dbd25c20100000000000000653f93327a0200fd00000000ffffffff036f5c854a0000000016001497cfc76442fe717f2a3f0cc9c175f7561b6619970000000000000000266a24aa21a9ed1892392fc479aa2479df651f83a83c625ae23d35876a9fac6d9c617c8d602d9f00000000000000002952534b424c4f434b3ad1087f5ba5c0e6d2c0ebe90d2ef35033860dfa99aec1afe04dfd11fa70ebd1a20120000000000000000000000000000000000000000000000000000000000000000000000000",
  "blockhash": "0000000000000000000b616cd42f140420d47544464ea9e59f72ff4d124f903a",
  "confirmations": 48,
  "time": 1536895846,
  "blocktime": 1536895846
}

Note: the vout-part mentions a type of "witness_v0_keyhash".

I'm not sure if this should be counted as a "Segwit transaction" or not. I guess it all comes down to the question if a coinbase transaction always counts as a non-segwit input or not.

Any feedback is welcome!

Sooner or later you're going to realize, just as I did, that there's a difference between knowing the path and walking the path
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!