<p>You may want to look at the reference implementation section: <a href="https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki#reference-implementations" rel="nofollow noreferrer">https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki#reference-implementations</a></p>
<p>It lists implementations for various languages, including <a href="https://github.com/sipa/bech32/tree/master/ref/c" rel="nofollow noreferrer">C</a>, <a href="https://github.com/sipa/bech32/tree/master/ref/c++" rel="nofollow noreferrer">C++</a>, and <a href="https://github.com/sipa/bech32/tree/master/ref/javascript" rel="nofollow noreferrer">JavaScript</a></p>

CC BY-SA 4.0
2021-10-29T04:00:46.720Z
Just to add to this answer, [this pr](https://github.com/sipa/bech32/pull/40/commits) on the github page has the java example.
Nissim R
CC BY-SA 4.0
2021-10-25T12:55:24.560Z
2021-10-25T12:55:24.560Z
Pieter Wuille
<p>The <a href="https://en.bitcoin.it/wiki/Bech32" rel="nofollow noreferrer">Bitcoin Wiki page for Bech32 addresses</a> explains how one can create a bech32 address from a public key. In step 6 it says-</p>
<blockquote>
<p>Compute the checksum by using the data from step 5 and the H.R.P (bc for MainNet and tb for TestNet)</p>
</blockquote>
<p>I went through the <a href="https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki#Bech32" rel="nofollow noreferrer">bip 173 wiki page</a> which explains the checksum process. However I do not know python and cannot understand most of it.</p>
<p>How does one compute the checksum? Is there some library I can use? I mainly develop in Java/Kotlin/C++. Either an explanation of the python code on the bip173 page or libraries/code snippets in the languages I develop in will be greatly appreciated.</p>

<bech32-address><p2wpkh><checksum>
Compute checksum for Bech32 address
Nissim R
# Compute checksum for Bech32 address

(Asked by: username_0 on 2021-10-25)

The [Bitcoin Wiki page for Bech32 addresses](https://en.bitcoin.it/wiki/Bech32) explains how one can create a bech32 address from a public key. In step 6 it says-

> Compute the checksum by using the data from step 5 and the H.R.P (bc for MainNet and tb for TestNet)

I went through the [bip 173 wiki page](https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki#Bech32) which explains the checksum process. However I do not know python and cannot understand most of it.

How does one compute the checksum? Is there some library I can use? I mainly develop in Java/Kotlin/C++. Either an explanation of the python code on the bip173 page or libraries/code snippets in the languages I develop in will be greatly appreciated.

**Tags:** bech32-address, p2wpkh, checksum


---

## 1 answers

### Answer by username_1 on 2021-10-25. Score: 4 | Accepted answer

You may want to look at the reference implementation section: <https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki#reference-implementations>

It lists implementations for various languages, including [C](https://github.com/sipa/bech32/tree/master/ref/c), [C++](https://github.com/sipa/bech32/tree/master/ref/c++), and [JavaScript](https://github.com/sipa/bech32/tree/master/ref/javascript)

> **Comments:**
> **username_0**: Just to add to this answer, [this pr](https://github.com/sipa/bech32/pull/40/commits) on the github page has the java example.  

---

