当前位置: 首页>>代码示例>>PHP>>正文


PHP account::address方法代码示例

本文整理汇总了PHP中account::address方法的典型用法代码示例。如果您正苦于以下问题:PHP account::address方法的具体用法?PHP account::address怎么用?PHP account::address使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在account的用法示例。


在下文中一共展示了account::address方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: request

 public static function request($params = array())
 {
     if (empty($params)) {
         $params['description'] = gio::input('Transaction Description');
         $params['amount'] = gio::input("Amount", "integer");
         $params['merchant'] = account::address();
         $params['client'] = gio::input("Enter the client's account address");
         $params['order id'] = md5(uniqid(rand(), true));
         $params['time'] = time();
     }
     $dest = Tools::address($params['client']);
     if (!$dest) {
         $status = 0;
         $res = "The client address is invalid";
     } else {
         $m = GsonCrypt::sign(Gmsg::create($params));
         if (!$m) {
             $status = 0;
             $res = "Unable to sign message to " . $params['client'];
         } else {
             $m = Gmsg::create(Gmsg::Prepare($m, "paymentrequest", config::$bankId));
             $net = new Gnet();
             $r = $net->send($m);
             unset($net);
             if (!$r) {
                 $status = 0;
                 $res = "Unable to send the message";
             } else {
                 $v = GsonCrypt::verify($r, config::$bankId);
                 if (!$v) {
                     $status = 0;
                     $res = "Unable to verify response from bank";
                 } else {
                     $v = Gmsg::extract($v);
                     if (!$v) {
                         $status = 0;
                         $res = "Unable to understand the response";
                     } else {
                         $status = $v['status'];
                         $res = $v['response'];
                     }
                 }
             }
         }
     }
     return array($status, $res);
 }
开发者ID:perfectcode1,项目名称:Gcoin,代码行数:47,代码来源:transaction.php

示例2: main

function main($mainmsg)
{
    gio::output(config::$walletMessage);
    if (account::isCreated()) {
        $serv = popen("service.ecsh", 'r');
    }
    $net = new Gnet();
    $inerr = 0;
    while (true) {
        $inmsg = array();
        if (account::isCreated()) {
            $inmsg["d"] = "Destroy Account";
            $dmsg = $mainmsg + $inmsg;
        } else {
            $inmsg["c"] = "Create Bank Wallet";
            $dmsg = $inmsg;
        }
        $dmsg["x"] = "Exit";
        if (!$inerr) {
            gio::output();
            foreach ($dmsg as $k => $v) {
                $k = strtoupper($k);
                gio::output("{$k} - {$v}");
            }
            gio::output();
            $msg = "Enter your choice and press enter";
        }
        $inerr = 0;
        $c = gio::input("{$msg}");
        if (!array_key_exists($c, $dmsg)) {
            $c = null;
        }
        switch ($c) {
            case 1:
                $a = account::address();
                gio::output("Bank's account address is: {$a}");
                break;
            case 2:
                $n = account::coins(config::$accountId, $coins);
                gio::output("You have {$n} coins");
                if ($n && gio::confirm("Do you wish to see their Id's")) {
                    foreach ($coins as $val => $ccs) {
                        foreach ($ccs as $i => $coin) {
                            gio::output("Ecash ID: {$i}");
                            foreach ($coin as $id => $c) {
                                if ($id == "token") {
                                    $c = md5($c);
                                }
                                if ($id == "hash") {
                                    $c = sha1($c);
                                }
                                if ($id == "mined") {
                                    $c = date(config::$timeFormat, $c);
                                }
                                gio::output("{$id}=>{$c}");
                            }
                            gio::output();
                        }
                    }
                }
                break;
            case 3:
                $m = transaction::prequest();
                gio::output($m[1]);
                break;
            case 4:
                transaction::pgrant();
                break;
            case 5:
                $acc = gio::input("Enter the wallet number [EMPTY for bank's self]");
                $o = gio::input("Enter the order id [EMPTY for all]");
                $f = null;
                if (gio::confirm("Do you want to create a file on your desktop")) {
                    do {
                        $f = gio::input("Enter the file name");
                    } while (!$f);
                }
                transaction::reports($o, $acc, $f);
                break;
            case 6:
                $m = transaction::clearrequests(null, null);
                gio::output($m[1]);
                break;
            case 7:
                account::merckey(gio::input("Enter the name of the file to write to your desktop"));
                break;
            case "c":
                $serv = account::create();
                break;
            case "d":
                gio::output("This action will irreversibly destroy your wallet and its contents");
                if (gio::confirm("Are you sure you want to destroy your account")) {
                    account::destroy();
                }
                break;
            case "x":
                @$net->send('shutdown');
                $net = null;
                if ($serv) {
                    $ret = pclose($serv);
//.........这里部分代码省略.........
开发者ID:perfectcode1,项目名称:Gcoin,代码行数:101,代码来源:win.php

示例3: prequest

 public static function prequest($params = array())
 {
     if (empty($params)) {
         $params['description'] = gio::input('Transaction Description');
         $params['amount'] = gio::input("Amount", "integer");
         $params['merchant'] = account::address();
         $params['client'] = gio::input("Enter the client's account address");
         $params['order id'] = md5(uniqid(rand(), true));
         $params['time'] = time();
     }
     if (!self::certexchange($params['client'])) {
         return array(0, "Can not communicate with the destination bank");
     }
     $dest = Tools::address($params['client']);
     if (!$dest) {
         $status = 0;
         $res = "The client address is invalid";
     } else {
         $m = GsonCrypt::sign(Gmsg::create($params));
         if (!$m) {
             $status = 0;
             $res = "Unable to sign message to " . $params['client'];
         } else {
             $m = Gmsg::create(Gmsg::Prepare($m, "paymentrequest", $dest['bank']));
             $net = new Gnet();
             $r = $net->connect($dest['address'], intval($dest['port']));
             if (!$r) {
                 $cerr = 1;
             }
             if ($r) {
                 $r = $net->send($m);
             }
             unset($net);
             if (!$r) {
                 $status = 0;
                 $res = isset($cerr) ? "Unable to connect to the merchank's bank" : "Unable to send the message";
             } else {
                 $v = GsonCrypt::verify($r, $dest['bank']);
                 if (!$v) {
                     $status = 0;
                     $res = "Unable to verify response from bank";
                 } else {
                     $v = Gmsg::extract($v);
                     if (!$v) {
                         $status = 0;
                         $res = "Unable to understand the response";
                     } else {
                         $status = $v['status'];
                         $res = $v['response'];
                     }
                 }
             }
         }
     }
     return array($status, $res);
 }
开发者ID:perfectcode1,项目名称:Gcoin,代码行数:56,代码来源:transaction.php

示例4: main

function main($mainmsg)
{
    gio::output(config::$walletMessage);
    $net = new Gnet();
    $inerr = 0;
    while (true) {
        $inmsg = array();
        if (account::isCreated()) {
            $inmsg["d"] = "Destroy Account";
            $dmsg = $mainmsg + $inmsg;
        } else {
            $inmsg["c"] = "Create Wallet Account [Merchant/Client]";
            $dmsg = $inmsg;
        }
        $dmsg["x"] = "Exit";
        if (!$inerr) {
            gio::output();
            foreach ($dmsg as $k => $v) {
                $k = strtoupper($k);
                gio::output("{$k} - {$v}");
            }
            gio::output();
            $msg = "Enter your choice and press enter";
        }
        $inerr = 0;
        $c = gio::input("{$msg}");
        if (!array_key_exists($c, $dmsg)) {
            $c = null;
        }
        switch ($c) {
            case 1:
                $a = account::address();
                gio::output("Your wallet address is: {$a}");
                break;
            case 2:
                $m = transaction::request();
                gio::output($m[1]);
                break;
            case 3:
                transaction::grant();
                break;
            case 4:
                $n = account::balance($coins);
                gio::output("Total value of eCash units: {$n}");
                if ($n && gio::confirm("Do you wish to see their Id's")) {
                    foreach ($coins as $val => $ccs) {
                        foreach ($ccs as $i => $coin) {
                            gio::output("Ecash ID: {$i}");
                            foreach ($coin as $id => $c) {
                                if ($id == "token") {
                                    $c = md5($c);
                                }
                                if ($id == "hash") {
                                    $c = sha1($c);
                                }
                                if ($id == "mined") {
                                    $c = date(config::$timeFormat, $c);
                                }
                                gio::output("{$id}=>{$c}");
                            }
                            gio::output();
                        }
                    }
                }
                break;
            case 5:
                $o = gio::input("Enter the order id [EMPTY for all]");
                $f = null;
                if (gio::confirm("Do you want to create a file on your desktop")) {
                    do {
                        $f = gio::input("Enter the file name");
                    } while (!$f);
                }
                transaction::reports($o, $f);
                break;
            case 6:
                transaction::clearallrequests();
                break;
            case 7:
                account::merckey(gio::input("Enter the name of the file to write to your desktop"));
                break;
            case 8:
                $maxallowed = 1000;
                $v = gio::input("What value of eCash do you wish to mine", "integer");
                $n = gio::input("How many eCashes do you wish to mine", "integer");
                $c = mine::countcoins($null);
                unset($null);
                if ($n > $maxallowed || $c + $n > $maxallowed) {
                    $rem = $maxallowed - $c;
                    gio::output("You can not mine above {$maxallowed} eCashes!");
                    gio::output("You can mine {$rem} more eCashes!");
                } else {
                    $res = mine::ecash($n, $v);
                    if ($res) {
                        gio::output("You have successfully mined {$n} eCashes.");
                        gio::output("Mining process took " . Tools::arrtostr($res, ", "));
                    } else {
                        gio::output("Mining operation failed!");
                    }
                }
//.........这里部分代码省略.........
开发者ID:perfectcode1,项目名称:Gcoin,代码行数:101,代码来源:win.php


注:本文中的account::address方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。