Skip to main content
Share Your Experience: Take the 2024 Developer Survey

Questions tagged [segregated-witness]

A 2017 softfork that introduced a new transaction format to fix third-party transaction malleability and increased the blocksize.

Filter by
Sorted by
Tagged with
0 votes
0 answers
14 views

How to create a litecoin testnet segwit wallet offline [closed]

Hi So I am using the bitcoinjs-lib pacakge to generate wallet address and private keys locally but it seems like it's creating the litecoin address of legacy type, my goal is here to create of segwit ...
Sudhanshu Sinha's user avatar
1 vote
1 answer
48 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̶, ...
user80100's user avatar
0 votes
1 answer
48 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 ...
Sudhanshu Sinha's user avatar
3 votes
1 answer
39 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 ...
inersha's user avatar
  • 3,155
0 votes
2 answers
40 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 ...
mon's user avatar
  • 3
0 votes
0 answers
10 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": [ { &...
user80100's user avatar
0 votes
2 answers
59 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, ...
Lee's user avatar
  • 833
2 votes
1 answer
97 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 ...
Lee's user avatar
  • 833
0 votes
1 answer
65 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", ...
Jack Tsia's user avatar
0 votes
1 answer
49 views

how to create txid from transaction.json

Consider this is the transaction.json file: { "version": 1, "locktime": 0, "vin": [ { "txid": "...
Yuvraj Chhetri's user avatar
0 votes
0 answers
38 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, ...
Javier Villanueva's user avatar
1 vote
1 answer
34 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 ...
lladane's user avatar
  • 13
6 votes
3 answers
716 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-...
WhoIsNinja's user avatar
0 votes
1 answer
32 views

Example of computing segwit txid from raw tx data

txid = 4508d55cf0d93ac43cbbb13a3b63d7a1e146911745f049893fc6b2d84e4e1256 raw block data = ...
Meir's user avatar
  • 13
3 votes
1 answer
60 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 ...
thotheolh's user avatar
  • 207
2 votes
1 answer
105 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 ...
user avatar
-2 votes
1 answer
26 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. ...
TrustCode's user avatar
2 votes
1 answer
108 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 ...
J S's user avatar
  • 35
1 vote
1 answer
79 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 ...
f321x's user avatar
  • 11
2 votes
1 answer
77 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 ...
Zenul_Abidin's user avatar
1 vote
1 answer
136 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 ...
mathboi's user avatar
  • 191
0 votes
1 answer
542 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....
john's user avatar
  • 1
0 votes
1 answer
73 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....
JoZeff's user avatar
  • 9
0 votes
1 answer
163 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 ...
Mark's user avatar
  • 9
2 votes
1 answer
94 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 ...
BitcoinFanatic's user avatar
0 votes
1 answer
77 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<&...
Cosmos's user avatar
  • 199
1 vote
1 answer
109 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 ...
BitcoinQuestioner's user avatar
4 votes
1 answer
156 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
  • 950
2 votes
1 answer
77 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
  • 950
2 votes
1 answer
111 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
  • 75.7k
6 votes
1 answer
178 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
  • 191
2 votes
4 answers
990 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
132 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
285 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,099
0 votes
0 answers
37 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
56 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
  • 804
1 vote
0 answers
180 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,099
2 votes
1 answer
382 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,099
0 votes
0 answers
57 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
41 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
99 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,099
1 vote
1 answer
173 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
486 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,099
1 vote
1 answer
251 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,099
0 votes
1 answer
44 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
  • 804
1 vote
1 answer
140 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,099
5 votes
1 answer
263 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,099
1 vote
2 answers
39 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
166 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
358 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
  • 75.7k

1
2 3 4 5
13