Questions tagged [segregated-witness]
A 2017 softfork that introduced a new transaction format to fix third-party transaction malleability and increased the blocksize.
632 questions
0
votes
1
answer
111
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
49
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
112
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
241
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
666
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
317
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 ...
1
vote
1
answer
157
views
What are the main advantages/purposes of SegWit today?
I am currently learning about SegWit and trying to understand what it is used for. It is clear to me that it was primarily introduced to overcome txid malleability, but...
Looking at this question and ...
5
votes
1
answer
306
views
What types of transaction malleability exist and which one of them does SegWit solve?
I am little confused about what types of transaction malleability exist in bitcoin and which one of them does SegWit solve.
Here Antoine Poinsot talks about txid malleability and third-party ...
1
vote
2
answers
45
views
Why is this P2WSH spend triggering a verification failure when broadcasting?
I'm experiment with building SegWit transactions manually, and I've written a non-standard simple script just for testing. No signing or anything, just your usual "add two numbers, check equality&...
1
vote
1
answer
174
views
What do the following lines of code do in the context of sending Bitcoin?
I have recently started dev on Bitcoin and have a doubt regarding the following code. I have a dApp that prompts users to connect their BTC Wallet and in return, I get their address(testnet).
I want ...
3
votes
1
answer
373
views
Why are there 17 native segwit versions?
Given that computers operate in binary, we often see various limits and scopes come in powers of 2. How come there are not sixteen (0–15) but seventeen (0–16) different native segwit versions?
1
vote
1
answer
205
views
Error Validating Segwit Transactions using Python Blockcypher API: Error Running Input Script
As the title states, I'm trying to send a Litecoin transaction using the Blockcypher API Python SDK, and using Bitcoinlib for key management. I have extensively reviewed the documentation and source ...
4
votes
2
answers
422
views
Can someone explain the byte composition of an inscription reveal transaction?
Doom was inscribed on chain. The reveal transaction had the following script
OP_PUSHBYTES_32 1809cc80b0c9bf0277e774f7f78c5dd0c61f9eda7bec7875dc99457bbf61af8f
OP_CHECKSIG
OP_0
OP_IF
OP_PUSHBYTES_3 ...
1
vote
2
answers
195
views
Inscriptions with size less than 10Kb were seemingly possible before taproot, why did they become popular only now?
In 2017 SegWit soft fork introduced consensus limit on script size MAX_STANDARD_P2WSH_SCRIPT_SIZE=10000. With P2WSH, one could seemingly use the same script structure ("envelope") OP_FALSE ...
1
vote
1
answer
382
views
Where exactly is the Inscription media stored in witness signature? [duplicate]
Is it stored in the witness program as
OP_FALSE
OP_IF
<data>
OP_ENDIF
or is it stored in annex as described in bip 341 or in some other form?
1
vote
1
answer
505
views
I get an Invalid Schnorr signature when trying to broadcast a taproot transaction
I have 0.00036134 testnet bitcoin at the segwit v1 address: tb1p3au39skpdd8suuhunr4ymp6ca6akv9keq20v5twuagpmyqntqaasl22f4w
I wrote this script to achieve 2 things: archive a hash in a transaction and ...
3
votes
1
answer
365
views
How can I find the public key corresponding to a P2TR input?
Can you please tell me what is inside the Taproot Witness data?
For P2WPKH, it is defined in BIP-0141 and we have: <signature> <pubkey>
But for Taproot, I can't find anything similar. Per ...
3
votes
1
answer
181
views
What is considered witness data in SegWit?
What fields in a transaction are considered witness data? I need this to calculate the vsize for fee.
My understanding is these are marker, flag and witness (from 1 and 2).
Or is it just witness, ...
1
vote
1
answer
88
views
Bitcoin transaction malleability is it only for unconfirmed transaction?
I do understand what is transaction malleability and how to do it in practice eg. DER-encoded ASN.1, ECDSA and know that these 2 have been fixed.
Also there are some other types (do not know examples),...
1
vote
2
answers
354
views
importmulti native segwit address to fetch utxos of p2wpkh native segwit address
I must fetch utxos for a native segwit address from the local Bitcoin node.
First I wanted to import the segwit address. However, it fails.
How can I import a native segwit address? I'm using latest ...
0
votes
1
answer
78
views
How can I optimize my python script that creates a btc native segwit tx with an OP_RETURN message?
I have the following code that successfully created a bitcoin transaction with an OP_RETURN message:
from bitcoinutils.utils import to_satoshis
from bitcoinutils.setup import setup
from bitcoinutils....
2
votes
1
answer
261
views
How do I use python-bitcoin-utils to add an OP_RETURN message into a bitcoin transaction?
I have the following code that successfully created a bitcoin transaction with python-bitcoin-utils:
from bitcoinutils.utils import to_satoshis
from bitcoinutils.setup import setup
from bitcoinutils....
2
votes
1
answer
3k
views
python-bitcoin-utils - sendrawtransaction RPC error: {"code":-25,"message":"bad-txns-inputs-missingorspent"} when trying to broadcast my tx?
I am trying to create a bitcoin transaction to send all of the funds from tb1qj6zz96g8xgrwpgmdlvmkrjlwzz54sf47086yc9 to tb1qxgm8j0cq7tnftef3t563psl56gtmzxanm5c9uy. ...
0
votes
0
answers
393
views
bitcoin-cli listunspent returns empty list
I'm running bitcoind bitcoind -regtest and want to send BTC to bcrt1qxhx5gq5gwaju2lh0pxnp7qpn4685cwvst4ql45 segwit address.
Why listunspent returns empty list after sending somebtc to segwit address?
...
2
votes
0
answers
216
views
How to generate a legacy-compatible address using Ledger Live?
I'm trying to withdraw funds from Bittrex to my Ledger device, but it seems they do not accept native Segwit addresses.
Is it possible to generate a legacy-compatible address (for instance a P2SH-...
0
votes
1
answer
104
views
Which value is appropriate for the MARKER field of a segwit tx messages: 0x00 or nonzero?
Reading at the Specification chapter in the BIP-0144 document, there seems to be conflicting statements.
The Description of the marker field in the table says "Must be zero"
Field Size
Name
...
0
votes
1
answer
874
views
How to create SegWit address from mnemonic in Python 3.8.10
I am having trouble creating SegWit address from mnemonic. I can't find any useful code to do that. I tried using BitcoinLib but I don't know how to disable saving wallets to disk.
EDIT:
I found ...
3
votes
1
answer
258
views
Validation of segwit v0-v1 tx automatically adds OP_CHECKSIG?
When I create a segwit transaction v0 (P2WPKH) or v1 (P2TR key-path spend) I do like that (let's spend a P2TR output):
Locking Script (of the P2TR output I'm spending): OP_1 PK_size PK
Witness: 1 (...
1
vote
2
answers
345
views
What are the OP codes associated with bc1?
As the title says I'm trying to extract bc1 addresses by using opcodes I've found from reading about bitcoin online. However, I cannot actually find the opcodes associated with bc1. The segwit outputs ...
0
votes
0
answers
183
views
How to sign SegWit Transaction without using third party libraries (step by step)
I have a PSBT transaction. My code parsed it into its component parts: 3 maps - global input, output. I based on the document 1. I parsed each transaction into separate fields. Found all scripts and ...
5
votes
2
answers
296
views
Is a transaction with a non-segwit input STILL considered malleable? If so how?
Below are a few examples of witness malleability, along with reasons why I believe they are no longer valid:
DER Malleability
For every DER signature with (r,s), there exists 2 valid 's' values -> ...
3
votes
1
answer
1k
views
How to resolve error when trying to sign and broadcast PSBT transaction via electrum - (Witness program hash mismatch code -26)?
I'm trying to generate a 2-of-2 multisig transaction as a PSBT so that both parties can easily sign their transaction. I'm doing this all on btc testnet as a p2sh p2wsh transaction
When initially ...
0
votes
1
answer
91
views
Is the "witness commitment" introduced in bip-0141 optional?
In BIP-0141, it states:
a new block rule is added which requires a commitment to the wtxid.
the coinbase's input's witness must consist of a single 32-byte array for the witness reserved value.
...
16
votes
2
answers
1k
views
Why is witness data downloaded during IBD in prune mode?
Why do pruned nodes download (segregated) witness data during IBD if much of that data is marked as Assumevalid?
These nodes seem to be downloading witness data just to prune it. Since we already know ...
2
votes
1
answer
287
views
Can any Script opcode be used in the witness program, or only specific ones?
I was wondering, can one use an OP_RETURN in the witness script? If not, why not? Also, how could I figure this out from reading Bitcoin Core source? I looked at this file, and it wasn't quite clear ...
1
vote
1
answer
159
views
Effect of the witness data discount on the UTXO set
Part of the rationale to apply the witness data discount was to incentivize transactions to spend more inputs and promote a smaller UTXO set. Are there any data on the success of this pursuit?
2
votes
1
answer
72
views
Bitcoin P2P network: unable to receive the full block data (witness stripped off)
I wrote a small script to play with the bitcoin P2P network.
The script advertises itself as (NODE_NETWORK | NODE_WITNESS), and connects to a full node running on the LAN.
Everything seems to work ...
14
votes
2
answers
1k
views
Follow-up to Segwit: Arbitrary data storage in witness?
In 2017 a question about Segwit: Arbitrary data storage in witness? asked whether people wanting to store more data in the blockchain than OP_RETURN allows could instead store data in the witness ...
5
votes
1
answer
129
views
Why wasn't P2SH-wrapped P2WPK added to any BIP?
Pieter Wuille wrote this:
There is no such thing as P2WPK; the only valid witness v0 programs are P2WPKH (OP_0 + hash160 of pubkey) or P2WSH (OP_0 + sha256 of script).
But I don't understand the ...
0
votes
2
answers
114
views
How can I calculate the length (in bytes) of the Witness data in a transaction?
I'm trying to parse a bitcoin block.
I took as an example this block from 2019. I'm trying to parse the first transaction.
I don't understand how to calculate how many bytes I have to read for the &...
3
votes
2
answers
380
views
Do non-Segwit nodes reject Segwit transactions with invalid signature?
As far as I can tell, non-Segwit nodes receive anyone-can-spend transactions, and thus come with no signature to validate. If a miner included a Segwit transaction to a block with invalid signature, ...
1
vote
1
answer
323
views
How do I determine whether an input or output is segwit? - revisited
This is a discussion that has already been had here, but bear with me.
We're gonna be talking about tx faae7e55db14a32e083cbf6a91db8a5ab6a3b05e050d9cefdec80b47f966848e
all I got is the encoded ...
2
votes
4
answers
129
views
Why doesn't Bitcoin use different types of transactions with only one type of address?
I don't understand that, why does bitcoin need to use different types of addresses for making the different types of transactions? Is'nt it possible to generate different transactions having a ...
1
vote
2
answers
175
views
Is the witness `version` of a bech32 address required to "send spendable funds" to the address?
Let's assume Alice has Bob's bech32 address (BC1QW508D6QEJXTDG4Y5R3ZARVARY0C5XW7KV8F3T4).
After decoding the address Alice knows that the address has a witness version of 0 AND 20 bytes of a hash (32 ...
2
votes
0
answers
28
views
How many transactions could fit in a Bitcoin block pre-SegWit and post-SegWit? [duplicate]
I am interested in how many transactions could fit into a 1MB Bitcoin block before SegWit and then afterwards. I can't find good information about this online and the figures seem to vary quite a bit.
...
1
vote
1
answer
403
views
Using the Bitcoin Crate to Sign a Segwit Transaction
Using the Bitcoin crate, I'm trying to create a transaction programmatically in Rust that spends an output associated with a P2WPKH address. This is the relevant code snippet:
fn sign_transaction<...
0
votes
2
answers
1k
views
Bitcoin Bech32 address validation
Bech32 addresses start with bc1 on the main net and tb1 on the test net.
I want to know whether a segwit address is valid or not.
How can I check that segwit addresses are correctly inserted?
2
votes
2
answers
398
views
Can one infer that a bc1 address is multisig?
Studying privacy and security implications of revealing if a bc1 address belongs to a multisig wallet vs a regular wallet.
I do notice that multisig bc1 addresses are longer than regular ones… P2WSH (...
0
votes
1
answer
122
views
How did SegWit start
My understanding of SegWit is that any non-segwit (legacy) nodes will see a SegWit output as an output anyone can spend (i.e. no signature required). This is currently fine since if the miner mines a ...