<p>It's in the witness right after the signature.</p>

<pre><code>ScriptSig: PUSHDATA(22)[00144b9d2d3dd1174ad656754a0c664e7a129b131f3b]
Witness:     0247304402201cf8db0c4afc164970ec4397327fe9b1dd9b7ff4a9093f94e554d624b5ffdcb702202848072c17f2bcce16b8d3d7cb2efdad87bc6c942b79f44b79f1c52f817d81ea012102384052a5ecde83bf8ee7ed77f378edb58aa65de22c4e91af87eee68015b9d509
</code></pre>

<p>0247304402201cf8db0c4afc164970ec4397327fe9b1dd9b7ff4a9093f94e554d624b5ffdcb702202848072c17f2bcce16b8d3d7cb2efdad87bc6c942b79f44b79f1c52f817d81ea0121<strong>02384052a5ecde83bf8ee7ed77f378edb58aa65de22c4e91af87eee68015b9d509</strong></p>

<p>EDIT: </p>

<blockquote>
  <p>Is there a way to reliably retrieve the pubkey and it's position in the raw transaction? </p>
</blockquote>

<p>You have to parse the witness.</p>

<p>02 : 2 items to follow</p>

<p>47 : 0x47 = 71 bytes (signature)</p>

<p>304402201cf8db0c4afc164970ec4397327fe9b1dd9b7ff4a9093f94e554d624b5ffdcb702202848072c17f2bcce16b8d3d7cb2efdad87bc6c942b79f44b79f1c52f817d81ea01 : the actual signature (last byte is the sighash code)</p>

<p>21 : 0x21 = 33 bytes (the pubkey)</p>

<p>02384052a5ecde83bf8ee7ed77f378edb58aa65de22c4e91af87eee68015b9d509 : the actual pubkey</p>

CC BY-SA 4.0
2018-10-01T14:47:17.413Z
2018-10-01T14:59:09.497Z
2018-10-01T14:59:09.497Z
Mike D
<p>Normally when you spend an input, you reveal your public key and signature so that ECVERIFY can be done.</p>

<p>I look at segwit raw transactions and cannot find the public key inside them, where do they go? </p>

<p>Example: <a href="https://www.blockchain.com/btc/tx/3179d18d6f36fa77b88909496535485d8188d96b79d295843789a9e0ff6c3e6a" rel="nofollow noreferrer">https://www.blockchain.com/btc/tx/3179d18d6f36fa77b88909496535485d8188d96b79d295843789a9e0ff6c3e6a</a></p>

<p>Is there a way to reliably retrieve the pubkey and it's position in the raw transaction? </p>

<transactions><segregated-witness>
Where is the pubkey for segwit inputs?
Jim
# Where is the pubkey for segwit inputs?

(Asked by: username_0 on 2018-10-01)

Normally when you spend an input, you reveal your public key and signature so that ECVERIFY can be done.

I look at segwit raw transactions and cannot find the public key inside them, where do they go?

Example: <https://www.blockchain.com/btc/tx/3179d18d6f36fa77b88909496535485d8188d96b79d295843789a9e0ff6c3e6a>

Is there a way to reliably retrieve the pubkey and it's position in the raw transaction?

**Tags:** transactions, segregated-witness


---

## 1 answers

### Answer by username_1 on 2018-10-01. Score: 5 | Accepted answer

It's in the witness right after the signature.

```
ScriptSig: PUSHDATA(22)[00144b9d2d3dd1174ad656754a0c664e7a129b131f3b]
Witness:     0247304402201cf8db0c4afc164970ec4397327fe9b1dd9b7ff4a9093f94e554d624b5ffdcb702202848072c17f2bcce16b8d3d7cb2efdad87bc6c942b79f44b79f1c52f817d81ea012102384052a5ecde83bf8ee7ed77f378edb58aa65de22c4e91af87eee68015b9d509

```

0247304402201cf8db0c4afc164970ec4397327fe9b1dd9b7ff4a9093f94e554d624b5ffdcb702202848072c17f2bcce16b8d3d7cb2efdad87bc6c942b79f44b79f1c52f817d81ea0121**02384052a5ecde83bf8ee7ed77f378edb58aa65de22c4e91af87eee68015b9d509**

EDIT:

> Is there a way to reliably retrieve the pubkey and it's position in the raw transaction?

You have to parse the witness.

02 : 2 items to follow

47 : 0x47 = 71 bytes (signature)

304402201cf8db0c4afc164970ec4397327fe9b1dd9b7ff4a9093f94e554d624b5ffdcb702202848072c17f2bcce16b8d3d7cb2efdad87bc6c942b79f44b79f1c52f817d81ea01 : the actual signature (last byte is the sighash code)

21 : 0x21 = 33 bytes (the pubkey)

02384052a5ecde83bf8ee7ed77f378edb58aa65de22c4e91af87eee68015b9d509 : the actual pubkey


---

