diff --git a/bin/lamassu-install-geth b/bin/lamassu-install-geth new file mode 100755 index 00000000..62184390 --- /dev/null +++ b/bin/lamassu-install-geth @@ -0,0 +1,34 @@ +#!/usr/bin/env bash +set -e + +if [ "$(whoami)" != "root" ]; then + echo -e "This script has to be run as \033[1mroot\033[0m user" + exit 3 +fi + +echo "Activating geth (Ethereum server wallet)..." + +export LOG_FILE=/tmp/install.log + +SEEDS_DIR=$HOME/seeds +SEED_FILE=$SEEDS_DIR/seed.txt +SEED=$(cat $SEED_FILE) +PASS_FILE=$SEEDS_DIR/geth.txt +hkdf geth-pw $SEED > $PASS_FILE +ACCOUNT_STR=$(geth --password $PASS_FILE account new) +ACCOUNT=$(echo $ACCOUNT_STR | grep -o '{.*}' | tr -d '{}') + +ufw allow 30303/tcp >> $LOG_FILE 2>&1 # Ethereum + +SCRIPTS_DIR=$HOME/scripts +mkdir -p $SCRIPTS_DIR +GETH_SCRIPT=$SCRIPTS_DIR/geth.sh + +# NOTE: We need to combine stderr with stdout because geth prints info to stderr +echo "geth --fast --rpc --unlock $ACCOUNT --password $PASS_FILE 2>&1" > $GETH_SCRIPT + +chmod 755 $GETH_SCRIPT +pm2 start $GETH_SCRIPT >> $LOG_FILE 2>&1 +pm2 save >> $LOG_FILE 2>&1 + +echo "Success. Your main account is 0x$ACCOUNT." diff --git a/bin/lamassu-mnemonic b/bin/lamassu-mnemonic index d5ae4c69..122975b8 100755 --- a/bin/lamassu-mnemonic +++ b/bin/lamassu-mnemonic @@ -1,3 +1,5 @@ +#!/usr/bin/env node + const fs = require('fs') const bip39 = require('bip39') diff --git a/lib/plugins/wallet/bitcoind/bitcoind.js b/lib/plugins/wallet/bitcoind/bitcoind.js index cda8814b..883e72a9 100644 --- a/lib/plugins/wallet/bitcoind/bitcoind.js +++ b/lib/plugins/wallet/bitcoind/bitcoind.js @@ -101,9 +101,9 @@ function sendCoins (account, address, cryptoAtoms, cryptoCode) { }) } -function newAddress (account, cryptoCode, info) { +function newAddress (account, info) { return new Promise((resolve, reject) => { - checkCryptoCode(cryptoCode) + checkCryptoCode(info.cryptoCode) const rpc = initRpc() rpc.getNewAddress((err, result) => { if (err) return reject(err)