<p>One way to check is to use a tool like <a href="https://github.com/keis/base58" rel="nofollow noreferrer">https://github.com/keis/base58</a> that implements base58check (<code>-c</code>) encoding and decoding (<code>-d</code>) with checksum verification to try to decode the final address:</p>

<pre><code>$ printf "0050d512c984b1656ef47c145c8fd5d5262d3904b14550e204" | xxd -r -p | base58
18NQJwokxLGA7KsHJdQWh6ANB46K6nP7Hm
$ printf "18NQJwokxLGA7KsHJdQWh6ANB46K6nP7Hm" | base58 -c -d | xxd -p
0050d512c984b1656ef47c145c8fd5d5262d3904b1
</code></pre>

<p>Now, change the checksum and see if it is able to decode:</p>

<pre><code>$ printf "0050d512c984b1656ef47c145c8fd5d5262d3904b14550e203" | xxd -r -p | base58
18NQJwokxLGA7KsHJdQWh6ANB46K6nP7Hk
Jordans-MacBook-Pro:~ Jbaczuk$ printf "18NQJwokxLGA7KsHJdQWh6ANB46K6nP7Hk" | base58 -c -d | xxd -p
Invalid checksum
</code></pre>

CC BY-SA 4.0
2019-01-22T15:46:56.320Z
thanks, for do checksum the operation is  decode base58 -and reply  `printf 0050d512c984b1656ef47c145c8fd5d5262d3904b1 |xxd -r -p | sha256sum -b | xxd -r -p | sha256sum -b | head -c 8`and Check the output with last 4 bytes ?
monkeyUser
CC BY-SA 4.0
2019-01-22T15:50:55.093Z
Yes, the first four bytes of the HASH256 is the checksum, which is appended to the end of the value to encode.
JBaczuk
CC BY-SA 4.0
2019-01-22T14:27:05.267Z
2019-01-22T14:27:05.267Z
JBaczuk
<p>I want to create a address bitcoin.</p>

<p>I have a payload with version like this:</p>

<pre><code>0050d512c984b1656ef47c145c8fd5d5262d3904b1
</code></pre>

<p>where <code>00</code> in my version prefix, and <code>50d512c984b1656ef47c145c8fd5d5262d3904b1</code> is my payload.</p>

<p>Now I Want to add checksum, with sha256 twice, the result is</p>

<pre><code>4550e2041dd936f17fd8a0d60f17c69faea8ef0e7d3ee82383153d93c2e837a8
</code></pre>

<p>where the first 4 bytes is checksum <strong>4550e204</strong></p>

<p>Now I can convert to base58 </p>

<pre><code>0050d512c984b1656ef47c145c8fd5d5262d3904b1**4550e204**
</code></pre>

<p>And I Get the right address.</p>

<p>I can read that </p>

<blockquote>
  <p>These four bytes serve as the error-checking code, or checksum. The
  checksum is concatenated (appended) to the end.</p>
</blockquote>

<p>How Can I check if my checksum (<strong>4550e204</strong>) is correct before base58 ?</p>

CC BY-SA 4.0
2019-01-22T12:33:25.467Z
Sorry I don't understand your question. You have described the derivation for the checksum given version&payload. Given a base58 address, you decode the address for the version+payload+checksum. From that you can verify the version+payload. What other scenario do you mean?
James C.
<address><private-key><public-key>
checksum in address
monkeyUser
# checksum in address

(Asked by: username_0 on 2019-01-22)

I want to create a address bitcoin.
I have a payload with version like this:
0050d512c984b1656ef47c145c8fd5d5262d3904b1

where 00 in my version prefix, and 50d512c984b1656ef47c145c8fd5d5262d3904b1 is my payload.
Now I Want to add checksum, with sha256 twice, the result is
4550e2041dd936f17fd8a0d60f17c69faea8ef0e7d3ee82383153d93c2e837a8

where the first 4 bytes is checksum 4550e204
Now I can convert to base58 
0050d512c984b1656ef47c145c8fd5d5262d3904b1**4550e204**

And I Get the right address.
I can read that 

These four bytes serve as the error-checking code, or checksum. The
  checksum is concatenated (appended) to the end.

How Can I check if my checksum (4550e204) is correct before base58 ?

**Tags:** address, private-key, public-key

> **Comments:**
> **username_1**: Sorry I don't understand your question. You have described the derivation for the checksum given version&payload. Given a base58 address, you decode the address for the version+payload+checksum. From that you can verify the version+payload. What other scenario do you mean?  

---

## 1 answers

### Answer by username_2 on 2019-01-22. Score: 0 | Accepted answer

One way to check is to use a tool like https://github.com/keis/base58 that implements base58check (-c) encoding and decoding (-d) with checksum verification to try to decode the final address:
$ printf "0050d512c984b1656ef47c145c8fd5d5262d3904b14550e204" | xxd -r -p | base58
18NQJwokxLGA7KsHJdQWh6ANB46K6nP7Hm
$ printf "18NQJwokxLGA7KsHJdQWh6ANB46K6nP7Hm" | base58 -c -d | xxd -p
0050d512c984b1656ef47c145c8fd5d5262d3904b1

Now, change the checksum and see if it is able to decode:
$ printf "0050d512c984b1656ef47c145c8fd5d5262d3904b14550e203" | xxd -r -p | base58
18NQJwokxLGA7KsHJdQWh6ANB46K6nP7Hk
Jordans-MacBook-Pro:~ Jbaczuk$ printf "18NQJwokxLGA7KsHJdQWh6ANB46K6nP7Hk" | base58 -c -d | xxd -p
Invalid checksum

> **Comments:**
> **username_0**: thanks, for do checksum the operation is  decode base58 -and reply  `printf 0050d512c984b1656ef47c145c8fd5d5262d3904b1 |xxd -r -p | sha256sum -b | xxd -r -p | sha256sum -b | head -c 8`and Check the output with last 4 bytes ?  
> **username_2**: Yes, the first four bytes of the HASH256 is the checksum, which is appended to the end of the value to encode.  

---

