This is php wrapper for LISK API written in OOP style.
It’s supposed to be a full implementation of the API.
Included in here is a CLI Parser which makes it possible to call all actions from command line. e.g.:
php api.php getBlocks --height=2967414
Currently supports Lisp API Version 0.8 The following sections from the lisk api are available:
- [x] Accounts
- [x] Loader
- [x] Transactions
- [x] Peers
- [x] Blocks
- [x] Signatures
- [x] Delegates
- [x] Apps
- [x] Multi-signature
For more infos see https://docs.lisk.io/docs/lisk-api
It’s a composer based package. \ Installation is as easy as:
composer require cb0/lisk-php-api
To start communicating with a lisk server you need to instanciate lisk client and specify the servers ip and port.
This would connect to the official lisk testnet.
$client = new \Lisk\Client('http://testnet.lisk.io:7000');
Request the balance of an account.
$client->getBalance($address);
Get the public key of an account. If the account does not exist the API call will return an error.
$client->getPublicKey($secret);
Request information about an account. If account with secret does not exist, account will be created.
$client->openAccount($secret);
Returns the public key of the provided secret key.
$client->generatePublicKey($secret);
Returns account information of an address.
$client->getAccountInfo($address);
Returns delegate accounts by address.
$client->getDelegates($address);
Vote for the selected delegates. Maximum of 33 delegates at once. (Note: This is currently not working with lisk api. Exception: “a.asset.votes.join is not a function”)
$client->voteDelegates($delegates, $secret, $secondSecret = null, $publicKey = null);
$client->getLoadingStatus();
Get the synchronization status of the client.
$client->getSynchronizationStatus();
Get the status of last received block. Returns true if block was received in the past 120 seconds.
$client->getBlockStatus();
List of transactions matched by provided parameters.
$client->listTransactions($blockId, $senderId, $recipientId, $limit, $offset, $orderBy);
Send transaction to broadcast network.
$client->sendTransaction($secret, $amount, $recipientId, $publicKey, $secondSecret);
Get transaction that matches the provided id.
$client->getTransaction($id);
Get unconfirmed transaction that matches the provided id.
$client->getUnconfirmedTransaction($id);
Gets a list of unconfirmed transactions.
$client->listUnconfirmedTransactions();
Gets a list of queued transactions.
$client->listQueuedTransactions();
Get queued transaction that matches the provided id.
$client->getQueuedTransaction($id);
Gets list of peers from provided filter parameters.
$client->getPeerList($state, $os, $version, $limit, $offset, $orderBy);
Gets a list peer versions and build times
$client->getPeerVersion();
Gets peer by IP address and port.
$client->getPeer($ip, $port);
Gets all blocks by provided filter(s).
$client->getBlocks($totalFee, $totalAmount, $previousBlock, $height, $generatorPublicKey, $limit, $offset, $orderBy);
Gets block by provided id.
$client->getBlock($id);
Get transaction fee for sending “normal” transactions.
$client->getBlockchainFee();
Get transaction fee for all types of transactions.
$client->getBlockchainFees();
Gets the forging reward for blocks.
$client->getBlockchainReward();
Gets the total amount of Lisk in circulation
$client->getTotalSupply();
Gets the blockchain height of the client.
$client->getBlockchainHeight();
Gets status of height, fee, milestone, blockreward and supply
$client->getStatusInfos();
Gets the nethash of the blockchain on a client.
$client->getBlockchainNethash();
Gets the milestone of the blockchain on a client.
$client->getBlockchainMilestone();
Gets the second signature status of an account.
$client->getSignatureFee();
Add a second signature to an account.
$client->addSecondSignature($secret, $secondSecret, $publicKey);
Puts request to create a delegate.
$client->createDelegate($secret, $username, $secondSecret);
Gets list of delegates by provided filter.
$client->getDelegateList($limit, $offset, $orderBy);
Gets delegate by public key or username.
$client->getDelegate($publicKey, $username);
Search for Delegates by “fuzzy” username.
$client->searchDelegate($username, $orderBy);
Get total count of registered delegates.
$client->getDelegateCount();
Get votes by account wallet address.
$client->getDelegateVotes($address);
Get voters of delegate.
$client->getDelegateVoters($publicKey);
Enables forging for a delegate on the client node.
$client->enableForging($secret);
Disables forging for a delegate on the client node.
$client->disableForging($secret);
Get amount of Lisk forged by an account.
$client->getForgedByAccount($generatorPublicKey, $start, $end);
Get next delegate lining up to forge.
$client->getNextForger($limit);
Registers a Blockchain Application.
$client->registerApp($secret, $category, $name, $type, $link, $secondSecret, $publicKey, $description, $tags, $icon);
Gets a list of Blockchain Applications registered on the network.
$client->getApps($category, $name, $appType, $link, $limit, $offset, $orderBy);
Gets a specific Blockchain Application by registered id.
$client->getApp($id);
Searches for Blockchain Applications by filter(s) on a node.
$client->searchApps($q, $category, $installed);
Installs a app by id on the node.
$client->installApp($id);
Returns a list of installed apps on the requested node.
$client->getInstalledApps();
Returns a list of installed app ids on the requested node.
$client->getAllInstalledApps();
Uninstalls a app by id from the requested node.
$client->uninstallApp($id);
Launches a app by id on the requested node.
$client->launchApp($id, $params);
Returns a list of app ids currently being installed on the requested node.
$client->installingApp();
Returns a list of app ids currently being uninstalled on the client node.
$client->uninstallingApp();
Returns a list of app ids which are currently launched on the client node.
$client->launchedApps();
Returns a full list of app categories.
$client->getCategories();
Stops a app by id on the requested node.
$client->stopApp($id);
Create a multi-signature account.
$client->createMultiSignatureAccount($secret, $lifetime, $min, $keysgroup, $secondSecret);
Gets a list of accounts that belong to a multi-signature account.
$client->getMultiSignatureAccounts($publicKey);
Signs a transaction that is awaiting signature.
$client->getPendingTransactions($publicKey);
Returns a list of multi-signature transactions that waiting for signature by publicKey.
$client->signPendingTransaction($secret, $transactionId, $publicKey);
- [x] [1] complete API
- [ ] [2] complete documentation
- [ ] [3] put package on packagist
- [ ] […] more
If you want to support me please consider voting for my lisk delegate
- pelops (6669300595452632273L) on MainNet
- pelops_testnet (3697531586899904038L) on TestNet
If you want to support the development just create a pull request or fork this project. I’ll try to merge everything into the projects asap.
These people have contributed to this project:
- diszad - since 10/2017
Thanks you very much!
License under GNU General Public License v3.0
Copyright (c) 2017 Marcus Puchalla <[email protected]>
LiskPhp is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
LiskPhp is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with LiskPhp. If not, see http://www.gnu.org/licenses/.