8

What does the v in vin and vout stand for? And is it an instance of a more general naming scheme?

Murch
  • 71,155
  • 33
  • 180
  • 600
Casey Rodarmor
  • 524
  • 2
  • 9

1 Answers1

11

The original Satoshi codebase used a programming style called "Hungarian notation", where variable names are prefixed with letters that indicate the data type they contain.

v in particular stands for "vector". So vin and vout just mean "in vector" and "out vector", and were (and are) the variable names for the inputs and outputs of a transaction.

In UTXOs, that name sort of got inherited, and "vout index" got abbreviated to vout in certain context.

Pieter Wuille
  • 98,249
  • 9
  • 183
  • 287
  • 1
    Satoshi confirmed Hungarian. – Casey Rodarmor Jan 06 '23 at 04:43
  • 6
    Obligatory rant about the fact that Hungarian notation was meant to be used on semantic types, not actual data types, but it was massively misunderstood by large swaths of managers. You don't need the variable name to tell you that you have a string, but it is nice to have the variable name tell you whether your string has, say, gone through input validation and sanitation and is therefore safe to send into backend machinery. – Arthur Jan 06 '23 at 10:18
  • 2
    @Arthur Unless you hope that Satoshi reads your rant here, I don't think you need to convince anyone here. Bitcoin Core no longer uses Hungarian notation as a style. – Pieter Wuille Jan 06 '23 at 14:17