erc20 php,aytaceminoglu

README

Interact with any ERC20 standard Ethereum token

This package is ultimate response to historic issue of no native API being available to PHP developers to interact with

ERC20 tokens (i.e. web3js contracts API).

This package communicates directly with Geth using RPC (aytaceminoglu/ethereum-rpc) and performs all ABI encoding and decoding in background,

resulting in pure simple and easy to use API for developers to perform all ERC20 standard operations.

Demo

A random ERC20 token was picked from a list, given contract address 0xd26114cd6EE289AccF82350c8d8487fedB8A0C07

$geth = new EthereumRPC('127.0.0.1', 8545);

$erc20 = new \ERC20\ERC20($geth);

$token = $erc20->token('0xd26114cd6EE289AccF82350c8d8487fedB8A0C07');

var_dump($token->name());

var_dump($token->symbol());

var_dump($token->decimals());

Result:

string(8) "OMGToken"

string(3) "OMG"

int(18)

Installation

composer require aytaceminoglu/erc20-php

Prerequisites

PHP >= 7.1+

Ethereum RPC client (aytaceminoglu/ethereum-rpc) > 1.0

ABI

A standard ERC20 ABI file is included in package residing in "data" directory.

Path to a custom ABI may be specified when constructing ERC20 token object.

$geth = new EthereumRPC('127.0.0.1', 8545);

$erc20 = new \ERC20\ERC20($geth);

$erc20->abiPath('/path/to/abi.json');

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值