{"id":37008801,"url":"https://github.com/ufado/tron-php","last_synced_at":"2026-01-14T00:50:24.367Z","repository":{"id":229755507,"uuid":"777544450","full_name":"ufado/tron-php","owner":"ufado","description":"目前支持波场的 TRX 和 TRC20 中生成地址，发起转账，离线签名，资源代理和收回等功能。唯一支持质押2.0相关功能，将会持续更新和维护。","archived":false,"fork":false,"pushed_at":"2024-06-03T09:05:20.000Z","size":22,"stargazers_count":10,"open_issues_count":0,"forks_count":5,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-26T01:57:30.278Z","etag":null,"topics":["tron","tron-api","tron-php","tron-protocol","trongrid"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ufado.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-03-26T03:34:35.000Z","updated_at":"2025-02-28T10:10:04.000Z","dependencies_parsed_at":"2024-04-01T17:30:55.267Z","dependency_job_id":null,"html_url":"https://github.com/ufado/tron-php","commit_stats":null,"previous_names":["ufado/tron-php"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/ufado/tron-php","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ufado%2Ftron-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ufado%2Ftron-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ufado%2Ftron-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ufado%2Ftron-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ufado","download_url":"https://codeload.github.com/ufado/tron-php/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ufado%2Ftron-php/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28407175,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T00:40:43.272Z","status":"ssl_error","status_checked_at":"2026-01-14T00:40:42.636Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["tron","tron-api","tron-php","tron-protocol","trongrid"],"created_at":"2026-01-14T00:50:24.184Z","updated_at":"2026-01-14T00:50:24.351Z","avatar_url":"https://github.com/ufado.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e波场开发包 php版\u003c/h1\u003e\r\n\r\n## 概述\r\n\r\n波场开发包目前支持波场的 TRX 和 TRC20 中生成地址，发起转账，离线签名，资源代理和收回，资源价格查询等功能。正在持续更新，将会支持更多的功能，已修复原版不少bug，将会持续维护。\r\n\r\n## 特点\r\n\r\n1. 方法调用快捷方便\r\n1. 兼容 TRON 网络中 TRX 货币和 TRC 系列所有通证\r\n1. 支持最新的质押2.0中的资源代理和资源回收\r\n1. 支持实时获取质押获得的资源数量，例如质押1trx获得的能量\r\n1. 接口可灵活增减\r\n1. 速度迅速 算法经过专门优化\r\n1. 持续更新 始终跟进波场新功能\r\n\r\n## 支持方法\r\n\r\n- 生成地址 `generateAddress()`\r\n- 验证地址 `validateAddress(Address $address)`\r\n- 根据私钥得到地址 `privateKeyToAddress(string $privateKeyHex)`\r\n- 查询余额 `balance(Address $address)`\r\n- 交易转账(离线签名) `transfer(Address $from, Address $to, float $amount)`\r\n- 查询最新区块 `blockNumber()`\r\n- 根据区块链查询信息 `blockByNumber(int $blockID)`\r\n- 根据交易哈希查询信息 `transactionReceipt(string $txHash)`\r\n- 资源代理`delegate(Address $from, Address $to, float $amount,string $resource = 'ENERGY', $lock=false,$lock_period=0)`\r\n- 资源收回`undelegate(Address $from,Address $to, float $amount,string $resource = 'ENERGY')`\r\n- 质押1trx获得的能量`getFrozenEnergyPrice(Address $my)`\r\n- 质押1trx获得的带宽`getFrozenNetPrice(Address $my)`\r\n\r\n## 快速开始\r\n\r\n### 安装\r\n\r\n``` php\r\ncomposer require ufado/tron-php\r\n```\r\n\r\n### 接口调用\r\n\r\n完整代码请查阅/examples下的文件\r\n\r\n[USDT.php](./examples/USDT.php)\r\n\r\n``` php\r\n//usdt转账\r\n$tronSecret = \"0000000\";//波场私钥\r\n$tronAddress = \"Txxxxxx\";//波场公钥（波场地址）\r\n//转换成Address类\r\n$fromAddr = $trc20Wallet-\u003eprivateKeyToAddress($tronSecret);//发起地址\r\n$toAddr = new Address(\r\n    $tronAddress,\r\n    '',\r\n    $trc20Wallet-\u003etron-\u003eaddress2HexString($tronAddress)\r\n);//接受地址\r\n$usdt = $trc20Wallet-\u003ebalance($fromAddr);//获取usdt余额\r\n$transferData = $trc20Wallet-\u003etransfer($fromAddr,$toAddr,1);//转账1usdt\r\n```\r\n\r\n[Trx.php](./examples/Trx.php)\r\n\r\n```php\r\n\r\n$tronSecret = \"0000000\";//波场私钥\r\n$tronAddress = \"Txxxxxx\";//波场公钥（波场地址）\r\n//转换成Address类\r\n$fromAddr = $trxWallet-\u003eprivateKeyToAddress($tronSecret);//发起地址\r\n$toAddr = new Address(\r\n    $tronAddress,\r\n    '',\r\n    $trxWallet-\u003etron-\u003eaddress2HexString($tronAddress)\r\n);//接受地址\r\n\r\n$trx = $trxWallet-\u003ebalance($fromAddr);//获取trx余额\r\n$transferData = $trxWallet-\u003etransfer($fromAddr,$toAddr,1); //转账1trx\r\n```\r\n\r\n[Delegate.php](./examples/Delegate.php)\r\n\r\n```php\r\n//以下全部为质押2.0接口\r\n$trxWallet-\u003edelegate($fromAddr,$toAddr,1);//代理1trx产生的能量\r\n$trxWallet-\u003eundelegate($fromAddr,$toAddr,1);//收回1trx产生的能量\r\n$trxWallet-\u003edelegate($fromAddr,$toAddr,1,\"BANDWITH\");//代理1trx产生的带宽\r\n$trxWallet-\u003eundelegate($fromAddr,$toAddr,\"BANDWITH\");//收回1trx产生的带宽\r\n$trxWallet-\u003edelegate($fromAddr,$toAddr,1,\"ENERGY\",true,1200);//代理1trx产生的能量,锁定期1小时，单位为3秒\r\n$trxWallet-\u003etron-\u003egetdelegatedresourceaccountindexv2($fromAddr-\u003eaddress);//获取全部已经代理的资源\r\n$trxWallet-\u003egetFrozenEnergyPrice($toAddr);//质押1trx获得的能量 例如12.369\r\n$trxWallet-\u003egetNetEnergyPrice($toAddr);//质押1trx获得的带宽 例如1.197\r\n```\r\n\r\n\r\n\r\n## 感谢\r\n\r\n| 开发者名称 | 描述 | 应用场景 |\r\n| :-----| :---- | :---- |\r\n| [iexbase/tron-api](https://github.com/iexbase/tron-api) | 波场官方文档推荐 PHP 扩展包 | 波场基础Api |\r\n| [Fenguoz](https://github.com/Fenguoz/) | 波场PHP 实现 | 波场基础Api |\r\n| [ufado/tron-api](https://github.com/ufado/tron-api) | 基于iexbase的自行维护扩展包 | 波场基础Api |\r\n\r\n## 联系\r\n\r\n项目合作 项目开发 源码定制 请联系\r\nHttps://t.me/ufado_bot","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fufado%2Ftron-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fufado%2Ftron-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fufado%2Ftron-php/lists"}