Skip to content

Commit

Permalink
updated docker scripts, mock data and configs
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Belets committed Nov 22, 2024
1 parent bca492c commit 9f6a71a
Show file tree
Hide file tree
Showing 20 changed files with 261 additions and 117 deletions.
4 changes: 2 additions & 2 deletions docker/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/janus-linux-amd64
/.qtum
/eth-rpc-gate-linux-amd64
/.Kaon
/supervisord.*
/env.list
2 changes: 1 addition & 1 deletion docker/configure_https.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ if [ ! -d "/https" ]; then
fi

echo "Generating key.pem and cert.pem"
openssl req -nodes -x509 -newkey rsa:4096 -keyout /https/key.pem -out /https/cert.pem -days 365 -subj "/C=US/ST=ST/L=L/O=Janus Self-signed https/OU=Janus Self-signed https/CN=Janus Self-signed https"
openssl req -nodes -x509 -newkey rsa:4096 -keyout /https/key.pem -out /https/cert.pem -days 365 -subj "/C=US/ST=ST/L=L/O=eth-rpc-gate Self-signed https/OU=eth-rpc-gate Self-signed https/CN=eth-rpc-gate Self-signed https"
if [ 0 -ne $? ]; then
echo "Failed to generate server.key"
exit $?
Expand Down
58 changes: 30 additions & 28 deletions docker/fill_user_account.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,43 +17,45 @@ repeat_until_success () {
echo Command finished successfully
}

# Qtum v22.1 no longer auto creates a default wallet, we need to create one to import keys and such
RANDOM=$(date +%s)
repeat_until_success qtum-cli -rpcuser=qtum -rpcpassword=testpasswd createwallet "createdWallet"$(( $RANDOM % 129 ))

#import private keys and then prefund them
repeat_until_success qtum-cli -rpcuser=qtum -rpcpassword=testpasswd importprivkey "cMbgxCJrTYUqgcmiC1berh5DFrtY1KeU4PXZ6NZxgenniF1mXCRk" address1 # addr=qUbxboqjBRp96j3La8D1RYkyqx5uQbJPoW hdkeypath=m/88'/0'/1'
repeat_until_success qtum-cli -rpcuser=qtum -rpcpassword=testpasswd importprivkey "cRcG1jizfBzHxfwu68aMjhy78CpnzD9gJYZ5ggDbzfYD3EQfGUDZ" address2 # addr=qLn9vqbr2Gx3TsVR9QyTVB5mrMoh4x43Uf hdkeypath=m/88'/0'/2'
repeat_until_success qtum-cli -rpcuser=qtum -rpcpassword=testpasswd importprivkey "cV79qBoCSA2NDrJz8S3T7J8f3zgkGfg4ua4hRRXfhbnq5VhXkukT" address3 # addr=qTCCy8qy7pW94EApdoBjYc1vQ2w68UnXPi
repeat_until_success qtum-cli -rpcuser=qtum -rpcpassword=testpasswd importprivkey "cV93kaaV8hvNqZ711s2z9jVWLYEtwwsVpyFeEZCP6otiZgrCTiEW" address4 # addr=qWMi6ne9mDQFatRGejxdDYVUV9rQVkAFGp
repeat_until_success qtum-cli -rpcuser=qtum -rpcpassword=testpasswd importprivkey "cVPHpTvmv3UjQsZfsMRrW5RrGCyTSAZ3MWs1f8R1VeKJSYxy5uac" address5 # addr=qLcshhsRS6HKeTKRYFdpXnGVZxw96QQcfm
repeat_until_success qtum-cli -rpcuser=qtum -rpcpassword=testpasswd importprivkey "cTs5NqY4Ko9o6FESHGBDEG77qqz9me7cyYCoinHcWEiqMZgLC6XY" address6 # addr=qW28njWueNpBXYWj2KDmtFG2gbLeALeHfV
repeat_until_success kaon-cli -rpcuser=kaon -rpcpassword=testpasswd importprivkey "YoBkvJXYcxihY3qYXZuh3ndN14hWmAPUU3qhFZw1Zbt9g85FjMCd" address2 # addr=auASFMxv45WgjCW6wkpDuHWjxXhzNA9mjP hdkeypath=m/88'/0'/2'
repeat_until_success kaon-cli -rpcuser=kaon -rpcpassword=testpasswd importprivkey "Yn3MpyMQzQR7osXkNyQ3DVNP6kwZGpmXhXzuuPGXZwyouhxmWxh7" address3 # addr=awQb8vf21idkFoZiYPA4hWgtuPyko2qUaR
repeat_until_success kaon-cli -rpcuser=kaon -rpcpassword=testpasswd importprivkey "YhrMRdEunTgoz4vs9RYc7Ui5yAYp2UmBeZsVfWHjifzVWeDQGVt7" address4 # addr=ar7PkgNdY1HkDtUo3D4GTsYrcqoHBJygNQ
repeat_until_success kaon-cli -rpcuser=kaon -rpcpassword=testpasswd importprivkey "YiaCnmCToCPUGgSrLxEiGVa297WiFGc5jrsUpy68BJiCe7Cym716" address5 # addr=b7CSynDNwb2LQcCWXs8Qn79LUkgMdsK61S
repeat_until_success kaon-cli -rpcuser=kaon -rpcpassword=testpasswd importprivkey "YifXHT9WJeP53jor88a6FYgxj3CDFjtkbYGb6tRHJK3UhdLye6m2" address6 # addr=ayHXgXugbHDDR8cBjX2ZVLfkGE78QTeW2Z

echo Finished importing accounts
echo Seeding accounts
echo Seeding qcavTSEVe31NLdXyfq925GzGp8yN5QnS6a
repeat_until_success qtum-cli -rpcuser=qtum -rpcpassword=testpasswd generatetoaddress 2 qcavTSEVe31NLdXyfq925GzGp8yN5QnS6a
qtum-cli -rpcuser=qtum -rpcpassword=testpasswd generatetoaddress 2 qa1W7VnwtJPoFDoNjxxGdDHBtsRKDpjW8c
qtum-cli -rpcuser=qtum -rpcpassword=testpasswd generatetoaddress 1000 qaofg5zZVyvPmWgGL6YdVAyRTKWd3MjZ4A
echo Seeding ucavTSEVe31NLdXyfq925GzGp8yN5QnS6a
repeat_until_success kaon-cli -rpcuser=kaon -rpcpassword=testpasswd generatetoaddress 2 ucavTSEVe31NLdXyfq925GzGp8yN5QnS6a
kaon-cli -rpcuser=kaon -rpcpassword=testpasswd generatetoaddress 2 ua1W7VnwtJPoFDoNjxxGdDHBtsRKDpjW8c
kaon-cli -rpcuser=kaon -rpcpassword=testpasswd generatetoaddress 1000 uaofg5zZVyvPmWgGL6YdVAyRTKWd3MjZ4A

# address1
echo Seeding qUbxboqjBRp96j3La8D1RYkyqx5uQbJPoW
repeat_until_success qtum-cli -rpcuser=qtum -rpcpassword=testpasswd generatetoaddress 1000 qUbxboqjBRp96j3La8D1RYkyqx5uQbJPoW
# hex addr 0x1CE507204a6fC8fd6aA7e54D1481d30ACB0Dbead (ar2SzdHghSgeacypPn7zfDe3qfKAEwimus) has only MM private key: cbc9b23fc49066bbe19e599364035b9e8d11bb51e0f1fb56b14f50564bfd15e9
# there is no private key for this addr in KAON format
echo Seeding ar2SzdHghSgeacypPn7zfDe3qfKAEwimus
repeat_until_success kaon-cli -rpcuser=kaon -rpcpassword=testpasswd generatetoaddress 1000 ar2SzdHghSgeacypPn7zfDe3qfKAEwimus

# address2
echo Seeding qLn9vqbr2Gx3TsVR9QyTVB5mrMoh4x43Uf
repeat_until_success qtum-cli -rpcuser=qtum -rpcpassword=testpasswd generatetoaddress 1000 qLn9vqbr2Gx3TsVR9QyTVB5mrMoh4x43Uf
# hex addr 0x3f501c368cb9ddb5f27ed72ac0d602724adfa175 (auASFMxv45WgjCW6wkpDuHWjxXhzNA9mjP) has only KAON private key: YoBkvJXYcxihY3qYXZuh3ndN14hWmAPUU3qhFZw1Zbt9g85FjMCd
# there is no private key for this addr in Eth format
echo Seeding auASFMxv45WgjCW6wkpDuHWjxXhzNA9mjP
repeat_until_success kaon-cli -rpcuser=kaon -rpcpassword=testpasswd generatetoaddress 1000 auASFMxv45WgjCW6wkpDuHWjxXhzNA9mjP
# address3
echo Seeding qTCCy8qy7pW94EApdoBjYc1vQ2w68UnXPi
repeat_until_success qtum-cli -rpcuser=qtum -rpcpassword=testpasswd generatetoaddress 500 qTCCy8qy7pW94EApdoBjYc1vQ2w68UnXPi
echo Seeding awQb8vf21idkFoZiYPA4hWgtuPyko2qUaR
repeat_until_success kaon-cli -rpcuser=kaon -rpcpassword=testpasswd generatetoaddress 500 awQb8vf21idkFoZiYPA4hWgtuPyko2qUaR
# address4
echo Seeding qWMi6ne9mDQFatRGejxdDYVUV9rQVkAFGp
repeat_until_success qtum-cli -rpcuser=qtum -rpcpassword=testpasswd generatetoaddress 250 qWMi6ne9mDQFatRGejxdDYVUV9rQVkAFGp
echo Seeding ar7PkgNdY1HkDtUo3D4GTsYrcqoHBJygNQ
repeat_until_success kaon-cli -rpcuser=kaon -rpcpassword=testpasswd generatetoaddress 250 ar7PkgNdY1HkDtUo3D4GTsYrcqoHBJygNQ
# address5
echo Seeding qLcshhsRS6HKeTKRYFdpXnGVZxw96QQcfm
repeat_until_success qtum-cli -rpcuser=qtum -rpcpassword=testpasswd generatetoaddress 100 qLcshhsRS6HKeTKRYFdpXnGVZxw96QQcfm
echo Seeding b7CSynDNwb2LQcCWXs8Qn79LUkgMdsK61S
repeat_until_success kaon-cli -rpcuser=kaon -rpcpassword=testpasswd generatetoaddress 100 b7CSynDNwb2LQcCWXs8Qn79LUkgMdsK61S
# address6
echo Seeding qW28njWueNpBXYWj2KDmtFG2gbLeALeHfV
repeat_until_success qtum-cli -rpcuser=qtum -rpcpassword=testpasswd generatetoaddress 100 qW28njWueNpBXYWj2KDmtFG2gbLeALeHfV
echo Seeding ayHXgXugbHDDR8cBjX2ZVLfkGE78QTeW2Z
repeat_until_success kaon-cli -rpcuser=kaon -rpcpassword=testpasswd generatetoaddress 100 ayHXgXugbHDDR8cBjX2ZVLfkGE78QTeW2Z
# playground pet shop dapp
echo Seeding 0xCca81b02942D8079A871e02BA03A3A4a8D7740d2
repeat_until_success qtum-cli -rpcuser=qtum -rpcpassword=testpasswd generatetoaddress 2 qcDWPLgdY9pTv3cKLkaMPvqjukURH3Qudy
# PK KAON: Yjf1pkLANZcMQd81HyyqV4BHBMwMLoqZzZ9W4YfGxtqEbinL5kQq
echo Seeding 0x270e4f191c2f13cfaea6c35edfe4020b433632d6
repeat_until_success kaon-cli -rpcuser=kaon -rpcpassword=testpasswd generatetoaddress 2 arxBCorh4mfs32wDvVpCx3fBeRjnTgMKNV
echo Finished importing and seeding accounts
4 changes: 2 additions & 2 deletions docker/go-build.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ ARG ALPINE_VERSION=3.16
FROM golang:${GO_VERSION}-alpine as builder
RUN apk add --no-cache make gcc musl-dev git

WORKDIR $GOPATH/src/github.com/qtumproject/janus
COPY go.mod go.sum $GOPATH/src/github.com/qtumproject/janus/
WORKDIR $GOPATH/src/github.com/kaonone/eth-rpc-gate
COPY go.mod go.sum $GOPATH/src/github.com/kaonone/eth-rpc-gate/

# Cache go modules
RUN go mod download -x
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM qtum/qtum
FROM kaon/kaon

COPY ./fill_user_account.sh ./
COPY ./populate_and_run.sh ./
Expand Down
16 changes: 16 additions & 0 deletions docker/kaond_restart.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

# Check if the kaond process is running
if pgrep -x "kaond" > /dev/null
then
echo "kaond is running, executing stop command"
docker exec kaon_mainnet kaon-cli stop
sleep 3 #executing too fast causes some errors
docker restart kaon_mainnet
else
echo "kaond is not running, restarting with -reindex"
# Modify the restart command to include the -reindex parameter
docker restart kaon_mainnet
sleep 3 #executing too fast causes some errors
docker exec kaon_mainnet kaond -reindex
fi
41 changes: 23 additions & 18 deletions docker/quick_start/docker-compose.mainnet.yml
Original file line number Diff line number Diff line change
@@ -1,42 +1,47 @@
version: "3.3"

networks:
qtumd_mainnet_network:
kaond_mainnet_network:
volumes:
qtumd_mainnet_volume:
kaond_mainnet_volume:

services:
janus_mainnet:
image: qtum/janus:latest
container_name: janus_mainnet
ethrpcgate_mainnet:
image: kaon/eth-rpc-gate:latest
container_name: ethrpcgate_mainnet
build:
context: ../../
cache_from:
- golang:1.18-alpine
ports:
- "23890:23890"
- "25996:25996"
environment:
- QTUM_RPC=http://qtum:testpasswd@qtum_mainnet:3890
- KAON_RPC=http://${RPC_USER}:${RPC_PASSWORD}@kaon_mainnet:51473
- COMPOSE_PROJECT_NAME=mainnet
- FLAG_HIDE_KAOND_LOGS=true
- HIDE_TCP_LOGS=true
volumes:
- ../standalone/myaccounts.txt:$GOPATH/github.com/qtumproject/janus/myaccounts.txt
- ../standalone/myaccounts.txt:$GOPATH/github.com/kaonone/eth-rpc-gate/myaccounts.txt
- ../../https:/https
- ../../logs:/logs
depends_on:
- qtum_mainnet
command: --bind 0.0.0.0 --port 23890 --ignoreTransactions --accounts $GOPATH/github.com/qtumproject/janus/myaccounts.txt --dev --https-key /https/key.pem --https-cert /https/cert.pem
- kaon_mainnet
command: --bind 0.0.0.0 --port 25996 --ignoreTransactions --accounts $GOPATH/github.com/kaonone/eth-rpc-gate/myaccounts.txt --https-key /https/key.pem --https-cert /https/cert.pem
networks:
- qtumd_mainnet_network
- kaond_mainnet_network

qtum_mainnet:
kaon_mainnet:
ports:
- "3890:3890"
image: qtum/qtum
container_name: qtum_mainnet
- "51473:51473"
image: kaon/kaon
container_name: kaon_mainnet
environment:
- COMPOSE_PROJECT_NAME=mainnet
command: qtumd -txindex -addrindex=1 -rpcbind=0.0.0.0:3890 -rpcallowip=0.0.0.0/0 -rpcuser=qtum -rpcpassword=testpasswd -deprecatedrpc=accounts
- RPC_USER=${RPC_USER}
- RPC_PASSWORD=${RPC_PASSWORD}
command: ["sh", "-c", "envsubst < /root/.Kaon/kaon.conf.mainnet.template > /root/.Kaon/kaon.conf && kaond"]
volumes:
- qtumd_mainnet_volume:/root/.qtum
- kaond_mainnet_volume:/root/.Kaon
- ./kaon.conf.mainnet.template:/root/.Kaon/kaon.conf.mainnet.template
networks:
- qtumd_mainnet_network
- kaond_mainnet_network
41 changes: 23 additions & 18 deletions docker/quick_start/docker-compose.regtest.yml
Original file line number Diff line number Diff line change
@@ -1,40 +1,45 @@
version: "3.3"

networks:
qtumd_regtest_network:
kaond_regtest_network:
volumes:
qtumd_regtest_volume:
kaond_regtest_volume:

services:
janus_regtest:
image: qtum/janus:dev
container_name: janus_regtest
ethrpcgate_regtest:
image: kaon/eth-rpc-gate:dev
container_name: ethrpcgate_regtest
build:
context: ../../
cache_from:
- golang:1.18-alpine
ports:
- "23889:23889"
- "25996:25996"
environment:
- QTUM_RPC=http://qtum:testpasswd@qtum_regtest:3889
- KAON_RPC=http://${RPC_USER}:${RPC_PASSWORD}@kaon_regtest:51474
- COMPOSE_PROJECT_NAME=regtest
volumes:
- ../standalone/myaccounts.txt:$GOPATH/github.com/qtumproject/janus/myaccounts.txt
- ../standalone/myaccounts.txt:$GOPATH/github.com/kaonone/eth-rpc-gate/myaccounts.txt
- ../../https:/https
- ../../logs:/logs
depends_on:
- qtum_regtest
command: --bind 0.0.0.0 --accounts $GOPATH/github.com/qtumproject/janus/myaccounts.txt --log-file /logs/janusLogs.txt --dev --https-key /https/key.pem --https-cert /https/cert.pem
- kaon_regtest
command: --bind 0.0.0.0 --accounts $GOPATH/github.com/kaonone/eth-rpc-gate/myaccounts.txt --log-file /logs/gateLogs.txt --dev --https-key /https/key.pem --https-cert /https/cert.pem
networks:
- qtumd_regtest_network
- kaond_regtest_network

qtum_regtest:
kaon_regtest:
ports:
- "3889:3889"
image: qtum/qtum
container_name: qtum_regtest
command: qtumd -regtest -txindex -addrindex=1 -rpcbind=0.0.0.0:3889 -rpcallowip=0.0.0.0/0 -logevents -rpcuser=qtum -rpcpassword=testpasswd -deprecatedrpc=accounts -printtoconsole
- "51474:51474"
image: kaon/kaon
container_name: kaon_regtest
environment:
- COMPOSE_PROJECT_NAME=regtest
- RPC_USER=${RPC_USER}
- RPC_PASSWORD=${RPC_PASSWORD}
command: ["sh", "-c", "envsubst < /root/.Kaon/kaon.conf.regtest.template > /root/.Kaon/kaon.conf && kaond"]
volumes:
- qtumd_regtest_volume:/root/.qtum
- kaond_regtest_volume:/root/.Kaon
- ./kaon.conf.regtest.template:/root/.Kaon/kaon.conf.regtest.template
networks:
- qtumd_regtest_network
- kaond_regtest_network
41 changes: 23 additions & 18 deletions docker/quick_start/docker-compose.testnet.yml
Original file line number Diff line number Diff line change
@@ -1,40 +1,45 @@
version: "3.3"

networks:
qtumd_testnet_network:
kaond_testnet_network:
volumes:
qtumd_testnet_volume:
kaond_testnet_volume:

services:
janus_testnet:
image: qtum/janus:dev
container_name: janus_testchain
ethrpcgate_testnet:
image: kaon/eth-rpc-gate:dev
container_name: ethrpcgate_testchain
build:
context: ../../
cache_from:
- golang:1.18-alpine
ports:
- "23889:23889"
- "25996:25996"
environment:
- QTUM_RPC=http://qtum:testpasswd@qtum_testnet:3889
- KAON_RPC=http://${RPC_USER}:${RPC_PASSWORD}@kaon_testnet:51474
- COMPOSE_PROJECT_NAME=testnet
volumes:
- ../standalone/myaccounts.txt:$GOPATH/github.com/qtumproject/janus/myaccounts.txt
- ../standalone/myaccounts.txt:$GOPATH/github.com/kaonone/eth-rpc-gate/myaccounts.txt
- ../../https:/https
- ../../logs:/logs
depends_on:
- qtum_testnet
command: --bind 0.0.0.0 --port 23889 --ignoreTransactions --accounts $GOPATH/github.com/qtumproject/janus/myaccounts.txt --dev --https-key /https/key.pem --https-cert /https/cert.pem
- kaon_testnet
command: --bind 0.0.0.0 --port 25996 --ignoreTransactions --accounts $GOPATH/github.com/kaonone/eth-rpc-gate/myaccounts.txt --dev --https-key /https/key.pem --https-cert /https/cert.pem
networks:
- qtumd_testnet_network
- kaond_testnet_network

qtum_testnet:
kaon_testnet:
ports:
- "3889:3889"
image: qtum/qtum
container_name: qtum_testnet
command: qtumd -testnet -txindex -addrindex=1 -rpcbind=0.0.0.0:3889 -rpcallowip=0.0.0.0/0 -logevents -rpcuser=qtum -rpcpassword=testpasswd -deprecatedrpc=accounts -printtoconsole
- "51474:51474"
image: kaon/kaon
container_name: kaon_testnet
environment:
- COMPOSE_PROJECT_NAME=testnet
- RPC_USER=${RPC_USER}
- RPC_PASSWORD=${RPC_PASSWORD}
command: ["sh", "-c", "envsubst < /root/.Kaon/kaon.conf.testnet.template > /root/.Kaon/kaon.conf && kaond"]
volumes:
- qtumd_testnet_volume:/root/.qtum
- kaond_testnet_volume:/root/.Kaon
- ./kaon.conf.testnet.template:/root/.Kaon/kaon.conf.testnet.template
networks:
- qtumd_testnet_network
- kaond_testnet_network
22 changes: 22 additions & 0 deletions docker/quick_start/kaon.conf.mainnet.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
rpcuser=${RPC_USER}
rpcpassword=${RPC_PASSWORD}
dnsseed=0
upnp=0
daemon=1
server=1
staking=1
listen=1
maxconnections=256
rpcport=51473
rpcbind=0.0.0.0:51473
rpcallowip=0.0.0.0/0
txindex=1
txrlpindex=1
addrindex=1
deprecatedrpc=accounts

rpcport=51474
# Options only for mainnet
[main]
port=9872
rpcport=51473
28 changes: 28 additions & 0 deletions docker/quick_start/kaon.conf.regtest.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
regtest=1
rpcuser=${RPC_USER}
rpcpassword=${RPC_PASSWORD}
dnsseed=0
upnp=0
debug=1
daemon=1
server=1
staking=1
listen=1
maxconnections=256
logtimestamps=1
txindex=1
txrlpindex=1
addrindex=1
logevents=1
printpriority=1
rpcport=51474
rpcbind=0.0.0.0:51474
rpcallowip=0.0.0.0/0
deprecatedrpc=accounts
[main]
port=9872
rpcport=51473
[regtest]
# listen on different ports than default testnet
port=5778
rpcport=51474
28 changes: 28 additions & 0 deletions docker/quick_start/kaon.conf.testnet.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
testnet=1
rpcuser=${RPC_USER}
rpcpassword=${RPC_PASSWORD}
dnsseed=0
upnp=0
debug=1
daemon=1
server=1
staking=1
listen=1
maxconnections=256
logtimestamps=1
txindex=1
txrlpindex=1
addrindex=1
logevents=1
printpriority=1
rpcport=51474
rpcbind=0.0.0.0:51474
rpcallowip=0.0.0.0/0
deprecatedrpc=accounts
[main]
port=9872
rpcport=51473
[testnet]
# listen on different ports than default testnet
port=5778
rpcport=51474
Loading

0 comments on commit 9f6a71a

Please sign in to comment.