I am using argument encoding from this page (https://github.com/ethereum/wiki/wiki/Ethereum-Contract-ABI) to build data field for offline signing. I am using eth.sendRawTransaction to call a function in my deployed smart contract. Everything is working fine when the functions have arguments (1 or more), but I am getting an "invalid opcode" exception for the functions which have no arguments. I am using just the first four bytes of the function selector (i.e, sha3('myFunc()')) since there are no arguments.

These functions are working fine when I use a dummy argument (keeping the rest same).

Is there a special way to handle functions without arguments ?

1 Answer 1


I cracked this one by sending the contract bytecode as the data field and {value:"0x0"} to execute the empty constructor.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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