Converting contract bytecode to Sophia code

Hi guys,

I have contract address and I want to create instance of the contract so that I can call its methods. I noticed the method getContractInstance() which accepts source code and contract address to create the object instance. but I only have contract aaddress. With contractAddress I found contract bytecode using method getContractByteCode but now I am stucked since the getContractInstance takes only source code as its parameter.

Hey @nduchak.chain Can you help here, please?

it use the getContractInstance() endpoint you need the contract sourcecode or it’s interface, otherwise the ACI can’t autogenerate method prototypes for you.

There is another way of calling contracts where you pass the methods and arguments manually and some checks are skipped, that also works without providing an interface. I don’t have any reference right now, @nduchak.chain will be able to help here.

1 Like

Hey, the thing is that you can not call contract if you don’t have a source/interface code(You can not create a callData for contract-call transaction)


Hey thanks for the reply. Any possibility of parsing the bytecode into source code or interface?

As i know currently it’s not possible

1 Like

Okay no problem. For now made it work using source code here on the contract tab. But I actually wanted to give feature, where user can ONLY input the contract address and he should be able to execute methods. but anyways thanks for help!