PHP code example of digitaldonkey / ecverify

1. Go to this page and download the library: Download digitaldonkey/ecverify library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

digitaldonkey / ecverify example snippets


use Ethereum\EcRecover;

$addrss = '0xbe93f9bacbcffc8ee6663f2647917ed7a20a57bb';
$message = 'hello world';
$signature = '0xce909e8ea6851bc36c007a0072d0524b07a3ff8d4e623aca4c71ca8e57250c4d0a3fc38fa8fbaaa81ead4b9f6bd03356b6f8bf18bccad167d78891636e1d69561b';

// Verify known address
$valid = EcRecover::personalVerifyEcRecover($message,  $signature,  $address);

// Recover unknown address
$recoveredAddress = EcRecover::personalEcRecover($message, $signature);
if ($recoveredAddress === $address) {
  echo 'Jay! it was a long way here. '
}