forked from flo3477/ethereumRPCDriver
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathethTest.php
More file actions
62 lines (30 loc) · 1.01 KB
/
ethTest.php
File metadata and controls
62 lines (30 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?php
require_once(dirname(__FILE__).'/ethereumDriver.php');
$config = array(
"rpcIP" => "127.0.0.1",
"rpcPort" => "8545",
);
$ethereum = new Ethereum($config["rpcIP"], $config["rpcPort"]);
$accounts = $ethereum->eth_accounts();
//var_dump($accounts);
echo "<br>";
$syncStat = (array) $ethereum->eth_syncing();
//var_dump($syncStat);
echo "<br>";
$sendETH = array(
"from" => "0xd747a091c5645195d516d8bf23af84afdd5dfaa5",
"to" => "0x687422eea2cb73b5d3e242ba5456b782919afc85",
"gas" => "0x76c0", // 30400
"gasPrice" => "0x9184e72a000", //10000000000000
"value" => "0x9184e72a", //2441406250
);
$transaction = NEW Ethereum_Transaction($sendETH["from"],$sendETH["to"],$sendETH["gas"],$sendETH["gasPrice"],$sendETH["value"]);
//var_dump($ethereum->eth_sendTransaction($transaction));
echo "<br>";
echo $ethereum->decode_hex(0x76c0) . " Gas <br>";
function wei2eth($wei){
return bcdiv($wei,'1000000000000000000',18);
}
function ethdecode($input){
return dechex($input);
}