<p>In the output there is a field "scriptPubKey" that for a standard transaction looks like this:</p>

<pre><code>OP_DUP OP_HASH160 62e907b15cbf27d5425399ebf6f0fb50ebb88f18 OP_EQUALVERIFY OP_CHECKSIG
</code></pre>

<p>The hex number is what you get the address from; this is the result of step #3 in <a href="https://en.bitcoin.it/wiki/Technical_background_of_Bitcoin_addresses" rel="noreferrer">https://en.bitcoin.it/wiki/Technical_background_of_Bitcoin_addresses</a>. To get the address continue the process in that example. (Though, arguably the hardest part is calculating <a href="https://en.bitcoin.it/wiki/Base58Check_encoding" rel="noreferrer">Base58Check</a>, for which an example is not given.)</p>

<p>Also relevant is <a href="https://en.bitcoin.it/wiki/Script#Standard_Transaction_to_Bitcoin_address" rel="noreferrer">https://en.bitcoin.it/wiki/Script#Standard_Transaction_to_Bitcoin_address</a>.</p>

CC BY-SA 3.0
2011-12-16T07:28:20.560Z
Hmm, nothing like using the wiki entry I wrote against me ;) (the first one). And the base 58 is not much of a problem, already programmed that awhile ago.
ThePiachu
CC BY-SA 3.0
2011-12-17T01:37:16.590Z
Has the Script been changed since the Genesis Block? I am having some problems figuring out how to process this scriptPubKey from that block: 4104678AFDB0FE5548271967F1A67130B7105CD6A828E03909A67962E0EA1F61DEB649F6BC3F4CEF38C4F35504E51EC112DE5C384DF7BA0B8D578A4C702B6BF11D5FAC
ThePiachu
CC BY-SA 3.0
2011-12-17T16:37:59.870Z
This transaction uses the https://en.bitcoin.it/wiki/Script#Standard_Generation_.2F_transaction_to_IP_address type. In it you have the public key itself before any hashing (step #1). The public key in the genesis block is 04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f, I'm not sure where you got this value from.
Meni Rosenfeld
CC BY-SA 3.0
2011-12-17T22:49:50.187Z
It's the same public key, but with opcodes added on both sides - push 0x41 bytes on the left and checksig on the right. So it is a raw scriptpubkey dump from https://en.bitcoin.it/wiki/Genesis_block
ThePiachu
CC BY-SA 3.0
2011-12-16T05:11:15.360Z
2011-12-16T12:58:10.227Z
2011-12-16T12:58:10.227Z
Meni Rosenfeld
<p>Is there some good example on how to process a basic tx's scriptsig and get the recipient's address from the raw transaction?</p>

<transactions><protocol><address><script>
Bitcoin script example
ThePiachu
# Bitcoin script example

(Asked by: username_0 on 2011-12-15)

Is there some good example on how to process a basic tx's scriptsig and get the recipient's address from the raw transaction?

**Tags:** transactions, protocol, address, script


---

## 1 answers

### Answer by username_1 on 2011-12-16. Score: 7 | Accepted answer

In the output there is a field "scriptPubKey" that for a standard transaction looks like this:

```
OP_DUP OP_HASH160 62e907b15cbf27d5425399ebf6f0fb50ebb88f18 OP_EQUALVERIFY OP_CHECKSIG

```

The hex number is what you get the address from; this is the result of step #3 in <https://en.bitcoin.it/wiki/Technical_background_of_Bitcoin_addresses>. To get the address continue the process in that example. (Though, arguably the hardest part is calculating [Base58Check](https://en.bitcoin.it/wiki/Base58Check_encoding), for which an example is not given.)

Also relevant is <https://en.bitcoin.it/wiki/Script#Standard_Transaction_to_Bitcoin_address>.

> **Comments:**
> **username_0**: Hmm, nothing like using the wiki entry I wrote against me ;) (the first one). And the base 58 is not much of a problem, already programmed that awhile ago.  
> **username_0**: Has the Script been changed since the Genesis Block? I am having some problems figuring out how to process this scriptPubKey from that block: 4104678AFDB0FE5548271967F1A67130B7105CD6A828E03909A67962E0EA1F61DEB649F6BC3F4CEF38C4F35504E51EC112DE5C384DF7BA0B8D578A4C702B6BF11D5FAC  
> **username_1**: This transaction uses the https://en.bitcoin.it/wiki/Script#Standard_Generation_.2F_transaction_to_IP_address type. In it you have the public key itself before any hashing (step #1). The public key in the genesis block is 04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f, I'm not sure where you got this value from.  
> **username_0**: It's the same public key, but with opcodes added on both sides - push 0x41 bytes on the left and checksig on the right. So it is a raw scriptpubkey dump from https://en.bitcoin.it/wiki/Genesis_block  

---

