All Projects → digitaldonkey → Ethereum Php

digitaldonkey / Ethereum Php

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

Projects that are alternatives of or similar to Ethereum Php

Web3swift
Elegant Web3js functionality in Swift. Native ABI parsing and smart contract interactions on Ethereum network.
Stars: ✭ 462 (+34.69%)
Mutual labels:  ethereum, smart-contracts, web3
Eth Crypto
Cryptographic javascript-functions for ethereum and tutorials to use them with web3js and solidity
Stars: ✭ 420 (+22.45%)
Mutual labels:  ethereum, smart-contracts, web3
Solidity Idiosyncrasies
Solidity gotchas, pitfalls, limitations, and idiosyncrasies.
Stars: ✭ 267 (-22.16%)
Mutual labels:  ethereum, smart-contracts, web3
Blockchainbooks.github.io
Blockchain Books
Stars: ✭ 139 (-59.48%)
Mutual labels:  ethereum, smart-contracts, web3
Web3.swift
A pure swift Ethereum Web3 library
Stars: ✭ 295 (-13.99%)
Mutual labels:  ethereum, smart-contracts, web3
Web3.php
A php interface for interacting with the Ethereum blockchain and ecosystem. Native ABI parsing and smart contract interactions.
Stars: ✭ 507 (+47.81%)
Mutual labels:  ethereum, smart-contracts, web3
React Ethereum Dapp Example
A starter boilerplate for an Ethereum dapp using web3.js v1.0, truffle, react, and parity
Stars: ✭ 384 (+11.95%)
Mutual labels:  ethereum, smart-contracts, web3
Alpha
Follow the white rabbit 🐇
Stars: ✭ 304 (-11.37%)
Mutual labels:  ethereum, smart-contracts, web3
Eth.social
An Ethereum dApp for posting social events.
Stars: ✭ 17 (-95.04%)
Mutual labels:  ethereum, smart-contracts, web3
Web3swift
Elegant Web3js functionality in Swift. Native ABI parsing and smart contract interactions.
Stars: ✭ 237 (-30.9%)
Mutual labels:  ethereum, smart-contracts, web3
Love Ethereum
区块链学习
Stars: ✭ 323 (-5.83%)
Mutual labels:  ethereum, smart-contracts
Octopus
Security Analysis tool for WebAssembly module (wasm) and Blockchain Smart Contracts (BTC/ETH/NEO/EOS)
Stars: ✭ 261 (-23.91%)
Mutual labels:  ethereum, smart-contracts
Ethereum Erc721
Non-fungible token implementation for Ethereum-based blockchains.
Stars: ✭ 253 (-26.24%)
Mutual labels:  ethereum, smart-contracts
Smart Contract Search Engine
Takes a link to a smart contract's raw ABI file and an RPC URL and then indexes all instances of that smart contract
Stars: ✭ 265 (-22.74%)
Mutual labels:  ethereum, smart-contracts
Celo Monorepo
Official repository for core projects comprising the Celo platform
Stars: ✭ 269 (-21.57%)
Mutual labels:  ethereum, smart-contracts
Truffle Flattener
Truffle Flattener concats solidity files from Truffle and Buidler projects with all of their dependencies
Stars: ✭ 254 (-25.95%)
Mutual labels:  ethereum, smart-contracts
Eventeum
A resilient Ethereum event listener that bridges your smart contract events and backend microservices
Stars: ✭ 272 (-20.7%)
Mutual labels:  ethereum, smart-contracts
Solidity Template
Combines Hardhat, TypeChain, Ethers, Waffle, Solhint and Solcover.
Stars: ✭ 269 (-21.57%)
Mutual labels:  ethereum, smart-contracts
full-blockchain-solidity-course-py
Ultimate Solidity, Blockchain, and Smart Contract - Beginner to Expert Full Course | Python Edition
Stars: ✭ 5,349 (+1459.48%)
Mutual labels:  smart-contracts, web3
Uniswap V2 Periphery
🎚 Peripheral smart contracts for interacting with Uniswap V2
Stars: ✭ 267 (-22.16%)
Mutual labels:  ethereum, smart-contracts

Ethereum-PHP

is a typed PHP-7.1+ interface to Ethereum JSON-RPC API.

Check out the latest API documentation.

Add library in a composer.json file

{
  "minimum-stability":"dev",
  "autoload": {
    "psr-4": {
      "Ethereum\\": "src/"
    }
  },
  "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.

require __DIR__ . '/vendor/autoload.php';
use Ethereum\Ethereum;

try {
	// Connect to Ganache
    $eth = new Ethereum('http://127.0.0.1:7545');
    // Should return Int 63
    echo $eth->eth_protocolVersion()->val();
}
catch (\Exception $exception) {
    die ("Unable to connect.");
}

Calling Contracts

You can call (unpayed) functions in smart contracts easily.

The json file "$fileName" used is what you get when you compile a contract with Truffle.

$ContractMeta = json_decode(file_get_contents($fileName));
$contract = new SmartContract(
  $ContractMeta->abi,
  $ContractMeta->networks->{NETWORK_ID}->address,
  new Ethereum(SERVER_URL)
);
$someBytes = new EthBytes('34537ce3a455db6b')
$x = $contract->myContractMethod();
echo $x->val()

You can also run tests at smart contracts, check out EthTestClient.

Event listening and handling

You can use Ethereum-PHP to watch changed on your smart contracts or index a Blockchain block by block. gs

See UsingFilters and ethereum-php-eventlistener.

Limitations

Currently not all datatypes are supported.

This library is read-only for now. This means you can retrieve information stored in Ethereum Blockchain.

To write to the blockchain you need a to sign transactions with a private key which is not supported yet.

architecture diagram

Documentation

The API documentation is available at ethereum-php.org.

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.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].