Nethereum icon indicating copy to clipboard operation
Nethereum copied to clipboard

Exception during contract deployment

Open TSKHot opened this issue 6 months ago • 1 comments

We're randomly getting the following exception when calling DeployContractAndWaitForReceiptAsync {"Contract code not deployed successfully"} at Nethereum.RPC.TransactionReceipts.TransactionReceiptPollingService.<PollForContractAddressAsync>d__13.MoveNext() at Nethereum.RPC.TransactionReceipts.TransactionReceiptPollingService.<ValidateDeploymentTransactionReceipt>d__12.MoveNext() at Nethereum.Contracts.DeploymentHandlers.DeploymentTransactionReceiptPollHandler`1.<SendTransactionAsync>d__3.MoveNext()

Note, the TransactionReceipt included in the exception does have a ContractAddress.

Occurs in our local test environment running Geth in dev mode (geth --http --http.api eth,net,web3,debug --dev --dev.period 2 --keystore --datadir )

TSKHot avatar Jul 18 '25 01:07 TSKHot

Hi!

We are getting same error. Despite the fact that contract was actually deployed, but slow node sync (it is a guess), NEthereum throws an exception for successful contract deployment. It occurs randomly, if our provider returns ethCode with actual deployed bytecode, then everything is ok. If it returns 0x then we get an error. But it was actually deployed. So we need to figure out what is the proper way to handle such cases, when contract was deployed but not synced yet across all nodes.

Here is the smart contract that was deployed: https://sepolia.etherscan.io/address/0x04a8719a4a2e437099edbc057bb2e45ee08858fd#code

  1. Bytecode is not 0x
  2. Alchemy returns 0x top result on screen 2
  3. NEthereum throws error

Screen 1 Image

Screen 2 Image

Kydyralin avatar Aug 18 '25 11:08 Kydyralin