diff --git a/docker/.gitignore b/docker/.gitignore index af51ac05..d099ac13 100644 --- a/docker/.gitignore +++ b/docker/.gitignore @@ -1,4 +1,4 @@ -/janus-linux-amd64 -/.qtum +/eth-rpc-gate-linux-amd64 +/.Kaon /supervisord.* /env.list diff --git a/docker/configure_https.sh b/docker/configure_https.sh index 722ceb69..d684edc4 100755 --- a/docker/configure_https.sh +++ b/docker/configure_https.sh @@ -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 $? diff --git a/docker/fill_user_account.sh b/docker/fill_user_account.sh index a18cb399..496ecb5d 100755 --- a/docker/fill_user_account.sh +++ b/docker/fill_user_account.sh @@ -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 diff --git a/docker/go-build.Dockerfile b/docker/go-build.Dockerfile index 52a61759..9900dc1d 100644 --- a/docker/go-build.Dockerfile +++ b/docker/go-build.Dockerfile @@ -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 diff --git a/docker/qtum-seeded.Dockerfile b/docker/kaon-seeded.Dockerfile similarity index 91% rename from docker/qtum-seeded.Dockerfile rename to docker/kaon-seeded.Dockerfile index af373183..5f1e6799 100644 --- a/docker/qtum-seeded.Dockerfile +++ b/docker/kaon-seeded.Dockerfile @@ -1,4 +1,4 @@ -FROM qtum/qtum +FROM kaon/kaon COPY ./fill_user_account.sh ./ COPY ./populate_and_run.sh ./ diff --git a/docker/kaond_restart.sh b/docker/kaond_restart.sh new file mode 100755 index 00000000..03179446 --- /dev/null +++ b/docker/kaond_restart.sh @@ -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 diff --git a/docker/quick_start/docker-compose.mainnet.yml b/docker/quick_start/docker-compose.mainnet.yml index 3dfa6204..d2f3427a 100644 --- a/docker/quick_start/docker-compose.mainnet.yml +++ b/docker/quick_start/docker-compose.mainnet.yml @@ -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 diff --git a/docker/quick_start/docker-compose.regtest.yml b/docker/quick_start/docker-compose.regtest.yml index ea327c5e..5d6a5eab 100644 --- a/docker/quick_start/docker-compose.regtest.yml +++ b/docker/quick_start/docker-compose.regtest.yml @@ -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 diff --git a/docker/quick_start/docker-compose.testnet.yml b/docker/quick_start/docker-compose.testnet.yml index ec104e49..1abee344 100644 --- a/docker/quick_start/docker-compose.testnet.yml +++ b/docker/quick_start/docker-compose.testnet.yml @@ -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 diff --git a/docker/quick_start/kaon.conf.mainnet.template b/docker/quick_start/kaon.conf.mainnet.template new file mode 100644 index 00000000..d7fdbd9f --- /dev/null +++ b/docker/quick_start/kaon.conf.mainnet.template @@ -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 \ No newline at end of file diff --git a/docker/quick_start/kaon.conf.regtest.template b/docker/quick_start/kaon.conf.regtest.template new file mode 100644 index 00000000..689822d3 --- /dev/null +++ b/docker/quick_start/kaon.conf.regtest.template @@ -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 diff --git a/docker/quick_start/kaon.conf.testnet.template b/docker/quick_start/kaon.conf.testnet.template new file mode 100644 index 00000000..1f461260 --- /dev/null +++ b/docker/quick_start/kaon.conf.testnet.template @@ -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 diff --git a/docker/setup_db.sh b/docker/setup_db.sh new file mode 100755 index 00000000..0f5cf0c3 --- /dev/null +++ b/docker/setup_db.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +# Database connection parameters +HOST="$SQL_HOST" +PORT="$SQL_PORT" +USER="$SQL_USER" +PASSWORD="$SQL_PASSWORD" +DBNAME="$SQL_DBNAME" +SSLMODE="$SQL_SSL" + +# Export password to avoid prompting +export PGPASSWORD=$PASSWORD + +# Execute DROP DATABASE commands +psql -h $HOST -p $PORT -U $USER -d $DBNAME -c "DROP DATABASE IF EXISTS ${DBNAME};" + +# Execute CREATE DATABASE commands +psql -h $HOST -p $PORT -U $USER -d $DBNAME -c "CREATE DATABASE ${DBNAME};" + +# Grant privileges +GRANT_COMMANDS=" +GRANT ALL PRIVILEGES ON DATABASE ${DBNAME} TO ${USER}; +" + +# Execute grant commands +psql -h $HOST -p $PORT -U $USER -d $DBNAME -c "$GRANT_COMMANDS" + +# Unset the password for security reasons +unset PGPASSWORD + +echo "PostgreSQL setup completed." +echo "Database: ${DBNAME}" +echo "User: ${USER}" \ No newline at end of file diff --git a/docker/setup_self_signed_https.sh b/docker/setup_self_signed_https.sh index fff5690f..21f0e66f 100755 --- a/docker/setup_self_signed_https.sh +++ b/docker/setup_self_signed_https.sh @@ -16,7 +16,7 @@ if [ ! -d "./https" ]; then fi echo "Generating key.pem and cert.pem" -docker run -v `pwd`/https:/https qtum/openssl.janus 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" +docker run -v `pwd`/https:/https kaon/openssl.ethrpcgate 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 $? @@ -37,18 +37,18 @@ fi exit 0 echo "Generating server.key" -docker run -v `pwd`/https:/https qtum/openssl.janus openssl genrsa -out /https/server.key 2048 +docker run -v `pwd`/https:/https kaon/openssl.ethrpcgate openssl genrsa -out /https/server.key 2048 if [ 0 -ne $? ]; then echo "Failed to generate server.key" exit $? fi -docker run -v `pwd`/https:/https qtum/openssl.janus openssl ecparam -genkey -name secp384r1 -out /https/server.key +docker run -v `pwd`/https:/https kaon/openssl.ethrpcgate openssl ecparam -genkey -name secp384r1 -out /https/server.key if [ 0 -ne $? ]; then echo "Failed to generate sever.key" exit $? fi echo "Generating server.crt" -docker run -v `pwd`/https:/https qtum/openssl.janus openssl req -nodes -new -x509 -sha256 -key /https/server.key -out /https/server.crt -days 3650 -subj "/C=US/ST=ST/L=L/O=Janus Self-signed https/OU=Janus Self-signed https/CN=Janus Self-signed https" +docker run -v `pwd`/https:/https kaon/openssl.ethrpcgate openssl req -nodes -new -x509 -sha256 -key /https/server.key -out /https/server.crt -days 3650 -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.crt" exit $? diff --git a/docker/spin_up.mainnet.sh b/docker/spin_up.mainnet.sh index fb1e1dfd..560e99b5 100755 --- a/docker/spin_up.mainnet.sh +++ b/docker/spin_up.mainnet.sh @@ -1,5 +1,5 @@ #!/bin/sh -docker-compose -f ${GOPATH}/src/github.com/qtumproject/janus/docker/quick_start/docker-compose.mainnet.yml up -d -# sleep 3 #executing too fast causes some errors -# docker cp ${GOPATH}/src/github.com/qtumproject/janus/docker/fill_user_account.sh qtum_testchain:. -# docker exec qtum_mainnet /bin/sh -c ./fill_user_account.sh \ No newline at end of file +docker-compose -f ${GOPATH}/src/github.com/kaonone/eth-rpc-gate/docker/quick_start/docker-compose.mainnet.yml up -d +sleep 3 #executing too fast causes some errors +docker cp ${GOPATH}/src/github.com/kaonone/eth-rpc-gate/docker/fill_user_account.sh kaon_testchain:. +docker exec kaon_mainnet /bin/sh -c ./fill_user_account.sh \ No newline at end of file diff --git a/docker/spin_up.regtest.sh b/docker/spin_up.regtest.sh index b274bfa2..08dad2f7 100755 --- a/docker/spin_up.regtest.sh +++ b/docker/spin_up.regtest.sh @@ -1,5 +1,5 @@ #!/bin/sh -docker-compose -f ${GOPATH}/src/github.com/qtumproject/janus/docker/quick_start/docker-compose.regtest.yml up -d +docker-compose -f ${GOPATH}/src/github.com/kaonone/eth-rpc-gate/docker/quick_start/docker-compose.regtest.yml up -d sleep 3 #executing too fast causes some errors -docker cp ${GOPATH}/src/github.com/qtumproject/janus/docker/fill_user_account.sh qtum_regtest:. -docker exec qtum_regtest /bin/sh -c ./fill_user_account.sh \ No newline at end of file +docker cp ${GOPATH}/src/github.com/kaonone/eth-rpc-gate/docker/fill_user_account.sh kaon_regtest:. +docker exec kaon_regtest /bin/sh -c ./fill_user_account.sh \ No newline at end of file diff --git a/docker/spin_up.testnet.sh b/docker/spin_up.testnet.sh index bcc91fb3..1acf27b3 100755 --- a/docker/spin_up.testnet.sh +++ b/docker/spin_up.testnet.sh @@ -1,5 +1,5 @@ #!/bin/sh -docker-compose -f ${GOPATH}/src/github.com/qtumproject/janus/docker/quick_start/docker-compose.testnet.yml up -d -# sleep 3 #executing too fast causes some errors -# docker cp ${GOPATH}/src/github.com/qtumproject/janus/docker/fill_user_account.sh qtum_testchain:. -# docker exec qtum_testnet /bin/sh -c ./fill_user_account.sh \ No newline at end of file +docker-compose -f ${GOPATH}/src/github.com/kaonone/eth-rpc-gate/docker/quick_start/docker-compose.testnet.yml up -d +sleep 3 #executing too fast causes some errors +docker cp ${GOPATH}/src/github.com/kaonone/eth-rpc-gate/docker/fill_user_account.sh kaon_testchain:. +docker exec kaon_testnet /bin/sh -c ./fill_user_account.sh \ No newline at end of file diff --git a/docker/standalone/myaccounts.txt b/docker/standalone/myaccounts.txt index a359fa74..6bb426be 100644 --- a/docker/standalone/myaccounts.txt +++ b/docker/standalone/myaccounts.txt @@ -1,6 +1,6 @@ -cMbgxCJrTYUqgcmiC1berh5DFrtY1KeU4PXZ6NZxgenniF1mXCRk -cRcG1jizfBzHxfwu68aMjhy78CpnzD9gJYZ5ggDbzfYD3EQfGUDZ -cV79qBoCSA2NDrJz8S3T7J8f3zgkGfg4ua4hRRXfhbnq5VhXkukT -cV93kaaV8hvNqZ711s2z9jVWLYEtwwsVpyFeEZCP6otiZgrCTiEW -cVPHpTvmv3UjQsZfsMRrW5RrGCyTSAZ3MWs1f8R1VeKJSYxy5uac -cTs5NqY4Ko9o6FESHGBDEG77qqz9me7cyYCoinHcWEiqMZgLC6XY \ No newline at end of file +YoBkvJXYcxihY3qYXZuh3ndN14hWmAPUU3qhFZw1Zbt9g85FjMCd +Yn3MpyMQzQR7osXkNyQ3DVNP6kwZGpmXhXzuuPGXZwyouhxmWxh7 +YhrMRdEunTgoz4vs9RYc7Ui5yAYp2UmBeZsVfWHjifzVWeDQGVt7 +YiaCnmCToCPUGgSrLxEiGVa297WiFGc5jrsUpy68BJiCe7Cym716 +YifXHT9WJeP53jor88a6FYgxj3CDFjtkbYGb6tRHJK3UhdLye6m2 +Yjf1pkLANZcMQd81HyyqV4BHBMwMLoqZzZ9W4YfGxtqEbinL5kQq \ No newline at end of file diff --git a/docker/unittests.Dockerfile b/docker/unittests.Dockerfile index a686b4a6..47bf640a 100644 --- a/docker/unittests.Dockerfile +++ b/docker/unittests.Dockerfile @@ -1,7 +1,7 @@ FROM golang:1.18 -WORKDIR $GOPATH/src/github.com/qtumproject/janus -COPY . $GOPATH/src/github.com/qtumproject/janus +WORKDIR $GOPATH/src/github.com/kaonone/eth-rpc-gate +COPY . $GOPATH/src/github.com/kaonone/eth-rpc-gate RUN go get -d ./... CMD [ "go", "test", "-v", "./..."] \ No newline at end of file diff --git a/myaccounts.txt b/myaccounts.txt index 013780bd..6bb426be 100644 --- a/myaccounts.txt +++ b/myaccounts.txt @@ -1,6 +1,6 @@ -cMbgxCJrTYUqgcmiC1berh5DFrtY1KeU4PXZ6NZxgenniF1mXCRk -cRcG1jizfBzHxfwu68aMjhy78CpnzD9gJYZ5ggDbzfYD3EQfGUDZ -cV79qBoCSA2NDrJz8S3T7J8f3zgkGfg4ua4hRRXfhbnq5VhXkukT -cV93kaaV8hvNqZ711s2z9jVWLYEtwwsVpyFeEZCP6otiZgrCTiEW -cVPHpTvmv3UjQsZfsMRrW5RrGCyTSAZ3MWs1f8R1VeKJSYxy5uac -cTs5NqY4Ko9o6FESHGBDEG77qqz9me7cyYCoinHcWEiqMZgLC6XY +YoBkvJXYcxihY3qYXZuh3ndN14hWmAPUU3qhFZw1Zbt9g85FjMCd +Yn3MpyMQzQR7osXkNyQ3DVNP6kwZGpmXhXzuuPGXZwyouhxmWxh7 +YhrMRdEunTgoz4vs9RYc7Ui5yAYp2UmBeZsVfWHjifzVWeDQGVt7 +YiaCnmCToCPUGgSrLxEiGVa297WiFGc5jrsUpy68BJiCe7Cym716 +YifXHT9WJeP53jor88a6FYgxj3CDFjtkbYGb6tRHJK3UhdLye6m2 +Yjf1pkLANZcMQd81HyyqV4BHBMwMLoqZzZ9W4YfGxtqEbinL5kQq \ No newline at end of file