Closed whonion closed 1 year ago
Are you sure that the bytecode there is the constructor-code and not the runtime bytecode?
Are you sure that the bytecode there is the constructor-code and not the runtime bytecode?
Not quite sure what you mean? I have tried different contracts, compiled in different ways. I'm just starting to learn this library, maybe I misunderstood something. Could you please tell me sir where I misunderstood or made a mistake ?
Are you sure that the bytecode there is the constructor-code and not the runtime bytecode?
I didn't immediately understand what you're talking about. Yes, this is the runtime code, now I need to figure out how to convert it to constructor bytecode. If everything else I'm passing is correct of course.
The compiler should spit out both the constructor code (for use in tx deployent) and the runtime bytecode. In this step:
estimateGas, err := client.EstimateGas(context.Background(), ethereum.CallMsg{
From: crypto.PubkeyToAddress(privateKey.PublicKey),
To: nil,
Data: bytecodeBytes,
})
you need to provide the constructor-code, not the runtime code.
Thank you, sir! Thanks to you, I solved the problem and realized what my mistake was
constructorBytes, err := hex.DecodeString(bytecodeStr[:len(bytecodeStr)-68])
Hello, guys! Can someone explain what the error is in this code:
I compile a simple contract here is his code:
Using ABI:
I try to deploy bytecode compiled with
solcjs
orRemix IDE
but get the errorgas uint64 overflow
when I try to calculate the cost of gas, and the transaction fails when I manually set the gas limit:Warning! Error encountered during contract execution [gas uint64 overflow]
Maybe I'm not passing the data to the function correctly, tell me please, what's my error ?