svm icon indicating copy to clipboard operation
svm copied to clipboard

Implement Simple-Coin with 2-3 MultiSig Template

Open YaronWittenstein opened this issue 3 years ago • 0 comments

Depends on #449

See also: SVM Transactions Signatures

Writing this Template should be very similar to the one at #449. The Template Storage will consist of 3 Public Keys that will be given upon the ctor.

As a reminder on this stage, the Immutable Storage has not been implemented yet (should be part of Simple Coin Integration #4).

The verify method will expect the parties involved in the Signatures as parameters.

It should look in high-level like this:

#[verify]
fn verify(a: u8, b: u8) -> bool {
    if a == b {
      return false;
   }
   
   verify_sig(a, read_sig(0)) && verify_sig(b, read_sig(1))
}

fn verify_sig(id: u8, sig: Blob64) -> bool {
  let pub_key = Storage::get_pub_key(id);
  Host::tx_verify(sig, pub_key)
}

fn read_sig(index: u8) -> Blob64 {
    let sigdata = Host::SigData();

    // decode the `index` signature
    // the exact decoding depends on the ABI of `sigdata`
}

YaronWittenstein avatar Dec 15 '21 07:12 YaronWittenstein