-
Notifications
You must be signed in to change notification settings - Fork 124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The code in public_tx.js under the Deploy a smart contract operation in the Tutorials module of Private networks has significant errors, resulting in various errors when running node public_tx.js. #1546
Comments
Same happens to me, still no luck |
it was successful the first time i ran it. when I tried running it again got this error |
It´s happening the same when I try to deploy a new contract: public.js const web3Instance = new Web3('http://myserver:8541'); const privateKey = // read in the contracts // get txnCount for the nonce value const rawTxOptions = { console.log("Signing the txn") console.log("Sending transaction..."); ` InvalidResponseError: Returned error: Internal error Node.js v18.16.0 Does anyone have any ideas about this problem? |
Was anyone able to use it? |
Hi, I am also getting the same issue while trying to deploy a contract on QBFT private network using Web3j with the generated smart contract wrapper. When I check the log with TRACE flag , it showed as "MessageFrame evaluation halted because of INVALID_OPERATION". I am quite not sure why is this happening.. |
Several potential issues identified (from error message):
Environment
Suggested fixUpdate the transaction configuration to include proper gas handling: const rawTxOptions = {
nonce: web3Instance.utils.numberToHex(txnCount),
from: account.address,
to: null,
value: "0x00",
data: "0x" + contractBin,
// Dynamic gas pricing
gasPrice: await web3Instance.eth.getGasPrice(),
// Estimate required gas
gas: await web3Instance.eth.estimateGas({
from: account.address,
data: "0x" + contractBin
})
}; Verification stepsConfirm network connection:await web3Instance.eth.net.isListening(); Check account balance:const balance = await web3Instance.eth.getBalance(account.address);
console.log("Balance:", web3Instance.utils.fromWei(balance, 'ether'), "ETH"); Verify current gas price:const gasPrice = await web3Instance.eth.getGasPrice();
console.log("Gas Price:", gasPrice); Advice for additional troubleshooting
|
Me too, i've successfully ran a containerized permissioned network using besu, with 4 nodes syncronized and the 3 classic test account from the documentation. I can make transactions but, |
Hi @joaniefromtheblock. I have configured my besu private network as a free gas network. So I need to give gas price as zero. But I found the issue. This might be helpful for you as well @TU0N0DAN and @haerker. I was using web3j to deploy contract and interact with it. When I try to deploy it I was getting the same issue as mention in the comment trail. So recently I found that my besu network is configured with londonBlock milestone. So I was trying to deploy a contract which is compiled with cancun evm version. Then I changed the evm version to london and compiled the contract. Used that for deployment. Now this worked. Please try this approach once. |
Thanks a lot for your response. I've been working on this issue for months. So i just need to change the EVM to London and it's fixed? Cool. How can i do that? How can I check the EVM version my contract was compiled for by the solidity compiler? (solc) Is it written in the compiled contract .json? Thanks a lot again How do i change the EVM version? Or how do i compile the contract for a given EVM version? My genesis.json only contains BerlinBlock Milestone, so i suppose my EVM is using Berlin. But i don't know for which EVM type my contract was compiled, or from where solc gets the version to compile to (if settable). Enabling the miner and the mining options doesn't seem to change anything, indeed it seems completely useless since the nodes are validating and not mining. (i'm using a IBFT 2.0 Permissioned Network PoA (PoS), not a PoW private chain for which mining is necessary, at least should be like this) Here is my docker-compose.yaml
This is my deploy.js script (i use node deploy.js for deploying)
This is the error i get
Those are the besu docker image logs (at maximum level TRACE) of the error.
|
Another thing i wanted to ask is: Is it correct to deploy the contract to a NULL address? (the Besu Documentation says to do so) Should i deploy the contract from an account or from a validator? Maybe Besu Developers know that better than us and already solved this issue. If someone could mention @ one of them would be great. In a PoS network logic the validators should theorically always deploy the contract, but in my script isn't like that. I've sent the deploy transaction from an account with funds in order to cover eventual gas fees. Validators got no funds, even if in theory they should cover gas fees and mint funds when needed automatically. Validators should be able to send funds to an account even if they got no funds ( instantly minting it ) Correct me if i am wrong. Thanks to everyone! UPDATE : I've made this curl call to my RPC in order to check the EVM Version (this was suggested by GPT)
and got this as response
44 should be Bysantium version but i'm not completely sure since GPT gave me this info. If anyone has more info sources or has the right answer please help me, us! UPDATE (2) My EVM Version hardfork appears to be petersburg for some reason, i'm not completely sure but hardforks berlin, cancun and london are not working, since when i create the Tx object passing 'berlin,london,cancun' as parameters and launch the transaction it doesn't work. If i instead create the Tx object passing 'petersburg' it works. The chain ID of the transaction also caused problems, the chain id on the besu documentation is "1337", but when i launch the transaction as public_tx.js does i do not specify any chain Id anywhere, so it automatically sets to 1 as default value. This is my code, and it worked, i deployed the smart contract! (not ERC-721 but a simple one). As you can see i've used petersburg hardfork in the end and it worked! I just don't know how to add Chain ID to the transaction, so i modified it in the genesis in order to match to the default transaction chain id (1). But this is an error i want to solve.
@Giridharan-Govindaraj let me know what you think bro thanks! I've been stuck on this job for months! Thanks a lot for enlightening me. Tag a besu developer if you can! That might be helpful. My genesis file only contains berlin block option, so i don't know how it can be petersburg. genesis.json
|
The code in public_tx.js under the Deploy a smart contract operation in the Tutorials module of Private networks has significant errors, resulting in various errors when running node public_tx.js.
InvalidResponseError: Returned error: Transaction processing could not be completed due to an exception
at Web3RequestManager._processJsonRpcResponse (/home/haerker/besu/Permissioned-Network/node_modules/web3-core/lib/commonjs/web3_request_manager.js:258:23)
at Web3RequestManager. (/home/haerker/besu/Permissioned-Network/node_modules/web3-core/lib/commonjs/web3_request_manager.js:156:29)
at Generator.next ()
at fulfilled (/home/haerker/besu/Permissioned-Network/node_modules/web3-core/lib/commonjs/web3_request_manager.js:21:58)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
innerError: {
code: -32000,
message: 'Transaction processing could not be completed due to an exception'
},
The text was updated successfully, but these errors were encountered: