ethereum-php icon indicating copy to clipboard operation
ethereum-php copied to clipboard

Expected EthB at eth_syncing (), couldn not be decoded. Value was: Array ( [currentBlock] => 0x3e3d94 [highestBlock] => 0x4d982d [knownStates] => 0x920f [pulledStates] => 0x5ecb [startingBlock] => 0x3e2db4 )

Open sunujacob opened this issue 7 years ago • 2 comments

I cloned dev branch into public html and installed dependencies through composer. I want to to use this project to interact with my php7 website and a go-ethereum node running on amazon linux ec2-instance. I can interact with that using geth console and curl function in the terminal.

When I run ethereum-php/public/client-example.php, I get below error in browser. I have my node up and running at 127.0.0.1:8545. I tried with 127.0.0.1 instead if localhost also. But same error. Please help.

We have a problem: Expected EthB at eth_syncing (), couldn not be decoded. Value was: Array ( [currentBlock] => 0x3e3d94 [highestBlock] => 0x4d982d [knownStates] => 0x920f [pulledStates] => 0x5ecb [startingBlock] => 0x3e2db4 )

#0 /var/www/html/plugins/ethereum/ethereum-php/src/Ethereum.php(203): Ethereum\Ethereum->createReturnValue(Array, 'EthB', 'eth_syncing') #1 [internal function]: Ethereum\Ethereum->Ethereum{closure}() #2 /var/www/html/plugins/ethereum/ethereum-php/src/Ethereum.php(221): call_user_func_array(Object(Closure), Array) #3 /var/www/html/plugins/ethereum/ethereum-php/src/EthMethods.php(136): Ethereum\Ethereum->__call('eth_syncing', Array) #4 /var/www/html/plugins/ethereum/ethereum-php/public/client-example.php(62): Ethereum\Ethereum->eth_syncing() #5 /var/www/html/plugins/ethereum/ethereum-php/public/client-example.php(33): status(Object(Ethereum\Ethereum)) #6 {main}

I want to interact with that node from my browser to create wallet public addresses for each user and do transactions and get wallet balance. Are these functions possible with this plugin.?

sunujacob avatar Feb 23 '18 12:02 sunujacob

Regarding eth_syncing() The main problem is that Ethereum has multiple return types (Bool/Array) varying dependend on the client. I need to have a deeper look how to work around that. We might create a custom Data type for that.

https://github.com/digitaldonkey/ethereum-php/blob/9c8a74810b810ae8048ae9b6db038b0899f0082d/src/JsonRpcInterface.php#L120

The Error is triggered because the return value is wrongly Boolean, while it should be

https://github.com/digitaldonkey/ethereum-php/blob/9c8a74810b810ae8048ae9b6db038b0899f0082d/resources/ethjs-schema.json#L11

Other questions

from my browser to create wallet public addresses

This is currently not in my scope, as I don't want to recommend unlocked Ethereum Nodes. But you are welcome to join. Please PM me if you want to discuss.

do transactions and get wallet balance

Currently working on calling TX. But my focus is first non-payable calls. But the way how it is designed I should work with an unlocked geth/parity and payable calls too.

digitaldonkey avatar Feb 28 '18 16:02 digitaldonkey

eth_syncing() needs a wrapper to include the Boolean and the status.

digitaldonkey avatar Mar 05 '18 13:03 digitaldonkey