Transaction not getting broadcasted

Hello,

I am trying to send ethereum from 1 address to another using php, and everything looks fine but the transaction is not showing up on the network.

I am using this package to make a connection with infura: allmediaindo/infura

I am using this package to create & sign a transaction: web3p/ethereum-tx

This is the code I am currently using to create, sign and send the transaction:

use allmediaindo\Infura\Infura;
use Web3p\EthereumTx\EIP2930Transaction;
  
$transaction = new EIP2930Transaction([
    'nonce' => '0x01',
    'from' => '0x70abb694597d4b902e4be55429599a703bd1c3bd',
    'to' => '0x4be102722f7370ad987f82fbdfa19532141f8b70',
    'gas' => '0x' . dechex(50000),
    'gasPrice' => '0x' . dechex(20000000000),
    'value' => '0x' . dechex(10000000000000000), //0.01eth
    'chainId' => 1,
    'accessList' => [],
    'data' => ''
]);

$signedTransaction = '0x' . $transaction->sign($privateKey);

$client = new Infura('mainnet', $infuraProjectID);
$tx = $client->eth_sendRawTransaction($signedTransaction);

The signedTransaction outputs:

0x01f86d01018504a817c80082c350944be102722f7370ad987f82fbdfa19532141f8b70872386f26fc1000080c001a0408ffef7134ea97f01f44350460ef0229e6065ba29ca89286e3d7f0eef13e8f4a01754d367205c0fbca42ceb3e1bc7ba2360ad790afe3f0b42fbaf4dd471d11c13

And this is the final hash:

0xd1af846358e37bea78a28773f10cc68fde6cd9a58f708da0c9847c2145ef7784

I’ve tried using MyCrypto - Ethereum Wallet Manager to manualy send the signed transaction, everything looks good, but it doesn’t show up on the network.

I’m not sure if my gas & gasPrice is good, but if I’m right it is way over the recommended amount.

I am struggling with this for a couple of days now already, so any help would be more than welcome!

Have a good one :slight_smile:

Hey, at the first look I’d say the nonce is the problem, it should be 0x0 because you haven’t sent any txns yet from that account.

1 Like

Thank you very much, changing the nonce to 0 fixed it!

I didn’t understand what nonce actualy was for, but it is the outgoing transaction count from the sender address right?

Hi @Luxiflex, that’s correct - the nonce is the number of transactions sent from a specific address.