0 votes
1 view
in Blockchain by (12.8k 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, https://ethereum.stackexchange.com/questions/30366/how-does-the-genesis-json-file-define-the-initial-state-of-the-blockchain

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.8k points)

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).

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...