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

CC BY-SA 3.0
2017-08-26T16:56:03.007Z
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
CC BY-SA 3.0
2017-08-26T17:08:39.337Z
No. You have to look at the output it spends from. You should be doing the same for all transactions anyways.
Ava Chow
CC BY-SA 3.0
2017-08-27T14:05:32.990Z
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
CC BY-SA 3.0
2017-08-27T15:07:03.157Z
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.
Ava Chow
CC BY-SA 3.0
2017-08-26T16:41:52.343Z
2017-08-26T16:41:52.343Z
Ava Chow
<p>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.</p>

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

<pre><code>ScriptSig: PUSHDATA(71)[3044022017e2af6e1308d431365deeb5739d41a909cf0d61a9c0e48f3ae5b0bd6544bfc5022066e73dd26d71d824552b034b322603cce8b936912b99f4f3df512e502bd7c11e01] 
PUSHDATA(33)[03d7b3bc2d0b4b72a845c469c9fee3c8cf475a2f237e379d7f75a4f463f7bd6ebd]
</code></pre>

<p><a href="https://blockchain.info/tx/10857ad56f1695559562af8076aea4ccba625ba79a82f75e5658c0c2fa4336c0" rel="nofollow noreferrer">https://blockchain.info/tx/10857ad56f1695559562af8076aea4ccba625ba79a82f75e5658c0c2fa4336c0</a></p>

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

<pre><code>ScriptSig: PUSHDATA(71)[304402204e45e16932b8af514961a1d3a1a25fdf3f4f7732e9d624c6c61548ab5fb8cd410220181522ec8eca07de4860a4acdd12909d831cc56cbbac4622082221a8768d1d0901]
</code></pre>

<p><a href="https://blockchain.info/tx/f4184fc596403b9d638783cf57adfe4c75c605f6356fbc91338530e9831e9e16" rel="nofollow noreferrer">https://blockchain.info/tx/f4184fc596403b9d638783cf57adfe4c75c605f6356fbc91338530e9831e9e16</a></p>

<transactions><script><input-script>
Missing public key in transaction input
Roper
# Missing public key in transaction input

(Asked by: username_0 on 2017-08-26)

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

**Tags:** transactions, script, input-script


---

## 1 answers

### Answer by username_1 on 2017-08-26. Score: 1 | Accepted answer

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

> **Comments:**
> **username_0**: 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.  
> **username_1**: No. You have to look at the output it spends from. You should be doing the same for all transactions anyways.  
> **username_0**: 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.  
> **username_1**: 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.  

---

