Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [p2pkh]

Pay-to-PubKey-Hash is the standard format for making payments on the Bitcoin network.

3
votes
1answer
160 views

How is Public Key extracted from (message, digital signature, address)

I'm under the impression that a public key is revealed when you sign a message. Given these 3 inputs. P2PKH Address, Digital Signature, Message. Is the public key exposed? If so, how do you extract ...
0
votes
1answer
34 views

Struggling to successfully broadcast a p2pkh transaction

I've been experimenting with sending bitcoin transactions with python for the past week. I successfully was able to send p2wpkh->ALL address types, p2sh-p2wpkh->ALL address types. What I am ...
0
votes
1answer
28 views

scriptcode, scriptsig, pubkeyscript confusion

I've been banging my head on a desk for a few days trying to understand the segwit protocol properly. Another roadblock has thrown me off-guard and I am struggling to grasp the concept of "scriptCode:...
0
votes
2answers
54 views

Checking signature only vs. P2PKH

It is clear to me why it's potentially unsafe to only use a check on == in scriptPubKey. For one, not verifying a signature in the redeem script means that someone could impersonate the redeemer. From ...
0
votes
1answer
32 views

P2PKH - Sharing a wallet address does not reveal my pub key?

Is it technically correct to say that if I share my address with the network, nobody has access to my pubkey still? But if I share a valid signature to a P2PKH UTXO, someone can derive my pubkey and ...
0
votes
1answer
54 views

Access funds on legacy address related to segwit address from which I have private key

The situation Hello. Our company running BTC pool. We've been mining BTC for a while and used segwit address 32Z3eXSPgxcHj2fnQy8d6dg66eVtZfxrBM as pool adress. But when we finally found a first ...
1
vote
1answer
119 views

Can I prove a double spend attempt with a signed tx with same input?

I am designing an cross-chain atomic swap in a custom blockchain - Protoblock. I think it can be done as long as Protoblock knows how to parse p2pkh bitcoin transactions. The critical part is being ...
0
votes
1answer
117 views

bitcoin public key vs public key hash vs. pub key [duplicate]

I am not talking about the privacy related concerns just the security aspect and the ability for someone to 'break my private key'. The addresses that my wallet generates are p2pkh addresses. If i ...
2
votes
2answers
340 views

Bitcoin - Technical difference between P2PKH and P2SH address generation?

I was convinced that the only difference between the generation of addresses starting with '1' and '3' was simply changing the prefix added to the digest from 0x00 to 0x05 after the ripemd160 part. ...
4
votes
2answers
340 views

How did pay-to-pubkey hash come about? What is its history?

We know that early blocks all used pay-to-pubkey (p2pk) and at some point, we mostly switched to pay-to-pubkey-hash (p2pkh). What is the history behind this? Who made the changes and when did p2pkh ...
1
vote
2answers
696 views

Is it possible to convert an address from p2pkh to p2sh?

Is it possible to convert a p2pkh address to a p2sh address? Also, will the balance of the p2pkh address carry over to the p2sh address?
4
votes
4answers
214 views

Why bother checking both public key and signature in P2PKH transactions?

In a P2PKH pubkey script, first, the public key provided by the intended spender is verified to be correct and then this key is used to verify the spender's signature. I wonder why just verifying the ...
7
votes
3answers
1k views

Why is P2PKH used instead of the simpler P2PK?

If elliptic curve cryptography is secure enough to be able to give away a public key without fear of anyone being able to calculate our private key from it, what's the reason for hashing our public ...
0
votes
2answers
77 views

Why is this script invalid, and how can I generate valid public key/digital signature pairs?

Why does the default P2PKH transaction at http://bitcoin-script-debugger.visvirial.com/ return NULL rather than true? I haven't tried to swallow the gory details of OP_CHECKSIG yet, but everything ...
0
votes
1answer
54 views

P2SH in Hardware wallet?

I am designing a hardware wallet and the software that will work with it. I plan to provide P2PKH transactions support in the software for hardware wallet to sign. Is it mandatory to support P2SH ...
1
vote
1answer
380 views

Convert P2SH to P2PKH

I'm using btcrecover to recover a Ledger BIP39 backup seed that I wrote down but seems to be wrong. The tool only accepts P2PKH addresses and my account was created very recently in this kind of ...
3
votes
4answers
213 views

Why doesn't address contain a full scriptPubKey?

This is a general question, but let's suppose a P2PKH transaction. P2PKH address starts with "1" and the sender incorporates it into the scriptPubKey as: OP_DUP OP_HASH160 <PublicKeyHash> ...
6
votes
2answers
2k views

Bech32 conversion to legacy P2PKH?

Electrum now generates Bech32 addresses for SegWit wallets. Example: bc1qnntcclssmtuvfw2te7q49lzvw67cfvpzxger4j Pubkey: 023f1b3421c6ae0c1758834d40806c2418194b507be261fa343a0636653f3ec75b If I ...
3
votes
3answers
499 views

How it is possible to validate existing Pay to Public Key Hash transaction without public key?

These are my understanding or assumptions. Sign a document requires secret key and message only as below SignDocument(secret key, message) => signature And verification of signature requires ...
2
votes
1answer
118 views

How can blockchain.info show the output address of a transaction when the output address has never been used in any other transaction?

I've stumbled across a transition on blockchain.info where the output address was displayed even though the output address had never been used in any other transaction. How can blockchain.info know ...
0
votes
1answer
323 views

Bitcoin P2PKH transaction - two questions

Trying to learn the basics of the bitcoin's standard transaction script here. For a transaction where Alice has sent coins to Bob, who is now trying to redeem them, we have the concatenated scriptSig ...
0
votes
3answers
45 views

OP_HASH160 pops the public key from stack after hashing it?

This guide https://bitcoin.org/en/developer-guide#p2pkh-script-validation mentions "The operation executed next, OP_HASH160, pushes onto the stack a hash of the data currently on top of it—in this ...
2
votes
1answer
205 views

How does Bitcoin prevent replay-attacks? [duplicate]

How does Bitcoin prevent replay-attacks for P2PKH transactions? As far as I understand, when a transaction is made to pay bitcoins to another account, the P2PKH script is used. scriptPubKey: OP_DUP ...
1
vote
1answer
51 views

Inconsistency in pubkey hashes usage explanation

I am learning about blockchain and reading a lot of stuff, but one question bothers me for last few days. So in docs they say that P2PKH transactions use hash of the public key instead of a public key ...
5
votes
1answer
612 views

Trying to understand Pay-to-Public-Key-Hash

I am new to bitcoin and I am trying to understand Pay-to-Public-Key-Hash (P2PKH) from the book: Mastering Bitcoin: Unlocking Digital Cryptocurrencies (p. 127). I understand that digital keys (which ...
14
votes
2answers
4k views

Why do you use Bitcoin addresses instead of public keys?

Why do you hash the public key twice? Are there security benefits to abstracting away from the public key? Is it because the address can represent multiple things? I'm missing something. Could you ...
5
votes
1answer
601 views

How big is the input of a P2PKH transaction?

How many bytes does a P2PKH input have? I'm finding a few different numbers: Why does the default miner implementation use pay-to-pubkey? states: push + sig + push + key = 1 + 72 + 1 + 61 = 139 ...
5
votes
1answer
457 views

What is the composition of transaction types in current blocks?

What types of transactions do we see in blocks today and how much of the blockspace do they occupy? I.e. does someone have data how much of the blocks are Pay to PubKey Hash, Pay to PubKey, Pay to ...
53
votes
3answers
62k views

How to calculate transaction size before sending (Legacy Non-Segwit - P2PKH/P2SH)

I know that I pay the transaction fee per kB, so how can I calculate how large the transaction will be before I send it via the RPC api. I run a site using bitcoins, and I cannot let the user's ...