Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Add Lisk Support #28

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions infra/.env
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,14 @@ export ETHEREUM_ADDRESS=0xa0df350d2637096571F7A701CBc1C5fdE30dF76A
export FILECOIN_PK=7b2254797065223a22736563703235366b31222c22507269766174654b6579223a22756d6a634e436a487a5438455757485849754a4c4b58745035437153323435666238626c656c756e5448493d227d
export FILECOIN_ADDRESS=t1ej2tountzqwnu6uswhqdzvw6yy5xvcig6rxl2qa

#
# Lisk
#
export LISK_MNEMONIC="tourist sustain kingdom predict state payment salad sound few board script bargain"
export LISK_ADDRESS="5989888845652285074L"
export LISK_DB_NAME="liskdb"
export LISK_DB_PW="liskdbpw"
export LISK_DB_USER="liskdbuser"
#
# Terra
#
Expand Down
30 changes: 30 additions & 0 deletions infra/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,34 @@ services:
entrypoint:
- "/root/run.sh"

# Lisk with Postgresql
#
lisk:
build:
context: ./lisk
ports:
- "0.0.0.0:3333:3333"
entrypoint:
- "/root/run.sh"
depends_on:
- liskdb
environment:
- LISK_DB_HOST=liskdb
- LISK_DB_PASSWORD=${LISK_DB_PW}
- LISK_DB_USER=${LISK_DB_USER}
- LISK_DB_NAME=${LISK_DB_NAME}
- LISK_MNEMONIC=${LISK_MNEMONIC}
- LISK_ADDRESS=${LISK_ADDRESS}
liskdb:
image: postgres:10-alpine
volumes:
- lisk-db-data:/var/lib/postgresql/data
restart: unless-stopped
environment:
- POSTGRES_DB=${LISK_DB_NAME}
- POSTGRES_PASSWORD=${LISK_DB_PW}
- POSTGRES_USER=${LISK_DB_USER}

#
# Solana
#
Expand Down Expand Up @@ -147,3 +175,5 @@ services:
entrypoint:
- "./root/run.sh"
- "${TERRA_ADDRESS}"
volumes:
lisk-db-data:
34 changes: 34 additions & 0 deletions infra/lisk/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
FROM ubuntu:xenial

RUN apt-get update && apt-get install --yes --fix-missing software-properties-common curl git clang
RUN apt-get install --yes --fix-missing --no-install-recommends build-essential
RUN curl -sL https://deb.nodesource.com/setup_12.x | bash -
RUN apt-get install --yes nodejs

RUN chmod 777 /root

RUN adduser --help
RUN adduser --system --group --home /home/lisk --shell /bin/bash --uid 1100 --disabled-password lisk

# Clone repository
RUN git clone https://github.com/LiskHQ/lisk-core.git

RUN mv lisk-core /root
WORKDIR /root/lisk-core

# TEMPORARY: use the branch that has a good reference to the submodules
# TODO: remove when the `master` branch of Lisk is updated
RUN git fetch
RUN git checkout master
RUN git pull

# Make sure submodule.recurse is set to true to make life with submodule easier.
RUN git config --global submodule.recurse true

# Build
RUN npm ci
RUN npm run build

COPY run.sh /root/run.sh
RUN chmod +x /root/run.sh
ENTRYPOINT ["/root/run.sh"]
5 changes: 5 additions & 0 deletions infra/lisk/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash
MNEMONIC=$1
ADDRESS=$2

npm start -- -n mainnet -a 0.0.0.0
8 changes: 6 additions & 2 deletions multichain.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ const (
ETH = Asset("ETH") // Ether
FIL = Asset("FIL") // Filecoin
FTM = Asset("FTM") // Fantom
LSK = Asset("LSK") // Lisk
SOL = Asset("SOL") // Solana
LUNA = Asset("LUNA") // Luna
ZEC = Asset("ZEC") // Zcash
Expand Down Expand Up @@ -135,6 +136,8 @@ func (asset Asset) OriginChain() Chain {
return Filecoin
case FTM:
return Fantom
case LSK:
return Lisk
case LUNA:
return Terra
case SOL:
Expand All @@ -151,7 +154,7 @@ func (asset Asset) ChainType() ChainType {
switch asset {
case BCH, BTC, DGB, DOGE, ZEC:
return ChainTypeUTXOBased
case BNB, ETH, FIL:
case BNB, ETH, FIL, LSK:
return ChainTypeAccountBased
default:
return ChainType("")
Expand Down Expand Up @@ -191,6 +194,7 @@ const (
Ethereum = Chain("Ethereum")
Fantom = Chain("Fantom")
Filecoin = Chain("Filecoin")
Lisk = Chain("Lisk")
Solana = Chain("Solana")
Terra = Chain("Terra")
Zcash = Chain("Zcash")
Expand Down Expand Up @@ -220,7 +224,7 @@ func (chain Chain) ChainType() ChainType {
switch chain {
case Bitcoin, BitcoinCash, DigiByte, Dogecoin, Zcash:
return ChainTypeUTXOBased
case BinanceSmartChain, Ethereum, Filecoin:
case BinanceSmartChain, Ethereum, Filecoin, Lisk:
return ChainTypeAccountBased
default:
return ChainType("")
Expand Down