Questions tagged [p2sh]

Pay to Script Hash is a transaction output format that allows you to lock funds to the execution of arbitrary scripts. It was defined in BIP0016.

Filter by
Sorted by
Tagged with
0 votes
1 answer
56 views

OP_HASH160: Computing script hash in a concrete P2SH transaction

I'm having troubles with understanding how script hash is computed in P2SH transactions. From BIP-16 documentation (https://github.com/bitcoin/bips/blob/master/bip-0016.mediawiki): scriptSig: [...
user avatar
1 vote
1 answer
41 views

Can The Redeem Script Consist Of Only 1 Public Key In P2SH Transactions:

I have a few questions relating to Bitcoin Signatures And P2SH: Why is P2SH used as opposed to other forms? Is it still prevalent today - has SegWit made it redundant or less useful, if not, what is ...
user avatar
  • 137
5 votes
1 answer
219 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 ...
user avatar
1 vote
1 answer
35 views

How can bitfinex send LTC to a Bitcoin address?

It's my fault. However, how come bitfinex doesn't guard against this error? Also how can it be possible? 32uxxMqwrpEKTDodF8BZkuRJGs8ruujoti is clearly not an LTC address. I am not even sure how the ...
user avatar
1 vote
0 answers
45 views

Solution for P2SH non-standard derivation paths

Creating P2SH (Nested Segwit) addresses from an imported BECH32 (Native Segwit) XPUB, when running Bitcoin Core (pre-2020 software) wallet (as watch-only, with private keys disabled) can lead to non-...
user avatar
0 votes
1 answer
49 views

p2sh addresses in elements

I'm building a script and have it's hex representation, then I convert it to a pubkey and address, which results in something like: 3NqNAUBEWarVjKerLcCnPrTGbaQ4QFcAfr or ...
user avatar
  • 123
2 votes
1 answer
77 views

Why does SegWit implement new address formats?

I would consider myself quite up-to-par with the concept and in-depth functionalities of SegWit (segregated witness). I just don't understand one key aspect of it; P2SH and bech32 addresses. why on ...
user avatar
1 vote
1 answer
57 views

Why does a script length of 254 need three bytes?

I'm looking at some raw txs (P2SH in that case) for learning, and I have one question about a particular tx: tx hash 0aeae24fa55544da49ba06ec338c9beee592ab4bea71eb8085908f377dd46084, i use this tool ...
user avatar
  • 11
0 votes
1 answer
82 views

How bitcoin browsers check P2PK and P2SH balance?

Suppose someone sends bitcoins to me using P2PK, I only enter my address starting with 1 in the bitcoin browser, can i get results? my public key hash doesn't appear in either UTXO, only one UTXO has ...
user avatar
0 votes
1 answer
45 views

How Bitcoin browsers update balance of an address?

Suppose i have a Bitcoin address for the first time and Alice sends me 1 Bitcoin using P2SH. As far as I know, Bitcoin browsers will scan the entire blockchain. In this case, my public key is not ...
user avatar
0 votes
1 answer
80 views

Parsing P2SH address from output script

I have already looked at link. I am trying to generate P2SH address from output script but no luck. I am using transaction 40eee3ae1760e3a8532263678cdf64569e6ad06abc133af64f735e52562bccc8 for testing ...
user avatar
  • 29
0 votes
2 answers
54 views

non-mandatory-script-verify-flag (unknown error) with a script that runs ok in btcdeb

after learning a lot about script (and playing with them on the testnet) i made a way longer script. $ btc decodescript 7455886f94935688789352885279935b88946e935b88945187 { "asm": "...
user avatar
  • 237
0 votes
1 answer
51 views

Hiding data in OP_RETURN statement?

I'm reading this article, and quote The blockchain transaction’s OP_RETURN data can be decrypted using AES-256 GCM to provide a backup command and control domain name How did someone able to ...
user avatar
  • 107
0 votes
0 answers
66 views

Can i recover missed phrase on p2sh wallet?

i have a wallet from past with p2sh format ,also i know my private key but i just lost 4 character of that,i tried few apps to recover that but no one works(they work on another wallets prefectly),i ...
user avatar
0 votes
0 answers
34 views

Non-mandatory-script-verify-flag (unknown error)

I am trying to learn how scripts are working. In a testnet i got some scripts working and learned a lot about what not to do. But now I am struggeling getting this to work. Originaly I worked with a ...
user avatar
  • 1
1 vote
2 answers
106 views

What if I change PubKeyHash in scriptPubKey of a transaction to my PubKeyHash?

Suppose a person A makes a transaction to person B and sends it to bitcoin network. Suppose I changed PubKeyHash in scriptPubKey of a transaction to my PubKeyHash and send it to bitcoin network. The ...
user avatar
0 votes
1 answer
79 views

P2SH-Multisig transaction not going through

I have some funds locked in a testnet P2SH address which requires 2-of-3 signatures. This is the address: 2NEKRqUqoDtsELzpBa5wuWEiJeVbio5cSa2 and the 3 keys: #1 - ...
user avatar
  • 65
3 votes
1 answer
144 views

Why P2SH seems to be never smaller than 34 characters, unlike P2PKH?

Why base58 of P2SH invoice address seems to be never smaller than 34 characters; unlike base58 of P2PKH invoice address, in which 33 characters is very common? Bitcoin wiki tells (format and emphasis ...
user avatar
  • 427
2 votes
2 answers
106 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 ...
user avatar
  • 427
0 votes
0 answers
205 views

How do you Derive Addresses from a BIP49 Master Public Key using P2WPKH-P2SH?

I am trying to derive addresses from a master public key (aka extended public key) in python. I don't fully understand the math behind the key derivation, but have been able to decode the master ...
user avatar
  • 1
1 vote
1 answer
291 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,...
user avatar
0 votes
0 answers
122 views

Generate P2SH bitcoin address from WIF in BitcoinJ Java

I'm trying to create P2SH-Segwit bitcoin address from the WIF private key. I'm using the BitcoinJ library in Java. See the following code. String base58PrivateKeyString = "...
user avatar
5 votes
2 answers
438 views

Why are P2WSH addresses larger than P2SH addresses?

One would, perhaps naively, assume that both addresses are hashes of scripts and therefore ought to be the same size.
user avatar
2 votes
1 answer
125 views

How to spend from a custom P2SH script using bitcore-lib

My Javascript/typescript project uses bitcore-lib. It uses Script.buildScriptHashOut to build custom P2SH outputs. How do I spend from this custom output?
user avatar
  • 9,849
1 vote
0 answers
44 views

P2SH address as a product of public keys

Assuming the multisig 2 of 3, if I do have extended public keys (xpub) for all 3 cosigners (with proper derivations), can I somewhat get the result address (P2SH)? How to calculate the "script&...
user avatar
  • 1,584
3 votes
1 answer
197 views

Bitcoin-qt getnewaddress returns address starting with 2

I am expecting it starts with '3' the the results below: getnewaddress "" "p2sh-segwit" 2NFcKJTPZs1syYhwaBkXty6Vt6FEKxD3HTC Is this because I am running on a private block chain?
user avatar
  • 175
2 votes
1 answer
146 views

Transaction Puzzles, Awareness and Questions

I was just reading about the two following scenarios: My understanding is that we have two transactions here that don't follow the usual scriptSig/scriptPubKey situation, and I think transactions ...
user avatar
  • 320
0 votes
1 answer
85 views

Pay to script hash address transaction not accepted by miners

I have fixed my initial transactions and have been able to send coins to a p2sh address Now I want to spend those coins but when I try to broadcast my transactions either the website (blockcypher) ...
user avatar
  • 2,391
0 votes
1 answer
97 views

Invalid p2sh transaction accepted by the network

I have try to build a 2 of 2 p2sh transaction from scratch using the book "programming bitcoin" by Jimmy Song, we are not directly guided to make one of those so I had to modify some of the ...
user avatar
  • 2,391
1 vote
0 answers
181 views

Calculating P2WKH nested in P2SH addr/redeem script hash from pubkey

My calculation of the hash160 doesn't seem to be correct - what are my sins? Tx spending the input: https://www.blockchain.com/btc/tx/d490cc0a5b9799e09b02dd4b20a6d7ca297c09c425983efc13b382f6023d0376 ...
user avatar
1 vote
1 answer
143 views

How are p2sh address spent

So, I was looking into how P2SH transactions are working and by looking at different blog post and in particular to this answer, I have the following question. So, let's take the same transaction: ...
user avatar
2 votes
2 answers
174 views

How a new wallet knows balances locked in P2SH transactions?

If my old wallet created and submitted a P2SH TX to the blockchain, and I migrate to a completely different wallet, how can the new wallet detect that that UTXO belongs to me? Since the script is ...
user avatar
0 votes
1 answer
186 views

Three different HEX having same wallet address how possible?

HEX1: 1111111111111111111111111111111111111111111111111111111111111111 public key: ...
user avatar
1 vote
1 answer
37 views

Read the "value" being redeemed in a Bitcoin P2SH Script

Is there any way for a Bitcoin P2SH Script to read the amount of Satoshis being redeemed?
user avatar
  • 41
2 votes
1 answer
97 views

Are P2SH transactions with disabled opcodes relayed/mined?

Many OPCODES like OP_AND, OP_CAT, OP_SUBSTR are disabled as described in https://en.bitcoin.it/wiki/Script. Although, with Bitcoin Core 0.10.0 Gavin Andresen proposed "any Script" in P2SH ...
user avatar
  • 362
1 vote
1 answer
68 views

Is the `addmultisignature` API call dependent on order of public keys in the array? Or is it lexicographically sorted?

Say Alice and Bob are part of a partnership business that accepts Bitcoin. They store all their main funds in cold storage until the end of 3 months, when they cash out and use a new address. This ...
user avatar
0 votes
2 answers
156 views

Clarifications on hd multisig wallet

I need clarification on multisig hd wallets. Let's imagine we have a 2/3 multisig. The first key is generated by the user on a mobile wallet, the second is kept on a server while the third is off-line ...
user avatar
  • 127
2 votes
1 answer
257 views

What happens if a P2SH redeem script is lost?

Assume Bob creates a complicated Bitcoin Script and asks Alice to make a payment to a hash of this script. (Using a P2SH transaction) If Bob loses the script (i.e. the source code of the script), is ...
user avatar
  • 25
0 votes
1 answer
128 views

Are P2PKH or P2SH transactions malleable?

BIP66 fixed one source of transaction malleability and segwit, to my understanding, fixed the rest of the sources. Yet, there are still many common types of non-segwit transactions in use, like P2PKH ...
user avatar
  • 701
1 vote
1 answer
115 views

Bitcoin script verification fails after certain time period

So I want to write a bitcoin script so that after a certain time period (say for example after 30 mins), the verification fails and transaction is marked invalid even if it gets broadcasted. Time ...
user avatar
1 vote
1 answer
123 views

how to find p2sh/p2wsh in utxo set after wallet recovery

i'm trying to understand how wallets remember a redeem script for p2sh/p2wsh for spending, after recovering from their seed, because the utxo set only has the hash in it, right? there are a nearly ...
user avatar
2 votes
0 answers
29 views

Ypub test vectors missing for mainnet

Following extended key derivation scheme in BIP49 is there a publicly available test vector repository for mainnet? The test vectors in https://github.com/bitcoin/bips/blob/master/bip-0049.mediawiki#...
user avatar
  • 1,584
0 votes
1 answer
319 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": "...
user avatar
  • 127
2 votes
1 answer
112 views

What is the link between address and use of the UTXO?

I state that I'm still a beginner. I need some clarification. I am using the Testnet. This is the information regarding the address I used to receive funds from a Faucet bitcoin-cli validateaddress ...
user avatar
  • 127
0 votes
1 answer
107 views

difference between signing a message and signing a p2sh

can i use the sign message function to sign the serialized hex for a p2sh transaction? Are the ecdsa functions used the same or are they different? It looks like the output is in a different format ...
user avatar
1 vote
0 answers
44 views

When did BIP16 pass the 550/1000 threshold?

BIP16 says on 01 Feb 2012, if more than 550 out of the previous 1000 blocks include "/P2SH/" in the coinbase, then BIP16 will activate on 15 Feb 2012 (Source). BIP16 was later revised. On 15 Mar 2012,...
user avatar
0 votes
0 answers
156 views

Generate p2sh-segwit and address bech32

When I use bitcoin-cli getnewaddress "" "p2sh-segwit" which kind of script is inside And can I convert if in bech32?
user avatar
1 vote
1 answer
277 views

How to Verify P2SH Signature

I am trying to debug an issue where i believe i might have a bad signature but i am trying to figure out how to approach it. What is this a signature of. Private key + what (redeem script? entire raw ...
user avatar
1 vote
1 answer
150 views

Old p2sh address not signing correctly on core v0.17

https://pastebin.com/kdQPkELN if anyone can see why i am getting a 16: mandatory-script-verify-flag-failed (Signature must be zero for failed CHECK(MULTI)SIG operation)failure.... It is a p2sh ...
user avatar
0 votes
1 answer
216 views

Standardness rules related to BIP 16 (P2SH)

I can read in BIP0016 wiki the P2SH Specification Transactions that redeem these pay-to-script outpoints are only considered standard if the serialized script - also referred to as the ...
user avatar