{"id":46036713,"url":"https://github.com/myxtype/eos-client","last_synced_at":"2026-03-01T05:31:11.684Z","repository":{"id":37546498,"uuid":"159421652","full_name":"myxtype/eos-client","owner":"myxtype","description":"PHP library of simple and extensible  to use eos rpc and offline signature.","archived":false,"fork":false,"pushed_at":"2023-04-19T18:52:30.000Z","size":37,"stargazers_count":47,"open_issues_count":4,"forks_count":23,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-12-03T17:20:00.883Z","etag":null,"topics":["blockchain","client","eos","eos-ecc","offline","php","rpc","signature"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/myxtype.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-11-28T00:56:44.000Z","updated_at":"2025-10-07T11:16:46.000Z","dependencies_parsed_at":"2022-08-18T02:55:54.840Z","dependency_job_id":null,"html_url":"https://github.com/myxtype/eos-client","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/myxtype/eos-client","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/myxtype%2Feos-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/myxtype%2Feos-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/myxtype%2Feos-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/myxtype%2Feos-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/myxtype","download_url":"https://codeload.github.com/myxtype/eos-client/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/myxtype%2Feos-client/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29960394,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-01T01:47:18.291Z","status":"online","status_checked_at":"2026-03-01T02:00:07.437Z","response_time":124,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["blockchain","client","eos","eos-ecc","offline","php","rpc","signature"],"created_at":"2026-03-01T05:31:11.056Z","updated_at":"2026-03-01T05:31:11.667Z","avatar_url":"https://github.com/myxtype.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# eos-client\neos client offline signature for PHP\n\n针对PHP的EOS RPC客户端，另外提供EOS-ECC方法和离线交易。\n\n# Install\n\ncomposer.json\n\n```json\n{\n    \"require\": {\n        \"myxtype/eos-client\": \"dev-master\"\n    }\n}\n```\n\n然后`composer update`即可。\n\n\u003e 或者直接 `composer require myxtype/eos-client:dev-master`\n\n# Initialization\n\n```php\nuse xtype\\Eos\\Client as EosClient;\n\n$client = new EosClient('http://api-kylin.eosasia.one');\n```\n\nGuzzleHttp Options.\n```php\n$client = new EosClient([\n    'base_uri' =\u003e 'http://api-kylin.eosasia.one',\n    'timeout' =\u003e 20,\n]);\n```\n\n# RPC\nYou can visit https://developers.eos.io/eosio-nodeos/v1.4.0/reference  View all RPC Method.\n\n\n- set version（设置版本）\n```php\n// set version\n$client-\u003eversion(1);\n// or\n$client-\u003eversion(1)-\u003echain();\n// or\n$client-\u003eversion('v1')-\u003echain();\n```\n\n- chain\n```php\n$chain = $client-\u003echain();\n// You can do this\n// will visit http://api-kylin.eosasia.one/v1/chain/get_info\nvar_dump($chain-\u003egetInfo());\n// or\nvar_dump($chain-\u003eget_info());\n// or\nvar_dump($client-\u003echain()-\u003eget_info()-\u003echain_id);\n// string(64) \"5fff1dae8dc8e2fc4d5b23b2c7665c97f9e9d8edf2b6485a86ba311c25639191\"\n\n// get_block\nvar_dump($chain-\u003egetBlock(['block_num_or_id' =\u003e 5]));\n```\n\n- history\n```php\n$history = $client-\u003ehistory();\nvar_dump($history-\u003egetTransaction([\n    'id' =\u003e '5fff1dae8dc8e2fc4d5b23b2c7665c97f9e9d8edf2b6485a86ba311c25639191'\n]));\n```\n\n- net\n```php\n$net = $client-\u003enet();\nvar_dump($net-\u003estatus());\n```\n\n- producer\n```php\n$producer = $client-\u003eproducer();\n```\n\n- wallet\n```php\n$wallet = $client-\u003ewallet();\n// Signature transaction if you have opened your wallet RPC\n$wallet-\u003esign_transaction([\n    'txn' =\u003e '',\n    'keys' =\u003e '',\n    'id' =\u003e '',\n]);\n```\n- Error（错误信息）\n\n在使用RPC过程中，你可能需要获取错误信息\n\n```php\ntry {\n    // get_block\n    var_dump($client-\u003echain()-\u003egetBlock(['id' =\u003e 5]));\n} catch(\\Exception $e) {\n    var_dump($client-\u003egetError());\n}\n```\n\n如果有错误信息，将返回一个类似下面的对象。\n\n``` php\nobject(stdClass)#21 (3) {\n  [\"code\"]=\u003e\n  int(500)\n  [\"message\"]=\u003e\n  string(22) \"Internal Service Error\"\n  [\"error\"]=\u003e\n  object(stdClass)#35 (4) {\n    [\"code\"]=\u003e\n    int(3010008)\n    [\"name\"]=\u003e\n    string(23) \"block_id_type_exception\"\n    [\"what\"]=\u003e\n    string(16) \"Invalid block ID\"\n    [\"details\"]=\u003e\n    array(1) {\n      [0]=\u003e\n      object(stdClass)#18 (4) {\n        [\"message\"]=\u003e\n        string(78) \"Invalid Block number or ID, must be greater than 0 and less than 64 characters\"\n        [\"file\"]=\u003e\n        string(16) \"chain_plugin.cpp\"\n        [\"line_number\"]=\u003e\n        int(1396)\n        [\"method\"]=\u003e\n        string(9) \"get_block\"\n      }\n    }\n  }\n}\n```\n\n- notice（说明）\n\nInterface parameters need to be filled in according to the official [EOS document](https://developers.eos.io/eosio-nodeos/v1.4.0/reference). These methods are not fixed. If EOS officially updates the interface, you can modify it directly according to the above, without updating the code of EosClient.\n\n接口参数需要按照[EOS官方文档](https://developers.eos.io/eosio-nodeos/v1.4.0/reference)来填写。这些方法都不是固定的，如果EOS官方更新了接口，你直接按照上面修改就行，不必更新EosClient的代码。\n\n# ECC\n\nhttps://github.com/EOSIO/eosjs-ecc\n\n- privateToPublic\n```php\nuse xtype\\Eos\\Ecc;\n\n$privateWif = '5**********';\n$public = Ecc::privateToPublic($privateWif);\nvar_dump($public);\n// EOS7nCpUfHCPqAhu2qkTXSPQYmFLAt58gsmdFRtGCD2CNYcnWdRd3\n```\n\n- randomKey\n```php\nuse xtype\\Eos\\Ecc;\n\n// 随机生成私钥\n$randomKey = Ecc::randomKey();\nvar_dump($randomKey);\n// 5KBRW5yz1syzQcJCFUmnDeoxBX6JoZ3UpwQk5r6uKKFfGajM8SA\n```\n\n- seedPrivate\n```php\nuse xtype\\Eos\\Ecc;\n\n$privateWif = Ecc::seedPrivate('secret');\nvar_dump($privateWif);\n// 5J9YKiVU3AWNkCa2zfQpj1f2NAeMQhLsYU51N8NM28J1bMnmrEQ\n```\n\n- isValidPublic\n- isValidPrivate\n- sign\n- signHash\n\n# Offline transaction\nOffline Signature and Transaction\n\n- Send EOS or other（发送代币）\n```php\nuse xtype\\Eos\\Client;\n\n$client = new Client('http://api-kylin.eosasia.one');\n// set your private key\n// 在这里设置你的私钥\n$client-\u003eaddPrivateKeys([\n    '5JC6gzzaKU4L6dP7AkmRPXJMcYqJxJ8iNB9tNwd2g4VbpRf5CPC'\n]);\n\n$tx = $client-\u003etransaction([\n    'actions' =\u003e [\n        [\n            'account' =\u003e 'eosio.token',\n            'name' =\u003e 'transfer',\n            'authorization' =\u003e [[\n                'actor' =\u003e 'xtypextypext',\n                'permission' =\u003e 'active',\n            ]],\n            'data' =\u003e [\n                'from' =\u003e 'xtypextypext',\n                'to' =\u003e 'mysuperpower',\n                'quantity' =\u003e '0.1000 EOS',\n                'memo' =\u003e '',\n            ],\n        ]\n    ]\n]);\necho \"Transaction ID: {$tx-\u003etransaction_id}\";\n// Transaction ID: 15ece6b6f0028e36919f9f208b47ae24233e5ae67a8f15319ad317d3e8be1a2a\n```\n\n- Buy Ram（购买内存）\n```php\n// 你甚至可以使用PHP链式调用对象方方法\n$tx = $client-\u003eaddPrivateKeys(['5JC6gzzaKU4L6dP7AkmRPXJMcYqJxJ8iNB9tNwd2g4VbpRf5CPC'])-\u003etransaction([\n    'actions' =\u003e [\n        [\n            'account' =\u003e 'eosio',\n            'name' =\u003e 'buyram',\n            'authorization' =\u003e [[\n                'actor' =\u003e 'xtypextypext',\n                'permission' =\u003e 'active',\n            ]],\n            'data' =\u003e [\n                'payer' =\u003e 'xtypextypext',\n                'receiver' =\u003e 'mysuperpower',\n                'quant' =\u003e '0.1000 EOS',\n            ],\n        ]\n    ]\n]);\necho \"Transaction ID: {$tx-\u003etransaction_id}\";\n// Transaction ID: 15ece6b6f0028e36919f9f208b47ae24233e5ae67a8f15319ad317d3e8be1a2a\n```\n\n- delegatebw（抵押来得到CPU和NET）\n```php\n$tx = $client-\u003eaddPrivateKeys(['5JC6gzzaKU4L6dP7AkmRPXJMcYqJxJ8iNB9tNwd2g4VbpRf5CPC'])-\u003etransaction([\n    'actions' =\u003e [\n        [\n            'account' =\u003e 'eosio',\n            'name' =\u003e 'delegatebw',\n            'authorization' =\u003e [[\n                'actor' =\u003e 'xtypextypext',\n                'permission' =\u003e 'active',\n            ]],\n            'data' =\u003e [\n                'from' =\u003e 'xtypextypext',\n                'receiver' =\u003e 'mysuperpower',\n                'stake_net_quantity' =\u003e '0.1000 EOS',\n                'stake_cpu_quantity' =\u003e '0.1000 EOS',\n                'transfer' =\u003e false,\n            ],\n        ]\n    ]\n]);\necho \"Transaction ID: {$tx-\u003etransaction_id}\";\n```\n\n- New Account (新建账户)\n```php\n// 新建账号\n$newAccount = 'ashnbjuihgt1';\n// randomKey 随机生成KEY\n$activePublicKey = Ecc::privateToPublic(Ecc::randomKey());\n$ownerPublicKey = Ecc::privateToPublic(Ecc::randomKey());\nvar_dump($newAccount, $activePublicKey, $ownerPublicKey);\n\n$tx = $client-\u003eaddPrivateKeys(['5JC6gzzaKU4L6dP7AkmRPXJMcYqJxJ8iNB9tNwd2g4VbpRf5CPC'])-\u003etransaction([\n    'actions' =\u003e [\n        [\n            'account' =\u003e 'eosio',\n            'name' =\u003e 'newaccount',\n            'authorization' =\u003e [[\n                'actor' =\u003e 'xtypextypext',\n                'permission' =\u003e 'active',\n            ]],\n            'data' =\u003e [\n                'creator' =\u003e 'xtypextypext',\n                // Main net key is name\n                'newact' =\u003e $newAccount,\n                'owner' =\u003e [\n                    'threshold' =\u003e 1,\n                    'keys' =\u003e [\n                        ['key' =\u003e $ownerPublicKey, 'weight' =\u003e 1],\n                    ],\n                    'accounts' =\u003e [],\n                    'waits' =\u003e [],\n                ],\n                'active' =\u003e [\n                    'threshold' =\u003e 1,\n                    'keys' =\u003e [\n                        ['key' =\u003e $activePublicKey, 'weight' =\u003e 1],\n                    ],\n                    'accounts' =\u003e [],\n                    'waits' =\u003e [],\n                ],\n            ],\n        ],\n        [\n            'account' =\u003e 'eosio',\n            'name' =\u003e 'buyram',\n            'authorization' =\u003e [[\n                'actor' =\u003e 'xtypextypext',\n                'permission' =\u003e 'active',\n            ]],\n            'data' =\u003e [\n                'payer' =\u003e 'xtypextypext',\n                'receiver' =\u003e $newAccount,\n                'quant' =\u003e '0.2500 EOS',\n            ],\n        ],\n        [\n            'account' =\u003e 'eosio',\n            'name' =\u003e 'delegatebw',\n            'authorization' =\u003e [[\n                'actor' =\u003e 'xtypextypext',\n                'permission' =\u003e 'active',\n            ]],\n            'data' =\u003e [\n                'from' =\u003e 'xtypextypext',\n                'receiver' =\u003e $newAccount,\n                'stake_net_quantity' =\u003e '0.3000 EOS',\n                'stake_cpu_quantity' =\u003e '0.2000 EOS',\n                'transfer' =\u003e false,\n            ],\n        ]\n    ]\n]);\necho \"Transaction ID: {$tx-\u003etransaction_id}\";\n// string(12) \"ashnbjuihgt1\"\n// string(53) \"EOS4uioRoFXsht5ExeD2v53BNWNE3MoEezMLzF6ZbxqzP1hAhmfdp\"\n// string(53) \"EOS8f3Cc8ex7zcgHH2xWcC1QgYQQTbio5DRRoCksteoX4PEnQyA4o\"\n// Transaction ID: d556e1abbe108e72d3ae2d1b0e1c9e581b95fa21931dee80e77175fd14322ffb\n```\n\n- Maintain（维护）\n\nThis project has been optimized and maintained. If you have a better plan, I hope you can join this project.\n\n这个项目一直在优化和维护，如果你有更好的方案，希望你能加入这个开源项目。\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmyxtype%2Feos-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmyxtype%2Feos-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmyxtype%2Feos-client/lists"}