0

I'm query the BTC blockchain using blockchain.com to understand my own transactions a bit better.

One thing that confuses me in the inclusion of the Pkscript (scriptPubKey) under "Inputs" in the transaction manifest. My understanding is that this script is part of the Output of a transaction.

I presume that its inclusion here is a reference to the Output of the originating transaction i.e. the Input of the current transaction includes a part of the Output of the previous transaction to provide extra information to the user.

ie it is not suggesting that the scriptPubKey is actually part of the Input of the current transaction.

e.g https://www.blockchain.com/btc/tx/7da0823ebf7a002a15b6bd11c676c6c213c349c982a9c454539e3ad63e9d57ee

1

A transaction (that is not a coinbase transaction) will have specified inputs and outputs. The inputs must be comprised of valid, existing UTXOs (referenced by transaction ID and output index number, called the 'outpoint'), which will be 'consumed' to create the outputs (newly created UTXOs).

To spend any UTXO, you need to satisfy the conditions of the locking script placed on it.

I presume that its inclusion here is a reference to the Output of the originating transaction i.e. the Input of the current transaction includes a part of the Output of the previous transaction to provide extra information to the user.

If we look under the hood at how transactions work:

The transaction input will include an outpoint, as well as an unlocking script that will satisfy the scriptPubKey, and a sequence number (which is not relevant to the question at hand). The scriptPubKey for an input isn't explicitly included in the transaction data, as that would be redundant. Instead, the scriptPubKey can be looked up via the outpoint.

The outputs created by a transaction will each include a value (amount of BTC), and a scriptPubKey.

A block explorer will likely just display all of this info together for ease of use though. So if you look up a transaction ID, the scriptPubKey of the inputs may be listed, despite the fact that the actual serialized transaction data doesn't explicitly include this data (it just includes the outpoint, which is used as reference to look up the relevant data).


You can think of the outpoint as the information about which UTXO is to be spent, the scriptPubKey as the 'lock' which must be opened in order to spend it, and the scriptsig as the 'key' which will open the lock.

| improve this answer | |
  • Thanks. I understand how Txs work. I just wanted to confirm that this is a quirk of blockchain.com, and not some sort of special Tx type that replicates scriptPubKey in the input. – Garreth McDaid Jun 22 at 22:08
  • @GarrethMcDaid right, blockchain explorers will show a lot of info that is an abstraction of the actual serialized transactions/blocks transmitted across the network. Many of the human-friendly interfaces we are used to are as such. – chytrik Jun 23 at 0:01
0

I'm pretty sure this is just a quirk of Blochchain.com.

For comparison, here is the same transaction in Sochain.com

https://sochain.com/tx/BTC/7da0823ebf7a002a15b6bd11c676c6c213c349c982a9c454539e3ad63e9d57ee

This show the standard Public Key + Signature scriptSig in the Input and the 2 x P2PKH scriptPubKey locks for the 2 Outputs.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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