diff --git a/infra/.env b/infra/.env index 2a3da981..206f525d 100644 --- a/infra/.env +++ b/infra/.env @@ -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 # diff --git a/infra/docker-compose.yaml b/infra/docker-compose.yaml index fd515594..975f1bbc 100644 --- a/infra/docker-compose.yaml +++ b/infra/docker-compose.yaml @@ -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 # @@ -147,3 +175,5 @@ services: entrypoint: - "./root/run.sh" - "${TERRA_ADDRESS}" +volumes: + lisk-db-data: \ No newline at end of file diff --git a/infra/lisk/Dockerfile b/infra/lisk/Dockerfile new file mode 100644 index 00000000..c2b152a8 --- /dev/null +++ b/infra/lisk/Dockerfile @@ -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"] diff --git a/infra/lisk/run.sh b/infra/lisk/run.sh new file mode 100644 index 00000000..374a43e5 --- /dev/null +++ b/infra/lisk/run.sh @@ -0,0 +1,5 @@ +#!/bin/bash +MNEMONIC=$1 +ADDRESS=$2 + +npm start -- -n mainnet -a 0.0.0.0 \ No newline at end of file diff --git a/multichain.go b/multichain.go index 4027570d..55000896 100644 --- a/multichain.go +++ b/multichain.go @@ -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 @@ -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: @@ -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("") @@ -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") @@ -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("")