I'm not the author of Ethereum part but have to connect to using php. Choosen Ethereum-PHP package (https://github.com/digitaldonkey/ethereum-php). Have connection to ethereum and smart contract but cannot execute smart contract function with parameter successfuly. I have Schema contract and function test ():
function test(uint value) public returns(uint) {
return value*2;
}
and ABI:
...
{"constant":false,"inputs":[{"name":"value","type":"uint256"}],
"name":"test","outputs":
[{"name":"","type":"uint256"}],
"payable":false,"stateMutability":"nonpayable","type":"function"}
...
Now in php I have:
$eth = new Ethereum('https://kovan.infura.io/<unique address>');
$schemaContract = new SmartContract($abi, '<contract address>', $eth);
// Call a function with result : 2
$result = $schemaContract->test(1)->Val();
I cannot recieve the result. Don't know exactly how to achieve this. Tried many different options like :
$result = $schemaContract->test(1);
$result = $schemaContract->test('1');
$result = $schemaContract->test(1);
$result = $schemaContract->__call('test',1);
But always recieved some error messages.
What am I doing wrong?
Best regards, TB