From 1ba9c00f04b1c4e38017887e8c4d4d0c02f64b17 Mon Sep 17 00:00:00 2001 From: Frank Polster Date: Sat, 12 Sep 2020 13:06:47 +0200 Subject: [PATCH 1/2] init --- infra/docker-compose.yaml | 14 ++++++++++++++ multichain.go | 8 ++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/infra/docker-compose.yaml b/infra/docker-compose.yaml index fd515594..c912ad3b 100644 --- a/infra/docker-compose.yaml +++ b/infra/docker-compose.yaml @@ -111,6 +111,20 @@ 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 + liskdb: + image: postgres + # # Solana # 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("") From 8f05354977a32578a80dfecad53cd7d90e180b17 Mon Sep 17 00:00:00 2001 From: Frank Polster Date: Sat, 12 Sep 2020 14:52:48 +0200 Subject: [PATCH 2/2] added lisk node --- infra/.env | 8 ++++++++ infra/docker-compose.yaml | 18 +++++++++++++++++- infra/lisk/Dockerfile | 34 ++++++++++++++++++++++++++++++++++ infra/lisk/run.sh | 5 +++++ 4 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 infra/lisk/Dockerfile create mode 100644 infra/lisk/run.sh 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 c912ad3b..975f1bbc 100644 --- a/infra/docker-compose.yaml +++ b/infra/docker-compose.yaml @@ -122,8 +122,22 @@ services: - "/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 + 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 @@ -161,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