cashscript icon indicating copy to clipboard operation
cashscript copied to clipboard

restricting sighash flag used by signer with covenants

Open mr-zwets opened this issue 5 months ago • 1 comments

Currently the CashScript docs do not have any info on how to restrict the sighash flag used by signer with a covenant

Hashtype value is last byte of the sig

so you could do something like

function example(sig userSig){
  bytes userSighashFlag = userSig.split(63)[1];
  // SIGHASH_UTXOS = 0x20
  require(userSighashFlag  == 0x20);
}

I think the above is actually acceptably clear as code, but we'd need more info in the docs about when it make sense to restrict the sighash types and maybe extra explanation about how they work

mr-zwets avatar May 16 '25 16:05 mr-zwets