делаю оплату криптой, вот код на бекенде
$web3 = new Web3(env('INFURA_API_HTTPS'));
$eth = $web3->getEth();
$nonce = null;
$eth->getTransactionCount(env('WALLET_ADDRESS'), 'pending', function ($err, $result) use (&$nonce) {
if ($err) {
throw new \Exception("Nonce error: $err");
}
$nonce = $result->toString();
});
$gasLimit = null;
$contract = (new Contract(env('INFURA_API_HTTPS'), env('CONTRACT_ABI')))->at(env('CONTRACT_ADDRESS'));
$contract->estimateGas('transfer', $to, $value,
['from' => env('WALLET_ADDRESS')], function ($er, $res) use (&$gasLimit) {
$gasLimit = $res->toString();
});
$gasPrice = null;
$eth->gasPrice(function ($err, $result) use (&$gasPrice) {
if ($err) {
throw new \Exception("Gas price error: $err");
}
$gasPrice = $result->toString();
});
$data = '0x'.$contract->getData('transfer', $to, $value);
$transaction = new \kornrunner\Ethereum\Transaction(
dechex($nonce),
dechex($gasPrice),
dechex($gasLimit),
env('CONTRACT_ADDRESS'),
dechex('0'),
$data
);
$signedTx = '0x'.$transaction->getRaw(env('WALLET_PRIVATE_KEY'), 80001);
$txHash = null;
$eth->sendRawTransaction($signedTx,
function ($err, $result) use (&$txHash) {
if ($err) {
throw new \Exception("Send error: $err");
}
$txHash = $result;
dd($result);
});
он выплевывает invalid sender
думал приватный ключ кривой
написал на ноде выплату - все ок., значит проблема в пхп-коде
сколько не рассматривал код либ(web3php web3js) - где ошибка не вижу