Glossary | Input
$4,134.30/BTCBuy

Input

An input is what you call an output when you're spending it in a transaction (to create new outputs).

Inputs are still outputs from old transactions. But when we decide to use outputs in new transactions, we refer to them an "inputs".

Refering to an output.

When you want to use an output as an input for a transaction, you just need to specify the one you want to use.

To refer to an existing output, you use the txid it was created in, along with the vout number for that transaction.

To refer to an existing output, you use the txid it was created in, along with the vout number for that transaction.

Byte Order: When you refer to a txid within transaction data, you have to reverse the byte order to get it in its original format. The byte-order used when searching for a txid is in reverse (due to a historical mistake in the way the original bitcoin client works).

Every transaction has a unique txid, so by using that with a specific output number (vout), you can refer to any output in the blockchain.

Unlocking

You can use any existing output as an input for a new transaction, but you need to be able to unlock them.

Each output is set with a locking script. So when you choose to use an existing output as an input for your trasaction, you also need to supply an unlocking script to go along with it.

Each output is set with a locking script. So when you choose to use an existing output as an input for your trasaction, you also need to supply an unlocking script to go along with it.

Nodes validate every transaction they receive. So if you do not provide an unlocking script that satisfies the locking script, your transaction will get rejected.

Example

Here's what an input looks like (as found in raw transaction data) [source].

|--------------------------txid--------------------------------||-vout-|  |----unlocking script----|
eb93218b707dc0d01f624098ce25a9581a123274259d847b44b4158ccb358d51000000008a473304402200...aab9c937c33ffffffff

So basically, an input is a reference to an output, plus an unlocking script that unlocks it for spending.

Even though the txid above refers to a transaction, if you want to search for it in the blockchain you need to reverse the byte order first.