Hey, i'm facing problem to execute tx for london hardfork.
This is how i'm building and sending tx
let buyAccountPrivateKeyTemp = Buffer.from(
buyTxAccounts[autoBuyPrivateKeyIndex],
'hex',
);
let buyTxParamsTemp = {
nonce: nonceTx,
maxPriorityFeePerGas: await this.web3.utils.toHex(buyTxAccounts[autoBuyMaxPriorityFeePerGasIndex]),
maxFeePerGas: await this.web3.utils.toHex(buyTxAccounts[autoBuyMaxFeePerGasIndex]),
gasLimit: await this.web3.utils.toHex(buyTxAccounts[autoBuyGasLimitIndex]),
to: routerAddress,
from: buyTxAccounts[autoBuyAccountIndex],
data: buy1TxWithRouterData,
chainId: "0x01",
accessList: [],
type: "0x02"

};

const common = new Common({ chain: Chain.Mainnet, hardfork: Hardfork.London });
let tx = FeeMarketEIP1559Transaction.fromTxData(buyTxParamsTemp, {common});
await tx.sign(buyAccountPrivateKeyTemp);
let serializedTxTemp = tx.serialize();
let serializedTx = serializedTxTemp.toString('hex');

web3.eth.sendSignedTransaction("0x"+serializedTx).on('transactionHash', function(hash){
console.log("Tx hash: ",hash);
}).on("error", function (error) {
console.log("Tx not succeed.",error);
});

i get error Tx not succeed. { Error: Returned error: invalid sender}. any suggestion ? i'm following this link https://www.npmjs.com/package/@ethereumjs/tx

Dec 31, 2021, 8:59 AM

© 2024 Draquery.com All rights reserved.