4

Some bitcoin transaction have version 2. For example, this transaction

https://blockchain.info/tx/b7022124bc7f31af9342d2f7af98ad9f60f2fd4fa544bf1affca8a436aadda41

if you request a hex (by adding ?format=hex for example) and putting it into https://blockchain.info/decode-tx , you get "version":2.

What does this mean? There are more transactions with version 2 out in the wild, but not that many.

In zcash transactions, version 2 means that the transaction has joinsplits. But I cannot find what it means in bitcoin.

I have found examples of version 2 transactions here and here

Murch
  • 71,155
  • 33
  • 180
  • 600
Karel Bílek
  • 2,655
  • 3
  • 24
  • 45

3 Answers3

3

It seems to be related to BIP 0068.

https://github.com/bitcoin/bips/blob/master/bip-0068.mediawiki

BIP 68 deals with relative locktime and repurposes sequence number for a that purpose. Relative locktime allows the user to set locktime relative to a previous output.

As of April 2017, Shapeshift uses only v2 transactions, when exchanging from altcoins into bitcoin.

Just for interest, zcash says this about version 2 (zcash uses version 2 to mark transaction with "secret" inputs/outputs):

Note: A transaction version number of 2 does not have the same meaning as in Bitcoin, where it is associated with support for OP CHECKSEQUENCEVERIFY as specified in [BIP-68]. Zcash was forked from Bitcoin v0.11.2 and does not currently support BIP 68, or the related BIPs 9, 112 and 113.

Karel Bílek
  • 2,655
  • 3
  • 24
  • 45
  • 4
    BIP68 introduces relative locktime, and that feature is up to now the only one that actually uses the transaction version field. But tx versions have been in Bitcoin since day one, and may be used for more things in the future – Pieter Wuille Feb 14 '17 at 18:25
1

BIP68 redefined the meaning of the sequence field on transaction inputs of transactions with an version of 2 or greater. If you want to use OP_CHECKSEQUENCEVERIFY (or OP_CSV, see BIP112) to make outputs that cannot be spent for some time or number of blocks until after they were created, your transaction needs to use version 2.

Previously the sequence was intended as a transaction replacement mechanism. Transaction inputs with higher sequences were supposed to be preferred over transaction inputs with lower sequences. However, there was no mechanism to enforce such behavior, rather than just monetarily incentivizing miners to do so, which made the sequence field essentially unused.

Murch
  • 71,155
  • 33
  • 180
  • 600
0

https://bitcoin.org/en/developer-reference#raw-transaction-format:

Transaction version number; currently version 1. Programs creating transactions using newer consensus rules may use higher version numbers.

pebwindkraft
  • 5,086
  • 2
  • 13
  • 34