Hot answers tagged

9

Is it acceptable to mix P2PKH and P2WPKH inputs in the same transaction as described above? Yes, absolutely. In the same way that you can mix multisig and P2SH and P2PK inputs in the same transaction. When would I encounter a situation where "all txins in a transaction are not associated with any witness data" When you're not spending any SegWit outputs....


3

P2WPKH - This stands for "Pay To Witness Public Key Hash" and the scriptPubkey is OP_0 0x14 {20-byte-hash}, where OP_0 is the version, byte 0x14 is the size of the data, and the {20-byte-hash} is a HASH160(PubKey). P2WSH - This stands for "Pay To Witness Script Hash" and the scriptPubkey is OP_0 0x20 {32-byte-hash}, where OP_0 is the version, byte 0x20 is ...


3

Okay so I think I've figured it out for anyone else wondering what exactly you have to do to derive an address from this type. In the case of the already mentioned transaction, (coinbase of block 542748) we first start by looking at the full decoded output script. 0 PUSHDATA(20) 97cfc76442fe717f2a3f0cc9c175f7561b661997 The very first OP_0 in the decoded ...


2

Feb2018: an older request, I just answer it so that future research might reveal useful data :-) To compose the redeem script for a P2WPKH, there is a fairly simple structure, I copied this mostly from here: Start with OP_0, followed by the keyhash. Keyhash is calculated with RIPEMD160(SHA256(public key)), similiar to "std" PKH. Do not use uncompressed ...


2

I might be understanding this incorrectly, but it sounds like the users and/or wallet custodian (coinbase, blockchain.info, etc) must create a P2SH-P2WPKH addresses in order for the witness data to be segregated and save on block space. Correct, you first have to receive money to a SegWit address. Witness space can only be used when spending outputs ...


2

How to quickly find the private key from Segwit P2SH address? As per today, it is impossible to find the private key from any public key or address. Also from a SegWit P2SH address. There is always hashing involved, which is a one way function. I think you maybe wanted to ask, how to come to the public addresses (see below), so that you can extract ...


2

i don't think bitcoinj support BIP-173 but you can read more from Bitcoinj repo For Segwit Bitconj 0.14 branch is ~2 years old and has got no support for segwit at all. For receiving on native Segwit addresses, you can use the master branch. For receiving on P2WPKH-P2SH, I'm not sure. If master doesn't work you can try the segwit branch (but that one isn'...


2

are P2WPKH and Bech32 synonyms now? No. Bech32 is also used for P2WSH addresses. Native segwit and Bech32 are synonyms. Is there such a thing as Base58 P2WPKH address? No.


2

As the protocol is upgraded with soft-forks changing script interpreter behaviour, the script-machine is extended with additional runs. Each new upgrade brings a new script run with new rules, whilst previous script runs continue to be evaluated according to older rules. Arguments need to be supplied to determine whether the newer script runs are to be ...


2

The P2WPKH actually uses the HASH160 hashing algorithm, which is just RIPEMD160(SHA256(pubkey)). The reason for using SHA256 is mentioned in BIP141: The increased size improves security against possible collision attacks, as 2^80 work is not infeasible anymore (By the end of 2015, 2^84 hashes have been calculated in Bitcoin mining since the creation ...


2

The execution order is: scriptSig/witness to construct the initial stack scriptPubKey (which may invoke redeemScript evaluation in case of P2SH, and witness script invocation in case of P2WSH) The scriptCode is simply a name for "the code being executed". Inside scriptPubKey evaluation, it is equal to the scriptPubKey. Inside redeemScript evaluation, it is ...


1

Only the private key for the second input is used in this signature as this signature is only for the second input. The first input is P2PK and is ignored in this example as it is non-segwit so the standard non-segwit sighash algorithm is used for it.


1

Bech32 is described in BIP 173. Everything you need to know top construct Bech32 addresses (along with sample code) can be found there.


1

I'm not entirely sure, but I think the intent of that change is to allow non-segwit wallets to generate payments to segwit wallets. Imagine that you're a business that uses segwit, but 1% of your customers insist on paying using a wallet that doesn't support segwit.


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