<blockquote>
<p>How big is the computational effort for an attacker to create a valid address that has the same M characters at the beginning and the same N characters at the end?</p>
</blockquote>
<p>It depends on what your attack model is.</p>
<p>If you're worried about an attacker replacing your address with another valid address that matches in a number of places, but is <strong>not</strong> spendable by the attacker (so they'd just be burned funds), this is easy, regardless of how many characters you check. If this is your concern, you should check all of them, except possibly the last  6, as those are only checksum characters. If everything but the checksum matches, the checksum itself will also match.</p>
<p>If you're only concerned about attackers who replace addresses with others they themselves can spend, it is harder.</p>
<ul>
<li><strong>In base58 addresses</strong>: Every character except the first one makes it 58 times harder for the attacker. Checking any 11 characters would require a nontrivial amount of computation time (2<sup>64.4</sup> work). At 22 characters, it would be assumed computationally infeasible for anyone (2<sup>128.9</sup> work, similar to what cracking a public key itself would need).
<ul>
<li>If you ignore lower/uppercase, every characters only makes it up to 29 times harder for an attacker. Then 14 characters would require 2<sup>68.0</sup> work, and 27 characters needs 2<sup>131.2</sup>.</li>
</ul>
</li>
<li><strong>In bech32(m) addresses</strong>: every character except the first 4 requires 32 times more work from the attacker. Around 13 characters here means 2<sup>65</sup> work, and 26 for 2<sup>130</sup>. Bech32 addresses are case insensitive.</li>
</ul>
<p>Note that these computations assume the attacker knows <em>which</em> characters you'll be looking at, which is perhaps the case if you're always going to pick the N first and M last to compare. If you compare random ones, it is significantly harder for attackers, but the computation would depend on the exact strategy used.</p>
<p>For reference, base58 addresses for Bitcoin mainnet start with 1... (P2PKH) or 3... (P2SH). bech32 addresses start with bc1q... (P2WPKH or P2WSH) or bc1p... (P2TR).</p>

CC BY-SA 4.0
2021-10-24T03:34:15.827Z
2021-10-24T04:05:30.643Z
2021-10-24T04:05:30.643Z
Pieter Wuille
<blockquote>
<p>How big is the computational effort for an attacker to create a valid address that has the same M characters at the beginning and the same N characters at the end?</p>
</blockquote>
<p>It's pretty easy to make addresses with are visually similar to one another, here only targeting the start of the address but there's no particular reason why it couldn't target the end as well.</p>
<pre><code>18eXmgR5Svoqqa6PaYVrKvbH6hvrp5xe3A  
18eXmgR5Svoqqa6JXSMmbNaD4Cs5ThcV1P
</code></pre>
<p>These examples for P2PKH are both valid, and used bitcoin keys that share 20 characters. They would have taken a number of hours to produce on today's CPUs, which isn't particularly an issue in any attack scenario.</p>
<blockquote>
<p>Is it okay if the recipient doesn't mention if a character is upper or lower case?</p>
</blockquote>
<p>Lowercase and uppercase are different addresses in p2pkh addresses, so it weakens any partial cross validation. For newer bech32 addresses capitalization is irrelevant and simply doesn't matter.</p>

CC BY-SA 4.0
2021-10-24T02:25:15.823Z
2021-10-24T02:25:15.823Z
Claris
<p>Let's assume I want to verify the receive address on the phone. The recipient confirms the first M and last N characters of the address. How big is the computational effort for an attacker to create a valid address that has the same M characters at the beginning and the same N characters at the end?</p>
<p>What would be a safe M/N?</p>
<p>Is it okay if the recipient doesn't mention if a character is upper or lower case?</p>

<address><security>
How many characters of an address do I actually need to verify?
tschaboo
# How many characters of an address do I actually need to verify?

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

Let's assume I want to verify the receive address on the phone. The recipient confirms the first M and last N characters of the address. How big is the computational effort for an attacker to create a valid address that has the same M characters at the beginning and the same N characters at the end?

What would be a safe M/N?

Is it okay if the recipient doesn't mention if a character is upper or lower case?

**Tags:** address, security


---

## 2 answers

### Answer by username_1 on 2021-10-24. Score: 1 | Accepted answer

> How big is the computational effort for an attacker to create a valid address that has the same M characters at the beginning and the same N characters at the end?

It depends on what your attack model is.

If you're worried about an attacker replacing your address with another valid address that matches in a number of places, but is **not** spendable by the attacker (so they'd just be burned funds), this is easy, regardless of how many characters you check. If this is your concern, you should check all of them, except possibly the last 6, as those are only checksum characters. If everything but the checksum matches, the checksum itself will also match.

If you're only concerned about attackers who replace addresses with others they themselves can spend, it is harder.

* **In base58 addresses**: Every character except the first one makes it 58 times harder for the attacker. Checking any 11 characters would require a nontrivial amount of computation time (264.4 work). At 22 characters, it would be assumed computationally infeasible for anyone (2128.9 work, similar to what cracking a public key itself would need).
  + If you ignore lower/uppercase, every characters only makes it up to 29 times harder for an attacker. Then 14 characters would require 268.0 work, and 27 characters needs 2131.2.
* **In bech32(m) addresses**: every character except the first 4 requires 32 times more work from the attacker. Around 13 characters here means 265 work, and 26 for 2130. Bech32 addresses are case insensitive.

Note that these computations assume the attacker knows *which* characters you'll be looking at, which is perhaps the case if you're always going to pick the N first and M last to compare. If you compare random ones, it is significantly harder for attackers, but the computation would depend on the exact strategy used.

For reference, base58 addresses for Bitcoin mainnet start with 1... (P2PKH) or 3... (P2SH). bech32 addresses start with bc1q... (P2WPKH or P2WSH) or bc1p... (P2TR).


---

### Answer by username_2 on 2021-10-24. Score: 1

> How big is the computational effort for an attacker to create a valid address that has the same M characters at the beginning and the same N characters at the end?

It's pretty easy to make addresses with are visually similar to one another, here only targeting the start of the address but there's no particular reason why it couldn't target the end as well.

```
18eXmgR5Svoqqa6PaYVrKvbH6hvrp5xe3A  
18eXmgR5Svoqqa6JXSMmbNaD4Cs5ThcV1P

```

These examples for P2PKH are both valid, and used bitcoin keys that share 20 characters. They would have taken a number of hours to produce on today's CPUs, which isn't particularly an issue in any attack scenario.

> Is it okay if the recipient doesn't mention if a character is upper or lower case?

Lowercase and uppercase are different addresses in p2pkh addresses, so it weakens any partial cross validation. For newer bech32 addresses capitalization is irrelevant and simply doesn't matter.


---

