3

I'm in the process of understanding scriptSigs of transaction inputs and encountered some transactions with inputs that seem to be missing a public key.

This is what I expect to see as a scriptSig. A signature and a public key.

ScriptSig: PUSHDATA(71)[3044022017e2af6e1308d431365deeb5739d41a909cf0d61a9c0e48f3ae5b0bd6544bfc5022066e73dd26d71d824552b034b322603cce8b936912b99f4f3df512e502bd7c11e01] 
PUSHDATA(33)[03d7b3bc2d0b4b72a845c469c9fee3c8cf475a2f237e379d7f75a4f463f7bd6ebd]

https://blockchain.info/tx/10857ad56f1695559562af8076aea4ccba625ba79a82f75e5658c0c2fa4336c0

However, I've encountered these type of scriptSigs as well. There seems to be no public key. What exactly is happening here?

ScriptSig: PUSHDATA(71)[304402204e45e16932b8af514961a1d3a1a25fdf3f4f7732e9d624c6c61548ab5fb8cd410220181522ec8eca07de4860a4acdd12909d831cc56cbbac4622082221a8768d1d0901]

https://blockchain.info/tx/f4184fc596403b9d638783cf57adfe4c75c605f6356fbc91338530e9831e9e16

1

That input spends a pay-to-pubkey output. The output it spends from contains the public key, so it is not in the input.

  • Is there any way to get the public key or associated address solely from such an input without looking back at the matching output? I ask because that would greatly increase the performance of a blockchain-wide analysis I'm trying to do. – Roper Aug 26 '17 at 16:56
  • No. You have to look at the output it spends from. You should be doing the same for all transactions anyways. – Andrew Chow Aug 26 '17 at 17:08
  • Any suggestions on how I can quickly query the matching output of an input to get the address and value? When walking over the whole blockchain, it's certainly not feasible to maintain a list of all unspent outputs so far in memory. – Roper Aug 27 '17 at 14:05
  • Make a database which is periodically flushed to disk that stores all unspent outputs. This database would have the entire UTXO set; you just add and remove things as new outputs are made and spent. BItcoin Core does this, and in fact, it can actually store the whole thing in memory, it just requires 6-7 GB of memory to do so. Otherwise just make it a database which is flushed to disk periodically. – Andrew Chow Aug 27 '17 at 15:07

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.