Skip to content

Instantly share code, notes, and snippets.

@askaaqib
Last active October 28, 2020 05:14
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save askaaqib/48621f94c812f25c89f598639b240de7 to your computer and use it in GitHub Desktop.
Save askaaqib/48621f94c812f25c89f598639b240de7 to your computer and use it in GitHub Desktop.
Ethereum Php Library
<?php
require "../vendor/autoload.php";
$eth = new \FurqanSiddiqui\Ethereum\Ethereum();
$eth->networkConfig()->setChainId(3);
echo "<pre>";
//// CREATE PRIVATE KEY
$prv = $eth->keyPairs()->privateKeyFromEntropy(hash("sha256", "whocares1"));
//Infura
$proejctId = "2ab0996559544efca0d85f4135b22322";
$projectScope = "fcab5f5e357c410bbfdb82b6c7058598";
$infura = new \FurqanSiddiqui\Ethereum\RPC\InfuraAPI($eth, $proejctId, $projectScope, "ropsten");
$tx = new \FurqanSiddiqui\Ethereum\Transactions\TxBuilder($eth);
$tx->nonce(1);
$tx->gas(new \FurqanSiddiqui\Ethereum\Math\WEIValue(0.000000003));
$tx->to(new \FurqanSiddiqui\Ethereum\Accounts\Account($eth, "0x9cf8dbdb77a83d1f07ad19751dedac11e3812b00"));
$tx->value(new \FurqanSiddiqui\Ethereum\Math\WEIValue(0.5));
$tx->data(123);
$serialize = $tx->serialize();
$signed = $prv->signTransaction($serialize);
var_dump($signed);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment