#!/usr/bin/env sh

BOR_HOME=$HOME/.bor
BOR_DATA_DIR=$BOR_HOME/data

# create heimdall file
mkdir -p $BOR_HOME

# get address
ADDRESS="`cat $BOR_HOME/address.txt`"

# start bor
bor --datadir $BOR_DATA_DIR \
  --port 30303 \
  --bor.heimdall "http://localhost:1317" \
  --http --http.addr '0.0.0.0' \
  --ws --ws.port 8546 \
  --http.vhosts '*' \
  --http.corsdomain '*' \
  --http.port 8545 \
  --ipcpath $BOR_DATA_DIR/bor.ipc \
  --http.api 'eth,net,web3,txpool,bor' \
  --syncmode 'full' \
  --networkid '{{ obj.config.borChainId }}' \
  --miner.gaslimit '20000000' \
  --txpool.nolocals \
  --txpool.accountslots '128' \
  --txpool.globalslots '20000'  \
  --txpool.lifetime '0h16m0s' \
  --maxpeers 200 \
  --metrics \
  --pprof --pprof.port 7071 --pprof.addr '0.0.0.0' \
  --unlock $ADDRESS \
  --keystore $BOR_HOME/keystore \
  --password $BOR_HOME/password.txt \
  --allow-insecure-unlock \
  --mine
