From 622b6117fdaea935109bcb01bd8cfa4643292dac Mon Sep 17 00:00:00 2001 From: cryptozoidberg Date: Sat, 9 Nov 2019 21:17:19 +0100 Subject: [PATCH 1/4] Extended build instructions and fixed markdown --- README.md | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 30c1c14c..0eb7acc2 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,20 @@ Recommended OS version: Ubuntu 17.04 LTS. For GUI version:\ `$ sudo apt-get install -y build-essential g++ python-dev autotools-dev libicu-dev libbz2-dev cmake git libboost-all-dev screen mesa-common-dev libglu1-mesa-dev qt5-default qtwebengine5-dev` -2. `$ cd zano/ && make -j$(nproc) gui` +2. Building binaries \ + 2.1. Building daemon and simplewallet: \ +   `$ cd zano/ && make -j` \ +   or \ +   `$ cd zano && mkdir build && cd build `\ +   `$ cmake .. `\ +   `$ make -j daemon simplewallet` \ + 2.2. Building GUI: \ +   `$ cd zano/ && make -j gui ` \ +   or \ +   `$ cd zano && mkdir build && cd build `\ +   `$ cmake -D BUILD_GUI=ON .. `\ +   `$ make -j Zano` \ +NOTICE: If you are building on machine with relatively small anount of RAM(small VPS for example, less then 16GB) and without proper setting of virtual memory, then be careful with setting `-j` option, this may cause compiller crashes. 3. Look for the binaries, including the `Zano` GUI, in the build directory ### Windows @@ -54,14 +67,14 @@ Recommended OS version: macOS Sierra 10.12.6 x64. To build GUI application: -1. Create self-signing certificate via Keychain Access: - a. Run Keychain Access. - b. Choose Keychain Access > Certificate Assistant > Create a Certificate. - c. Use “Zano” (without quotes) as certificate name. - d. Choose “Code Signing” in “Certificate Type” field. - e. Press “Create”, then “Done”. - f. Make sure the certificate was added to keychain "System". If not—move it to "System". - g. Double click the certificate you've just added, enter the trust section and under "When using this certificate" select "Always trust". +1. Create self-signing certificate via Keychain Access:\ + a. Run Keychain Access.\ + b. Choose Keychain Access > Certificate Assistant > Create a Certificate.\ + c. Use “Zano” (without quotes) as certificate name.\ + d. Choose “Code Signing” in “Certificate Type” field.\ + e. Press “Create”, then “Done”.\ + f. Make sure the certificate was added to keychain "System". If not—move it to "System".\ + g. Double click the certificate you've just added, enter the trust section and under "When using this certificate" select "Always trust".\ h. Unfold the certificate in Keychain Access window and double click underlying private key "Zano". Select "Access Control" tab, then select "Allow all applications to access this item". Click "Save Changes". 2. Revise building script, comment out unwanted steps and run it: `utils/build_script_mac_osx.sh` 3. The application should be here: `/buid_mac_osx_64/release/src` From 9a55a0b7dab83a9b9900f11013702d2ab336cc50 Mon Sep 17 00:00:00 2001 From: ArqTras <33489188+ArqTras@users.noreply.github.com> Date: Sun, 15 Dec 2019 14:35:40 +0100 Subject: [PATCH 2/4] GUI compilation update (#145) --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 0eb7acc2..e5319eb2 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,7 @@ For GUI version:\   `$ cd zano && mkdir build && cd build `\   `$ cmake -D BUILD_GUI=ON .. `\   `$ make -j Zano` \ +   `$ rsync -haP ~/zano/src/gui/qt-daemon/html ~/zano/build/src` \ NOTICE: If you are building on machine with relatively small anount of RAM(small VPS for example, less then 16GB) and without proper setting of virtual memory, then be careful with setting `-j` option, this may cause compiller crashes. 3. Look for the binaries, including the `Zano` GUI, in the build directory From 29a276f1806d838a9ba51ab786aba0e5999e571f Mon Sep 17 00:00:00 2001 From: sowle Date: Thu, 26 Dec 2019 18:08:57 +0300 Subject: [PATCH 3/4] do not allow watch-only wallets be opened by GUI + refactoring --- src/currency_core/account.cpp | 31 ++++++++++++++++--- .../qt-daemon/application/daemon_backend.cpp | 4 ++- src/gui/qt-daemon/application/view_iface.h | 1 + src/gui/qt-daemon/html/assets/i18n/en.json | 1 + src/gui/qt-daemon/html/main.js | 3 ++ .../app/_helpers/services/backend.service.ts | 3 ++ .../html_source/src/assets/i18n/en.json | 1 + src/wallet/wallet2.cpp | 2 +- 8 files changed, 40 insertions(+), 6 deletions(-) diff --git a/src/currency_core/account.cpp b/src/currency_core/account.cpp index 39f6675e..0f8adc36 100644 --- a/src/currency_core/account.cpp +++ b/src/currency_core/account.cpp @@ -28,16 +28,21 @@ namespace currency //----------------------------------------------------------------- account_base::account_base() - :m_keys{} - ,m_creation_timestamp{} - ,m_seed{} { set_null(); } //----------------------------------------------------------------- void account_base::set_null() { + // fill sensitive data with random bytes + crypto::generate_random_bytes(sizeof m_keys.m_spend_secret_key, &m_keys.m_spend_secret_key); + crypto::generate_random_bytes(sizeof m_keys.m_view_secret_key, &m_keys.m_view_secret_key); + crypto::generate_random_bytes(m_seed.size(), &m_seed[0]); + + // clear m_keys = account_keys(); + m_creation_timestamp = 0; + m_seed.clear(); } //----------------------------------------------------------------- void account_base::generate() @@ -65,6 +70,8 @@ namespace currency std::string account_base::get_restore_braindata() const { std::string restore_buff = get_restore_data(); + if (restore_buff.empty()) + return ""; std::vector v; v.assign((unsigned char*)restore_buff.data(), (unsigned char*)restore_buff.data() + restore_buff.size()); std::string seed_brain_data = tools::mnemonic_encoding::binary2text(v); @@ -124,7 +131,23 @@ namespace currency //----------------------------------------------------------------- void account_base::make_account_watch_only() { - m_keys.m_spend_secret_key = currency::null_skey; + // keep only: + // timestamp + // view pub & spend pub (public address) + // view sec + + // store to local tmp + uint64_t local_ts = m_creation_timestamp; + account_public_address local_addr = m_keys.m_account_address; + crypto::secret_key local_view_sec = m_keys.m_view_secret_key; + + // clear + set_null(); + + // restore + m_creation_timestamp = local_ts; + m_keys.m_account_address = local_addr; + m_keys.m_view_secret_key = local_view_sec; } //----------------------------------------------------------------- std::string transform_addr_to_str(const account_public_address& addr) diff --git a/src/gui/qt-daemon/application/daemon_backend.cpp b/src/gui/qt-daemon/application/daemon_backend.cpp index b4bd319d..c707766b 100644 --- a/src/gui/qt-daemon/application/daemon_backend.cpp +++ b/src/gui/qt-daemon/application/daemon_backend.cpp @@ -676,7 +676,9 @@ std::string daemon_backend::open_wallet(const std::wstring& path, const std::str { try { - w->load(path, password); + w->load(path, password); + if (w->is_watch_only()) + return API_RETURN_CODE_WALLET_WATCH_ONLY_NOT_SUPPORTED; w->get_recent_transfers_history(owr.recent_history.history, 0, txs_to_return, owr.recent_history.total_history_items); //w->get_unconfirmed_transfers(owr.recent_history.unconfirmed); w->get_unconfirmed_transfers(owr.recent_history.history); diff --git a/src/gui/qt-daemon/application/view_iface.h b/src/gui/qt-daemon/application/view_iface.h index d50cec72..52591e8e 100644 --- a/src/gui/qt-daemon/application/view_iface.h +++ b/src/gui/qt-daemon/application/view_iface.h @@ -736,6 +736,7 @@ public: #define API_RETURN_CODE_BAD_ARG_WRONG_PAYMENT_ID "BAD_ARG_WRONG_PAYMENT_ID" #define API_RETURN_CODE_WRONG_PASSWORD "WRONG_PASSWORD" #define API_RETURN_CODE_WALLET_WRONG_ID "WALLET_WRONG_ID" +#define API_RETURN_CODE_WALLET_WATCH_ONLY_NOT_SUPPORTED "WALLET_WATCH_ONLY_NOT_SUPPORTED" #define API_RETURN_CODE_FILE_NOT_FOUND "FILE_NOT_FOUND" #define API_RETURN_CODE_ALREADY_EXISTS "ALREADY_EXISTS" #define API_RETURN_CODE_CANCELED "CANCELED" diff --git a/src/gui/qt-daemon/html/assets/i18n/en.json b/src/gui/qt-daemon/html/assets/i18n/en.json index 8376eef7..b720e948 100644 --- a/src/gui/qt-daemon/html/assets/i18n/en.json +++ b/src/gui/qt-daemon/html/assets/i18n/en.json @@ -581,6 +581,7 @@ "TRANSACTION_ERROR": "Error. Transaction not completed.", "BAD_ARG": "Invalid argument", "WALLET_WRONG_ID": "Invalid wallet ID", + "WALLET_WATCH_ONLY_NOT_SUPPORTED": "Watch-only wallets can only be opened by simplewallet", "WRONG_PASSWORD": "Invalid password", "FILE_RESTORED": "The wallet file was corrupted. We have recovered the keys and the wallet from the blockchain", "FILE_NOT_FOUND": "File not found", diff --git a/src/gui/qt-daemon/html/main.js b/src/gui/qt-daemon/html/main.js index cdc633e6..34d33acd 100644 --- a/src/gui/qt-daemon/html/main.js +++ b/src/gui/qt-daemon/html/main.js @@ -1843,6 +1843,9 @@ var BackendService = /** @class */ (function () { case 'WALLET_WRONG_ID': error_translate = 'ERRORS.WALLET_WRONG_ID'; break; + case 'WALLET_WATCH_ONLY_NOT_SUPPORTED': + error_translate = 'ERRORS.WALLET_WATCH_ONLY_NOT_SUPPORTED'; + break; case 'WRONG_PASSWORD': case 'WRONG_PASSWORD:invalid password': params = JSON.parse(params); diff --git a/src/gui/qt-daemon/html_source/src/app/_helpers/services/backend.service.ts b/src/gui/qt-daemon/html_source/src/app/_helpers/services/backend.service.ts index d4d4971f..eb90c830 100644 --- a/src/gui/qt-daemon/html_source/src/app/_helpers/services/backend.service.ts +++ b/src/gui/qt-daemon/html_source/src/app/_helpers/services/backend.service.ts @@ -109,6 +109,9 @@ export class BackendService { case 'WALLET_WRONG_ID': error_translate = 'ERRORS.WALLET_WRONG_ID'; break; + case 'WALLET_WATCH_ONLY_NOT_SUPPORTED': + error_translate = 'ERRORS.WALLET_WATCH_ONLY_NOT_SUPPORTED'; + break; case 'WRONG_PASSWORD': case 'WRONG_PASSWORD:invalid password': params = JSON.parse(params); diff --git a/src/gui/qt-daemon/html_source/src/assets/i18n/en.json b/src/gui/qt-daemon/html_source/src/assets/i18n/en.json index 8376eef7..b720e948 100644 --- a/src/gui/qt-daemon/html_source/src/assets/i18n/en.json +++ b/src/gui/qt-daemon/html_source/src/assets/i18n/en.json @@ -581,6 +581,7 @@ "TRANSACTION_ERROR": "Error. Transaction not completed.", "BAD_ARG": "Invalid argument", "WALLET_WRONG_ID": "Invalid wallet ID", + "WALLET_WATCH_ONLY_NOT_SUPPORTED": "Watch-only wallets can only be opened by simplewallet", "WRONG_PASSWORD": "Invalid password", "FILE_RESTORED": "The wallet file was corrupted. We have recovered the keys and the wallet from the blockchain", "FILE_NOT_FOUND": "File not found", diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index 8cf28801..d66fead1 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -2097,7 +2097,7 @@ void wallet2::store(const std::wstring& path_to_save, const std::string& passwor //prepare data std::string keys_buff; - bool r = store_keys(keys_buff, password); + bool r = store_keys(keys_buff, password, m_watch_only); WLT_THROW_IF_FALSE_WALLET_CMN_ERR_EX(r, "failed to store_keys for wallet " << ascii_path_to_save); //store data From 31d824ace90860f6f31ff59ed9d11d57f009f909 Mon Sep 17 00:00:00 2001 From: sowle Date: Thu, 26 Dec 2019 18:09:41 +0300 Subject: [PATCH 4/4] === build number: 76 -> 77 === --- src/version.h.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/version.h.in b/src/version.h.in index dc908a47..e736fb6f 100644 --- a/src/version.h.in +++ b/src/version.h.in @@ -8,6 +8,6 @@ #define PROJECT_REVISION "4" #define PROJECT_VERSION PROJECT_MAJOR_VERSION "." PROJECT_MINOR_VERSION "." PROJECT_REVISION -#define PROJECT_VERSION_BUILD_NO 76 +#define PROJECT_VERSION_BUILD_NO 77 #define PROJECT_VERSION_BUILD_NO_STR STRINGIFY_EXPAND(PROJECT_VERSION_BUILD_NO) #define PROJECT_VERSION_LONG PROJECT_VERSION "." PROJECT_VERSION_BUILD_NO_STR "[" BUILD_COMMIT_ID "]"