博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
ETH功能类
阅读量:5307 次
发布时间:2019-06-14

本文共 10079 字,大约阅读时间需要 33 分钟。

request($method, $params); return $ret; } catch (RPCException $e) {
throw $e; } } private function decode_hex($input) {
if (substr($input, 0, 2) == '0x') {
$input = substr($input, 2); } if (preg_match('/[a-f0-9]+/', $input)) {
return hexdec($input); } return $input; } public function web3_clientVersion() {
return $this->ether_request(__FUNCTION__); } public function web3_sha3($input) {
return $this->ether_request(__FUNCTION__, array($input)); } public function net_version() {
return $this->ether_request(__FUNCTION__); } public function net_listening() {
return $this->ether_request(__FUNCTION__); } public function net_peerCount() {
return $this->ether_request(__FUNCTION__); } public function eth_protocolVersion() {
return $this->ether_request(__FUNCTION__); } public function eth_coinbase() {
return $this->ether_request(__FUNCTION__); } public function eth_mining() {
return $this->ether_request(__FUNCTION__); } public function eth_hashrate() {
return $this->ether_request(__FUNCTION__); } public function eth_gasPrice() {
return $this->ether_request(__FUNCTION__); } public function eth_accounts() {
return $this->ether_request(__FUNCTION__); } public function personal_newAccount($passwd) {
return $this->ether_request(__FUNCTION__, array($passwd)); } public function personal_unlockAccount($account, $passwd) {
return $this->ether_request(__FUNCTION__, array($account,$passwd)); } public function eth_blockNumber($decode_hex=false) {
$block = $this->ether_request(__FUNCTION__); if ($decode_hex) {
$block = $this->decode_hex($block); } return $block; } public function eth_getBalance($address, $block='latest', $decode_hex=false) {
$balance = $this->ether_request(__FUNCTION__, array($address, $block)); if ($decode_hex) {
$balance = $this->decode_hex($balance); } return $balance; } public function eth_getStorageAt($address, $at, $block='latest') {
return $this->ether_request(__FUNCTION__, array($address, $at, $block)); } public function eth_getTransactionCount($address, $block='latest', $decode_hex=false) {
$count = $this->ether_request(__FUNCTION__, array($address, $block)); if ($decode_hex) {
$count = $this->decode_hex($count); } return $count; } public function eth_getBlockTransactionCountByHash($tx_hash) {
return $this->ether_request(__FUNCTION__, array($tx_hash)); } public function eth_getBlockTransactionCountByNumber($tx='latest') {
return $this->ether_request(__FUNCTION__, array($tx)); } public function eth_getUncleCountByBlockHash($block_hash) {
return $this->ether_request(__FUNCTION__, array($block_hash)); } public function eth_getUncleCountByBlockNumber($block='latest') {
return $this->ether_request(__FUNCTION__, array($block)); } public function eth_getCode($address, $block='latest') {
return $this->ether_request(__FUNCTION__, array($address, $block)); } public function eth_sign($address, $input) {
return $this->ether_request(__FUNCTION__, array($address, $input)); } // function eth_sendTransaction($transaction) // {
// if(!is_a($transaction, 'Ethereum_Transaction')) // {
// throw new ErrorException('Transaction object expected'); // } // else // {
// return $this->ether_request(__FUNCTION__, $transaction->toArray()); // } // } public function eth_sendTransaction($account_from, $account_to, $amount) {
return $this->ether_request(__FUNCTION__, array(array("from"=>$account_from,"to"=>$account_to,"value"=>'0x'.$amount, "gas" => '0x5208', "gasPrice" => '0x55ae82600'))); // "gas" => '0xc350', "gasPrice" => '0x1a13b8600' } public function eth_call($message, $block) {
if (!is_a($message, 'Ethereum_Message')) {
throw new ErrorException('Message object expected'); } else {
return $this->ether_request(__FUNCTION__, $message->toArray()); } } public function eth_estimateGas($message, $block) {
if (!is_a($message, 'Ethereum_Message')) {
throw new ErrorException('Message object expected'); } else {
return $this->ether_request(__FUNCTION__, $message->toArray()); } } public function eth_getBlockByHash($hash, $full_tx=true) {
return $this->ether_request(__FUNCTION__, array($hash, $full_tx)); } public function eth_getBlockByNumber($block='latest', $full_tx=true) {
return $this->ether_request(__FUNCTION__, array($block, $full_tx)); } public function eth_getTransactionByHash($hash) {
return $this->ether_request(__FUNCTION__, array($hash)); } public function eth_getTransactionByBlockHashAndIndex($hash, $index) {
return $this->ether_request(__FUNCTION__, array($hash, $index)); } public function eth_getTransactionByBlockNumberAndIndex($block, $index) {
return $this->ether_request(__FUNCTION__, array($block, $index)); } public function eth_getTransactionReceipt($tx_hash) {
return $this->ether_request(__FUNCTION__, array($tx_hash)); } public function eth_getUncleByBlockHashAndIndex($hash, $index) {
return $this->ether_request(__FUNCTION__, array($hash, $index)); } public function eth_getUncleByBlockNumberAndIndex($block, $index) {
return $this->ether_request(__FUNCTION__, array($block, $index)); } public function eth_getCompilers() {
return $this->ether_request(__FUNCTION__); } public function eth_compileSolidity($code) {
return $this->ether_request(__FUNCTION__, array($code)); } public function eth_compileLLL($code) {
return $this->ether_request(__FUNCTION__, array($code)); } public function eth_compileSerpent($code) {
return $this->ether_request(__FUNCTION__, array($code)); } public function eth_newFilter($filter, $decode_hex=false) {
if (!is_a($filter, 'Ethereum_Filter')) {
throw new ErrorException('Expected a Filter object'); } else {
$id = $this->ether_request(__FUNCTION__, $filter->toArray()); if ($decode_hex) {
$id = $this->decode_hex($id); } return $id; } } public function eth_newBlockFilter($decode_hex=false) {
$id = $this->ether_request(__FUNCTION__); if ($decode_hex) {
$id = $this->decode_hex($id); } return $id; } public function eth_newPendingTransactionFilter($decode_hex=false) {
$id = $this->ether_request(__FUNCTION__); if ($decode_hex) {
$id = $this->decode_hex($id); } return $id; } public function eth_uninstallFilter($id) {
return $this->ether_request(__FUNCTION__, array($id)); } public function eth_getFilterChanges($id) {
return $this->ether_request(__FUNCTION__, array($id)); } public function eth_getFilterLogs($id) {
return $this->ether_request(__FUNCTION__, array($id)); } public function eth_getLogs($filter) {
if (!is_a($filter, 'Ethereum_Filter')) {
throw new ErrorException('Expected a Filter object'); } else {
return $this->ether_request(__FUNCTION__, $filter->toArray()); } } public function eth_getWork() {
return $this->ether_request(__FUNCTION__); } public function eth_submitWork($nonce, $pow_hash, $mix_digest) {
return $this->ether_request(__FUNCTION__, array($nonce, $pow_hash, $mix_digest)); } public function db_putString($db, $key, $value) {
return $this->ether_request(__FUNCTION__, array($db, $key, $value)); } public function db_getString($db, $key) {
return $this->ether_request(__FUNCTION__, array($db, $key)); } public function db_putHex($db, $key, $value) {
return $this->ether_request(__FUNCTION__, array($db, $key, $value)); } public function db_getHex($db, $key) {
return $this->ether_request(__FUNCTION__, array($db, $key)); } public function shh_version() {
return $this->ether_request(__FUNCTION__); } public function shh_post($post) {
if (!is_a($post, 'Whisper_Post')) {
throw new ErrorException('Expected a Whisper post'); } else {
return $this->ether_request(__FUNCTION__, $post->toArray()); } } public function shh_newIdentinty() {
return $this->ether_request(__FUNCTION__); } public function shh_hasIdentity($id) {
return $this->ether_request(__FUNCTION__); } public function shh_newFilter($to=null, $topics=array()) {
return $this->ether_request(__FUNCTION__, array(array('to'=>$to, 'topics'=>$topics))); } public function shh_uninstallFilter($id) {
return $this->ether_request(__FUNCTION__, array($id)); } public function shh_getFilterChanges($id) {
return $this->ether_request(__FUNCTION__, array($id)); } public function shh_getMessages($id) {
return $this->ether_request(__FUNCTION__, array($id)); } }

转载于:https://www.cnblogs.com/wzjwffg/p/11277321.html

你可能感兴趣的文章
MIT Scheme 的基本使用
查看>>
程序员的“机械同感”
查看>>
在16aspx.com上下了一个简单商品房销售系统源码,怎么修改它的默认登录名和密码...
查看>>
c++回调函数
查看>>
linux下Rtree的安装
查看>>
【Java】 剑指offer(53-2) 0到n-1中缺失的数字
查看>>
Delphi中ListView类的用法
查看>>
多米诺骨牌
查看>>
Linq 学习(1) Group & Join--网摘
查看>>
asp.net 调用前台JS调用后台,后台掉前台JS
查看>>
Attribute(特性)与AOP
查看>>
苹果手表:大方向和谷歌一样,硬件分道扬镳
查看>>
Competing Consumers Pattern (竞争消费者模式)
查看>>
Android面试收集录15 Android Bitmap压缩策略
查看>>
PHP魔术方法之__call与__callStatic方法
查看>>
ubuntu 安装后的配置
查看>>
web前端之路,js的一些好书(摘自聂微东 )
查看>>
【模板】对拍程序
查看>>
【转】redo与undo
查看>>
解决升级系统导致的 curl: (48) An unknown option was passed in to libcurl
查看>>