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.

221 questions
66
votes
3 answers

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 balance go negative, so I need to know if they have…
macintosh264
  • 761
  • 1
  • 6
  • 3
41
votes
1 answer

My raw transaction destroyed 0.0284377 BTC. What did I do wrong?

Years ago I designed a .NET module which facilitates the transmission of BTC to my customers. It creates a binary representation of the desired transaction based on the material presented here and here: The binary representation is then converted to…
30
votes
1 answer

What is P2PK, P2PKH, P2SH, P2WPKH - ELI5

Explain like I'm 5 years old and my other half of the brain is surgically removed :) I don't want to put a lot of stress on my brain Also what is the difference between BTC held in P2SH and Unspent P2SH Output…
user380208
  • 613
  • 1
  • 6
  • 11
23
votes
1 answer

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 don't get what's happening here. I've tried…
jnnk
  • 1,906
  • 15
  • 23
17
votes
2 answers

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). How do transactions coming from a normal…
B T
  • 1,569
  • 13
  • 27
10
votes
1 answer

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 developer guide says: "When Bob wants to spend…
Colman McMahon
  • 195
  • 3
  • 12
10
votes
1 answer

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 protocol. It seems to discuss the adding of a…
Highly Irregular
  • 10,910
  • 6
  • 52
  • 102
9
votes
2 answers

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 Segwit" and "New Segwit" what would you call em?
9
votes
1 answer

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?
MCCCS
  • 10,097
  • 5
  • 27
  • 55
8
votes
3 answers

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 can see that the ScriptSig contains the hash of…
Robert
  • 351
  • 3
  • 15
8
votes
1 answer

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 transactions (and get them relayed!) using P2SH.…
boot4life
  • 509
  • 1
  • 3
  • 11
8
votes
2 answers

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 voting that way with their mining power?
kirian
  • 3,279
  • 1
  • 24
  • 36
7
votes
1 answer

Does OP_HASH160 consume the top stack element?

In a standard P2PKH configuration, the scripts look like: Pubkey script: OP_DUP OP_HASH160 OP_EQUALVERIFY OP_CHECKSIG Signature script: When redeeming P2PKH outputs, OP_DUP is done because the pubkey is used twice,…
morsecoder
  • 14,008
  • 2
  • 42
  • 92
6
votes
1 answer

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 covenants in the sense of…
fiction
  • 518
  • 2
  • 12
6
votes
1 answer

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-flag-failed (Signature must be zero for failed…
Jus12
  • 1,365
  • 1
  • 14
  • 24
1
2 3
14 15