Skip to content

Instantly share code, notes, and snippets.

@jasny
Created October 17, 2022 15:10
Show Gist options
  • Save jasny/8273ce6f1b67dec4f654b82ba332ec0c to your computer and use it in GitHub Desktop.
Save jasny/8273ce6f1b67dec4f654b82ba332ec0c to your computer and use it in GitHub Desktop.
#define public keys
let alicePubKey = base58'5AzfA9UfpWVYiwFwvdr77k6LWupSTGLb14b24oVdEpMM'
let bobPubKey = base58'2KwU4vzdgPmKyf7q354H9kSyX9NZjNiq4qbnH2wi2VDF'
let cooperPubKey = base58'GbrUeGaBfmyFJjSQb9Z8uTCej5GzjXfRDVGJGrmgt5cD'
#check whoever provided the valid proof
let aliceSigned = if (sigVerify(tx.bodyBytes, tx.proofs[0], alicePubKey ) || sigVerify(tx.bodyBytes, tx.proofs[1], alicePubKey )) then 1 else 0
let bobSigned = if (sigVerify(tx.bodyBytes, tx.proofs[0], bobPubKey ) || sigVerify(tx.bodyBytes, tx.proofs[1], bobPubKey )) then 1 else 0
let cooperSigned = if (sigVerify(tx.bodyBytes, tx.proofs[0], cooperPubKey) || sigVerify(tx.bodyBytes, tx.proofs[1], cooperPubKey)) then 1 else 0
#sum up every valid proof to get at least 2
aliceSigned + bobSigned + cooperSigned >= 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment