50
votes
Accepted
My raw transaction destroyed 0.0284377 BTC. What did I do wrong?
Addresses that start with 3... are P2SH addresses, and they've been around for almost 6 years now. Historically they saw limited use - used by multisig wallets like Copay and GreenAddress. The ...
26
votes
How to calculate transaction size before sending (Legacy Non-Segwit - P2PKH/P2SH)
Here are some calculations based on the Protocol Documentation.
A Bitcoin Transaction is composed of the following:
Version (4 Bytes)
TxIn Count (1 ~ 9B)
For each TxIn:
Outpoint (36B)
Script Length ...
16
votes
Accepted
Is it possible to convert an address from p2pkh to p2sh?
Is it possible to covert a p2pkh adrress to a p2sh adress?
Don't.
Addresses are determined by the wallet. It's the receiver's wallet saying "I will accept payment when it arrives at address X". ...
12
votes
Accepted
How do bech32 addresses compare to P2SH addresses in transaction size?
bech32 produces smaller transactions than P2SH segwit transactions.
one extra byte per output to create P2SH outputs than to create bech32 utxos (P2SH uses OP_HASH160 and OP_EQUAL in addition to a 20 ...
11
votes
Accepted
Where are P2SH full redeem scripts stored?
Here's a working example that lays the groundwork for answering your question:
Alice wants to pay Bob, so she asks Bob for an address.
Bob wants to receive payment to a P2SH address.
So Bob creates ...
9
votes
Birthday attack on P2SH
Why does this document seem to imply that the birthday attack only works for multisig P2SH and then only for one of the signers?
The birthday attack (to the best of my knowledge) requires that the ...
9
votes
Accepted
What is the Witness and what data does it contain?
This structure contains data required to check transaction validity
but not required to determine transaction effects. In particular,
scripts and signatures are moved into this new structure.
The ...
8
votes
Accepted
How do you spend a P2SH transaction?
You get this error because Bitcoin has tried to validate the script, and failed, because not all of the signatures necessary were added in the previous signrawtransaction. You can also tell this ...
8
votes
Where the P2SH script gets written?
The script is maintained by the intended recipient; he is the one responsible to keep it and not to lose it. The nodes do not store any database of the scripts.
The script is provided by the spender ...
8
votes
Accepted
What's the use of not relaying non-standard transactions if anyone can still use them using P2SH?
As you say, there are two separate concerns here:
There are some scripts that might cause harm to the network.
There are some scripts that might make future upgrades harder.
For the case of harm to ...
7
votes
Pay to Script Hash Execution
I've been hunting for this information myself, and had to dig to the bitcoin source code to find the answer - couldn't find it anywhere else.
There is a hardcoded logic in bitcoin for P2SH validation:...
7
votes
Accepted
Difference between a SegWit address and a P2SH address
Until a P2SH-P2WPKH UTXO is spent and the redeemScript is exposed, a P2SH-P2WPKH address is indistinguishable from a non-segwit P2SH address (such as a non-segwit multi-signature address)
Reference: ...
7
votes
What the difference between old segwit (3) and new segwit address (bc)?
The difference lies in the encoding and the underlying representation in the transaction data stored on the blockchain.
The 3-segwit addresses are known as P2SH-P2WPKH or P2SH-P2WSH. This stands for ...
7
votes
Accepted
Why is my P2SH sigScript field prepended with 0x00?
OP_CHECKMULTISIG contains a bug which consumes one extra element from the stack. Due to this, an additional OP_FALSE (0x00) is pushed for multisig scripts to make the script evaluation valid.
6
votes
Accepted
Multisig created from Multisig address
No. A "multisig address" is really a hash of a redeem script encoded as a P2SH address. Redeem scripts can't be nested, which means you can't include one redeem script inside another redeem script, ...
6
votes
Accepted
Does OP_HASH160 consume the top stack element?
Yes, OP_HASH160 consumes the top stack element and replaces it with its hash.
So how does P2SH work, if the script is consumed after HASH160 runs?
Here's how P2SH transactions are processed:
...
6
votes
Accepted
Which security threats in P2PKH lead to the use of P2SH?
The only security concern of P2PKH is that it only requires 1 key to spend coins paid to it. P2SH just lets you be even more secure by easily putting more conditions on the redemption of your coins, ...
6
votes
Accepted
What is meant by "relaxed standards" for P2SH redeem scripts in Bitcoin Core 0.10.0?
What are the specific changes which have been made (ie relaxed standards)?
Gavin Andresen made this pull request proposing the change, as well as this rationale document describing why he supported ...
6
votes
Accepted
What the difference between old segwit (3) and new segwit address (bc)?
There's no big difference for users between the two. The fee is lower while using native Segwit address (bech32), and the address format differs.
Let's look at the motivations of bech32 address ...
6
votes
Accepted
How can one see if an address is multisig?
There are different types of addresses in Bitcoin. The simplest format is called pay-to-public-key-hash (p2pkh) which locks funds to a single private key. Another is called pay-to-script-hash (p2sh), ...
6
votes
Accepted
Bitcoin-qt getnewaddress returns address starting with 2
You are using testnet. Addresses starting with "M", "N", "2" and "tb1" are testnet addresses.
5
votes
Accepted
If I was developing a Bitcoin wallet, should I support both legacy and compatibility addresses?
Displaying two would be justified if you were asking about a BC1 p2wpkh vs a 3xxx p2sh(p2wpkh) because not everything supports BC1 but its pretty good to use when supported.
Displaying two isn't ...
5
votes
Accepted
Why are P2WSH addresses larger than P2SH addresses?
Because P2SH addresses are too short to provide typically desirable levels of security security level we expect from Bitcoin, against certain attacks. On top of that, they use bech32 encoding rather ...
5
votes
Accepted
Why P2SH seems to be never smaller than 34 characters, unlike P2PKH?
Because Base58 initial 1s carry 8 bits of data, but P2SH addresses cannot be represented with a string with initial 1s so it starts with 3 which, like all other cases & characters, encodes 5.86 ...
4
votes
Accepted
What new transactions are possible with 15 operations?
It's not exactly "15 operations"...
The Bitcoin address is not really a public key, but a special script that is built from special commands. From those commands you could build really weird ...
4
votes
Accepted
P2SH address decoding
Here is the example
of the transaction from the question
the redeem script is: ...
4
votes
Accepted
How does a P2SH script get executed?
Does P2SH validation create a second stack using a copy of the redeem script, and then validate that stack before moving on to deserializing the redeem script (and then validating that script as ...
4
votes
Accepted
How is it possible that the same WIF Private Key generates two different addresses?
The same private key can be used to derive a couple of different addresses. For example, there will be a different address generated depending on whether you use a compressed or uncompressed public ...
4
votes
What is the Witness and what data does it contain?
For the segwit variants of an output (P2PKH becomes P2WPKH and P2SH becomes P2WSH), the witness contains the same data that would be found in the scriptSig. For P2PKH, in the scriptSig, you would have ...
4
votes
How can one see if an address is multisig?
Once an address has been spent from, the script that is used to create the P2SH address will be revealed in the spending transaction. So any addresses that have the 'm-of-n' information listed on that ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
p2sh × 195script × 44
multi-signature × 32
transactions × 26
segregated-witness × 25
bitcoin-core × 22
p2pkh × 18
address × 14
signature × 14
raw-transaction × 12
scriptsig × 11
bip32-hd-wallets × 9
p2wpkh × 9
wallet × 7
bech32-address × 7
p2wsh × 7
blockchain × 6
bitcoinj × 6
bitcoind × 5
hash × 5
private-key × 4
litecoin × 4
development × 4
public-key × 4
testnet × 4