Giter Club home page Giter Club logo

erc20-php's Introduction

ERC20 Tokens

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 relies on furqansiddiqui/ethereum-php package to perform all ABI encoding and decoding, as well as communication with Ethereum node using RPC/API, resulting in pure simple and easy to use API for developers to perform all ERC20 standard operations.

Ethereum Node Status
Geth / Ethereum-Go RPC ✔️
Infura.IO ✔️

Demo

  • Testing interaction with Thether USD / USDT ERC20 smart contract:
$eth = new \FurqanSiddiqui\Ethereum\Ethereum();
$infura = new \FurqanSiddiqui\Ethereum\RPC\InfuraAPI($eth, "PROJECT-ID", "PROJECT-SECRET");
$infura->ignoreSSL(); // In case Infura.IO SSL errors

$erc20 = new \FurqanSiddiqui\Ethereum\ERC20\ERC20($eth);
$erc20->useRPCClient($infura);

$usdt = $erc20->token("0xdac17f958d2ee523a2206206994597c13d831ec7");
var_dump($usdt->name());
var_dump($usdt->symbol());
var_dump($usdt->decimals());
var_dump($usdt->totalSupply());
var_dump($usdt->balanceOf($eth->getAccount("ETHEREUM-ADDRESS")));

Result:

string(9) "TetherUSD"
string(4) "USDT"
int(6)
string(18) "10034907979.686358"
string(12) "53150.417979"

Prerequisites

Installation

composer require furqansiddiqui/erc20-php

erc20-php's People

Contributors

furqansiddiqui avatar survivordj avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.