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
0 votes
2 answers
48 views

Is it possible to create a token on the Bitcoin chain

If we can will the token also follow the same rules as btc?i suspect it might, like btc halving, mining methods
Eli Shane's user avatar
2 votes
2 answers
83 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
90 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
74 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
77 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
71 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
137 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
  • 323
1 vote
1 answer
38 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
  • 323
1 vote
2 answers
63 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
28 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
43 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
233 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
52 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
62 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
55 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 ...
choboplusplus's user avatar
0 votes
1 answer
149 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
81 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
213 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
63 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
4 votes
2 answers
205 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
  • 105
3 votes
1 answer
125 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
41 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
  • 91
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
113 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's user avatar
  • 175
1 vote
1 answer
137 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
51 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
  • 91
12 votes
2 answers
704 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
5 votes
1 answer
69 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 ...
Mercedes's user avatar
  • 693
0 votes
2 answers
60 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 &...
nem0z's user avatar
  • 103
2 votes
2 answers
230 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, ...
Angelo's user avatar
  • 383
0 votes
1 answer
78 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 ...
RooSoft's user avatar
  • 127
2 votes
4 answers
110 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 ...
mjdimn's user avatar
  • 23
1 vote
2 answers
122 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 ...
janniks's user avatar
  • 195
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. ...
paulteachesthings's user avatar
0 votes
1 answer
180 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<...
THLO's user avatar
  • 1
0 votes
0 answers
45 views

How to hash coinbase transactions of recent blocks

For earlier blocks, if I hash the raw data of the first transaction in the block, I get back exactly the transaction hash. However, for recent blocks, this seems no longer work. Can someone give a ...
maggio veneto's user avatar
0 votes
2 answers
387 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?
MJay's user avatar
  • 107
2 votes
2 answers
177 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 (...
sunknudsen's user avatar
0 votes
1 answer
96 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 ...
postgres_trouble's user avatar
0 votes
1 answer
88 views

How does the SegWit part of a transaction get serialized and parsed?

I'm reading Programming Bitcoin. And in Chapter13, I am confused with how the witness part is serialized and parsed. The auther gives the following method to parse it: def parse_segwit(cls, s, testnet=...
Shawn C's user avatar
  • 27
1 vote
1 answer
113 views

Can The Redeem Script Consist Of Only 1 Public Key In P2SH Transactions:

I have a few questions relating to Bitcoin Signatures And P2SH: Why is P2SH used as opposed to other forms? Is it still prevalent today - has SegWit made it redundant or less useful, if not, what is ...
Jamo's user avatar
  • 157
1 vote
2 answers
104 views

How do segwit nodes behave when they receive a transaction between two legacy nodes?

Segwit nodes know about the move of the witnesses to another part of the transaction block. What would happen when they receive a transaction between two legacy nodes, knowing that they will build it ...
nourou4them's user avatar
0 votes
1 answer
57 views

Where Is Signature Data Stored In Post-SegWit Transactions?

If i'm correct, i am pretty sure that signature data such as the scriptsigsize and scriptsig is stored outside the Tx_Data of a Bitcoin transaction. But then where is it stored? Is it in the block or ...
Jamo's user avatar
  • 157
1 vote
1 answer
87 views

How is a Bitcoin transaction signed using ECDSA?

I am quite familiar with the way secp256k1 ECDSA works as well as the equations that are utilised. However, I have no idea how this ECDSA applies to signing Bitcoin (SegWit Format) and transferring it ...
Jamo's user avatar
  • 157
2 votes
1 answer
179 views

SegWit signing algorithm and its improvement

I was reading about Segregated Witness upgrade from the book Mastering Bitcoin by Andreas and there were some questions I have not figured out. I am appreciated to get some of your help! A) There was ...
John Pham's user avatar
3 votes
1 answer
126 views

How do you commit to the previous output's amount when signing a segwit input with rust-bitcoin?

I'm trying to sign a segwit transaction in rust-bitcoin. To start with, my transaction setup looks as follows: let previous_output = OutPoint::new(Txid::from_hex("...
arik's user avatar
  • 218
2 votes
1 answer
251 views

Segwit includes the input amount in the SignatureHash. What possible attack can this prevent?

Legacy transactions only include transaction components in the SignatureHash, but segwit transactions also add the amounts of inputs in the SignatureHash. Quoting from the Mastering Bitcoin Book: ...
The Quantum Physicist's user avatar
1 vote
0 answers
420 views

crypto.com defiwallet sends bitcoin to random segwit address if a bitcoin taproot address is selected after confirmation of the correct address [closed]

UPDATE: Crypto.com acknowledge the bug and refunded the full amount, at the time of writing this update the crypto.com team confirmed that they are working on fixing the bug and the defi wallet will ...
froginspace's user avatar
1 vote
1 answer
60 views

How does a node get information from the TxID?

If I'm right, segwit TxIDs are composed of the SHA^2(256) hash of the non-segwit data of a transaction. But, how does another node use the TxID to obtain information about the transaction such as the ...
Jamo's user avatar
  • 157
1 vote
1 answer
738 views

What are the parts of a Bitcoin transaction in segwit format?

I know that pre-segwit transactions looked like the following (This is the hash of the transaction in block 170 - the 10000 bitcoin pizza exchange): ...
Jamo's user avatar
  • 157

1
2 3 4 5
12