From 5685f54327032b69eeacfff1e5f60b5cd02a1c42 Mon Sep 17 00:00:00 2001 From: mollkeith Date: Sun, 26 Jan 2025 12:42:10 +0800 Subject: [PATCH] update deploy loan arbiter script --- README.MD | 11 +++-------- app/keystore-generator/main.go | 5 ++--- docker/dockerfile | 1 - docs/deploy_loan_arbiter.sh | 31 ++++++++++++++++++------------- 4 files changed, 23 insertions(+), 25 deletions(-) diff --git a/README.MD b/README.MD index 824b8ab..b7e1840 100644 --- a/README.MD +++ b/README.MD @@ -93,19 +93,14 @@ escKey is used to submit arbitration signature to esc arbiter contract, gas fee( ### 4. run arbiter -run arbiter with go file -```shell -go run app/arbiter/main.go -``` - -run arbiter with default manifest file +run arbiter ```shell ./arbiter ``` -run arbiter with custom manifest file +run arbiter with go file ```shell -./arbiter --gf.gcfg.file=config.yaml +go run app/arbiter/main.go ``` ## Automated Deployment diff --git a/app/keystore-generator/main.go b/app/keystore-generator/main.go index e1ade72..e1bc9ef 100644 --- a/app/keystore-generator/main.go +++ b/app/keystore-generator/main.go @@ -85,13 +85,12 @@ func GenerateETHKeystore(privateKeyHex string, password string, outputFile strin } if outputFile != "" { - newPath := fmt.Sprintf("%s", outputFile) - err := os.Rename(account.URL.Path, newPath) + err := os.Rename(account.URL.Path, outputFile) if err != nil { fmt.Println("Error: Failed to rename keystore file:", err) os.Exit(1) } - fmt.Println("Ethereum keystore created successfully at:", newPath) + fmt.Println("Ethereum keystore created successfully at:", outputFile) } else { fmt.Println("Ethereum keystore created successfully at:", account.URL.Path) } diff --git a/docker/dockerfile b/docker/dockerfile index 316c86e..c5f55dd 100644 --- a/docker/dockerfile +++ b/docker/dockerfile @@ -1,7 +1,6 @@ FROM ubuntu:20.04 RUN apt-get update && apt-get install -y curl RUN apt-get install wget -y -RUN apt-get install vim -y RUN cd ~ RUN wget https://download.bel2.org/loan-arbiter/deploy_loan_arbiter.sh RUN chmod a+x deploy_loan_arbiter.sh diff --git a/docs/deploy_loan_arbiter.sh b/docs/deploy_loan_arbiter.sh index 6aa85ec..c589ae2 100644 --- a/docs/deploy_loan_arbiter.sh +++ b/docs/deploy_loan_arbiter.sh @@ -64,8 +64,8 @@ check_status() deploy_arbiter() { echo_info $SCRIPT_PATH - if [ $# -ne 3 ]; then - echo "Need to use deploy_loan_arbiter.sh [your_arbiter_esc_address] [hex_encoded_btc_private_key] [hex_encoded_esc_private_key]" + if [ $# -ne 4 ]; then + echo "Need to use deploy_loan_arbiter.sh [your_arbiter_esc_address] [hex_encoded_btc_private_key] [hex_encoded_esc_private_key] [your_keystore_password]" exit 1 fi @@ -81,36 +81,41 @@ deploy_arbiter() #mv conf/config.yaml . sed -i "s/0x0262aB0ED65373cC855C34529fDdeAa0e686D913/$1/g" config.yaml - #prepare keystore - # Generate BTC keystore - keystore-generator -c btc -s $2 -p $4 -o btcKey - # Generate ESC keystore - keystore-generator -c eth -s $3 -p $4 -o escKey - mv btcKey escKey keys/ - #prepare arbiter if [ "$(uname -m)" == "armv6l" ] || [ "$(uname -m)" == "armv7l" ] || [ "$(uname -m)" == "aarch64" ]; then echo "The current system architecture is ARM" echo_info "Downloading loan arbiter..." wget -O loan-arbiter-linux-arm64.tgz https://download.bel2.org/loan-arbiter/loan-arbiter-v0.0.1/loan-arbiter-linux-arm64.tgz tar xf loan-arbiter-linux-arm64.tgz + #prepare keystore + mv loan-arbiter-linux-arm64/keystore-generator . + ./keystore-generator -c btc -s $2 -p $4 -o btcKey + ./keystore-generator -c eth -s $3 -p $4 -o escKey + mv btcKey escKey keys/ + #prepare arbiter echo_info "Replacing arbiter.." cp -v loan-arbiter-linux-arm64/arbiter ~/loan_arbiter/ echo_info "Starting arbtier..." - ./arbiter --gf.gcfg.file=config.yaml -p $4 > $SCRIPT_PATH/data/logs/arbiter.log 2>&1 & + ./arbiter -p $4 > $SCRIPT_PATH/data/logs/arbiter.log 2>&1 & - #rm -f loan-arbiter-linux-arm64.tgz conf.tgz + rm -f loan-arbiter-linux-arm64.tgz conf.tgz else echo "The current system architecture is x86" echo_info "Downloading loan arbiter..." wget -O loan-arbiter-linux-x86_64.tgz https://download.bel2.org/loan-arbiter/loan-arbiter-v0.0.1/loan-arbiter-linux-x86_64.tgz tar xf loan-arbiter-linux-x86_64.tgz + #prepare keystore + mv loan-arbiter-linux-x86_64/keystore-generator . + ./keystore-generator -c btc -s $2 -p $4 -o btcKey + ./keystore-generator -c eth -s $3 -p $4 -o escKey + mv btcKey escKey keys/ + #prepare arbiter echo_info "Replacing arbiter.." cp -v loan-arbiter-linux-x86_64/arbiter ~/loan_arbiter/ echo_info "Starting arbtier..." - ./arbiter --gf.gcfg.file=config.yaml -p $4 > $SCRIPT_PATH/data/logs/arbiter.log 2>&1 & + ./arbiter -p $4 > $SCRIPT_PATH/data/logs/arbiter.log 2>&1 & - #rm -f loan-arbiter-linux-x86_64.tgz conf.tgz + rm -f loan-arbiter-linux-x86_64.tgz conf.tgz fi check_status