Skip to content

lhm5425/ethereum-php-1

 
 

Repository files navigation

Ethereum-PHP

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",
  }
}

Usage

composer require digitaldonkey/ethereum-php

This 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.");
}

Limitations & Architecture

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.

architecture diagram

Documentation

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

About

PHP interface to Ethereum JSON-RPC API. Fully typed Web3 for PHP 7.X

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 95.6%
  • HTML 2.9%
  • CSS 1.5%