Web3 Beginner Series: Want to Get Rich by Luck? Let's Talk About the "Database Breach" in Blockchain.

CN
2 hours ago

Assume there is a big brother who has 100 bitcoins (worth about ten million dollars) in his wallet, but he has lost the private key. Theoretically, these bitcoins are still on the chain, and as long as someone "happens" to generate the same private key or address, they can take the money.

So the question arises: Can I write a program to randomly generate addresses and try my luck? Maybe I'll hit a wealthy address?

What is "address collision"?

Simple Explanation

Imagine this:

  • There are 10^48 lockers in the world (that's 1 followed by 48 zeros)
  • Among them, about 100 million lockers contain money
  • You now need to randomly guess a locker number to see if you can win

This is the "address collision" in blockchain—randomly generating addresses in the hope of colliding with an address that has a balance.

How are blockchain addresses generated?

Simplified process:

  1. Generate a random number (private key)
  2. Use a mathematical formula to calculate the public key
  3. Hash the public key to get the address

It's that simple! An address is generated.

Try it out: 10 lines of code to generate a wallet address

Step 1: Install the tools

Step 2: Write the code

Create a new file called "create-wallet.js":

Step 3: Run it

The output will be similar to:

That's it! You have generated a wallet address. 🎊

Can I randomly generate addresses and try my luck?

Example of an "address collision" program

Of course, you can give it a try! Write a loop:

First, we need to register for a ZAN account, activate node services, and obtain rpcUrl (https://docs.zan.top/docs/quick-start-guide).

Running Results

How difficult is it? Let's do the math

Basic Data

What does 10^-40 mean?

Let's understand it in a more relatable way:

1. Buying a lottery ticket 🎫

In other words: If the difficulty of winning the lottery is "randomly finding one person in all of China, and it happens to be you," then the difficulty of an address collision is "randomly selecting one atom in the entire universe, and getting it right 40 times in a row."

2. Card drawing game 🎴

Assume you are playing a game:

  • SSR drop rate is 0.6% (six in a thousand)
  • Feels very hard to draw, right?

Now let's calculate the address collision:

  • Equivalent to having to draw 18 SSRs in a row (assuming a 0.6% probability)
  • Or in other words, getting 18 consecutive gold lights

Do you think it's possible? 😂

3. Real-life scenario 🌍

Why is it so difficult? The mathematical principle

The vastness of address space

An Ethereum address looks like this:

Removing "0x," there are 40 hexadecimal characters, which is 160 bits.

Possible combinations:

It can be roughly pronounced as: "One thousand four hundred sixty-one unbelievable five thousand…" (already beyond the naming range of Chinese numbers)

Real-world cases

Has anyone succeeded? 🤔

From the birth of Bitcoin in 2009 to now (16 years):

  • Zero successful collisions: No one has ever randomly generated an address that collided with someone else's wallet
  • Zero private key breaches: No one has ever cracked a private key through brute force calculation

What about those stolen wallets?

All the "wallet theft" incidents you've heard about are due to:

Key point: All thefts are due to human error, not because the math was cracked.

Should I still worry about security?

Mathematically: Absolutely secure ✅

As long as:

  • Your private key is truly randomly generated (not something like "1234567890")
  • You haven't leaked your private key to anyone

Then mathematically, no one can crack your wallet.

In practice: Be aware of these ⚠️

Although database collisions are unlikely to succeed, you still need to be careful:

❌ Things you should never do

✅ Correct practices

Quick Summary

Core Points

  1. Generating addresses is super easy: 10 lines of code can generate countless addresses
  2. Address collisions are extremely difficult: 10^32 times harder than winning the lottery
  3. Mathematically secure: From 2009 to now, no one has successfully collided
  4. Humans are the biggest vulnerability: All thefts are due to private key leaks, not because the math was cracked

One-sentence summary

Instead of spending time on address collisions, you might as well buy a lottery ticket; instead of buying a lottery ticket, you might as well work hard. 😄

For friends who want to try address collisions

If you really want to try:

Appendix: Complete Address Collision Simulator

Want to experience the feeling of "never getting a result"? Here’s a complete version:

In conclusion

Remember these three sentences:

  1. Generating addresses is easy, just a few lines of code
  2. Address collisions are impossible to succeed, countless times harder than winning the lottery
  3. Protect your private key, it is the only security risk

⚠️ Important Reminder ⚠️

Never use mnemonic phrases and private keys from example code online!

Never tell anyone your private key!

Never tell anyone your private key!

Never tell anyone your private key!

(Important things are said three times)

This article was written by Ken Lee from the ZANTeam (X account @zan_team).

免责声明:本文章仅代表作者个人观点,不代表本平台的立场和观点。本文章仅供信息分享,不构成对任何人的任何投资建议。用户与作者之间的任何争议,与本平台无关。如网页中刊载的文章或图片涉及侵权,请提供相关的权利证明和身份证明发送邮件到support@aicoin.com,本平台相关工作人员将会进行核查。

Share To
APP

X

Telegram

Facebook

Reddit

CopyLink