Bitcoin Forum
May 21, 2024, 04:22:09 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Transaction version 2  (Read 130 times)
Frodek (OP)
Member
**
Offline Offline

Activity: 138
Merit: 25


View Profile
March 30, 2024, 08:56:41 PM
 #1

What are difference between version 1 and version 2 of transaction?
Charles-Tim
Legendary
*
Offline Offline

Activity: 1554
Merit: 4907



View Profile
March 30, 2024, 09:06:13 PM
 #2

Try and explain yourself clearly.

Did you mean segwit version 0 and segwit version 1? That is what I think of that is very similar to what you might be referring to version 1 and 2.

Frodek (OP)
Member
**
Offline Offline

Activity: 138
Merit: 25


View Profile
March 30, 2024, 09:23:53 PM
 #3

Try and explain yourself clearly.

Did you mean segwit version 0 and segwit version 1? That is what I think of that is very similar to what you might be referring to version 1 and 2.
A years ago I have written blockchain analyzer for Bitcoin,Litecoin Dash and Bitcoin Cash. Now I download 150 GB Litecoin blocks (above 500 for Bitcoin is too much for me) and run analyzing. In block LTC 2398213 my program crash on last transaction. I don't know, transaction is bad, or I not handle this format. Transaction is version = 2, s segwit, Processing inputs and outputs but I get huge sizes of witness blocks.
Transaction 9e919a5cc9a38f79d687cb84f0005a452589adbb33a5c092837137df19549dcb
This is Litecoin topic, but I think, the same transaction extension have Bitcoin (?)
pooya87
Legendary
*
Offline Offline

Activity: 3458
Merit: 10572



View Profile
March 31, 2024, 04:51:55 AM
 #4

Transaction 9e919a5cc9a38f79d687cb84f0005a452589adbb33a5c092837137df19549dcb
It's the weird MWEB protocol they introduced into Litecoin.
It sets the SegWit flag to 8 (0x0008 instead of 0x0001 we have in Bitcoin and by extension in Litecoin) and apparently it also lets you break a bunch of consensus rules such as spending coins without providing any witness (signature or anything like that) such as the transaction you posted here.
https://github.com/litecoin-project/litecoin/blob/cd1660afaf5b31a80e797668b12b5b3933844842/src/primitives/transaction.h#L310

Your code could be breaking in at least 3 different places: (1) the flag being undefined (2) lack of witness while it is expected (3) while trying to verify the tx

It has nothing to do with the transaction version being 2 by the way.

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
seoincorporation
Legendary
*
Online Online

Activity: 3164
Merit: 2947


Top Crypto Casino


View Profile
March 31, 2024, 06:19:26 PM
 #5

I think the problem here is with the kind of address... As you can see some block explorers have problems with that transaction too, let me show you:

Explorers with errors:
https://www.oklink.com/ltc/tx/9e919a5cc9a38f79d687cb84f0005a452589adbb33a5c092837137df19549dcb
https://blockexplorer.one/litecoin/mainnet/tx/9e919a5cc9a38f79d687cb84f0005a452589adbb33a5c092837137df19549dcb
https://live.blockcypher.com/ltc/tx/9e919a5cc9a38f79d687cb84f0005a452589adbb33a5c092837137df19549dcb/

Explorers without errors:
https://chainz.cryptoid.info/ltc/tx.dws?9e919a5cc9a38f79d687cb84f0005a452589adbb33a5c092837137df19549dcb.htm
https://blockchair.com/litecoin/transaction/9e919a5cc9a38f79d687cb84f0005a452589adbb33a5c092837137df19549dcb

Since your code is old, maybe you should update it to allow SegWit addresses (the ones that start with ltc1). That should do the magic and let your code work fine.

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


▄▄████▄▄
▄███▀▀███▄
██████████
▀███▄░▄██▀
▄▄████▄▄░▀█▀▄██▀▄▄████▄▄
▄███▀▀▀████▄▄██▀▄███▀▀███▄
███████▄▄▀▀████▄▄▀▀███████
▀███▄▄███▀░░░▀▀████▄▄▄███▀
▀▀████▀▀████████▀▀████▀▀
NotATether
Legendary
*
Offline Offline

Activity: 1610
Merit: 6752


bitcoincleanup.com / bitmixlist.org


View Profile WWW
April 01, 2024, 02:15:24 AM
Merited by ABCbits (3), iceland2k14 (1)
 #6

Transactions with a version number of 2 support locktime. There is technically already a field for locktime (then called nsequence) for the version 1 transactions but its functionality was disabled (by Satoshi?) a few years before locktime was introduced.

Basically it works like this:

How does locktime work?

The locktime field is 4 bytes in size and can hold values between 0 (0x00000000) and 4294967295 (0xffffffff).

You can set a specific block height or time by using different ranges of value:

Locktime   Description
<=499999999   Transaction cannot be mined until after a specific height.
>=500000000   Transaction cannot be mined until after a specific time.
This is also known as "absolute locktime", as you're setting a specific height or time in the future. It's also possible to set a relative locktime on a transaction if you prefer.

For the locktime field to be enabled, at least one of the sequence values on the inputs must be set to 0xfffffffe or below. If all of the inputs' sequence values are set to the maximum value of 0xffffffff, the transaction is considered "final" and the locktime feature is disabled.

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
pooya87
Legendary
*
Offline Offline

Activity: 3458
Merit: 10572



View Profile
April 01, 2024, 02:16:44 PM
 #7

Transactions with a version number of 2 support locktime. There is technically already a field for locktime (then called nsequence) for the version 1 transactions but its functionality was disabled (by Satoshi?) a few years before locktime was introduced.
Do you have a reference for this? Because I think you are confusing locktime (the last 4 bytes of each tx) with OP_CHECKSEQUENCEVERIFY.
As far as I know locktime is enforced for all transactions regardless of their version and the only case where tx version is checked is for OP_CHECKSEQUENCEVERIFY and if it is less than 2 the interpreter returns false. Tx version is not used anywhere else I know of.

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
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!