<p>They are bech32 addresses that encode a P2WSH scriptPubKey. The script that maps to those addresses contain the SHA256 of a script that will be revealed when the output is spent.</p>
<blockquote>
<p>They all encode the public key using Ripe160 (RIPEMD160?)</p>
</blockquote>
<p>No. Addresses do not just encode public keys, nor do they necessarily encode a particular hash. It depends on the address type as it is dependent on the script that will be created.</p>
<p>Addresses beginning with a 1 encode the RIPEMD160 of the SHA256 of a public key and create P2PKH output scripts.</p>
<p>Addresses beginning with a 3 encode the RIPEMD160 of the SHA256 of a script and create P2SH output scripts.</p>
<p>bc1q addresses that are 42 characters long encode the RIPEMD160 of the SHA256 of a public key and create P2WPKH output scripts.</p>
<p>bc1q addresses that are 62 characters long encode the SHA256 of a script and create P2WSH output scripts.</p>
<p>bc1p addresses that are 62 characters long encode an X-only public key and create P2TR (Taproot) output scripts.</p>

CC BY-SA 4.0
2021-11-15T17:49:12.637Z
2021-11-15T17:49:12.637Z
Ava Chow
<p>I'm trying to understand Bitcoin address encodings. I understand there's three (four?) different address encodings P2PKH, P2SH, Bech32, and Bech32m (Bech32m just uses a different constant when XORing). They all encode the public key using Ripe160 (RIPEMD160?). I was able to use some libraries to extract the ripe160 encoded address, which should be 20 bytes, but there are some longer strings in this list of addresses with currency:</p>
<p>Bitcoin addresses with currency from <a href="http://addresses.loyce.club/blockchair_bitcoin_addresses_and_balance_LATEST.tsv.gz" rel="nofollow noreferrer">loyce.com</a></p>
<pre><code>34xp4vRoCGJym3xR7yCVPFHoCNxv4Twseo
**bc1qgdjqv0av3q56jvd82tkdjpy7gdp9ut8tlqmgrpmv24sq90ecnvqqjwvw97**
1P5ZEDWTKTFGxQjZphgWPQUpe554WKDfHQ
37XuVSEpWW4trkfmvWzegTHQt7BdktSKUs
38UmuUqPCrFmQo4khkomQwZ4VbY2nZMJ67
3Kzh9qAqVWQhEsfQz7zEQL1EuSx5tyNLNS
1FeexV6bAHb8ybZjqQMjJrcCrHGW9sb6uF
3LYJfcfHPXYJreMsASk2jkn69LWEYKzexb
bc1qa5wkgaew2dkv56kfvj49j0av5nml45x9ek9hz6
1LdRcdxfbSnmCYYNdeYpUnztiYzVfBEQeC
1AC4fMwgY8j9onSbXEWeH6Zan8QGMSdmtA
1LruNZjwamWJXThX2Y8C2d47QqhAkkc5os
1NDyJtNTjmwk5xPNhjgAMu4HDHigtobu1s
3Gpex6g5FPmYWm26myFq7dW12ntd8zMcCY
bc1q5shngj24323nsrmxv99st02na6srekfctt30ch
385cR5DM96n1HvBDMzLHPYcw89fZAXULJP
3LQUu4v9z6KNch71j7kbj8GPeAGUo1FW6a
**bc1q5pucatprjrqltdp58f92mhqkfuvwpa43vhsjwpxlryude0plzyhqjkqazp**
...
</code></pre>
<p>They start with <code>bc1</code> so that indicates Bech32, correct? When decoding using something like <a href="https://slowli.github.io/bech32-buffer/" rel="nofollow noreferrer">bech32-buffer</a> I get 32 bytes.</p>
<p>In doing some more digging, there's also this <a href="https://programmingblockchain.gitbook.io/programmingblockchain/bitcoin_transfer/payment_script" rel="nofollow noreferrer">scriptPubKey</a> encoding. Is that what these long encodings are? How do you differentiate them? I assume since the site is listing address with currency, I should be able to pull the ripe160 address from the script, are there any recommended parsers?</p>
<p>I found another <a href="https://bitcoin.stackexchange.com/a/89010/128353">post</a> which suggests doing pattern matching, and pulling the parsing code from Bitcoin Core. Am I heading down the correct path here?</p>

CC BY-SA 4.0
2021-11-15T15:33:15.637Z
What are you trying to do with these addresses? The answer very much depends on that.
Pieter Wuille
CC BY-SA 4.0
2021-11-18T18:18:20.487Z
@PieterWuille Learning, just want to understand all the different forms.
Jerinaw
<address>
What are These Long Addresses in the Loyce.com Address List?
Jerinaw
# What are These Long Addresses in the Loyce.com Address List?

(Asked by: username_0 on 2021-11-15)

I'm trying to understand Bitcoin address encodings. I understand there's three (four?) different address encodings P2PKH, P2SH, Bech32, and Bech32m (Bech32m just uses a different constant when XORing). They all encode the public key using Ripe160 (RIPEMD160?). I was able to use some libraries to extract the ripe160 encoded address, which should be 20 bytes, but there are some longer strings in this list of addresses with currency:
Bitcoin addresses with currency from loyce.com
34xp4vRoCGJym3xR7yCVPFHoCNxv4Twseo
**bc1qgdjqv0av3q56jvd82tkdjpy7gdp9ut8tlqmgrpmv24sq90ecnvqqjwvw97**
1P5ZEDWTKTFGxQjZphgWPQUpe554WKDfHQ
37XuVSEpWW4trkfmvWzegTHQt7BdktSKUs
38UmuUqPCrFmQo4khkomQwZ4VbY2nZMJ67
3Kzh9qAqVWQhEsfQz7zEQL1EuSx5tyNLNS
1FeexV6bAHb8ybZjqQMjJrcCrHGW9sb6uF
3LYJfcfHPXYJreMsASk2jkn69LWEYKzexb
bc1qa5wkgaew2dkv56kfvj49j0av5nml45x9ek9hz6
1LdRcdxfbSnmCYYNdeYpUnztiYzVfBEQeC
1AC4fMwgY8j9onSbXEWeH6Zan8QGMSdmtA
1LruNZjwamWJXThX2Y8C2d47QqhAkkc5os
1NDyJtNTjmwk5xPNhjgAMu4HDHigtobu1s
3Gpex6g5FPmYWm26myFq7dW12ntd8zMcCY
bc1q5shngj24323nsrmxv99st02na6srekfctt30ch
385cR5DM96n1HvBDMzLHPYcw89fZAXULJP
3LQUu4v9z6KNch71j7kbj8GPeAGUo1FW6a
**bc1q5pucatprjrqltdp58f92mhqkfuvwpa43vhsjwpxlryude0plzyhqjkqazp**
...

They start with bc1 so that indicates Bech32, correct? When decoding using something like bech32-buffer I get 32 bytes.
In doing some more digging, there's also this scriptPubKey encoding. Is that what these long encodings are? How do you differentiate them? I assume since the site is listing address with currency, I should be able to pull the ripe160 address from the script, are there any recommended parsers?
I found another post which suggests doing pattern matching, and pulling the parsing code from Bitcoin Core. Am I heading down the correct path here?

**Tags:** address

> **Comments:**
> **username_1**: What are you trying to do with these addresses? The answer very much depends on that.  
> **username_0**: @PieterWuille Learning, just want to understand all the different forms.  

---

## 1 answers

### Answer by username_2 on 2021-11-15. Score: 4 | Accepted answer

They are bech32 addresses that encode a P2WSH scriptPubKey. The script that maps to those addresses contain the SHA256 of a script that will be revealed when the output is spent.

> They all encode the public key using Ripe160 (RIPEMD160?)

No. Addresses do not just encode public keys, nor do they necessarily encode a particular hash. It depends on the address type as it is dependent on the script that will be created.

Addresses beginning with a 1 encode the RIPEMD160 of the SHA256 of a public key and create P2PKH output scripts.

Addresses beginning with a 3 encode the RIPEMD160 of the SHA256 of a script and create P2SH output scripts.

bc1q addresses that are 42 characters long encode the RIPEMD160 of the SHA256 of a public key and create P2WPKH output scripts.

bc1q addresses that are 62 characters long encode the SHA256 of a script and create P2WSH output scripts.

bc1p addresses that are 62 characters long encode an X-only public key and create P2TR (Taproot) output scripts.


---

