Before we get started, open up Kali Linux. Follow the directions here and download Mr. Beck’s Bitcoin wallet generator.

Any time a user wants to ‘create’ a public Bitcoin wallet address that others can send Bitcoin to, they first pick a random series of 256 zeros and ones.

Open up gen.py In its current state, the program generates a random wallet address each time it runs.

image.png

You don’t need to understand everything this program does, but we'll take a high-level overview. First, let’s consider the line below:

private_key = os.urandom(32).hex()

Let’s just run this by itself by creating a new program.

Create a new Python program called test.py and copy/paste the following.

test.py

import os

private_key = os.urandom(32).hex()
print(private_key)

Then run it like this:

python3 test.py

image.png

This part of the program generates a random string of 256 bits of 0s and 1s each time it is run. We display the random string generated using Hexadecimal.

Let’s count the number of characters in the string test.py produces.

Untitled

Each Hexadecimal character is 4 bits. (64 X 4) = 256 zeros and ones generated randomly. This program generates random 256-bit values.