Skip to main content

Questions tagged [p2wpkh]

Pay to Witness Public Key Hash is the native SegWit v0 single-sig output format. P2WPKH addresses are Bech32 encoded and start with the prefix `bc1q`.

Filter by
Sorted by
Tagged with
1 vote
1 answer
113 views

Is it possible to "label" Segwit spendable output ScriptPubKeys with arbitrary bytes?

If one created a Redeem Script for a transaction output following a P2SH-P2WPKH pattern but with bytes prepended, something like: OP_PUSHBYTES_8 41206c6162656c2e OP_DROP OP_0 OP_PUSHBYTES_20 <20 ...
Lee's user avatar
  • 958
3 votes
1 answer
63 views

What's the reason for the scriptCode format for a P2WPKH? (BIP 143)

When signing a P2WPKH input, the P2WPKH locking script is converted to the pattern of a legacy P2PKH when creating the scriptCode. From BIP 143: For P2WPKH witness program, the scriptCode is ...
inersha's user avatar
  • 3,185
2 votes
1 answer
124 views

Exact witness requirements for a segwit transaction with P2PKH and P2WPKH inputs

Segwit transactions can mix segwit and non-segwit inputs: Segwit transaction from mixed addresses (segwit and non-segwit) Can I build a raw segwit transaction with no segwit inputs? But how exactly ...
Lee's user avatar
  • 958
0 votes
1 answer
123 views

Why can I not find my transaction in the mempool?

I built a native segwit raw v2 transaction with the pwpkh addresses, and get the decoded transaction as the follows { "version": "02000000", "marker": "00", ...
Jack Tsia's user avatar
-1 votes
1 answer
85 views

How does one verify signature in a P2WPKH transaction?

(Assume there's no OP_CODESEPERATOR) For standard P2PKH, the signature digest is generated this way: NewTransaction settle the TxOuts well set all TxIn scripts to empty insert the Previous Locking ...
Archit Dabral's user avatar
0 votes
1 answer
49 views

Incorrect Transaction ID being calculated for a p2wpkh transaction

RAW Signed transaction (signet) ...
Prabhat Verma's user avatar
0 votes
0 answers
78 views

bad data structure cause "Signature must be zero for failed CHECK(MULTI)SIG operation"

i could not fix the problem using available answer for this error on BSE. this is my previous transaction. i test alot of different data structure which was said to be the correct one but i got ...
user avatar
0 votes
1 answer
115 views

I Get "Non-canonical DER signature" Error

it was asked few times in BSE and they were pointing the problem to the sighash which was not appended to the transaction but i did it and still have problem. i had a problem with amount of fee and ...
user avatar
2 votes
1 answer
120 views

the purpose of the field before signature in P2WPKH

what is the purpose of that 02 in this P2WPKH transaction : 01000000 0001 01 d6f3994ab779ac849996a6235699ced672fa4b8334f825a2f1fcb4081c5b0c62 00000000 00 ffffffff 02 1027000000000000 16 ...
user avatar
2 votes
1 answer
239 views

What is the content of ScriptPubKey for P2WPKH?

What is the content of ScriptPubKey for P2WPKH? Master bitcoin book 2end edition says the following (link): Example P2WPKH output script 0 ab68025513c3dbd2f7b92a94e0581f5d50f654e7 In programming ...
dassd's user avatar
  • 1,099
2 votes
1 answer
258 views

How can I spend a mix of UTXOs (p2sh, p2wpkh, p2wsh) along with a p2tr UTXO?

I'm constructing a script to spend multiple distinct UTXOs in a single transaction. I've successfully combined all UTXOs except for two. Succeeding in spending a P2TR with P2PKH UTXO. I encountered a ...
Mohsen Haydari's user avatar
9 votes
1 answer
1k views

Is there an economic incentive to switch from P2WPKH to P2TR?

I have multiple times seen people argue that there is “no economic incentive” to switch from P2WPKH to P2TR. I know that the sum of input and output weight on P2WPKH and P2TR are very similar, but how ...
Murch's user avatar
  • 77k
1 vote
3 answers
94 views

How can clients know the destination address for this P2WPKH transaction?

This is the raw hex of a random transaction I picked up on the blockchain: ...
Pedro D.'s user avatar
1 vote
2 answers
104 views

Is there authoritative documentation on how to generate a P2WPKH address?

I Googled and found some BIPs but looking through bitcoincore.org, I could not find documentation on the process to generate a P2WPKH address. Looking through other random articles, I see the process ...
Ash's user avatar
  • 111
0 votes
1 answer
74 views

How can I optimize my python script that creates a btc native segwit tx with an OP_RETURN message?

I have the following code that successfully created a bitcoin transaction with an OP_RETURN message: from bitcoinutils.utils import to_satoshis from bitcoinutils.setup import setup from bitcoinutils....
ChristianOConnor's user avatar
2 votes
1 answer
248 views

How do I use python-bitcoin-utils to add an OP_RETURN message into a bitcoin transaction?

I have the following code that successfully created a bitcoin transaction with python-bitcoin-utils: from bitcoinutils.utils import to_satoshis from bitcoinutils.setup import setup from bitcoinutils....
ChristianOConnor's user avatar
0 votes
1 answer
315 views

Generated new p2wpkh address from pubkey of existing address - but found it has old transactions!

this is certainly my lack of understanding, but it challenge what i know about blockchain. I created a new address p2wpkh from public key with bech32 (testnet) on ‎2022-11-10 : ...
Kimboo Rasta's user avatar
1 vote
1 answer
221 views

p2wpkh spending problem

I use unsynced bitcoin core wallet because data is too costly and I do not trust anything other than bitcoin core, people told me to do so. Playing around I originated this transaction id: ...
andre's user avatar
  • 21
0 votes
2 answers
843 views

Bech32 encoded address to scriptPubKey

My goal is to parse a BTC transaction and validate if the transaction was sent to a given BTC address. So I need to transform a BTC address to the scriptPubKey used in the transaction. I got this ...
Niel Deckx's user avatar
1 vote
0 answers
91 views

Is it possible to generate SegWit bc1 public/private key pair using Electrum command line?

I am looking for a way to generate SegWit bc1 public/private key pair that one can use as a paper wallet. Thanks for helping out!
sunknudsen's user avatar
6 votes
1 answer
455 views

What is the largest multisig quorum currently possible?

Bitcoin script allows for a UTXO to be (un)encumbered by an N-of-N signature. When N is 1, this is referred to as a single signature. What are the limits of N for this application? What is the ...
Matthias's user avatar
0 votes
1 answer
120 views

Why does my hash not line up with the one in the scriptPubKey?

I got some btc in testnet, here are the outputs. this is the UTXO that i get my btc { "value": 17.24756333, "n": 1, "scriptPubKey": { "asm": "...
KHJUAF403456ZS3K564WAEF's user avatar
0 votes
1 answer
978 views

sign native P2WPKH with bitcoinjs-lib (signing sighash) (non-mandatory-script-verify-flag)

i experimented a lot with p2wsh multisig configurations with bitcoinjs-lib. but when i tried to sign a standard native segwit p2wpkh to p2wpkh transaction everything goes ok except for bitcoin-cli ...
Antoni's user avatar
  • 287
2 votes
1 answer
1k views

Compute checksum for Bech32 address

The Bitcoin Wiki page for Bech32 addresses explains how one can create a bech32 address from a public key. In step 6 it says- Compute the checksum by using the data from step 5 and the H.R.P (bc for ...
Nissim R's user avatar
  • 123
2 votes
2 answers
125 views

tracking invoice address type migration

I'd love to see charts with stats on percent of utxos by invoice address type (specially P2PKH, P2SH, P2SH-P2WPKH, P2WPKH, P2TR), over time; and same for percent of coin supply. No doubt I can pay a ...
Mercedes's user avatar
  • 862
0 votes
2 answers
549 views

Missing Witness field in p2wpkh decoded tx hex

I have placed together a raw tx hex but when it's unable to be broadcasted as I keep getting an error below sendrawtransaction RPC error: {"code":-25,"message":"bad-txns-...
jiamijiang's user avatar
1 vote
0 answers
143 views

Java bip32 library

I'm looking for java library that will cover bip32 address derivation (xpub to P2PKH, P2SH, P2WSH, P2WPKH, P2SH-P2WPKH). There seem to be a lot of libraries covering P2PKH, but not much else (like ...
Tony Sanak's user avatar
  • 1,709
6 votes
2 answers
2k views

What are the scriptPubKey, scriptSig, redeem script and witness for the various output types?

scriptPubKey, redeem script, witness script, witness program are defined in this StackExchange post. What are the scriptPubKey, scriptSig, redeem script and witness for the various output types (P2PKH,...
Michael Folkson's user avatar
4 votes
1 answer
1k views

How do the fees for taproot transactions compare to P2WPKH?

How would the most basic taproot transactions (not involving scripts) compare to P2WPKH transactions in terms of vbytes or fees?
Darius's user avatar
  • 809
2 votes
3 answers
239 views

How hard is it for an exchange to adopt native segwit? Is it not as simple as updating the address regex checker on the front-end?

Just wondering, maybe I'm missing something. Are there changes on the backend needed to be implemented as well? Not as simple as changing the regex validation on the front end?
Dwyte's user avatar
  • 123
2 votes
1 answer
140 views

createPaymentTransactionNew with Bech32 address

How to properly call createPaymentTransactionNew using @ledgerhq/hw-app-bt to spend utxos from a bech32 transaction? This is the code I'm using to call it, having previously defined inputs and purpose,...
Federico Caccia's user avatar
0 votes
2 answers
190 views

Spending transaction output with only xpriv key

Is it possible to spend a P2WPKH transaction output, with only knowing the xpriv key and not knowing the specific private key that corresponds to the public key of the transaction?
Marko's user avatar
  • 111
0 votes
1 answer
770 views

Convert Electrum p2pkh wallet to p2wpkh one?

Is it possible, in Electrum, to convert a p2pkh wallet to a p2wpkh one, so I can use the Lightning network?
Geremia's user avatar
  • 4,715
0 votes
2 answers
849 views

Generating P2WSH addresses | Is there a standard WitnessScript?

For the examples below I am going to be talking of 1-of-1 multisig only derived from a single private key. For P2WPKH, the address is generated using using hash160 of the public key which acts as the ...
GMaster's user avatar
  • 187
0 votes
1 answer
345 views

Three different HEX having same wallet address how possible?

HEX1: 1111111111111111111111111111111111111111111111111111111111111111 public key: ...
Oliverkahn's user avatar
4 votes
1 answer
1k views

What is the size and weight of a P2WPKH input?

I'm investigating diverging P2WPKH input size calculations on two Bitcoin projects and some blog posts. I'm looking for a detailed explanation of the exact weight, vsize and serialized length of a ...
Murch's user avatar
  • 77k
0 votes
1 answer
580 views

"scriptSig" for P2SH-P2WPKH

I'm not sure I understand the fields of my input. I have a P2SH address (Testnet). This is the input of my transaction: "vin": [ { "txid": "...
MaXbeMan's user avatar
  • 125
1 vote
1 answer
270 views

How to interpret the Descriptor field?

These are my UTXO in Tesnet environment: { "txid": "93ae7787fe8203e9f13534205ca0310baf8bf5e2b55b2faa1f8b09134f475208", "vout": 1, "address": "2N4VywDy3DnkCmCM8yvfMSFHiEt2ePxzLXu", "...
MaXbeMan's user avatar
  • 125
3 votes
1 answer
162 views

Is the dust output limit the same for p2wpkh and p2wsh?

I've seen mentioned in a few places that the dust limit for an output to be considered standard is minRelayTxFee*3. Based on this, I would expect the dust limit for a p2wsh output to be larger than ...
Darius's user avatar
  • 809
1 vote
1 answer
519 views

ScriptSig in P2SH-P2WPKH BIP16

I have some doubts about P2SH-P2WPKH BIP16. I can read the witness program and I understand that a node is triggered when find 0 and 20 o 32 bytes in scriptSig or ScriptpubKey, more precisely: If is ...
monkeyUser's user avatar
  • 1,004
3 votes
1 answer
188 views

Can a coinbase transaction have a segwit output?

And more generally speaking, are there any restrictions on the output of a coinbase transaction?
Darius's user avatar
  • 809
0 votes
1 answer
209 views

What is the signature digest for Segwit outputs

(Assume there's no OP_CODESEPERATOR) For standard P2PKH, the signature digest is generated this way: NewTransaction settle the TxOuts well set all TxIn scripts to empty insert the Previous Locking ...
gudako's user avatar
  • 159
0 votes
1 answer
451 views

P2WPKH - which private key is used to generate signature?

I am looking at the BIP143 P2WPKH example. I am kind of following until the generation of the sigHash: c37af31116d1b27caf68aae9e3ac82f1477929014d5b917657d0eb49478cb670 but then that is used to ...
SCBuergel's user avatar
  • 125
5 votes
1 answer
409 views

Convert WIF to Witness PubKey Hash Address in Go

How can WIF be easily converted to WitnessPubKeyHash in Go? We need to get the public key from WIF and than calculate witness program as ripemd160(sha256(compressed_pub_key)). But is there a ...
Kuba's user avatar
  • 151
1 vote
2 answers
511 views

SHA256 vs RIPEMD160 in SegWit

In Pay-To-Witness-Public-Key-Hash (P2WPKH), the RIPEMD160 hash function is used to hash the public key of the recipient in the locking script. On the contrary, Pay-To-Witness-Script-Hash (P2WSH) uses ...
dcfg's user avatar
  • 404
7 votes
1 answer
2k views

In simple terms, what are the major differences between P2WPKH and P2WSH bech32 addresses?

I've read over the bip173, bip141, and bip143 specifications and they're a bit too technical to get at the simple answers I'm looking for.
kawthuldrok's user avatar
3 votes
1 answer
443 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:...
cryptodescriptor's user avatar
2 votes
1 answer
965 views

P2SH-P2WPKH - has always segwit UTXOs?

I've been reading a lot of docs on BTC transaction structure, and find it really confusing when it comes to SegWit story. So, the very first thing is, if I've P2SH-P2WPKH address, does it mean that ...
Jaroslav Gorjatsev's user avatar
6 votes
1 answer
3k views

How do I Derive Bech32 Address from P2WPKH Output Script?

I am building a small script to decode the raw coinbase transaction data into a human-readable viewer without external scripts to better my understanding around the subject. I've noticed that there ...
Mason Ticehurst's user avatar
0 votes
1 answer
389 views

BIP 84, BIP 173 Implementation in BitcoinJ

Can BitcoinJ (Java) supports complete implementations of BIP 173, BIP 84? How can segwit address can be created using BitcoinJ for SPV wallet?
iamrajshah's user avatar