Calling sendSignedTransaction returns {"code":-32602,"message":"invalid arguments to eth_getBlockByNumber"}

I am using infura kovan with nodejs and web3 v1.0.0-beta55
Sending transactions using sendSignedTransaction returns the error

{“code”:-32602,“message”:“invalid arguments to eth_getBlockByNumber”}

This happens only in about 3 of 10 times tried.
I am adding a code snipped to reproduce this here. It will create new tx and send them 10 times and count how many will show the error.

const EthereumTx = require(‘ethereumjs-tx’).Transaction;
const web3eth = require(‘web3-eth’);

const eth = new web3eth.Eth(‘’, null);
const eth_priv_key_seed = “REMOVED”
const eth_priv_key = Buffer.from(eth_priv_key_seed, ‘hex’)

global.good = 0;
global.bad = 0;

async function loop() {
var nonce = (await eth.getTransactionCount(‘SENDING_ADDRESS’));
for (let i = 0; i < 10; i+= 1) {
await sendPayment(nonce);
nonce += 1;
console.log(‘good:’, good, ‘bad:’, bad);

async function sendPayment(nonce) {
const payment = {
nonce: nonce,
gasPrice: ‘0x1000000000’,
gasLimit: ‘0xcf08’,
value: ‘0x0000000000001’,
chainId: 42,
amount: ‘0x0000000000001’,
const tx = new EthereumTx(payment);
const serializedTx = “0x”+tx.serialize().toString(“hex”);
try {
let res = await eth.sendSignedTransaction(serializedTx);
good += 1;
catch (err) {
bad += 1;

Seems in a recent commit for Web3JS there was a removal or some string conversion that appears to break the getBlockByNumber call processed as part of the sendSignedTransaction method.

Can you try v1.0.0-beta54 and let us know if that fixes your issue?

Hi Mike

thanks for your help and the idea. I checked that, but unfortunately, that was not the solution yet. I am still getting the error, using the following packages:

$ npm list web3 web3-eth ethereumjs-tx
test@0.0.1 abc\debugging_sendSignedTransaction
±- ethereumjs-tx@2.0.0
-- web3@1.0.0-beta.54– web3-eth@1.0.0-beta.54
`-- ethereumjs-tx@1.3.7

We are reaching out to the development team for Web3.js to see if we can help by getting an RPC dump. Will let you know as soon as we get more information.

Hi mike

thanks for your help.

The error message has changed a bit, now I am getting this error:

{ error: Error: Node error: {“code”:-32602,“message”:“Invalid params: Invalid bl
ock number: missing 0x prefix.”}

This could be related to the other one, I guess.