I am trying to use Web3.js to push a transaction that is failing. From what I understand, Web3.js seems to perform a pre-flight of the transaction and throw an exception. Therefore the transaction does not get sent to the network.

For debugging purposes, I would like to force push the transaction so that I can look at the error recorded on the blockchain.

Is there a way to force Web3.js to send a transaction anyways even when it is failing?

I am using the contract based style to send the tx, such as:

const contract = new web3.eth.Contract(ABI, ADDRESS);
await contract.methods.test().send({ from: ACCOUNT });
  • What's the error exactly? web3 should send the transaction anyway unless it is not valid.
    – Ismael
    Jun 2, 2021 at 6:45
  • 1
    I think the error does not matter. If I have a contract function that reverts and I try to call it using Web3 I always get a JavaScript Error, nothing is broadcast to the network. I would like to bypass that and force Web3 to push the transaction anyways. The transaction will error out and I will pay for the gas, but that is actually what I want to happen. I am asking how to force that using Web3, if possible at all.
    – raugfer
    Jun 2, 2021 at 15:20
  • There are a few error that will prevent web3 from sending the transaction (or sending and it failing immediately), sender doesn't have enough funds, incorrect network id, but otherwise web3 should send the transaction. I asked for the error to better determine the possible cause.
    – Ismael
    Jun 2, 2021 at 16:27

1 Answer 1


Solved this using eth_sendTransaction

const iface = new Iface(NFTXMarketplaceZap);
const data = iface.encodeFunctionData("methodName", [ params ])
const tx = [{
  "from": "0xa",
  "to": "0xb",
  "gas": "0xf93E0", // ~1000000
  "gasPrice": "0x3B9ACA00", // 1 gwei
  "value": "0xa",
  "data": data

signer.send('eth_sendTransaction', params).then((tx) => {
  console.log('transactionHash is ' + tx);

No more being blocked by failing pre-flight checks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.