43
votes
What is P2PK, P2PKH, P2SH, P2WPKH - ELI5
P2PKH: "Pay To Public Key Hash"
This is how transactions are made. You are requiring the sender to supply a valid signature (from the private key) and public key. The transaction output script will ...
26
votes
How to calculate transaction size before sending (Legacy Non-Segwit - P2PKH/P2SH)
Here are some calculations based on the Protocol Documentation.
A Bitcoin Transaction is composed of the following:
Version (4 Bytes)
TxIn Count (1 ~ 9B)
For each TxIn:
Outpoint (36B)
Script Length ...
22
votes
Accepted
Why is P2PKH used instead of the simpler P2PK?
The original reason why addresses were a public key hashes is something you'll need to ask Satoshi. My guess however is that it was just shorter and more convenient (note that compressed public keys ...
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 ...
16
votes
Accepted
Is it possible to convert an address from p2pkh to p2sh?
Is it possible to covert a p2pkh adrress to a p2sh adress?
Don't.
Addresses are determined by the wallet. It's the receiver's wallet saying "I will accept payment when it arrives at address X". ...
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 ...
13
votes
Accepted
Bech32 conversion to legacy P2PKH?
Is it safe to receive funds at this 1FJJd... address?
Kind of. Your wallet knows the private key that corresponds to that address as it is the same private key for the bech32 address. However it does ...
11
votes
Accepted
How big is the input of a P2PKH transaction?
The first number does not include the prevout, sequence number, or the length byte for the scriptSig. It also uses 65 bytes for the public key (which is correct if it is uncompressed, but compressed ...
10
votes
Accepted
How did pay-to-pubkey hash come about? What is its history?
Pay to Public Key Hash has existed for the entirety of Bitcoin's life. P2PKH addresses have existed since the earliest release of Bitcoin. Creating P2PKH addresses and sending to P2PKH addresses was ...
10
votes
Accepted
How is Public Key extracted from (message, digital signature, address)
An algorithm called Public Key Recovery exists for ECDSA, which lets you construct the public keys for which a given pair of message and signature would be valid.
To explain the algorithm, remember ...
10
votes
What is the largest multisig quorum currently possible?
The rules governing this depend on the type of script used and whether that script is in the output script, in a P2SH, in a P2WSH, or in P2TR. Additionally, the rules are more restrictive for ...
9
votes
Accepted
How can I cheaply consolidate P2PKH outputs?
There really is no better answer than "wait for fees to come down". That might not be the most satisfying answer, but fees were below 2 sat/vB only a month ago, and the vast majority of ...
8
votes
Accepted
How to generate legacy receiving address in Bitcoin core 0.19.x.x
From within the GUI, no, and this is intentional. There is no reason to use P2PKH addresses anymore. If you need backwards compatibility, then that's what the P2SH checkbox is for.
But if you really ...
7
votes
Accepted
Is - a valid bitcoin address character
No, "-" is neither part of the base58 character set 123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz used to encode non-segwit addresses, nor the bech32 character set ...
7
votes
Accepted
Is there a way to convert a P2PKH address into P2TR?
Short answer: no, at least not via the key path (and using a script path would be less efficient than using P2WPKH instead)
Longer answer: no, and even if it were possible, this would be a terrible ...
6
votes
Why is P2PKH used instead of the simpler P2PK?
The public key is first SHA256 hashed and then RipeMD160 hashed. A Bitcoin address is actually an encoded hash of the public key.
A public key is 65 bytes long (0x04 + 64 bytes public key) or 33 ...
6
votes
Accepted
Certain spent P2PKH outputs give error: Non-canonical DER signature
The requirement for canonical DER signatures was only added in the BIP66 softfork in 2015.
Before that time, such non-canonical signatures were legal, and your transaction predates the BIP66 ...
6
votes
Accepted
Does a P2PKH transaction send to the hash of the uncompressed key or the compressed key?
As far as Bitcoin's consensus rules are concerned, compressed and uncompressed keys for the same private key, are distinct keys.
The answer to your question is: whatever the receiver's wallet uses. As ...
5
votes
Accepted
If I was developing a Bitcoin wallet, should I support both legacy and compatibility addresses?
Displaying two would be justified if you were asking about a BC1 p2wpkh vs a 3xxx p2sh(p2wpkh) because not everything supports BC1 but its pretty good to use when supported.
Displaying two isn't ...
5
votes
Accepted
How does this simple script use the OP_CHECKSIG opcode?
Let's run through the program.
The stack starts as <A sig> <A pubkey>.
You run OP_DUP. The stack is now <A sig> <A pubkey> <A pubkey>.
You run OP_HASH160. The stack is ...
5
votes
Accepted
Why P2SH seems to be never smaller than 34 characters, unlike P2PKH?
Because Base58 initial 1s carry 8 bits of data, but P2SH addresses cannot be represented with a string with initial 1s so it starts with 3 which, like all other cases & characters, encodes 5.86 ...
5
votes
Accepted
A question about the role of OP_DUP in the P2PK(H) transaction specification, and possibility of slightly smaller single address transactions
Re-reading your question, I realize my other answer may be besides the point.
It is certainly possible that the scripting language's semantics would recognize this scenario and cause failure if ...
4
votes
Bech32 conversion to legacy P2PKH?
You can’t assume that any given software will be know to go searching for arbitrary encodings of the public key you’re “converting” to. Depending on the wallet software on the other end, your payment ...
4
votes
Accepted
Why doesn't address contain a full scriptPubKey?
There are several reasons for this, some historical and some more recently:
At first, addresses were probably not intended to cover everything Bitcoin Script could do. They were a fallback for the ...
4
votes
How did pay-to-pubkey hash come about? What is its history?
The earliest client by satoshi had both.
P2PK was default for mining and payments received using the interactive IP-to-IP payment protocol; P2PKH was intended for use in non-interactive payments.
...
4
votes
Accepted
How is a locking script reliably detected as a P2PKH script?
The secret is that it is being interpreted as an opcode.
Opcodes 0x01 through 0x4b (decimal 1 to 75) are opcodes that specify the length of the data being pushed after them, as their own numerical ...
4
votes
Accepted
Why OP_DUP instead of providing the PubKey twice in P2PKH?
Unfortunately, that would not be secure. Imagine an output with scriptPubkey OP_HASH160 <hash(P1)> OP_EQUALVERIFY OP_CHECKSIG. Now anyone can spend such an output by generating their own key P2, ...
4
votes
tracking invoice address type migration
You can find the first on https://txstats.com/dashboard/db/utxo-set-repartition-by-output-type?orgId=1. For a version weighed by value you can look at the graphs of the individual output types on the ...
4
votes
Accepted
Is it possible to use a P2PKH output with a schnorr signature?
No, it is not possible to use Schnorr signatures with old output types.
Current node software evaluating transactions expects an ECDSA signature for an input spending a P2PKH output. Putting a Schnorr ...
4
votes
Why does SegWit implement new address formats?
There had to be a way to distinguish between segwit addresses and "legacy" addresses so that software could correctly identify the type of transaction it needed to create.
The obvious ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
p2pkh × 93p2sh × 22
transactions × 18
script × 14
address × 13
segregated-witness × 11
p2pk × 9
p2wpkh × 8
bitcoin-core × 7
signature × 7
wallet × 6
public-key × 6
raw-transaction × 6
bech32-address × 6
transaction-verification × 5
p2tr × 5
electrum × 4
address-generation × 4
utxo × 4
base58 × 4
input-script × 4
python × 3
ecdsa × 3
opcodes × 3
checksig × 3