web3p / ethereum-tx

Ethereum transaction library in PHP.
https://www.web3p.xyz/ethereumtx.html
MIT License
183 stars 63 forks source link

How to support matic chain? #36

Closed pyaming closed 3 years ago

pyaming commented 3 years ago

$transaction = new Transaction([ 'nonce' => Utils::toHex((string) $cb,true), 'from' => $address, 'to' => '0x50ed39a368498dfe43e556ba1c73f3d861e0ad95', 'gas' => Utils::toHex(21000,true), 'gasPrice' => Utils::toHex(26000000000,true), 'value' => '0x00', 'data' => "0xa9059cbb00000000000000000000000000e11189e3229067a668cc9bd08d233e508b260f00000000000000000000000000000000000000000000005c1a5c8a4fecac0000", 'chainId' =>Utils::toHex(80001,true), ]);

        $signedTransaction = $transaction->sign("0f9e82ccf75a3729818163482173ab36662ed61a7e0a10fcdbb8c7d694fc986b");
        $eth->sendRawTransaction('0x'.$signedTransaction,function ($err,$result){
            exit_data($err);
        });

result : -3002 invalid sender

pyaming commented 3 years ago

chainID type error