Question about ABI

ApoLLo286ApoLLo286 Member Posts: 2
edited May 2015 in Python Implementation
I develop simple dapp where uses python as backend for interaction with geth over jsonrpc

My user-story is

1. I call json rpc method eth_compileSolidity for compilation
2. I call json rpc method eth_sendTransaction for transfer contract into blockchain, and get back contract ABI
3. And then, i want call method in my contract

In AlethZero, when i create contract, i see something like this

19c54359… :method 1
412f2e82… :method 2

And after that, i send transaction with data:

$0x19c54359 - method id

What i should use in pyethereum for method call?

Best Answer


  • ApoLLo286ApoLLo286 Member Posts: 2
    This code solve my problem

    abi = json.loads(self.contract_abi)
    for i, entity in enumerate(abi):
    if entity['type'] == 'constructor': # Current impelementation of ABI don't understand solidity constructor
    raw = json.dumps(abi)
    translator = ContractTranslator(raw.encode("ascii"))
    bytes_pres = translator.encode("sensors", [1])
    res = binascii.hexlify(bytes_pres)
    result =[2:], res.decode("ascii"))

Sign In or Register to comment.