Returns a Result
to let the caller choose an error handling strategy.
Follows the Secp256k1 elliptical curve.
signature
: [B512] - The signature generated by signing a message hash.msg_hash
: [b256] - The signed data.use std::{ecr::ec_recover_address, b512::B512};
fn foo() {
let hi = 0xbd0c9b8792876713afa8bff383eebf31c43437823ed761cc3600d0016de5110c;
let lo = 0x44ac566bd156b4fc71a4a4cb2655d3dd360c695edb17dc3b64d611e122fea23d;
let msg_hash = 0xee45573606c96c98ba970ff7cf9511f1b8b25e6bcd52ced30b89df1e4a9c4323;
let address = Address::from(0x7AAE2D980BE4C3275C72CE5B527FA23FFB97B766966559DD062E2B78FD9D3766);
let signature: B512 = B512::from((hi, lo));
// A recovered Fuel address.
let result_address = ec_recover_address(signature, msg_hash).unwrap();
assert(result_address == address);
}