Giter VIP home page Giter VIP logo

php-eth-raw-tx's Introduction

php-eth-raw-tx

PHP tool to create Ethereum raw transaction

Pre-requisite

secp256k1-php

You need secp256k1-php. Which itself needs secp256k1 to be installed on your system.

Last tests were run using the following versions :

  • secp256k1-lastest
  • secp256k1-php-0.1.2

You will need gcc, libtool, make, automake , which is standard package you can grab from apt, yum, brew...

First install secp256k1

$> 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
$>

Then secp256k1-php

$> 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
$>

Finally add extension to you php.ini file

extension=secp256k1.so

Examples

You may run examples in examples folder.

Creating a raw transaction

$tx = new \EthereumRawTx\Transaction(
    \BitWasp\Buffertools\Buffer::hex('d44d259015b61a5fe5027221239d840d92583adb'),
    \BitWasp\Buffertools\Buffer::int(5 * 10**18),
);

$raw = $tx->getRaw(\BitWasp\Buffertools\Buffer::hex(MY_PRIVATE_KEY));

Demo :

php examples/send_ether.php

Tests

You can run specs with

vendor/bin/peridot tests/

php-eth-raw-tx's People

Contributors

etienneroudeix avatar neverendingloopman avatar kornrunner avatar camtosh avatar

Watchers

James Cloos avatar  avatar  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.