SendRawTransaction hash don't show anything with etherscan

I’m developing some Laravel application for use ETH smart contracts.

I have user web3 php package for the integration. I want to call my smart contract function (‘transfer’)
to transfer some ERC20 custom tokens to another wallet from master wallet. when I used sendRawTransaction function it returns transaction hash. but I can’t see transaction information with
Etherscan . and also getTransactionResipt function also don’t work with this txhah.

can you guys please help me to success this .

Used Ropston network. and when I’m trying with wallet to wallet transaction using Metamask it works fine without an error. only here I have issue.

below I attached my code.

// Contract function used from web3.php => https://github.com/web3p/web3.php
// Transaction used from web3p/Transaction-tx => https://github.com/web3p/ethereum-tx

$this->contract = new Contract(new HttpProvider(new HttpRequestManager("https://ropsten.infura.io/v3/My APi Key", 0.1)), $this->abi);


$custom_token=100;

$data = $this->contract->at($this->contract_address)->getData('transfer', $this->to_address, $custom_token, ['from' => $this->contract_owner]);

$transaction = new Transaction([
    'nonce' => $this->tr_count + 1,
    'from' => $this->contract_owner,
    'to' => $this->contract_address,
    "gasPrice" => "3000",
    "gas" => 566540,
    'value' => 0, // 0.1 eth
    'data' =>  $data,
    'chainId' => 0x03,
]);

$signedTransaction = '0x' . $transaction->sign('my private address');

$this->eth->sendRawTransaction($signedTransaction, function ($err, $resp) {
    dd($err, $resp);
});

Hi @lathindu1, and welcome to the Infura community!

Are you getting an error message at all?
Note that even though you receive a transaction ID, it doesn’t necessarily mean the transaction itself got mined. You might be trying to send your transaction with too low of a gas price, or perhaps an incorrect nonce number.

I’m not super familiar with Laravel, but that may help get you on the right track!

Hey @Leiya_Kenney thank you very much for your reply.
I calculated expected gas and sent more than that. so made different diferrent transactions. even today I can’t see any report for that transactions. it’s gone 8/9 days but can’t get any success or not with returned tx id.

Okay; sounds like the gas price isn’t the issue then. Have you checked to make sure the nonce numbers are correct?
Occasionally when you send multiple transactions, a later nonce can get mined before an earlier nonce, meaning your transaction with that lower nonce number will not get mined and will sit in the queue until it gets deleted.

Hello
I have exactly the same problem. Did you find out why this is happening?

Thank you in advance.

Hey @procorbin, and welcome to the Infura community!

Did you double-check to make sure your nonce numbers are correct? If so, can you please send over the code you’re seeing this issue happen with so we can dig further into it?

What is the nonce ? is it the number of transactions correctly made on the network?
My last transaction returned this transaction number to me: 0xbe7211055c4033ada4119a82c8782ef6983fc14a465ea5cc93930d769a3a6564

I just found my problem, my nonce was not prefixed by “0X”, which prevented my transaction from transmitting.
Thank you for your help.

Hey @procorbin - glad you hear you figured out the error! Yes, everything has to be formatted correctly in order for things to work. Another thing to note is that just because you get the transaction ID (0xbe…), that does not mean your transaction has been mined, so it may not show up on Etherscan if that’s the case.

Hello

How can I check if the hash is processed or not (using the api) ?

I am having the same problem and it took a lot of time to deal with it. Please help me !

Thank you!

Hi,
After developing all, I have written two articles about this.

Article-1: Click here to see

Article-2: Click here to see

And the third article is on the way. I hope you may get help with this.

Hi @Truong_Nguyen, and welcome to the Infura community!
You can always use getTransactionReceipt to get the hash information - you will not get a value unless the transaction has gone through successfully.

Hey @lathindu1, thanks for sharing those resources! I am not able to access them via the links you shared, but I’m eager to read what you’ve written! If you can update those links, that would be a great resource for our users!

1 Like

HI @Leiya_Kenney Actually, I have tested again. The links are working correctly. I’m mentioning them again here also.

Integrate Metamask With Laravel

Validate Transactions with Etherscan

And these days I’m writing about Infura these days. I will share those once done here.

Thanks for updating those! They’re working for me now :slight_smile:
Thanks for sharing! Feel free to create a separate post on the Community board with your articles!

1 Like