is a typed PHP-7 interface to Ethereum JSON-RPC API.
Check out the latest API documentation.
Add library in a composer.json file
{
"repositories": [
{
"type": "git",
"url": "https://github.com/digitaldonkey/ethereum-php.git"
}
],
"require": {
"digitaldonkey/ethereum-php": "dev-master",
}
}composer require digitaldonkey/ethereum-phpThis is the important part of composer.json in Drupal Ethereum Module.
try {
$eth = new EthereumController('http://localhost:8445');
echo $eth->client->eth_protocolVersion();
}
catch (\Exception $exception) {
die ("Unable to connect.");
}Currently only primitive data types are supported, but RLP will come soon.
Read-only This library is read-only for now. this means you can retrieve information stored in Ethereum Blockchain.
In order to write to the blockchain you need a to sign transactions with a private key. I discourage using a unlocked Ethereum client, as a hacker of your website would be able to spend your eth.
For reference see the Ethereum RPC documentation and for data encoding RLP dcumentation in Ethereum Wiki.
There is also a more readable Ethereum Frontier Guide version.
More to read and watch
