2

i use a contract as follows :

pragma solidity ^0.4.0;
contract TestContract
{
function multiply(uint a, uint b) returns (uint)
    {
        return a * b;
    }
}

and solc --bin-runtime TestContract.sol to get its runtimecode.

then evm --code 0x[runtimecode] --input 0x165c4a1600000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000007 run (input value is got from Remix and solc --hashes xxx.sol ,input parameter 5,7)

but the result displayed in cmd is 0x .what's wrong? if deploy in privatechain and execute the local method , it will return the correct answer 35.

0

contract code

contract TestContract
{
function multiply(uint a, uint b) public pure returns (uint)
    {
        return a*b;
    }
}

then

solc --bin-runtime TestContract.sol :

======= test.sol:TestContract =======
Binary of the runtime part: 
608060405260043610603f576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063165c4a16146044575b600080fd5b348015604f57600080fd5b5060766004803603810190808035906020019092919080359060200190929190505050608c565b6040518082815260200191505060405180910390f35b60008183029050929150505600a165627a7a72305820b321ef9f385622373dd6ff8a6ee31a7ead7dbccb991373435cef33b0526fd3110029

then call evm

evm --code 608060405260043610603f576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063165c4a16146044575b600080fd5b348015604f57600080fd5b5060766004803603810190808035906020019092919080359060200190929190505050608c565b6040518082815260200191505060405180910390f35b60008183029050929150505600a165627a7a72305820b321ef9f385622373dd6ff8a6ee31a7ead7dbccb991373435cef33b0526fd3110029 --input 165c4a1600000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000007 run

your error was using calldata with 0x

the output result is

0x0000000000000000000000000000000000000000000000000000000000000023

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.