8

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

1 Answer 1

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.

3
  • 1
    Satoshi confirmed Hungarian. Jan 6, 2023 at 4: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 6, 2023 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. Jan 6, 2023 at 14:17

Your Answer

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

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