您的位置 首页 php

PHP一秒接入TRX波场

  1. 首先项目中安装TRX官方推荐的PHP开发包,需要注意一下PHP7.4,低于这个版本装不上,当然后也有其他的办法

    composer require iexbase/tron-api 
  2. 安装完成后可以不用USE,直接在你的业务方法中new出来

    $url ='这个地址就是官方的API地址';
    $fullNode = new \IEXBase\TronAPI\Provider\HttpProvider($url);
    $solidityNode = new \IEXBase\TronAPI\Provider\HttpProvider($url);
    $eventServer = new \IEXBase\TronAPI\Provider\HttpProvider($url);
    try {
    $tron = new \IEXBase\TronAPI\Tron($fullNode, $solidityNode, $eventServer);
    } catch (\IEXBase\TronAPI\Exception\TronException $e) {
    exit($e->getMessage());
    } 
  3. 这里直接用一个方法作为演示,让大家看得更明白

    function Test()
    { 
      $url ='这个地址就是官方的API地址';
    	$fullNode = new \IEXBase\TronAPI\Provider\HttpProvider($url);
    	$solidityNode = new \IEXBase\TronAPI\Provider\HttpProvider($url);
    	$eventServer = new \IEXBase\TronAPI\Provider\HttpProvider($url);
    	try {
    	$tron = new \IEXBase\TronAPI\Tron($fullNode, $solidityNode, $eventServer);
    	} catch (\IEXBase\TronAPI\Exception\TronException $e) {
    	exit($e->getMessage());
    	}
    	//波场返回值地址是16进制的需要转换成Base58check格式跟你的数据库做匹配
    	$result= $tron->hexString2Address(str_replace("0x","41",'4189d45b75a99a699032d12360fc3efffc5cf2603c'));
    }
    //返回值
    地址是:TNXyyBTdz822pMQskZsP8NRknBMKdK7xrM 

以上就是在PHP项目中最基础的接入TRX的方式,剩下大家就可以根据自己的业务逻辑去结合E波场了,是不是很简单?

关于tron-api里面的文件大家composer后可自行查阅tron-api封装了哪些方法

PHP一秒接入TRX波场

以上是tron-api安装完成后目录结构,好了大家今天就先分享这些吧,如果有不懂得可以给我留言我会一一解答的。

文章来源:智云一二三科技

文章标题:PHP一秒接入TRX波场

文章地址:https://www.zhihuclub.com/77121.shtml

关于作者: 智云科技

热门文章

评论已关闭

36条评论

  1. And since Tadalafil is a phosphodiesterase type 5 PDE5 inhibitor, it can interact with nitrate-based medications Unsurprisingly, the risks associated with PDE-5 inhibitors are similar across these four popular drugs, and include priapism, low blood pressure, and blurred vision

  2. Large numbers of items and high download counts may satisfy administration, but they don t tell a story about what value your repository adds to the world

  3. 2005 also measured and compared melatonin production, light exposure, and physical activity levels in 165 manufacturing workers on three non rotating shifts first, 06 00 14 00; second, 14 00 22 00; and third, 22 00 06 00

  4. Rational Zika vaccine design via the modulation of antigen membrane anchors in chimpanzee adenoviral vectors

  5. Melanocyte stem cell quiescence is sufficient to suppress melanoma development Drug ranking based on drug positivity scores

  6. Moreover, for most clinical scenarios of ILRR, there may be multiple reasonable salvage strategies that multidisciplinary teams should carefully discuss and present to the patient CREB 1alpha is recruited to and mediates upregulation of the cytochrome c promoter during enhanced mitochondrial biogenesis accompanying skeletal muscle differentiation

  7. 5 mg LE LOD 40 40 40 40 Ovulation rate, abortion rate, pregnancy rate Brain tissue was homogenized in RIPA buffer containing protease inhibitors Thermo Scientific

  8. 2005 05 27 Not applicable US Tarka Verapamil hydrochloride 240 mg Trandolapril 2 mg Tablet, extended release Oral Bgp Pharma Ulc 2002 07 15 2019 11 19 Canada Tarka Verapamil hydrochloride 240 mg 1 Trandolapril 2 mg 1 Tablet, film coated, extended release Oral AbbVie Inc

  9. There are only two inotropes frequently used in the United States dobutamine and milrinone

  10. Ceftriaxone treatment failure of pharyngeal gonorrhoea verified by international recommendations, Sweden, July 2010 46, 47 In kidneys of Vhl deficient mice the postischemic increase of Ngal mRNA was significantly reduced by 87 compared with WT P 0

  11. Summary of Recommendations for Providing Family Planning and Related Preventive Health Services

  12. After oral administration of magnesium citrate, there is a 40 increase in urine excretion of magnesium

  13. With the holidays soon upon us, you may be looking for the perfect gift for a loved one with cancer

  14. The King of Horse Steroids If there is one anabolic steroid we can aptly label king of horse steroids line it is that of Equipoise EQ; in fact, nothing else comes close However, larger studies, such as those involving knockout experiments, GWAS and exome sequencing, are needed to determine whether APE1 Ref 1 is proatherogenic or antiatherogenic

  15. Some dr will go until the egg is 40mm 12 8 2012 If you are a woman who works in an industry involving plastics or metal manufacturing, or in a conventional farming environment that exposes you to crop chemicals, you could be at a higher risk of developing breast cancer than women in other industries

  16. 1998; 56 1125 40 Tell your doctor right away if you have any serious side effects, including interrupted breathing during sleep sleep apnea, mental mood changes, fast irregular heartbeat, increased thirst urination, signs of infection such as fever, persistent sore throat, easy bruising bleeding, difficulty urinating, signs of your adrenal glands not working well such as loss of appetite, unusual tiredness, weight loss

  17. Describe the protocols Mandana Ghahremani used in your cycles at Reproductive Fertility and their degree of success

  18. Thanks for some other wonderful article. The place else may anybody
    get that kind of information in such an ideal way of writing?
    I have a presentation subsequent week, and I am on the search
    for such info.

网站地图