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

1

3 Answers 3

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.

1
  • 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 Feb 14, 2017 at 18:25
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.

2
  • 3
    That's outdated. Since BIP68, v2 transactions exist. See the answer below. Apr 19, 2017 at 8:04
  • There is actually a lot of v2 transactions now; shapeshift, for example, creates only v2 transactions (when exchanging into bitcoin). Apr 19, 2017 at 9:19
0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.