1. Go to this page and download the library: Download arcgen/myeth-php 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/ */
arcgen / myeth-php example snippets
use MYETH\MyEth;
$message = "Hello, world!";
$privateKey = ''; // without 0x (remove 0x before passing private key)
$signedMessage = MyEth::signMessage($message, $privateKey);
echo json_encode($signedMessage);
use MYETH\MyEth;
$transactionEncodedJson = '{"nonce":0,"gasPrice":1000000000,"gas":21000,"to":"0x4bbeEB066eD09B7AEd07bF39EEe0460DFa261520","value":1000000000000000000,"data":""}';
$privateKey = ''; // without 0x (remove 0x before passing private key)
$signedTransaction = MyEth::signTransaction($transactionEncodedJson, $privateKey);
echo $signedTransaction;
use MYETH\MyEth;
$transactionEncodedJson = '{"nonce":0,"gasPrice":1000000000,"gas":21000,"to":"0x4bbeEB066eD09B7AEd07bF39EEe0460DFa261520","value":1000000000000000000,"data":""}';
$privateKey = ''; // without 0x (remove 0x before passing private key)
$web3Provider = 'https://mainnet.infura.io/v3/YOUR_INFURA_PROJECT_ID';
// Invoke the signAndSendTransaction method
$response = MyEth::signAndSendTransaction($transactionEncodedJson, $privateKey, $web3Provider);
echo $response;