Questions tagged [segregated-witness]

Segregated Witness (segwit) defines a transaction format introduced in 2017 which doesn't include signatures in the transaction identifier (txid).

Filter by
Sorted by
Tagged with
2 votes
1 answer
115 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 ...
LeaBit's user avatar
  • 478
0 votes
1 answer
56 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, ...
LeaBit's user avatar
  • 478
2 votes
1 answer
83 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” ...
Murch's user avatar
  • 72.6k
6 votes
1 answer
163 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) ...
mathboi's user avatar
  • 127
2 votes
4 answers
479 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?
rwysbotf's user avatar
1 vote
1 answer
124 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 ...
user avatar
0 votes
1 answer
140 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 ...
dassd's user avatar
  • 1,029
0 votes
0 answers
30 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 ...
alnostru's user avatar
0 votes
1 answer
34 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 ...
Mercedes's user avatar
  • 797
1 vote
0 answers
142 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 ...
dassd's user avatar
  • 1,029
1 vote
1 answer
318 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 ...
dassd's user avatar
  • 1,029
0 votes
0 answers
46 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 ...
bitc's user avatar
  • 1
0 votes
1 answer
28 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 ...
Nicholas Sandomeno's user avatar
0 votes
1 answer
93 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 ...
dassd's user avatar
  • 1,029
1 vote
1 answer
72 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 ...
Buster Mønster's user avatar
2 votes
1 answer
355 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, ...
dassd's user avatar
  • 1,029
1 vote
1 answer
174 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 ...
dassd's user avatar
  • 1,029
0 votes
1 answer
42 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 ...
Mercedes's user avatar
  • 797
1 vote
1 answer
131 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 ...
dassd's user avatar
  • 1,029
5 votes
1 answer
229 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 ...
dassd's user avatar
  • 1,029
1 vote
2 answers
36 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&...
ursuscamp's user avatar
1 vote
1 answer
154 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 ...
Abhishek's user avatar
3 votes
1 answer
347 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?
Murch's user avatar
  • 72.6k
1 vote
1 answer
110 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 ...
Cursed's user avatar
  • 11
2 votes
2 answers
162 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 ...
DeLorean88's user avatar
1 vote
2 answers
118 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 ...
DeLorean88's user avatar
1 vote
1 answer
144 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?
DeLorean88's user avatar
1 vote
1 answer
177 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 ...
ChristianOConnor's user avatar
3 votes
1 answer
178 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 ...
Sina Sharifzade's user avatar
3 votes
1 answer
167 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, ...
WebOrCode's user avatar
  • 333
1 vote
1 answer
63 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),...
WebOrCode's user avatar
  • 333
1 vote
2 answers
180 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 ...
att's user avatar
  • 123
0 votes
1 answer
50 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....
ChristianOConnor's user avatar
1 vote
1 answer
91 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....
ChristianOConnor's user avatar
1 vote
1 answer
1k 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. ...
ChristianOConnor's user avatar
0 votes
0 answers
157 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? ...
att's user avatar
  • 123
2 votes
0 answers
121 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-...
noelle's user avatar
  • 21
0 votes
1 answer
79 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 ...
r_comma_s's user avatar
0 votes
1 answer
322 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 ...
cloudzik's user avatar
2 votes
1 answer
126 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 (...
alemaz98's user avatar
  • 133
1 vote
2 answers
267 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 ...
bitcoinluvr6969's user avatar
0 votes
0 answers
111 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 ...
Roman Andronov's user avatar
5 votes
2 answers
269 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 -> ...
Peter's user avatar
  • 115
3 votes
1 answer
336 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 ...
btctestdev11's user avatar
0 votes
1 answer
56 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. ...
Simon L's user avatar
  • 111
14 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 ...
Son Kaos999's user avatar
1 vote
1 answer
158 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 ...
Hunter Beast's user avatar
1 vote
1 answer
145 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?
Fernando N.'s user avatar
2 votes
1 answer
62 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 ...
Simon L's user avatar
  • 111
12 votes
2 answers
832 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 ...
RedGrittyBrick's user avatar

1
2 3 4 5
12