I have downloaded and configured Besu as a Free Gas Network (https://besu.hyperledger.org/en/stable/HowTo/Configure/FreeGas/ ).
Creating transaction using Truffle works fine, but not in my application with ethereumjs tx:
var rawTransaction = {
"from": account,
gasPrice:0,
"gasLimit": web3js.utils.toHex(4000000),
"to": contract._address,
"value": "0x0",
"data": encodedData,
"nonce": web3js.utils.toHex(count),
};
const customCommon = Common.default.forCustomChain(
'mainnet',
{
name: 'my-network',
networkId: "2018",
chainId: "2018",
},
"muirGlacier"
);
var transaction = new Tx(rawTransaction,{common:customCommon});
//signing transaction with private key
transaction.sign(privateKeyBuff);
web3js.eth.sendSignedTransaction('0x' + transaction.serialize().toString('hex'))
Than I have an error:
Error : { Error: Transaction has been reverted by the EVM:
{
"blockHash": "0x4c91078b140c84aae379bb704fa2a248ce9008675b4a0bcd8bd1ccb648b17011",
"blockNumber": 33202,
"contractAddress": null,
"cumulativeGasUsed": 24221,
"from": "0x90f8bf6a479f320ead074411a4b0e7944ea8c9c1",
"gasUsed": 24221,
"logs": [],
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"status": false,
"to": "0x5e774d2a4726722d893ea4a45954ea9e38087e18",
"transactionHash": "0xe384b93e253f9182b837a7d4cdd6c6b47b7f3a6eeecd63efd8e91a548fbcbe28",
"transactionIndex": 0
}
This works fine on ropsten for instance (with a different gas parameter, and no customCommon call...).