Frequently Asked Questions
In Bitcoin, a private key is just a 256-bit prime number between 1
and
115792089237316195423570985008687907852837564279074904382605163141518161494336
or in
hexadecimal from 0000000000000000000000000000000000000000000000000000000000000001
to
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364140
.
The range of valid private keys is governed by the secp256k1 ECDSA standard used by Bitcoin.
A public key is a number that corresponds to a private key, but does not need to be kept secret. A public key can be calculated from a private key, but not vice versa. A public key can be used to determine if a signature is genuine (in other words, produced with the proper key) without requiring the private key to be divulged. In Bitcoin, public keys are either compressed or uncompressed.
- Compressed public keys are 33 bytes, consisting of a prefix either
0x02
or0x03
, and a 256-bit integer called x.
The prefix of a compressed key allows for the y value to be derived from the x value.
Example:0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798
- The older uncompressed public keys are 65 bytes, consisting of constant prefix
0x04
, followed by two 256-bit integers called x and y (2 * 32 bytes).
Example:0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8
A Bitcoin address is a unique identifier used to receive and send Bitcoin. It is a string of alphanumeric characters that typically begins with a "1" or "3" and is generated using cryptographic techniques. Bitcoin addresses are generated from the corresponding private keys, which are used to sign transactions and prove ownership of the associated Bitcoin. When someone wants to send Bitcoin to another person or entity, they need to know the recipient's Bitcoin address to specify where the funds should be sent. Similarly, when someone wants to receive Bitcoin, they provide their Bitcoin address to the sender, who can then initiate the transaction to that address.
Technically Bitcoin address is a BASE-58 encoding of RIPEMD-160 hash derived from a public key. There are 2160 (nearly 1048) Bitcoin addresses.
Bitcoin addresses come in various formats, each tailored for different transaction methods, features, and optimizations. Here are the key address types:
Legacy Address C U
- They follow the Pay-to-Public-Key-Hash (P2PKH) format
- These are the original Bitcoin addresses, starting with a "1" prefix and using Base58 encoding
-
Legacy addresses can use two types of public keys:
- Uncompressed: Longer public keys (65 bytes), which result in slightly larger transaction sizes and higher fees
- Compressed: Shorter public keys (33 bytes), offering reduced transaction size and lower fees compared to uncompressed
- While still widely supported by wallets and exchanges, legacy addresses are less efficient than newer formats
- Example:
1BgGZ9tcN4rm9KBzDn7KprQz87SZ26SAMH
Script Address S
- They use the Pay-to-Script-Hash (P2SH) format, enabling more complex scripts like multi-signature wallets, time-locked payments, and other advanced transactions
- These addresses start with a "3" prefix and using Base58 encoding
- P2SH addresses are more efficient than legacy addresses and are highly compatible with most Bitcoin wallets
- Example:
3JvL6Ymt8MVWiCNHC7oWU6nLeHNJKLZGLN
SegWit Address W WS
- These are native Segregated Witness (SegWit) addresses
- SegWit addresses are more efficient because they reduce transaction size, lower fees, and resolve some transaction malleability issues
- These addresses start with a "bc1" prefix and use Bech32m encoding
-
They come in two variations:
- Pay-to-Witness-Public-Key-Hash (P2WPKH) – For simple transactions
- Pay-to-Witness-Script-Hash (P2WSH) – For more complex transactions, like multi-sig
- Example:
bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4
Taproot Address T
- Taproot was introduced in November 2021, building on SegWit
- Taproot addresses start with a "bc1p" prefix and use the Bech32m encoding
- It optimizes complex transactions, improving both scalability and privacy.
- Example:
bc1pmfr3p9j00pfxjh0zmgp99y8zftmd3s5pmedqhyptwy6lm87hf5sspknck9
WIF is an abbreviation of Wallet Import Format (also known as Wallet Export Format) and is a way of encoding a private key to make it shorter and easier to copy.
Every single private key can be represented as two different WIF private keys: compressed and uncompressed.
- A compressed WIF private key starts with "K" or "L" and
corresponds to a compressed public key/address.
Example:KwDiBf89QgGbjEhKnhXJuH7LrciVrZi3qYjgd9M7rFU73sVHnoWn
- An uncompressed WIF private key starts with "5" and corresponds to an
uncompressed public key/address.
Example:5HpHagT65TZzG1PH3CSu63k8DbpvD8s5ip4nEB3kEsreAnchuDf
The mini private key format is a method of encoding a Bitcoin private key in as few as 30 characters for the purpose of being embedded in a small space. A private key encoded in this format is called a minikey. This private key format was designed for and first used in Casascius physical bitcoins, and is also favorable for use in QR codes. The mini private key format offers its own built-in check code as a small margin of protection against typos.
Example: S6c56bnXQiBjk9mqSYE7ykVQ7NzrRy
.
A brainwallet is the concept of storing Bitcoins in one's own mind by memorizing a recovery passphrase. An early old-style brainwallet was created by memorization of a passphrase and converting it to a private key with a hashing or key derivation algorithm (example: SHA-256). This method was found to be very insecure and should not be used because humans are not a good source of entropy (randomness).
Examples of famous brainwallets:
- bitcoin is awesome (501 BTC)
- how much wood could a woodchuck chuck if a woodchuck could chuck wood (500 BTC)
- correct horse battery staple (37 BTC)
The original Bitcoin client stores private key information in a file named wallet.dat following the so called "bitkeys" format. The wallet.dat file contains your private keys, public keys, scripts (which correspond to addresses), key metadata (e.g. labels), and the transactions related to your wallet. If you have an HD wallet, it also includes the HD seed and the derivation paths for each private key.
The wallet.dat file is located in the Bitcoin data directory and may be encrypted with a password. The format of this file is Berkeley DB. Tools that can manipulate wallet files include pywallet.
The wallet.dat file is located in the Bitcoin Core data directory, the location of which varies depending on your operating system:
-
Windows:
C:\Users\YourUserName\Appdata\Roaming\Bitcoin
-
Mac:
~/Library/Application Support/Bitcoin
-
Linux:
~/.bitcoin
There are multiple vectors to find a private key with associated balance:
- Solving crypto puzzles
- Brute-forcing brainwallets
- Searching for leaked paper wallets, QR codes or private keys (in the form of images or plain text)
- Searching for leaked Bitcoin wallet.dat files or backup passphrases (mnemonics)
- Brute-forcing private keys generated with poor entropy (randomness): Milk Sad, Trust Wallet, Cake Wallet, brainwallet.org
- Browsing through our directory or random private keys (although this method is not effective)
The following tools can be used to find or recover private keys:
See also: Overview of key cracking tools