Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sign function does not work correctly #27

Closed
sarlongda opened this issue Jul 30, 2020 · 1 comment · Fixed by #31
Closed

sign function does not work correctly #27

sarlongda opened this issue Jul 30, 2020 · 1 comment · Fixed by #31
Labels
good first issue Good for newcomers

Comments

@sarlongda
Copy link

sarlongda commented Jul 30, 2020

I used this library to test sendRawTransaction.
But I am getting this error - "transaction could not be decoded: could not recover from address: could not recover secp256k1 key: calculated Rx is larger than curve P" when I send signed transaction

f8ed01850861c46800827d0094d02a1ed82FA5091A5639dc507f2F6130E5Bc61Be80b8886139303539636262303030303030303030303030303030303030303030303030326130383566313530646638333639306165353232653933616136336530363466646166303439303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030343824a0bb8e9387f97cca50d0193bbbc57ebd1071156ed539e89beeeb73e104f8d01df0a07ada6542d9d29dc0c238ce54df923a35995f830f476b2b60167b72a6bbdf793d

This is my signed transaction by using transaction->sign() function
In my view, this result is wrong.

$eth->getTransactionCount($fromAccount, 'pending', function($err, $nonce) use ($eth, $fromAccount, $data) {
$rawTransaction = new Web3Transaction([
"from" => $fromAccount,
"gasPrice" => '0x861c46800',
"gasLimit" => '0x7d00',
"to" => env('CONTRACT_ADDRESS'),
"value" => "0x0",
"data" => $data,
"chainID" => 1,
"nonce" => sprintf('0x%s', dechex(intval($nonce->toString())+1))
]);
$signedTx = $rawTransaction->sign(env('COMPANY_PRIVATE_KEY'));
Log::debug($signedTx);
$eth->sendRawTransaction(sprintf('0x%s', $signedTx), function ($err, $tx) {
if ($err !== null) {
Log::debug("Error: " . $err->getMessage());
}
Log::debug('TX: ' . $tx);
});
});

This is my code to get the result.
Anyone can help me with this issue?

@sc0Vu
Copy link
Member

sc0Vu commented Sep 21, 2020

@sarlongda

I'm not sure whether the issue is, but it looks like some number was too big so the X is out of limit.

Did you use 32 bytes of private key (do not paste key here)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants