Questions tagged [segregated-witness]
A 2017 softfork that introduced a new transaction format to fix third-party transaction malleability and increased the blocksize.
625
questions
3
votes
1
answer
127
views
Did Segwit (BIP141) eliminate all txid malleability issues listed in BIP62?
There are 9 malleability issues listed in the BIP62, but doesn't seem like BIP141 addressed all of them. If not, why not and why is it not an issue for Lightning or other DoS vectors?
What is exactly ...
0
votes
1
answer
26
views
Is Testnet3 Addresses Support Segwit P2WSH P2WPKH transactions?
How Do I Know if My Bitcoin Address Is Segwit?
"Today, many Bitcoin wallets support SegWit by default. Bitcoin SegWit addresses typically start with a “3” or “bc1”.
Addresses starting with “3” ...
1
vote
1
answer
53
views
How to get Segwit address from OKX wallet
I am going to connect OKX wallet in my bitcoin based game app and have one problem in getting native segwit address from okx wallet. I read their developer doc and there are two way to get address. ...
0
votes
0
answers
34
views
Manual Bitcoin transaction assembly: which output type should be used and how to compose a segwit field?
I try to sign the following transaction:
...
1
vote
1
answer
113
views
Is it possible to "label" Segwit spendable output ScriptPubKeys with arbitrary bytes?
If one created a Redeem Script for a transaction output following a P2SH-P2WPKH pattern but with bytes prepended, something like:
OP_PUSHBYTES_8 41206c6162656c2e OP_DROP OP_0 OP_PUSHBYTES_20 <20 ...
1
vote
0
answers
35
views
Why is Taproot important to Ordinals? [duplicate]
I've learned SegWit, Taproot, Schnoor and Ordinals recently. I can understand all these terms. But I don't understand why people say Taproot makes Ordinals possible.
Taproot is actually the version 1 ...
1
vote
1
answer
62
views
How can a replace occur with a tx with lower fee and feerate?
I have seen a tx A get replaced by a tx B, where B had a lower fee and feerate than A and it was broadcasted later. How is it possible?
These are the txs details:
Tx A: segwit, ̶t̶a̶p̶r̶o̶o̶t̶, ...
0
votes
1
answer
89
views
How to create and sign a segwit transaction using any npm pacakge
So I am using this NPM package ( https://www.npmjs.com/package/bitcore-lib )
to create and sign a Bitcoin legacy transaction locally and it was working fine for legacy.
But when I tried to do the same ...
3
votes
1
answer
63
views
What's the reason for the scriptCode format for a P2WPKH? (BIP 143)
When signing a P2WPKH input, the P2WPKH locking script is converted to the pattern of a legacy P2PKH when creating the scriptCode.
From BIP 143:
For P2WPKH witness program, the scriptCode is ...
0
votes
2
answers
48
views
marker byte interpretation by legacy transaction parser [duplicate]
The marker byte is interpreted by a legacy transaction parser as number of inputs in the transaction and is always 0. My question is, why is a transaction with 0 inputs considered valid by a legacy ...
0
votes
0
answers
29
views
How to spend one or more p2tr inputs in python?
I see that bitcoinlib does not support taproot yet. Is there any good lib out there to spend one or more taproot inputs? I would like to create txs like this:
...
"inputs": [
{
&...
0
votes
2
answers
74
views
How do pre-Segwit nodes interpret transactions containing Taproot OP_CHECKSIGADD?
When pre-Segwit nodes encounter blocks with Segwit transactions, they'll see them as "spent anyone can spend" transactions and so can validate them and move on to the next block.
However, ...
2
votes
1
answer
124
views
Exact witness requirements for a segwit transaction with P2PKH and P2WPKH inputs
Segwit transactions can mix segwit and non-segwit inputs:
Segwit transaction from mixed addresses (segwit and non-segwit)
Can I build a raw segwit transaction with no segwit inputs?
But how exactly ...
0
votes
1
answer
123
views
Why can I not find my transaction in the mempool?
I built a native segwit raw v2 transaction with the pwpkh addresses, and get the decoded transaction as the follows
{
"version": "02000000",
"marker": "00",
...
0
votes
1
answer
75
views
how to create txid from transaction.json
Consider this is the transaction.json file:
{
"version": 1,
"locktime": 0,
"vin": [
{
"txid": "...
0
votes
0
answers
82
views
Getting error "non-mandatory-script-verify-flag (Witness program hash mismatch)" when trying to send raw signed transaction
I'm trying to send a fairly simple segwit transaction with multiple input and outputs using bitcoinlib, here's how the simplified code looks like:
from bitcoinlib.transactions import Output, Key, ...
1
vote
1
answer
44
views
Transaction Validation
What will it mean if the tranasaction input contains both signature script and witness, in case of scriptpubkey_type of p2sh or p2pkh, will it be invalid or valid ? As we use witness for SegWit ...
6
votes
3
answers
733
views
What are the risks of running a pre-SegWit node (0.12.1)?
Many in the anti-spam faction have contemplated running a pre-SegWit node. But they're told that it is an insecure downgrade and a detrimental idea. So,
Is it safe to assume that Bitcoin is not soft-...
0
votes
1
answer
45
views
Example of computing segwit txid from raw tx data
txid = 4508d55cf0d93ac43cbbb13a3b63d7a1e146911745f049893fc6b2d84e4e1256
raw block data = ...
3
votes
1
answer
92
views
Creating a raw Segwit transaction from scratch and getting Signature must be zero for failed CHECK(MULTI)SIG operation
I am trying to create a Segwit transaction on TESTNET from scratch while referencing an online guide:
https://medium.com/coinmonks/creating-and-signing-a-segwit-transaction-from-scratch-ec98577b526a
...
2
votes
1
answer
120
views
the purpose of the field before signature in P2WPKH
what is the purpose of that 02 in this P2WPKH transaction :
01000000
0001
01
d6f3994ab779ac849996a6235699ced672fa4b8334f825a2f1fcb4081c5b0c62
00000000
00
ffffffff
02
1027000000000000
16
...
-2
votes
1
answer
30
views
Problem identifying the transaction hash for a new segwit uxto wallet
How do I the transaction id or transaction hash of a new segwit wallet I just created and sent tokens to? The transaction hash I see from blochian.info refers to the hash of the previous transaction.
...
2
votes
1
answer
158
views
Which private key is used in Taproot transactions?
The transaction only has one input, where its scriptPubKey is --> Op_1 Q , where Q is the tweaked public key.
Let p = private key, P = Public key, q = p + tweak, Q = tweaked Public key
To create ...
1
vote
1
answer
105
views
Nonstandard witness when building a transaction
i try to spend a P2WSH 2of2 multisig input in Python for learning purposes.
When i check my assembled TX with testmempoolaccept i get "bad-witness-nonstandard".
This is my function to ...
2
votes
1
answer
113
views
What is the default private key type for legacy and segwit addresses?
In a library I'm reading, I can export a private key to a WIF, which takes a compressed boolean parameter. It reads:
"...False if you want a standard WIF export (the most standard option). True ...
1
vote
1
answer
164
views
Are there plans to make a script invalid if there is more than one element left in the stack?
In BIP62, it was proposed to make a script invalid if there was more than one element left in the stack after execution. This proposal was eventually withdrawn.
From what I read, some people have ...
0
votes
1
answer
988
views
Accidently sent BTC to taproot wallet on Phantom. Wondering how i can get it back to Segwit so i can buy ordinals with it
Hey Guys i sent BTC to my Phantom Taproot account, but now i realize i should have sent it to my segwit acccount. Im wondering how i can transfer it over and if its even possible on Phantom. It was 0....
0
votes
1
answer
134
views
Meaning of xPub in SegWit wallet on blockchain.com and their legacy-type addresses
According to my understanding, an xPub of a Legacy sub-wallet should begin with xpub... and of a SegWit sub-wallet with zpub.... And the addresses begin with 1 and bc1 respectively.
But on blockchain....
0
votes
1
answer
285
views
What is arbitrary witness data and unspent transaction output?
I'm learning about bitcoin, and I keep seeing arbitrary witness data and I'm confused what it really means. Like what do they mean about arbitrary, does that just mean the data can be anything you ...
2
votes
1
answer
108
views
Is a BIP required for the removal of SegWit Discount for Inscriptions?
Is a BIP required for the removal of SegWit Discount for Inscriptions?
The rationale of such a change is to standardize the fee structure across all data types included in a block, ensuring that ...
0
votes
1
answer
82
views
What happens when we send MSG_WITNESS_TX/MSG_WITNESS_BLOCK to non-segWit node?
Unknown services flag are ignored by node that don't know them, but what about GETDATA messages and identifiers?
For services flag, if node is not updated e.g to segWit, it will just not check (1<&...
1
vote
1
answer
146
views
P2WSH Bitcoin Core Witness Script Empty Error
I am trying to spend a P2WSH output. Here are the steps I have taken:
I have created a P2WSH output via bitcoin-cli. These are the details of the P2WSH output:
Type
V0_P2WSH
scriptPubKey (asm)
OP_0 ...
4
votes
1
answer
166
views
Are all transactions, whether SegWit or non-SegWit, part of the commitment in a coinbase transaction?
A merkle root in a block header is a way to commit all transactions in that block. However, since it does not cover transaction witness data, another commitment needs to be made in a coinbase ...
2
votes
1
answer
82
views
What would happen if we provide witness program different than 32 bytes for SegWit 1?
If the witness program (at the time of writing this question) is greater than 1, it is considered as anyone-can-spend output. Also, if the witness version is 1 and the witness program is 32 bytes, ...
2
votes
1
answer
116
views
Can a non-segwit transaction be serialized in the segwit format?
What would happen if a node sent a non-segwit transaction with flag and marker bytes announcing a witness section, but then put 0x00 for each input’s witness stack? Would this “waste of extra bytes” ...
6
votes
1
answer
188
views
Why are hashSequence and hashPrevouts computed separately?
When a Segwit transaction is signed, among the many hashes that are calculated to create the data that is going to be signed, the hash of the concatenated [input + index] is calculated (hashPrevouts) ...
2
votes
4
answers
1k
views
Why are some bc1 addresses 42 characters and others 62 characters in Base58?
The length of bc1 Bitcoin addresses varies between 42 and 62 characters in Base58 encoding. What causes this difference in character count?
1
vote
1
answer
136
views
How are the block header bytes treated when calculating the block size in weight?
In pre-segwit, block header bytes were counted as "1 byte" and participated equally in the block size up to 1MB. Since the header is 80 bytes, we would actually have 999,917 bytes (1,000,000 ...
0
votes
1
answer
330
views
What is the way that fee is calculated in post-segwit bitcoin?
In pre-segwit bitcoin, process of calculating transaction fee was easy. Actually everything was based on the fact that the byte has its own value/price (estimated by network) and then fee is obtained ...
0
votes
0
answers
41
views
signing input for spend funds locked by this script
Please explain how to sign input for raw transaction with privet key corresponding to 1st or 2nd public key in this script
"asm": "OP_IF 1694275749 OP_CHECKLOCKTIMEVERIFY OP_DROP ...
0
votes
1
answer
81
views
P2SH-P2WSH-P2PKH and P2SH-P2WPKH
What are the advantages and disadvantages of using P2WSH-wrapped P2PKH instead of P2WPKH?
What are the advantages and disadvantages of using P2SH-wrapped P2WSH-wrapped P2PKH instead of P2SH-wrapped ...
1
vote
0
answers
183
views
Why is the discount on segWit data exactly a factor of 4 and not 5, 6 or something higher?
According to BIP141, the formula for calculating block/transaction weight is:
BASE SIZE * 3 + TOTAL SIZE
According to Bitcoin wiki (and also based on the above formula):
Each byte of the segwit ...
2
votes
1
answer
402
views
How is segwit backward compatible (soft fork) when the transaction serialization structure is changed?
I understand that SegWit is backward compatible (soft-fork) from this perspective.
So, for old nodes the following output script (scriptPubKey)
OP_n (where n from 0 to 16) <2-40 bytes>
... is ...
0
votes
1
answer
105
views
conditional spending from P2WSH address
What im doing wrong?
Sinse I found out that Bitcoin is programmable money Im trying to use it potential.
Using this site https://improvein.github.io/bitcoin-forge/?#/script/create I’ve created a ...
0
votes
1
answer
45
views
What mechanism is used by nodes to link Witness data to its Transaction?
I am stuck in developing an understanding of how a node could go from SegWit TXID to lookup Witness data, or vice-versa.
I see that eventually a witness TXID is calculated and included in a Merkle ...
0
votes
1
answer
111
views
Does adding OP_1 to scriptSig create a fork between non-segWit and segWit nodes?
According to this, when the scriptPubKey equals to:
OP_n (with n between 0 and 16, inclusive) followed by a direct push of exactly 2 to 40 bytes inclusive
... it denotes the start of SegWit validating ...
1
vote
1
answer
216
views
Segwit Taproot xPub switchup
I'm hoping someone can help me out here. I added a new wallet to my BTCPayServer, but I did not add "-[taproot]" to the end of the xPub. I assume that it then was perceived as a Segwit ...
2
votes
1
answer
579
views
What is the purpose of P2WPKH-P2SH?
When I ask the google what is the purpose of P2WPKH nested in P2SH, it says the following:
This allows the user to send funds to a SegWit (Segregated Witness)
address using a non-SegWit transaction, ...
1
vote
1
answer
291
views
What does it mean that BIP141 is "buried" in Bitcoin core?
I am reading the list of BIPs implemented in Bitcoin core (link) and it says that BIP141 is "buried since v0.19.0", what does that mean? Does this mean that what written in BIP141 is no ...
0
votes
1
answer
48
views
Are contrived combinations of address format and segwit version program possible?
I wonder that I'm unable to see how exactly BIP 0341 forbids v1+ segwit from using bech32.
Does consensus allow combining v1+ segwit programs with the bech32 format?
I could expect v0 segwit was maybe ...