web3p / web3.php

A php interface for interacting with the Ethereum blockchain and ecosystem. Native ABI parsing and smart contract interactions.
MIT License
1.15k stars 540 forks source link

Invalid signature v value #328

Closed adriftgreat closed 10 months ago

adriftgreat commented 11 months ago

When I use the sendRawTransaction method, I always prompt Invalid signature v value. May I ask what the problem is? Thank you Here is my code

$transaction=   new Transaction([
    'nonce' => Utils::toHex('0', true),
    'from' => $config['address'],
    'to' => $toAddress,
    'gas' => '0x76c0',
    'gasPrice' => '0x9184e72a000',
    'value' => '0x9184e72a',
    'chainId' => $config['chan_id'],
]);

$ethObject  =   new Eth($config['node_url']);
$toAddress  =   '0x5cE4Df07A7f1003Ce07Fb790d7bEC574F82d60Ad';

$signedTransaction = '0x'.$transaction->sign($config['private_key']);

$transactionInfo    =   [];
$ethObject->sendRawTransaction($signedTransaction, function($err, $data) use(&$transactionInfo) {
    if ($err !== null)
    {
        $transactionInfo['message'] =   $err->getMessage();
    }

    $transactionInfo['response'] =   $data;
});

print_r($transactionInfo);`
adriftgreat commented 10 months ago

Is this library already unmanned for maintenance? I tried and used the NodeJs package to solve the problem