diff --git a/README.md b/README.md index 7dafb1f..fd62fce 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,15 @@ Web3j [2.3.0](https://github.com/web3j/web3j/releases/tag/v2.3.0) is required an ## Running +Make sure `env/dev/resources/config.edn` is correctly populated. + +Lauch a local geth node with the bot account unlocked: + +``` +#!/bin/bash +geth --fast --testnet --cache=1024 --datadir=$HOME/.ropsten --verbosity 4 --port 50100 --ipcpath ~/.ropsten/geth.ipc --rpc --rpcaddr 127.0.0.1 --rpcport 8545 --rpcapi db,eth,net,web3,personal --rpccorsdomain""https://wallet.ethereum.or"" --unlock""YOUR_ADDR"" --password <(echo""YOUR_PASSWD"") +``` + Launch following commands each in its own shell: ``` @@ -46,6 +55,18 @@ lein figwheel lein less auto ``` +_NOTE_ + +Due to a current limitation you will have to do the following to have `lein run` work: + +``` +lein build-contracts +lein jar +lein repl # this will fail +cp -r target/classes/commiteth target/base+system+user+dev/classes +lein run +``` + ## Uberjar build To create a standalone uberjar: diff --git a/env/dev/resources/config.edn b/env/dev/resources/config.edn index 46f46bb..7833b1a 100644 --- a/env/dev/resources/config.edn +++ b/env/dev/resources/config.edn @@ -1,6 +1,26 @@ -{:dev true - :port 3000 +{:dev true + :port 3000 ;; when :nrepl-port is set the application starts the nREPL server on load - :nrepl-port 7000 - :jdbc-database-url "jdbc:postgresql://localhost/commiteth?user=commiteth&password=commiteth" - :server-address "http://localhost:3000"} + :nrepl-port 7000 + :jdbc-database-url "jdbc:postgresql://localhost/commiteth?user=commiteth&password=commiteth" + ;; this needs to resolve to your local machine from the public internet + :server-address "http://PUBLIC-DNS:3000" + + ;; eth address of bot account + :eth-account "0x.." + :eth-password "XXX" + + ;; RPC URL to ethereum node to be used + :eth-rpc-url "http://localhost:8547" + :eth-wallet-file "/some/location" + + ;; commiteth-test-tpatja + :github-client-id "CLIENT ID" + :github-client-secret "CLIENT SECRET" + + ;; github username + password for bot account + :github-user "commiteth" + :github-password "XXX" + :on-testnet true} + + diff --git a/src/clj/commiteth/eth/web3j.clj b/src/clj/commiteth/eth/web3j.clj index 1b2081c..2bd33df 100644 --- a/src/clj/commiteth/eth/web3j.clj +++ b/src/clj/commiteth/eth/web3j.clj @@ -15,9 +15,14 @@ (env :eth-password)) (defn creds [] - (WalletUtils/loadCredentials - (wallet-password) - (wallet-file-path))) + (let [password (wallet-password) + file-path (wallet-file-path)] + (if (and password file-path) + (WalletUtils/loadCredentials + password + file-path) + (throw (ex-info "Make sure you provided proper credentials in appropriate resources/config.edn" + {:password password :file-path file-path}))))) (defn create-web3j [] (Web3j/build (HttpService. (eth/eth-rpc-url))))