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
60
votes
3answers
68k 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 ...
22
votes
1answer
5k views

How do “Pay to Script Hash” transactions work?

BIP16 gives the following example to explain "Pay to Script Hash": scriptSig: [signature] {[pubkey] OP_CHECKSIG} scriptPubKey: OP_HASH160 [20-byte-hash of {[pubkey] OP_CHECKSIG} ] OP_EQUAL But I ...
14
votes
2answers
6k views

How do bech32 addresses compare to P2SH addresses in transaction size?

Bech32 (starts with bc1) and P2SH (starts with 3) can both be used for segwit transactions. I know bech32 is supposed to create smaller transactions, but I'd like to know how much smaller (than P2SH). ...
10
votes
1answer
3k views

What is an explanation of the P2SH voting in layman's terms?

Reading this question and looking in the bitcointalk forums at the related discussion, there seems to be some kind of miner vote being done on whether a change will be implemented in the bitcoin ...
8
votes
2answers
2k views

What the difference between old segwit (3) and new segwit address (bc)?

i'm not that kind of person who understands cryptography and math, can you tell me simply the main purpose of new segwit address? are transactions fee the same for new segwit (bc1)? instead of "Old ...
8
votes
1answer
2k views

Where are P2SH full redeem scripts stored?

A pay-to-script-hash/P2SH full redeem script can be up to 520-bytes in size. Just to clarify, prior to being revealed/spent, is the redeem script stored in the spender/Bob's wallet or elsewhere? The ...
8
votes
1answer
7k views

Difference between a SegWit address and a P2SH address

Let there be an address 3ABCDEFGHJKDJHDH.... How can I understand if it's a SegWit address or a MultiSig address?
8
votes
2answers
233 views

How can one know which way mining pools will vote for P2SH?

Is there a list somewhere showing how each mining pool will vote on the P2SH question? and If a pool says that it is voting one way, is it possible to independently verify that they are indeed ...
7
votes
1answer
237 views

What's the use of not relaying non-standard transactions if anyone can still use them using P2SH?

It seems that non-standard transactions are not normally relayed because there is a concern this might break the network or it might make future upgrades harder. But anyone can use these non-standard ...
7
votes
1answer
534 views

Does OP_HASH160 consume the top stack element?

In a standard P2PKH configuration, the scripts look like: Pubkey script: OP_DUP OP_HASH160 <PubKeyHash> OP_EQUALVERIFY OP_CHECKSIG Signature script: <sig> <pubkey> When redeeming ...
6
votes
4answers
874 views

Why are the majority of miners not voting on on P2SH?

Link (via reddit) Currently the vast majority of miners just don't vote. Was there a mistake made in organizing the voting process (maybe most miners haven't heard about this vote?), or perhaps most ...
6
votes
3answers
1k views

What are the implications of BIP 12 vs BIP 16 and OP_CODEHASHCHECK?

There is a discussion about two different Bitcoin Improvement Proposals - BIP 12 and BIP 16, and probably only one of them is going to be included in Bitcoin 0.6 (miners will decided which by a ...
5
votes
1answer
385 views

Where the P2SH script gets written?

I understand that when I'm doing a transaction, I'm locking those bitcoins to whoever provide the solution to a script that has the hash I posted. But, where does the hash get written? I would ...
5
votes
1answer
1k views

How do you spend a P2SH transaction?

I've been running into a lot of trouble getting a transaction to spend coins in a multisig address. I create the raw transaction When I go to sign, I get "Operation not valid with the correct stack ...
5
votes
1answer
807 views

Pay to Script Hash Execution

Combining the spending transaction scriptSig and funding transaction scriptPubKey, we get: <OP_0> <sig A> <sig C> <redeemScript> <OP_HASH160> <redeemScriptHash> &...
5
votes
2answers
2k views

P2SH address decoding

What is the process of decoding the P2SH address? We have this information so far. Let's run through an example tx bea1e7ae7ecdc502215717f30d62a12085bb2866d8db730dfb626b60c337534c The hex script (...
5
votes
1answer
1k views

What is meant by “relaxed standards” for P2SH redeem scripts in Bitcoin Core 0.10.0?

From the Bitcoin Core 0.10.0 release notes: Standard script rules relaxed for P2SH addresses The IsStandard() rules have been almost completely removed for P2SH redemption scripts, allowing ...
5
votes
1answer
196 views

p2sh checksig failing

I'm attempting to validate a p2sh transaction from the live bitcoin blockchain, however it is failing the checksig. I am using pybitcointools for the checksig and I have successfully validated lots of ...
5
votes
3answers
410 views

BIP0016 pay-to-scripthash transaction validation

BIP0016 says "Validation fails if there are any operations other than "push data" operations in the scriptSig". What does it mean "push data operations"? OP_CHECKMULTISIG seems to be allowed but does ...
4
votes
2answers
1k views

Birthday attack on P2SH

The Segwit Benefits document has this to say about P2SH security for base transactions: Multisig payments currently use P2SH which is secured by the 160-bit HASH160 algorithm (RIPEMD of SHA256). ...
4
votes
1answer
134 views

Why is my P2SH sigScript field prepended with 0x00?

I created a P2SH transaction and signed it using coinb.in. The sigScript field for this transaction is: da 00 47 3044 0220 ...
4
votes
1answer
246 views

How is OP_CHECKTEMPLATEVERIFY a scaling solution

I was wondering about OP_CHECKTEMPLATEVERIFY or OP_SECURETHEBAG as it was previously called. As far as I understand it you can commit on how to spend the coins later this way. But it doesn't enable ...
4
votes
1answer
268 views

BIP-0016 p2sh keys and altcoins

It appears that bitcoin addresses using p2sh keys have a different prefix to that of normal bitcoin addresses. Do other altcoins such as litecoin, peercoin, dogecoin etc include this functionality?
4
votes
1answer
468 views

How does a P2SH script get executed?

I'm trying to visualize how a typical P2SH script gets executed, as I realize that it's a special form of script that gets executed slightly differently to a standard script. Before P2SH: Before ...
4
votes
4answers
350 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 ...
4
votes
1answer
495 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 ...
4
votes
1answer
2k views

Step by step example to redeem a P2SH output required

I have been following BIP16 in creating a P2SH transaction. I want to create a simple (one signature) P2SH. I am getting an error when trying to broadcast the tx. Error is 16: mandatory-script-verify-...
4
votes
1answer
1k views

Redeem script for segwit addresses

How does one derive the Redeem Script for the new Pay-to-Witness Pubkey Hash addresses? With existing P2SH it's revealed after providing N number of Public Keys through a createmultisig function in ...
4
votes
1answer
671 views

Clarification of BIP32 hierarchical deterministic multisig scripts

As everyone is aware, I'm a huge proponent of Vitalik Buterin's pybitcointools Python 2.7/3.x library. I am having a some trouble understanding the BIP32 concepts, which are coded in the deterministic/...
4
votes
2answers
545 views

Did P2SH (BIP 16) get accepted?

Based on this, it seems like it did http://blockchain.info/p2sh but it seems I can't find a definitive answer.
3
votes
3answers
2k views

What is the Witness and what data does it contain?

I've learned about the Segregated Witness but couldn't find info on breaking it down. I know usually when legacy addresses are used the public keys for example will be under Scriptig. With P2SH, I ...
3
votes
4answers
2k views

Electrum 2.0: non-BIP39/32 standardisation complicates matters immensely. Why?

Electrum 2.0 has been causing me some frustration, insofar as it seems to be a non-standard implementation of BIP32/BIP39 (HD wallets, mnemonic seed, respectively). The wallet in question is a 2of2 ...
3
votes
1answer
107 views

What new transactions are possible with 15 operations?

Today Gavin tweeted that he's relaxing the IsStandard rules for pay-to-script-hash transactions to allow any transaction with 15 or less operations. (Full git commit here) When this is merged and ...
3
votes
2answers
1k views

How does P2SH unlocking work?

"Mastering Bitcoin" by Antonopoulos in its P2SH section describes how the unlocking and locking scripts are executed and evaluated by nodes. The author gives this as example of an unlocking script: &...
3
votes
1answer
170 views

Scripts within Scripts

I have read the following: https://github.com/bitcoin/bips/blob/master/bip-0016.mediawiki https://darkwallet.is/bip16-17 However, I would like to know, can one specify a pay-to-script hash that ...
3
votes
1answer
354 views

How to get bitcoin P2SH (3*) address balance with bitcoind

i'm trying to understand how to calculate/obtain balance of a P2SH address added to my running bitcoind with "addmultisigaddress..." and that is properly displayed by the command "...
3
votes
1answer
62 views

Sign P2SH transaction with Openssl

I have an P2SH 1-3 and I want to use openssl to sign a transaction. my redem script is ...
3
votes
1answer
725 views

How to quickly find the private key from Segwit P2SH address?

I have a very large list of Segwit addresses for bitcoin, starting with '3' and do not know the corresponding legacy '1' address for them. How can I quickly find the corresponding legacy address to ...
3
votes
1answer
810 views

Verifying a P2SH transaction script by hand. How should I concatenate OP CODES in order to hash the script?

I'm reading this: Transaction 40eee3ae1760e3a8532263678cdf64569e6ad06abc133af64f735e52562bccc8 paid to P2SH address 3P14159f73E4gFr7JterCCQh9QjiTjiZrG. You can see the redeem script in ...
3
votes
1answer
552 views

Is there a JavaScript library for validating P2SH addresses?

I looked at coinstring.js but it looks like it only validates simple BTC addresses (1-prepended addresses). isValid(base58str, version) Validates whether the address string or wallet import ...
3
votes
1answer
702 views

P2SH transaction signing

I'm trying to redeem a 2of2 p2sh unspent output. I have the complete multisig redeem script, a single input and a single p2pkh output. My understanding is that I should replace the ScriptPubKey of ...
3
votes
0answers
401 views

Electrum Seed Purpose for MultiSig Wallet

I'm curious as to what exactly is protected by the seed that Electrum generates for a multisig wallet. My knowledge of the protocol implementation is rather basic, so please correct me where I'm wrong ...
3
votes
0answers
482 views

How can I store a redeem script in my wallet?

Imagine that I wrote a redeem script. I calculated the related P2SH address, and sent some bitcoins to that address. In order to spend that bitcoins, I need to remember two things: The private keys ...
3
votes
0answers
499 views

Creation of P2SH MultiSig Input Script

In the createP2SHMultiSigInputScript() function of BitcoinJ according to this: public static Script createP2SHMultiSigInputScript(@NullableList signatures,Script multisigProgram) Create a program ...
2
votes
2answers
2k 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?
2
votes
2answers
269 views

How can one see if an address is multisig?

Some addresses on this page indicate whether the address is a multisig, and what the threshold signature scheme is. How do they detect this?
2
votes
1answer
200 views

Multisig created from Multisig address

Can a multisig address creation process use other multisig addresses as signers to result in a new multisig address Would this also result in a greater number of signers to be necessary to approve a ...
2
votes
1answer
2k views

Which security threats in P2PKH lead to the use of P2SH?

To steal a P2PKH output you would have to find the private key of the public key that generated the hash used in the tx. This is impossible to do in a feasible timespan, therefore making the tx secure....
2
votes
3answers
1k views

Bitcoin-tx sign/redeem p2sh transaction (Unable to sign input, invalid stack size (possibly missing key))

I'm seeking help in redeeming a p2sh transaction using the standard tools from bitcoin core, e.g., bitcoin-cli or using directly the RPC commands via curl would also be fine. Creating the P2SH ...
2
votes
1answer
165 views

how to spend an utxo when the corresponding scriptsig is longer than 256 bytes?

I am trying to spend an utxo sent to a p2sh address. The scriptsig (including the redeem script) is longer than 256 bytes. When the transaction is serialized there is only one byte to indicate the ...