Skip to main content
Share Your Experience: Take the 2024 Developer Survey
38 votes
Accepted

Why is it not possible to get the private key out of the public key?

How I understood it, the equation for the public key is defined as so K = k * G With K being the public key, k the private key and G the generator point. That's correct. Now my first question, is G ...
Pieter Wuille's user avatar
36 votes

Key derivation in HD wallets using the extended private key vs hardened derivation

There's a lot of confusion here, mostly bits and pieces of the whole scheme that is Hierarchical Deterministic derivation, and finally two questions that seem to indicate missing some point about it. ...
arubi's user avatar
  • 1,864
36 votes
Accepted

Why does hashing public keys not actually provide any quantum resistance?

Although hashing a public key by itself does provide quantum resistance, this is really only when it is considered by itself in a vacuum. Unfortunately, public key hashes do not exist in a vacuum and ...
Ava Chow's user avatar
  • 70.8k
33 votes
Accepted

What are the potential attacks against ECDSA that would be possible if we used raw public keys as addresses?

The theory It is assumed that in order to forge an ECDSA signature you need to compute the private key for a given public key first (this operation is known as the "discrete logarithm" (DL), ...
Pieter Wuille's user avatar
22 votes
Accepted

How would one "Encrypt" a message using a Bitcoin *public key* and use its private key to decrypt it?

Yes, this is possible. However, I want to upfront state that this is not advisable for multiple reasons: Bitcoin keys are intended to be single use for privacy reasons, and leveraging them for ...
Pieter Wuille's user avatar
22 votes
Accepted

What are the DER signature and SEC format

DER The Distinguished Encoding Rules (DER) format is used to encode ECDSA signatures in Bitcoin. An ECDSA signature is generated using a private key and a hash of the signed message. It consists of ...
Murch's user avatar
  • 75.7k
20 votes

Why do you use Bitcoin addresses instead of public keys?

Yes, you could send bitcoins directly to the public key: in fact, both Pay-to-PubKey (P2PK) and Pay-to-PubKey-Hash (P2PKH) were introduced in the first Bitcoin release. IIRC, P2PK is still used for ...
Murch's user avatar
  • 75.7k
15 votes

Why do you use Bitcoin addresses instead of public keys?

As @Murch correctly pointed out it is indeed possible to send bitcoin to either a public key or to the hash of a public key. The original motivation for using hashes of public keys was to shorten the ...
Benedikt Bünz's user avatar
14 votes

Is it possible to get the public key of a bitcoin address I do not have the private keys for with the standard client?

To be honest, it IS possible, but you need a signature made by that address. From that point, you can get the public key. See this piece of code: https://github.com/bitcoinjs/bitcoinjs-message/blob/...
Peter Willemsen's user avatar
13 votes
Accepted

What makes an extended public or private key?

The extended public key contains just a bit more information than the public key and chaincode, but the public key and chaincode are all that matter for key derivation. The rest is just metadata about ...
Ava Chow's user avatar
  • 70.8k
12 votes

Is it possible to get the public key of a bitcoin address I do not have the private keys for with the standard client?

It is impossible. Given an ECDSA (compressed 65Bytes or not 33Bytes) public-key K, a Bitcoin address is generated using the cryptographic hash functions SHA-256 and RIPEMD-160. The public-key is ...
Badr Bellaj's user avatar
  • 1,151
12 votes

What is relation between scriptSig and scriptPubKey?

I had the same question as well and spent forever trying to understand it and finally cracked it. "The sender (A) only has the Bitcoin Address of the recipient (B), so how does he get the pubKeyHash ...
cloudnthings's user avatar
11 votes
Accepted

difference between Master Public/private Key and Public/private Key?

With "Master public key" you probably refer to deterministic key derivation after bip32. The correct term is "Master extended private key" (acronym xpriv) and "Master extended public key" (acronym ...
Jonas Schnelli's user avatar
11 votes
Accepted

What are the chances of getting duplicate wallet using bitcoinlib in python3?

When you create a private key, this process is (or at least should be) completely random - meaning that in theory, the probability of creating some specific private key is 1/N where N is the number of ...
mxbi's user avatar
  • 336
11 votes
Accepted

How can a deterministic wallet have one private key but multiple public keys

No, there is not one private key. There is one Master private key. The master private key is then used to generate more private keys in a deterministic fashion, i.e. using the same master private key, ...
Ava Chow's user avatar
  • 70.8k
10 votes
Accepted

How to uncompress a public key?

Points are decompressed by solving for y in the equation used for secp256k1's elliptic curve where x is the last 32 bytes of your public key. The equation is y^2 = x^3 + 7. You will get 2 possible y ...
Ava Chow's user avatar
  • 70.8k
10 votes

How does a wallet get the public key from an address?

Perhaps you're confused by the phrasing "the wallet", as it's only the receiver's wallet who needs to know the public key, and he has it, because he created the address in the first place. ...
Pieter Wuille's user avatar
10 votes
Accepted

Why do compressed and uncompressed public keys have to produce different addresses?

My question is: Why cant you just uncompress the compressed public key (effectively making it an uncompressed public key) and then derive the address. That way even if you use the compressed key, ...
Pieter Wuille's user avatar
9 votes

Does the private key of Bitcoin change everytime the address changes?

You have many private keys Quintessentially, a wallet is a key chain for your private keys plus optional convenience and usability functions. When you create a wallet, at least one but usually lots ...
Murch's user avatar
  • 75.7k
9 votes

How to get the Public Keys of a bitcoin User

You cannot compute the public key of an address (that is not yours), because the address is computed from the hash of the public key. You can find the public key of your own address with the Bitcoin-...
Susan's user avatar
  • 245
8 votes

Does the private key of Bitcoin change everytime the address changes?

If you are posting different questions I suggest, posting them up in different threads. But I'll try to answer all of them. 1) It doesn't work like that. Every address is a pair (private key, public ...
galileopy's user avatar
  • 344
8 votes

How do I convert Public Key x value to y in Python and verify?

First, you need to understand what the two formats actually are. The first is the compressed SEC format and the second is the uncompressed SEC format. The difference between the two is that the ...
Jimmy Song's user avatar
  • 7,759
8 votes

What is the difference between your address and your public keys

cited: A Bitcoin address is a 160-bit hash of the public portion of a public/private ECDSA keypair. a picture may make it easier to understand how an address is generated from a public key; Image ...
Cyker's user avatar
  • 257
8 votes

Is a P2TR address a compressed public key?

SEC encoded public keys are either: Uncompressed 65-byte encoding: 0x04 + [32-byte X coordinate] + [32-byte Y coordinate] Compressed 33-byte encoding: 0x02 + [32-byte X coordinate] (if Y coordinate ...
Pieter Wuille's user avatar
7 votes

Why is it not possible to get the private key out of the public key?

Mathematicians like their analogies, sometimes those analogies can be helpful, but they can equally be confusing, particularly to those new to a field. In mathematics a "group" consists of a ...
Peter Green's user avatar
7 votes
Accepted

Is a P2TR address a compressed public key?

Pay to Taproot uses x-only pubkeys. In Bitcoin, a private key d is a scalar, and its corresponding public key Q is the elliptic curve point found by multiplying d with the generator G of secp256k1: Q =...
Murch's user avatar
  • 75.7k
6 votes

Can rainbow tables be used to find private keys from public keys?

No. A rainbow table is simply a memory-cpu tradeoff that allows you to find preimages of a function faster by having a precomputed table with some of the entries. In order to construct a rainbow ...
Pieter Wuille's user avatar
6 votes

Recovering ECDSA public key from the signature

when looking at a signed (P2PKH) tx, the signature looks like this: ...
pebwindkraft's user avatar
  • 5,096
6 votes
Accepted

SECP256K1 Minimum Value for Private Key

If people in general would more often pick lower integers as private keys than larger integers, then it would be a good strategy for an attacker to start with lower integers. However, the opposite ...
Pieter Wuille's user avatar
6 votes
Accepted

python-bitcoinlib | Create Private Keys, Public Keys and Addresses - How to Do It?

Sorry I am not familiar with python-bitcoinlib but if your goal is to just create keys/addresses you can use this library (disclosure: I wrote it) the following way: Generating a private key ...
Mike D's user avatar
  • 3,569

Only top scored, non community-wiki answers of a minimum length are eligible