From b7c567f57da5252310b08d7a3d9755150ac07197 Mon Sep 17 00:00:00 2001 From: Vincent Gariepy Date: Mon, 10 Feb 2014 08:09:31 -0500 Subject: [PATCH] Add balance, address and secret commands in CLI client --- eth/main.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/eth/main.cpp b/eth/main.cpp index 6c3b4bed7..174654a62 100644 --- a/eth/main.cpp +++ b/eth/main.cpp @@ -169,6 +169,7 @@ int main(int argc, char** argv) } Client c("Ethereum(++)/v" ADD_QUOTES(ETH_VERSION) "/" ADD_QUOTES(ETH_BUILD_TYPE) "/" ADD_QUOTES(ETH_BUILD_PLATFORM), coinbase, dbPath); + cout << "\nYour secret key is:\n" + asHex(us.secret().asArray()) + "\nAddress:\n" + asHex(us.address().asArray()) + " <-- \n" << endl; if (interactive) { cout << "Ethereum (++)" << endl; @@ -205,6 +206,23 @@ int main(int argc, char** argv) { c.stopMining(); } + else if (cmd == "address") + { + cout << "\nCurrent address: " + asHex(us.address().asArray()) << endl; + cout << "===\n" << endl; + } + else if (cmd == "secret") + { + cout << "\nCurrent secret: " + asHex(us.secret().asArray()) << endl; + cout << "===\n" << endl; + } + else if (cmd == "balance") + { + u256 balance = c.state().balance(us.address()); + cout << "\nCurrent balance: "; + cout << balance << endl; + cout << "===\n" << endl; + } else if (cmd == "transact") { string sechex;