A Node.JS module, which provides an wrapper for the Lisk API.
Account related API calls.
Get information about an account.
Request
var liskAPI = require("lisk-api");
liskAPI.openAccount("secret key of account",
function(error, success, response) {
console.log(response);
});
Response
{
"success": true,
"account": {
"address": "Address of account. String",
"unconfirmedBalance": "Unconfirmed balance of account. Integer",
"balance": "Balance of account. Integer",
"publicKey": "Public key of account. Hex",
"unconfirmedSignature": "If account enabled second signature, but it's still not confirmed. Boolean: true or false",
"secondSignature": "If account enabled second signature. Boolean: true or false",
"secondPublicKey": "Second signature public key. Hex",
"username": "Username of account."
}
}
Get the balance of an account.
Request
var liskAPI = require("lisk-api");
liskAPI.getBalance("Address of the account",
function(error, success, response) {
console.log(response);
});
Response
{
"success": true,
"balance": "Balance of account",
"unconfirmedBalance": "Unconfirmed balance of account"
}
Get the public key of an account. If the account does not exist the API call will return an error.
Request
var liskAPI = require("lisk-api");
liskAPI.getPublicKey("Address of the account",
function(error, success, response) {
console.log(response);
});
Response
{
"success": true,
"publicKey": "Public key of account. Hex"
}
Returns the public key of the provided secret key.
Request
var liskAPI = require("lisk-api");
liskAPI.generatePublicKey("secret key of account",
function(error, success, response) {
console.log(response);
});
Response
{
"success": true,
"publicKey": "Public key of account. Hex"
}
Return account information of an address.
Request
var liskAPI = require("lisk-api");
liskAPI.getAccount("Address of the account",
function(error, success, response) {
console.log(response);
});
Response
{
"success": true,
"account": {
"address": "Address of account. String",
"unconfirmedBalance": "Unconfirmed balance of account. Integer",
"balance": "Balance of account. Integer",
"publicKey": "Public key of account. Hex",
"unconfirmedSignature": "If account enabled second signature, but it's still not confirmed. Boolean: true or false",
"secondSignature": "If account enabled second signature. Boolean: true or false",
"secondPublicKey": "Second signature public key. Hex"
}
}
Get votes by account address.
Request
var liskAPI = require("lisk-api");
liskAPI.getVotes("Address of the account",
function(error, success, response) {
console.log(response);
});
Response
{
"success": true,
"delegates": "array of delegates"
}
Vote for the selected delegates. Maximum of 33 delegates at once.
Request
var liskAPI = require("lisk-api");
liskAPI.vote("Secret key of account",
"Second secret of account, required if user uses second signature. The parameter is ignored when the value is null.",
"Public key of sender account, to verify secret passphrase in wallet. Optional, only for UI. The parameter is ignored when the value is null."
"Array of string in the following format: ['+DelegatePublicKey'] OR ['-DelegatePublicKey']. Use + to UPvote, - to DOWNvote",
function(error, success, response) {
console.log(response);
});
Response
{
"success": true,
"transaction": {object}
}
Provides the synchronisation and loading information of a client. These API calls are only working if the client is syncing or loading.
Returns account's delegates by address.
Request
var liskAPI = require("lisk-api");
liskAPI.getLoadingStatus(function(error, success, response) {
console.log(response);
});
Response
{
"success": true,
"loaded": "Is blockchain loaded? Boolean: true or false",
"now": "Last block loaded during loading time. Integer",
"blocksCount": "Total blocks count in blockchain at loading time. Integer"
}
Get the synchronisation status of the client.
Request
var liskAPI = require("lisk-api");
liskAPI.getSynchronisationStatus(function(error, success, response) {
console.log(response);
});
Response
{
"success": true,
"sync": "Is wallet is syncing with another peers? Boolean: true or false",
"blocks": "Number of blocks remaining to sync. Integer",
"height": "Total blocks in blockchain. Integer"
}
API calls related to transactions.
Transactions list matched by provided parameters.
Request
var liskAPI = require("lisk-api");
var parameters = {
"blockId": "Block id of transaction. (String)",
"senderId": "Sender address of transaction. (String)",
"recipientId": "Recipient of transaction. (String)",
"limit": "Limit of transaction to send in response. Default is 20. (Number)",
"offset": "Offset to load. (Integer number)",
"orderBy": "Name of column to order. After column name must go 'desc' or 'asc' to choose order type, prefix for column name is t_. Example: orderBy=t_timestamp:desc (String)"
};
liskAPI.getTransactionsList(parameters, function(error, success, response) {
console.log(response);
});
Response
{
"success": true,
"transactions": [
"list of transactions objects"
]
}
Send transaction to broadcast network.
Request
var liskAPI = require("lisk-api");
liskAPI.sendTransaction("Secret key of account",
"Secret key from second transaction, required if user uses second signature. The parameter is ignored when the value is null.",
"Public key of sender account, to verify secret passphrase in wallet. Optional, only for UI. The parameter is ignored when the value is null.",
"Amount of transaction * 10^8. Example: to send 1.1234 LISK, use 112340000 as amount",
"Recipient of transaction. Address.",
function(error, success, response) {
console.log(response);
});
Response
{
"success": true,
"transactionId": "id of added transaction"
}
Transaction matched by id.
Request
var liskAPI = require("lisk-api");
liskAPI.getTransaction("String of transaction (String)", function(error, success, response) {
console.log(response);
});
Response
{
"success": true,
"transaction": {
"id": "Id of transaction. String",
"type": "Type of transaction. Integer",
"subtype": "Subtype of transaction. Integer",
"timestamp": "Timestamp of transaction. Integer",
"senderPublicKey": "Sender public key of transaction. Hex",
"senderId": "Address of transaction sender. String",
"recipientId": "Recipient id of transaction. String",
"amount": "Amount. Integer",
"fee": "Fee. Integer",
"signature": "Signature. Hex",
"signSignature": "Second signature. Hex",
"companyGeneratorPublicKey": "If transaction was sent to merchant, provided comapny generator public key to find company. Hex",
"confirmations": "Number of confirmations. Integer"
}
}
Get unconfirmed transaction by id.
Request
var liskAPI = require("lisk-api");
liskAPI.getUnconfirmedTransaction("String of transaction (String)", function(error, success, response) {
console.log(response);
});
Response
{
"success": true,
"transaction": {
"id": "Id of transaction. String",
"type": "Type of transaction. Integer",
"subtype": "Subtype of transaction. Integer",
"timestamp": "Timestamp of transaction. Integer",
"senderPublicKey": "Sender public key of transaction. Hex",
"senderId": "Address of transaction sender. String",
"recipientId": "Recipient id of transaction. String",
"amount": "Amount. Integer",
"fee": "Fee. Integer",
"signature": "Signature. Hex",
"signSignature": "Second signature. Hex",
"confirmations": "Number of confirmations. Integer"
}
}
Get list of unconfirmed transactions.
Request
var liskAPI = require("lisk-api");
liskAPI.getUnconfirmedTransactions(function(error, success, response) {
console.log(response);
});
Response
{
"success" : true,
"transactions" : [list of transaction objects]
}
Peers API.
Get peers list by parameters.
Request
var liskAPI = require("lisk-api");
var parameters = {
"state: State of peer. 1 - disconnected. 2 - connected. 0 - banned. (String)",
"os: OS of peer. (String)",
"shared: Is peer shared? Boolean: true or false. (String)",
"version: Version of peer. (String)",
"limit: Limit to show. Max limit is 100. (Integer)",
"offset: Offset to load. (Integer)",
"orderBy: Name of column to order. After column name must go 'desc' or 'asc' to choose order type. (String)"
};
liskAPI.getPeersList(parameters, function(error, success, response) {
console.log(response);
});
All parameters joins by "OR".
Response
{
"success": true,
"peers": [
"list of peers"
]
}
Get peer by ip and port
Request
var liskAPI = require("lisk-api");
liskAPI.getPeer("ip: Ip of peer. (String)",
"port: Port of peer. (Integer)",
function(error, success, response) {
console.log(response);
});
Response
{
"success": true,
"peer": "peer object"
}
Get peer version and build time
Request
var liskAPI = require("lisk-api");
liskAPI.getPeerVersion(function(err, success, response){
console.log(response);
});
Response
{
"success": true,
"version": "version of Lisk",
"build": "time of build"
}
Blocks manage API.
Get block by id.
var liskAPI = require("lisk-api");
liskAPI.getBlock(function("id: Id of block", err, success, response){
console.log(response);
});
Response
{
"success": true,
"block": {
"id": "Id of block. String",
"version": "Version of block. Integer",
"timestamp": "Timestamp of block. Integer",
"height": "Height of block. Integer",
"previousBlock": "Previous block id. String",
"numberOfRequests": "Not using now. Will be removed in 0.2.0",
"numberOfTransactions": "Number of transactions. Integer",
"numberOfConfirmations": "Not using now.",
"totalAmount": "Total amount of block. Integer",
"totalFee": "Total fee of block. Integer",
"payloadLength": "Payload length of block. Integer",
"requestsLength": "Not using now. Will be removed in 0.2.0",
"confirmationsLength": "Not using now.,
"payloadHash": "Payload hash. Hex",
"generatorPublicKey": "Generator public key. Hex",
"generatorId": "Generator id. String.",
"generationSignature": "Generation signature. Not using. Will be removed in 0.2.0",
"blockSignature": "Block signature. Hex"
}
}
Get all blocks.
var liskAPI = require("lisk-api");
var parameters = {
"totalFee: total fee of block. (Integer)",
"totalAmount: total amount of block. (Integer)",
"previousBlock: previous block of need block. (String)",
"height: height of block. (Integer)",
"generatorPublicKey: generator id of block in hex. (String)",
"limit: limit of blocks to add to response. Default to 20. (Integer)",
"offset: offset to load blocks. (Integer)",
"orderBy: field name to order by. Format: fieldname:orderType. Example: height:desc, timestamp:asc (String)"
};
liskAPI.getBlocks(parameters, function(err, success, response){
console.log(response);
});
All parameters joins by OR.
Response
{
"success": true,
"blocks": [
"array of blocks"
]
}
Get transaction fee for sending "normal" transactions.
var liskAPI = require("lisk-api");
liskAPI.getBlockchainFee(function(err, success, response){
console.log(response);
});
Response
{
"success": true,
"fee": "fee amount"
}
Get blockchain height.
var liskAPI = require("lisk-api");
liskAPI.getBlockchainHeight(function(err, success, response){
console.log(response);
});
Response
{
"success": true,
"height": "Height of blockchain. Integer"
}
Get amount forged by account.
var liskAPI = require("lisk-api");
liskAPI.getForgedByAccount("generatorPublicKey: generator id of block in hex. (String)",
function(err, success, response){
console.log(response);
});
Response
{
"success": true,
"sum": "Forged amount. Integer"
}
Blocks manage API.
Add second signature to account.
Request
var liskAPI = require("lisk-api");
liskAPI.addSecondSignature("secret key of account",
"second key of account"
"Public key of account, to verify valid secret key and account. Optional. The parameter is ignored when the value is null."
function(err, success, response){
console.log(response);
});
Response
{
"success": true,
"transactionId": "id of transaction with new signature",
"publicKey": "Public key of signature. hex"
}
Delegates API.
Calls for delegates functional.
Request
var liskAPI = require("lisk-api");
liskAPI.enableDelegateOnAccount("Secret key of account",
"Second secret of account, required if user uses second signature. The parameter is ignored when the value is null."
"Username of delegate. String from 1 to 20 characters."
function(err, success, response){
console.log(response);
});
Request
{
"secret": "Secret key of account",
"secondSecret": "Second secret of account",
"username": "Username of delegate. String from 1 to 20 characters."
}
Response
{
"success": true,
"transaction": "transaction object"
}
Get delegates list.
Request
var liskAPI = require("lisk-api");
var parameters = {
"limit: Limit to show. Integer. (Integer)",
"offset: Offset (Integer)",
"orderBy: Order by field (String)"
};
liskAPI.getDelegates(parameters, function(err, success, response){
console.log(response);
});
Response
{
"success": true,
"delegates": "delegates objects array"
}
- Delegates Array includes: delegateId, address, publicKey, vote (# of votes), producedBlocks, missedBlocks, rate, productivity
Get delegate by username.
Request
var liskAPI = require("lisk-api");
liskAPI.getDelegate("username of delegate", function(err, success, response){
console.log(response);
});
Response
{
"success": true,
"delegate": {
"username": "username of delegate",
"transactionId": "transaction id",
"votes": "amount of stake voted for this delegate"
}
Get votes by account address.
Request
var liskAPI = require("lisk-api");
liskAPI.getVotes("Address of the account. (String)",
function(error, success, response) {
console.log(response);
});
Response
{
"success": true,
"delegates": "array of delegates"
}
- Delegates Array includes: delegateId, address, publicKey, vote (# of votes), producedBlocks, missedBlocks, rate, productivity
Get voters of delegate.
Request
var liskAPI = require("lisk-api");
liskAPI.getVoters("Public key of delegate. (String)",
function(error, success, response) {
console.log(response);
});
Response
{
"success": true,
"accounts": [
"array of accounts who vote for delegate"
]
}
Enable forging
Request
var liskAPI = require("lisk-api");
liskAPI.enableForging("secret key of delegate account",
function(error, success, response) {
console.log(response);
});
Response
{
"success": true,
"address": "address"
}
Disable forging
Request
var liskAPI = require("lisk-api");
liskAPI.disableForging("secret key of delegate account",
function(error, success, response) {
console.log(response);
});
Response
{
"success": true,
"address": "address"
}
Dapps API.
Registers a dapp.
Request
var liskAPI = require("lisk-api");
var data = {
"secret": "Secret of account. String. Required",
"secondSecret": "Second secret of account. String. Optional",
"publicKey": "Public key to verify sender secret key. Hex. Optional",
"category": "DApp category. Integer. Required",
"name": "DApp name. String. Required",
"description": "DApp description. String. Optional",
"tags": "DApp tags. String. Optional",
"type": "DApp type. Integer. Required (Only type 0 is currently supported)",
"link": "Link to DApp file. ZIP supported. String. Required",
"icon": "Link to icon file. PNG and JPG/JPEG supported. String. Optional"
}
liskAPI.registerDapp(data, function(error, success, response) {
console.log(response);
});
Response
{
"success": true,
"transactionId": "transaction id"
}
Gets a list of dapps registered on the network.
Request
var liskAPI = require("lisk-api");
var parameters = {
"category": "DApp category. (Integer)",
"name": "DApp name. (String)",
"type": "DApp type. (Integer)",
"link": "DApp link. (String)",
"limit": "Query limit. Maximum is 100. (Integer)",
"offset": "Query offset. (Integer)",
"orderBy": "Order by field. (String)"
}
liskAPI.getDapps(parameters, function(error, success, response) {
console.log(response);
});
Response
{
"success": true,
"dapps": "array of dapps"
}
Gets a specific dapp by id.
Request
var liskAPI = require("lisk-api");
liskAPI.getDaap("id: Id of dapp", function(error, success, response) {
console.log(response);
});
Response
{
"success": true,
"dapp": "dapp object"
}
Searches for dapps by keyword(s).
Request
var liskAPI = require("lisk-api");
liskAPI.searchDappStore("q: Search criteria. (String)",
"Category to search within. (Integer)",
"installed: Search installed dapps only. 1 or 0. (Integer)",
function(error, success, response) {
console.log(response);
});
Response
{
"success": true,
"dapps": [
"array of dapps"
]
}
Installs a dapp by id on the node.
Request
var liskAPI = require("lisk-api");
liskAPI.installDapp("dapp id to install", function(error, success, response) {
console.log(response);
});
Response
{
"success": true,
"path": "dappp install path"
}
Returns a list of installed dapps on the requested node.
Request
var liskAPI = require("lisk-api");
liskAPI.installedDapps(function(error, success, response) {
console.log(response);
});
Response
{
"success": "true",
"dapps": [
"array of dapps"
]
}
Returns a list of installed dapp ids on the requested node.
Request
var liskAPI = require("lisk-api");
liskAPI.installedDappsIds(function(error, success, response) {
console.log(response);
});
Response
{
"success": true,
"ids": [
"ids of dapps"
]
}
Uninstalls a dapp by id from the requested node.
Request
var liskAPI = require("lisk-api");
liskAPI.uninstallDapp("dapp id to uninstall", function(error, success, response) {
console.log(response);
});
Response
{
"success": true
}
Launches a dapp by id on the requested node.
Request
var liskAPI = require("lisk-api");
liskAPI.launchDapp("dapp id to launch", function(error, success, response) {
console.log(response);
});
Response
{
"success": true
}
Returns a list of dapp ids currently being installed on the requested node.
Request
var liskAPI = require("lisk-api");
liskAPI.installing(function(error, success, response) {
console.log(response);
});
Response
{
"success": true,
"installing": [
"array of dapp ids"
]
}
Returns a list of dapp ids which are currently launched on the requested node.
Request
var liskAPI = require("lisk-api");
liskAPI.launched(function(error, success, response) {
console.log(response);
});
Response
{
"success": true,
"launched": [
"array of dapp ids"
]
}
Returns a full list of dapp categories.
Request
var liskAPI = require("lisk-api");
liskAPI.categories(function(error, success, response) {
console.log(response);
});
Response
{
"success": true,
"category": "object containing category names and ids"
}
Stops a dapp by id on the requested node.
Request
var liskAPI = require("lisk-api");
liskAPI.stopDapp("dapp id to stop", function(error, success, response) {
console.log(response);
});
Response
{
"success": true
}
Multisignature group API.
Return multisig transaction that waiting for your signature.
Request
var liskAPI = require("lisk-api");
liskAPI.getPendingMultiSignatureTransactions("Public key of account (String)",
function(error, success, response) {
console.log(response);
});
Response
{
"success": true,
"transactions": ['array of transactions to sign']
}
Create a multisignature account.
Request
var liskAPI = require("lisk-api");
liskAPI.createMultiSignatureAccount("your secret. string. required.",
"request lifetime in hours (1-24). required.",
"minimum signatures needed to approve a tx or a change (1-15). integer. required",
"[array of public keys strings]. add '+' before publicKey to add an account or '-' to remove. required.",
function(error, success, response) {
console.log(response);
});
Response
{
"success": true,
"transactionId": "transaction id"
}
Sign transaction that wait for your signature.
var liskAPI = require("lisk-api");
liskAPI.signTransaction("your secret. string. required.",
"public key of your account. string. optional. The parameter is ignored when the value is null.",
"id of transaction to sign.",
function(error, success, response) {
console.log(response);
});
Response
{
"success": true,
"transactionId": "transaction id"
}
Get accounts of multisignature.
var liskAPI = require("lisk-api");
liskAPI.getAccountsOfMultisignature("Public key of multi-signature account (String)",
function(error, success, response) {
console.log(response);
});
Response
{
"success": true,
"accounts": "array of accounts"
}