SIGHASH_CONSTRA(IN)FIRSTIN(PUT) - A new sighash flag for efficient covenant spends
Burak Keceli - 01.30.2021 [DRAFT]
Currently interacting with covenants are inefficient and not scalable. In order to interact with a covenant (or calling a function) people must spend from the same covenant state, and this spend is limited to only one interaction per state. Multiple people trying to simultaneously spend from the same state results in unconfirmed transaction chain forks. SIGHASH_CONSTRAFIRSTIN aims to address this issue by allowing multiple participants to interact with the same covenant simultaneously.
How It Works:
SIGHASH_CONSTRAFIRSTIN signs the very first input in addition to input it is part of. It essentially agrees to participate in a transaction, as long as first input is constrained to an expected outpoint.
SIGHASH_CONSTRAFIRSTIN is not a sighash flag standalone, however it can work with three sighash constructions that exist today.
- SIGHASH_SINGLE | SIGHASH_ANYONECANPAY | SIGHASH_CONSTRAFIRSTIN
This construction signs the first input, the input that contains it, and the corresponding output. This says “I definitely want to move this much BCH to this output, but I don’t care about other outputs and any other input except first input in this transaction”.
- SIGHASH_ALL | SIGHASH_ANYONECANPAY | SIGHASH_CONSTRAFIRSTIN
This construction signs the first input, the one input it is part of, and all outputs. It’s essentially saying “I agree to participate in this transaction, as long as the following recipients receive these amounts. I don’t care about any additional inputs except the first input.”
- SIGHASH_NONE | SIGHASH_ANYONECANPAY | SIGHASH_CONSTRAFIRSTIN
This construction signs the one input it is in, and the first input. This is essentially saying “Any transaction including this input can spend this BCH as long as first input is expected outpoint”.
This proposal is licensed under a Creative Commons Attribution 4.0 International License