Explore Courses Blog Tutorials Interview Questions
0 votes
in Blockchain by (12.7k points)
edited by

I encountered an issue is it possible to predefine a contract by assigning alloc -> code field like this,

enter image description here

However, it seems like no matter which method in the contract I call, it always returns the Bytecode of the contract itself regardless of the logic and content of this method.

enter image description here

And this might be the reason when I deploy a contract:

enter image description here

When I call test(), obtaining:

enter image description here which is not a string.

When I call test2(), obtaining:

enter image description here which is a very big number.

When I call test3(1), obtaining a false, which is not 1 == 1.

I have taken a look through the related threads, found this,

It looks like the storage setting is necessary but I have totally no idea what key/value I should write.

How could I deal with this case then?

1 Answer

0 votes
by (29.5k points)
edited by

Did you include --bin instead of --bin-runtime from solc? How did you generate the code to be included?
The --bin code is the code that is run on the contract creation transaction, which returns the actual code to be included in the contract (which is --bin-runtime).

You can learn more about Blockchain through Blockchain Certification Course by Intellipaat.

Browse Categories