bcphp/ethereum

Ethereum for PHP: Make JSON-RPC with nodes.

v0.2 2018-05-21 23:25 UTC

This package is not auto-updated.

Last update: 2024-04-14 03:07:00 UTC


README

This library provides useful functions to operate an ethereum node.

Requirements

  • PHP 7.0+
  • gmp
  • mbstring
  • secp256k1-lastest
  • secp256k1-php-0.1.2
  • autoconf
  • libtool
  • phpize

Instalation

  1. Install secp256k1-lastest:
curl -L0k https://github.com/bitcoin-core/secp256k1/archive/master.zip > secp256k1-latest.zip
unzip secp256k1-latest.zip
cd secp256k1-master
./autogen.sh
./configure --enable-experimental --enable-module-{ecdh,recovery}
make
sudo make install
cd .. # go out
  1. Install secp256k1-php-0.1.2:
curl -L0k https://github.com/Bit-Wasp/secp256k1-php/archive/v0.1.2.zip > secp256k1-php-0.1.2.zip
unzip secp256k1-php-0.1.2.zip
cd secp256k1-php-0.1.2/secp256k1
phpize
./configure --with-secp256k1
make
sudo make install
cd .. # go out
  1. Modify php.ini

Find your extension directory location:

php -i | grep extension_dir

If secp256k1.so dosen't exists, move secp256k1.so to the extension directory location:

cd secp256k1-php-0.1.2/secp256k1/.libs/
mv /secp256k1.so <EXTENSION_DIRECTORY_LOCATION>

Find your php.ini:

php --ini

Add this line for enable secp256k1 lib:

extension=secp256k1.so
  1. Install via composer

Add to composer:

"require-dev": {
	"bcphp/ethereum": "*",
},

or

composer require bcphp/ethereum

JSON-RCP

Connect to an ethereum node through json rpc.

SEND RAW TRANSACTIONS

Make raw signed transactions.