10

The lightning network as is is working without SIGHASH_NOINPUT. Thus in its current form it is not needed. However Christian Decker came up with the eltoo payment channel construction. In a nutshell this would get rid of the penalty based construction we use right now and reduce a lot of overhead for maintaining channel state as the state becomes ...


9

The SIGHASH type is serialized as a single byte and then simply appended to the DER-encoded signature. Example of a typical P2PKH scriptSig: 304402206e3729f021476102a06ea453cea0a26cb9c096cca641efc4229c1111ed3a96fd022037dce1456a93f53d3e868c789b1b750a48a4c1110cd5b7049779b5f4f3c8b62001 03ff1104b46b2141df1948dd0df2223720a3a471ec57404cace47063843a699a0f The ...


6

CoinJoin uses SIGHASH_ALL. I initially found this confusing because I assumed the interface to CoinJoin a little less synchronized than it is. CoinJoin requires each participant to first specify a UTXO and a public key to pay out to. Someone then constructs a partially complete transaction which makes use of those UTXOs and pays out to the public keys ...


4

I assume it is simply the result of lazyness. In the original client source code (and still today), the sighash type is represented as an int. The serialization framework by default serializes ints as 4 little-endian bytes. I assume Bitcoin's creator did not bother converting it to a single byte before serializing. If there is any other reason, I'm afraid ...


3

The sighash type conditions what is part of the digest which is eventually signed for the transaction to be valid. Some sighash types allow to either include (commit to) part --or none-- of the outputs of the transaction in the digest. Using these far less common sighash types introduce some malleability for a transaction, which usually allow more ...


3

This struct appears to describe the SIGHASH flags: /** Signature hash types/flags */ enum { SIGHASH_ALL = 1, SIGHASH_NONE = 2, SIGHASH_SINGLE = 3, SIGHASH_ANYONECANPAY = 0x80, }; and it's encoded as the last byte. Note that SIGHASH_ANYONECANPAY can appear in conjunction with any of the three previous flags.


3

SIGHASH_NONE implies that Input 2 will only spend if Input 1 is included in the transaction. This is false. Input 2 is essentially a blank check. SIGHASH_NONE signs none of the outputs (I don't care where the BTC goes), and SIGHASH_ANYONECANPAY signs only input 2 (I don't care who else is participating in the tx. This essentially creates an input, which if ...


2

The purpose for "after certain time, set FORKID to 0xSMTHNG" is to keep the old chain alive but separate, in case of a bug in hard fork. After a Bitcoin Cash hardfork, let's say November 2018, if you're using an incompatible client, a client that complies with May 2018, it'll make transactions with a FORKID that starts with 0xFF00, and those transactions ...


2

A one input/one output tx signed with SIGHASH_SINGLE|SIGHASH_ANYONECANPAY can still be modified to include more inputs and outputs, as long as the original input and output are not modified. A tx signed with SIGHASH_ALL cannot be modified at all, and no new inputs or outputs can be added.


2

When creating a Bitcoin transaction, each input explicitly states which unspent transaction output (UTXO) is consumed (via an outpoint consisting of txid:vout) and then proves the spender's authority to use this unspent. For the standard output format such a proof is a signature created by the private key corresponding to the public key the funds were ...


2

From BIP143: If the ANYONECANPAY flag is not set, hashPrevouts is the double SHA256 of the serialization of all input outpoints; Otherwise, hashPrevouts is a uint256 of 0x0000......0000. All the details you need are in the BIP


1

No, this is not possible - once an outpoint is consumed by a transaction, it is considered spent, including within the same transaction. Your only option here would be to have an intermediary transaction splitting A (or using another input), and then using the two outputs from that as inputs along with SIGHASH_SINGLE | SIGHASH_ANYONECANPAY for your flags. ...


1

However, the length bytes seem to make the entire process extremely complex. Not very complex. Here is a piece of my code for generating digest for standard non-segwit transactions and sighash_all inputs (I do not need and have not tested other hashtypes). const MyKey32 Transaction::getDigest ( const int n, const QByteArray& scr ) const { ...


1

A signature is applied to the input being signed by default, so you don't really pick the input. You have two options: SIGHASH_SINGLE - All inputs are signed, and a single output with the same vout index as your vin index is signed. That is to say, if you have a tx with 5 inputs, out of which your input is the second one, and 4 outputs, all five inputs and ...


1

Partial answer (not a new solution - I merely adapted the micropayment channel protocol): if you allow for public key exchange, one solution seems to me to be: t1: source funds an address A controlled by source and escrow t2: source partially signs transaction T spending A to destination. Then she sends this partially signed transaction to escrow. it is ...


1

First, it should be said it's not possible to enforce which sighash flags may be used in a P2SH address. Signing is a concern for only the parties to wish to spend funds. Their intent can be captured using SIGHASH flags when signing. OP is right, and certainly can mix SIGHASH flags in an input script. Signatures in the same script are considered separately,...


Only top voted, non community-wiki answers of a minimum length are eligible