Skip to content
/ lisk Public
forked from LiskArchive/lisk-sdk

πŸ“Ÿ Lisk blockchain application platform

License

Notifications You must be signed in to change notification settings

vshall20/lisk

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Lisk

Build Status Coverage Status License: GPL v3 Join the chat at https://gitter.im/LiskHQ/lisk Dependency Status devDependency Status

Lisk is a next generation crypto-currency and decentralized application platform, written entirely in JavaScript. The official documentation about the whole ecosystem can be found in https://lisk.io/documentation.

Lisk Core is the program that implements the Lisk Protocol. In other words, Lisk Core is what every machine needs to set-up in order to run a node that allows for participation in the network.

This document details how to install Lisk Core from source, but there are two other ways to participate in the network: binaries and Docker images. If you have satisfied the requirements from the Pre-Installation section, you can jumpt directly to the next section Installation Steps.

Pre-Installation

The next section details the prerequisites to install Lisk Core from source using the different tagged releases.

System Install

  • Tool chain components -- Used for compiling dependencies

    • Ubuntu 14|16 / Debian:

      sudo apt-get update
      sudo apt-get install -y python build-essential curl automake autoconf libtool
      
    • MacOS 10.12-10.13 (Sierra/High Sierra):

      Make sure that you have both XCode and Homebrew installed on your machine.

      Update homebrew and install dependencies:

      brew update
      brew doctor
      brew install curl automake autoconf libtool
      
  • Git (https://github.com/git/git) -- Used for cloning and updating Lisk

    • Ubuntu 14|16 / Debian:

      sudo apt-get install -y git
      
    • MacOS 10.12-10.13 (Sierra/High Sierra):

      brew install git
      
  • Node.js serves as the underlying engine for code execution.

    Install System wide via package manager:

    • Ubuntu 14|16 / Debian:

      curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
      sudo apt-get install -y nodejs
      
    • MacOS 10.12-10.13 (Sierra/High Sierra):

      brew install [email protected]
      
  • (Recommended) Install using a version manager such as nvm.

    1. Install nvm following their instructions (https://github.com/creationix/nvm#installation)
    2. Install the correct version of Node.js using nvm:
    nvm install 6.14.1
    
  • (Recommended) PM2 (https://github.com/Unitech/pm2) -- PM2 manages the node process for Lisk

    npm install -g pm2
    

PostgreSQL (version 9.6):

  • Ubuntu 14|16 / Debian:
curl -sL "https://downloads.lisk.io/scripts/setup_postgresql.Linux" | bash -
sudo -u postgres createuser --createdb $USER
createdb lisk_test
createdb lisk_main
sudo -u postgres psql -d lisk_test -c "alter user "$USER" with password 'password';"
sudo -u postgres psql -d lisk_main -c "alter user "$USER" with password 'password';"
  • MacOS 10.12-10.13 (Sierra/High Sierra):
brew install [email protected]
initdb /usr/local/var/postgres -E utf8
brew services start [email protected]
createdb lisk_test
createdb lisk_main

Installing Redis

  • Ubuntu 14|16 / Debian:
sudo apt-get install redis-server

Start redis:

service redis start

Stop redis:

service redis stop
  • MacOS 10.12-10.13 (Sierra/High Sierra):
brew install redis

Start redis:

brew services start redis

Stop redis:

brew services stop redis

NOTE: Lisk does not run on the redis default port of 6379. Instead it is configured to run on port: 6380. Because of this, in order for Lisk to run, you have one of two options:

Change the Redis launch configuration

Update the launch configuration file on your system. Note that their a number of ways to do this. The following is one way:

  1. Stop redis-server
  2. Edit the file redis.conf and change: port 6379 to port 6380
    • Ubuntu 14|16 / Debian: /etc/redis/redis.conf
    • MacOS: /usr/local/etc/redis.conf
  3. Start redis-server

Now confirm that redis is running on port 6380:

redis-cli -p 6380
ping

And you should get the result PONG. TO update the redis port in Lisk configuration, check the section Configuring Lisk

Installation Steps

Before you proceed, you need to decide if you want to connect your node to the Testnet (Test Network), to the Mainnet (Main Network) or to work in your own network. In order to connect your node with the Mainnet for example, clone this Lisk Core repository from the master branch and initialize the modules.

git clone https://github.com/LiskHQ/lisk.git
cd lisk
git checkout master
npm install

Managing Lisk

To test Lisk is built and configured correctly, issue the following command:

node app.js

This will start the lisk instance with devnet configuration. Once the process is verified as running correctly, CTRL+C and start the process with pm2. This will fork the process into the background and automatically recover the process if it fails.

pm2 start --name lisk app.js

After the process is started, its runtime status and log location can be retrieved by issuing the following command:

pm2 show lisk

To stop Lisk after it has been started with pm2, issue the following command:

pm2 stop lisk

NOTE: The port, address and config-path can be overridden by providing the relevant command switch:

pm2 start --name lisk app.js -- -p [port] -a [address] -c [config-path] -n [network]

You can pass any of devnet, alphanet, betanet, testnet or mainnet for the network option.

Configuring Lisk

Structure

  1. The Lisk configuration is managed under different folder structures.
  2. Root folder for all configuration is ./config/.
  3. You can find network specific configuration folder there as well.
  4. Main file that used as base is config/default/config.json
  5. Don't override any value in above mentioned file if you need custom configuration.
  6. Either modify network specific config.json or create your own json file and pass it as command line options.
  7. What ever config.json provided will be merged on top of config/default/config.json to generate final configuration to start the lisk.
  8. For development purposes use devnet as network option, others network are specific to public lisk networks.

Command Line Options

There are plenty of options available that you can use to override configuration on runtime while starting the lisk.

node app.js [options]

Each of that option can be appended on command line. There are also few ENV variables that can be utilized for this purpose.

Option ENV Variable Config Option Description
--network
-n
LISK_NETWORK Which configurations set to use, associated to lisk networks. Any of this option can be used devnet, alphanet, betanet, testnet and mainnet. Default value is devnet.
--config
-c
LISK_CONFIG_FILE Path the custom configuration file, which will override values of config/default/config.json
--port
-p
LISK_WS_PORT wsPort TCP port for P2P layer
--http-port
-h
LISK_HTTP_PORT httpPort TCP port for HTTP API
--address
-a
address Listening host name or ip
--database
-d
db.database PostgreSQL database name to connect
--peers
-p
LISK_PEERS peers.list Comma separated list of peers to connect in the format 192.168.99.100:5000,172.169.99.77:5000
--log
-l
LISK_CONSOLE_LOG_LEVEL consoleLogLevel Log level for lisk for console output
--snapshot
-s
Number of round for which take the snapshot. If none specified it will use the highest round available.

For more detail understanding of configuration read this online documentation

Examples

Change Redis Port

Update the redis.port configuration attribute in config/devnet/config.json or any other network you want to configure.

Tests

Preparing Node

  1. Recreate the database in order to run the tests against a new blockchain:
dropdb lisk_dev
createdb lisk_dev
  1. Launch Lisk (runs on port 4000):
NODE_ENV=test node app.js

Running Tests

Tests are run using the following command:

npm test -- mocha:<tag>:<suite>:[section]
  • Where tag can be one of slow | unstable | untagged | extensive (required)
  • Where suite can be one of unit | functional | integration (required)
  • Where section depending of the chosen suite can be:
    • when functional --> get | post | ws | system (optional)

Examples:

npm test -- mocha:slow:unit
npm test -- mocha:untagged:functional:get
npm test -- mocha:unstable:functional:ws
npm test -- mocha:extensive:integration

Individual test files can be run using the following command:

npm run mocha -- path/to/test.js

Contributors

https://github.com/LiskHQ/lisk/graphs/contributors

License

Copyright Β© 2016-2018 Lisk Foundation

This program 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.

This program 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 this program. If not, see https://www.gnu.org/licenses/.


This program also incorporates work previously released with lisk 0.9.11 (and earlier) versions under the MIT License. To comply with the requirements of that license, the following permission notice, applicable to those parts of the code only, is included below:

Copyright Β© 2016-2018 Lisk Foundation Copyright Β© 2015 Crypti

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

πŸ“Ÿ Lisk blockchain application platform

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 99.0%
  • Other 1.0%