solc --version
solc, the solidity compiler commandline interface
Version: 0.4.18-develop.2017.9.23+commit.ccb68970.Linux.g++
Please note that I couldn't solve this problem for months, I have tried everything :(
I have following contract; I can call set()with following byte array on solidity browser. The smart contract accepts the input as bytes32. I assume if geth and solidity browser sees a string starting with 0x, it converts it to byte format.
Following transaction call works without having any problem.
It gives following error, I assume python sees the input given to set() as string instead of bytes. And the string version of the input exceeds the byte32.
@classmethod
def _encode_abi(cls, abi, arguments, data=None):
argument_types = get_abi_input_types(abi)
if not check_if_arguments_can_be_encoded(abi, arguments, {}):
raise TypeError(
"One or more arguments could not be encoded to the necessary "
"ABI type. Expected types are: {0}".format(
> ', '.join(argument_types),
)
)
E TypeError: One or more arguments could not be encoded to the necessary ABI type. Expected types are: bytes32
[Q] While using Populus on pytest how could I transfer byte array as an input to the contract like in solidity browser?
Please note that I couldn't solve this problem for months, I have tried everything :(
I have following contract; I can call
set()
with following byte array on solidity browser. The smart contract accepts the input asbytes32
. I assume ifgeth
andsolidity browser
sees a string starting with0x
, it converts it tobyte
format.Following transaction call works without having any problem.
--
myContract.get()
Returns:"0x15CEF23823A9410D60CB6E6CC56046EC6035A9353100476EA28C94752AF104CD
My contract:
I want to do same operation on Populus. When I try to call it as on
test_greeter.py
:It gives following error, I assume python sees the input given to
set()
as string instead of bytes. And the string version of the input exceeds thebyte32
.[Q] While using Populus on pytest how could I transfer byte array as an input to the contract like in solidity browser?
Thank you for your valuable time and help.