Last active
October 28, 2020 05:14
-
-
Save askaaqib/48621f94c812f25c89f598639b240de7 to your computer and use it in GitHub Desktop.
Ethereum Php Library
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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