aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/wallet2.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* | | wallet2: allow empty wallet filename to avoid saving datamoneromooo-monero2017-12-171-29/+57
| | | | | | | | | | | | Useful to speed tests up and avoid unnecessary leftover files
* | | Add N/N multisig tx generation and signingmoneromooo-monero2017-12-171-60/+515
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Scheme by luigi1111: Multisig for RingCT on Monero 2 of 2 User A (coordinator): Spendkey b,B Viewkey a,A (shared) User B: Spendkey c,C Viewkey a,A (shared) Public Address: C+B, A Both have their own watch only wallet via C+B, a A will coordinate spending process (though B could easily as well, coordinator is more needed for more participants) A and B watch for incoming outputs B creates "half" key images for discovered output D: I2_D = (Hs(aR)+c) * Hp(D) B also creates 1.5 random keypairs (one scalar and 2 pubkeys; one on base G and one on base Hp(D)) for each output, storing the scalar(k) (linked to D), and sending the pubkeys with I2_D. A also creates "half" key images: I1_D = (Hs(aR)+b) * Hp(D) Then I_D = I1_D + I2_D Having I_D allows A to check spent status of course, but more importantly allows A to actually build a transaction prefix (and thus transaction). A builds the transaction until most of the way through MLSAG_Gen, adding the 2 pubkeys (per input) provided with I2_D to his own generated ones where they are needed (secret row L, R). At this point, A has a mostly completed transaction (but with an invalid/incomplete signature). A sends over the tx and includes r, which allows B (with the recipient's address) to verify the destination and amount (by reconstructing the stealth address and decoding ecdhInfo). B then finishes the signature by computing ss[secret_index][0] = ss[secret_index][0] + k - cc[secret_index]*c (secret indices need to be passed as well). B can then broadcast the tx, or send it back to A for broadcasting. Once B has completed the signing (and verified the tx to be valid), he can add the full I_D to his cache, allowing him to verify spent status as well. NOTE: A and B *must* present key A and B to each other with a valid signature proving they know a and b respectively. Otherwise, trickery like the following becomes possible: A creates viewkey a,A, spendkey b,B, and sends a,A,B to B. B creates a fake key C = zG - B. B sends C back to A. The combined spendkey C+B then equals zG, allowing B to spend funds at any time! The signature fixes this, because B does not know a c corresponding to C (and thus can't produce a signature). 2 of 3 User A (coordinator) Shared viewkey a,A "spendkey" j,J User B "spendkey" k,K User C "spendkey" m,M A collects K and M from B and C B collects J and M from A and C C collects J and K from A and B A computes N = nG, n = Hs(jK) A computes O = oG, o = Hs(jM) B anc C compute P = pG, p = Hs(kM) || Hs(mK) B and C can also compute N and O respectively if they wish to be able to coordinate Address: N+O+P, A The rest follows as above. The coordinator possesses 2 of 3 needed keys; he can get the other needed part of the signature/key images from either of the other two. Alternatively, if secure communication exists between parties: A gives j to B B gives k to C C gives m to A Address: J+K+M, A 3 of 3 Identical to 2 of 2, except the coordinator must collect the key images from both of the others. The transaction must also be passed an additional hop: A -> B -> C (or A -> C -> B), who can then broadcast it or send it back to A. N-1 of N Generally the same as 2 of 3, except participants need to be arranged in a ring to pass their keys around (using either the secure or insecure method). For example (ignoring viewkey so letters line up): [4 of 5] User: spendkey A: a B: b C: c D: d E: e a -> B, b -> C, c -> D, d -> E, e -> A Order of signing does not matter, it just must reach n-1 users. A "remaining keys" list must be passed around with the transaction so the signers know if they should use 1 or both keys. Collecting key image parts becomes a little messy, but basically every wallet sends over both of their parts with a tag for each. Thia way the coordinating wallet can keep track of which images have been added and which wallet they come from. Reasoning: 1. The key images must be added only once (coordinator will get key images for key a from both A and B, he must add only one to get the proper key actual key image) 2. The coordinator must keep track of which helper pubkeys came from which wallet (discussed in 2 of 2 section). The coordinator must choose only one set to use, then include his choice in the "remaining keys" list so the other wallets know which of their keys to use. You can generalize it further to N-2 of N or even M of N, but I'm not sure there's legitimate demand to justify the complexity. It might also be straightforward enough to support with minimal changes from N-1 format. You basically just give each user additional keys for each additional "-1" you desire. N-2 would be 3 keys per user, N-3 4 keys, etc. The process is somewhat cumbersome: To create a N/N multisig wallet: - each participant creates a normal wallet - each participant runs "prepare_multisig", and sends the resulting string to every other participant - each participant runs "make_multisig N A B C D...", with N being the threshold and A B C D... being the strings received from other participants (the threshold must currently equal N) As txes are received, participants' wallets will need to synchronize so that those new outputs may be spent: - each participant runs "export_multisig FILENAME", and sends the FILENAME file to every other participant - each participant runs "import_multisig A B C D...", with A B C D... being the filenames received from other participants Then, a transaction may be initiated: - one of the participants runs "transfer ADDRESS AMOUNT" - this partly signed transaction will be written to the "multisig_monero_tx" file - the initiator sends this file to another participant - that other participant runs "sign_multisig multisig_monero_tx" - the resulting transaction is written to the "multisig_monero_tx" file again - if the threshold was not reached, the file must be sent to another participant, until enough have signed - the last participant to sign runs "submit_multisig multisig_monero_tx" to relay the transaction to the Monero network
* | | wallet: add multisig key generationmoneromooo-monero2017-12-171-4/+159
| | | | | | | | | | | | Scheme by luigi1111
* | | Merge pull request #2857Riccardo Spagni2017-12-171-5/+5
|\ \ \ | | | | | | | | | | | | 7193b89f Scrub keys from memory just before scope end. (moneromooo-monero)
| * | | Scrub keys from memory just before scope end.moneromooo-monero2017-12-161-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Partially implements #74. Securely erases keys from memory after they are no longer needed. Might have a performance impact, which I haven't measured (perf measurements aren't generally reliable on laptops). Thanks to @stoffu for the suggestion to specialize the pod_to_hex/hex_to_pod functions. Using overloads + SFINAE instead generalizes it so other types can be marked as scrubbed without adding more boilerplate.
* | | | move includes around to lessen overall loadmoneromooo-monero2017-12-161-2/+5
|/ / /
* | | Merge pull request #2885Riccardo Spagni2017-12-161-1/+6
|\ \ \ | | | | | | | | | | | | a1e3670b catch wallet decrypt false positive (Riccardo Spagni)
| * | | catch wallet decrypt false positiveRiccardo Spagni2017-12-041-1/+6
| |/ /
* | | Merge pull request #2860Riccardo Spagni2017-12-161-16/+16
|\ \ \ | |_|/ |/| | | | | | | | | | | | | | 3dffe71b new wipeable_string class to replace std::string passphrases (moneromooo-monero) 7a2a5741 utils: initialize easylogging++ in on_startup (moneromooo-monero) 54950829 use memwipe in a few relevant places (moneromooo-monero) 000666ff add a memwipe function (moneromooo-monero)
| * | new wipeable_string class to replace std::string passphrasesmoneromooo-monero2017-11-271-16/+16
| | |
* | | add bulletproofs from v7 on testnetmoneromooo-monero2017-12-081-7/+10
| | |
* | | integrate bulletproofs into moneromoneromooo-monero2017-12-081-12/+25
| |/ |/|
* | Merge pull request #2833Riccardo Spagni2017-12-021-20/+33
|\ \ | | | | | | | | | b0426d4c Fixes #759 Add sanity check on restore height (Cifrado)
| * | Fixes #759 Add sanity check on restore heightCifrado2017-11-171-20/+33
| | |
* | | Merge pull request #2850Riccardo Spagni2017-12-021-1/+1
|\ \ \ | | | | | | | | | | | | d875a9ff wallet2: detect multiple outputs from a tx to different subaddresses (moneromooo-monero)
| * | | wallet2: detect multiple outputs from a tx to different subaddressesmoneromooo-monero2017-11-211-1/+1
| |/ /
* | | Merge pull request #2828Riccardo Spagni2017-12-021-2/+11
|\ \ \ | |_|/ |/| | | | | 6cbe7bcd wallet2: check generate_key_derivation return value (moneromooo-monero)
| * | wallet2: check generate_key_derivation return valuemoneromooo-monero2017-11-161-2/+11
| |/
* | Merge pull request #2824Riccardo Spagni2017-11-251-1/+0
|\ \ | | | | | | | | | 51895fd7 split wallet and wallet_api (moneromooo-monero)
| * | split wallet and wallet_apimoneromooo-monero2017-11-161-1/+0
| |/ | | | | | | | | This speeds up building a lot when wallet2.h (or something it includes) changes, since all the API includes wallet2.h
* | Merge pull request #2823Riccardo Spagni2017-11-251-6/+4
|\ \ | | | | | | | | | 0d149f70 Add out-of-bound exceptions and handle them in RPC (Michał Sałaban)
| * | Add out-of-bound exceptions and handle them in RPCMichał Sałaban2017-11-151-6/+4
| |/
* | Merge pull request #2806Riccardo Spagni2017-11-251-1/+3
|\ \ | | | | | | | | | da706b61 Fix false GCC warning '‘*((void*)& subaddr_account +4)’ may be used unitialized' (binaryFate)
| * | Fix false GCC warning '‘*((void*)& subaddr_account +4)’ may be used ↵binaryFate2017-11-141-1/+3
| | | | | | | | | | | | unitialized'
* | | Merge pull request #2800Riccardo Spagni2017-11-251-102/+94
|\ \ \ | | | | | | | | | | | | | | | | 0b726be7 wallet2: minimize the number of construct_tx calls (moneromooo-monero) 9d505d26 wallet2: cleanup some debug logs (moneromooo-monero)
| * | | wallet2: minimize the number of construct_tx callsmoneromooo-monero2017-11-151-95/+90
| | | |
| * | | wallet2: cleanup some debug logsmoneromooo-monero2017-11-151-7/+4
| | |/ | |/|
* | | Merge pull request #2797Riccardo Spagni2017-11-251-10/+14
|\ \ \ | | | | | | | | | | | | 7e387fb1 wallet2: only add a dummy 0 output if there's one output otherwise (moneromooo-monero)
| * | | wallet2: only add a dummy 0 output if there's one output otherwisemoneromooo-monero2017-11-131-10/+14
| | |/ | |/|
* | | Merge pull request #2368Riccardo Spagni2017-11-251-0/+230
|\ \ \ | | | | | | | | | | | | b0b7e0f0 Spend proof without txkey (stoffu)
| * | | Spend proof without txkeystoffu2017-11-211-0/+230
| | | |
* | | | fix for tx proof: use exception instead of error_str when signature gen failedstoffu2017-11-211-12/+3
|/ / /
* | | Merge pull request #2768Riccardo Spagni2017-11-201-0/+2
|\ \ \ | | | | | | | | | | | | ef941855 Wallet RPC: Add prompt-for-password flag (Tim L)
| * | | Wallet RPC: Add prompt-for-password flagTim L2017-11-151-0/+2
| | |/ | |/|
* / | Tx proof (revised):stoffu2017-11-181-0/+349
|/ / | | | | | | | | | | | | | | | | - refactoring: proof generation/checking code was moved from simplewallet.cpp to wallet2.cpp - allow an arbitrary message to be signed together with txid - introduce two types (outbound & inbound) of tx proofs; with the same syntax, inbound is selected when <address> belongs to this wallet, outbound otherwise. see GitHub thread for more discussion - wallet RPC: added get_tx_key, check_tx_key, get_tx_proof, check_tx_proof - wallet API: moved WalletManagerImpl::checkPayment to Wallet::checkTxKey, added Wallet::getTxProof/checkTxProof - get_tx_key/check_tx_key: handle additional tx keys by concatenating them into a single string
* | Merge pull request #2773Riccardo Spagni2017-11-151-13/+12
|\ \ | | | | | | | | | ffe5b857 Correct totals computation (Michał Sałaban)
| * | Correct totals computationMichał Sałaban2017-11-081-13/+12
| |/
* | Merge pull request #2772Riccardo Spagni2017-11-151-1/+1
|\ \ | | | | | | | | | 5d92c7cc wallet2: typo fix in error message (moneromooo-monero)
| * | wallet2: typo fix in error messagemoneromooo-monero2017-11-071-1/+1
| | |
* | | Merge pull request #2634Riccardo Spagni2017-11-151-0/+21
|\ \ \ | | | | | | | | | | | | b738f4b5 wallet: add sweep_single command (stoffu)
| * | | wallet: add sweep_single commandstoffu2017-11-151-0/+21
| | | |
* | | | Merge pull request #2628Riccardo Spagni2017-11-151-42/+19
|\ \ \ \ | |/ / / |/| | | | | | | 7cb303a4 wallet2: simplify incoming tx processing code (moneromooo-monero)
| * | | wallet2: simplify incoming tx processing codemoneromooo-monero2017-11-141-42/+19
| | | |
* | | | More missed readline dependencies thru scoped_message_writerHoward Chu2017-11-141-3/+1
| | | |
* | | | Fix 437421ce42f1deaa7ec3f28c0c17aff519f1230dHoward Chu2017-11-141-1/+1
| | | | | | | | | | | | | | | | Missing an error argument for an exception
* | | | Merge pull request #2739Riccardo Spagni2017-11-141-10/+17
|\ \ \ \ | | | | | | | | | | | | | | | 99f398a2 wallet2: avoid growing the short history when refreshing in a loop (moneromooo-monero)
| * | | | wallet2: avoid growing the short history when refreshing in a loopmoneromooo-monero2017-11-141-10/+17
| | | | |
* | | | | Merge pull request #2736Riccardo Spagni2017-11-141-103/+52
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 0d9c0db9 Do not build against epee_readline if it was not built (Howard Chu) 178014c9 split off readline code into epee_readline (moneromooo-monero) a9e14a19 link against readline only for monerod and wallet-wallet-{rpc,cli} (moneromooo-monero) 437421ce wallet: move some scoped_message_writer calls from the libs (moneromooo-monero) e89994e9 wallet: rejig to avoid prompting in wallet2 (moneromooo-monero) ec5135e5 move input_line from command_line to simplewallet (moneromooo-monero) 082db75f move cryptonote command line options to cryptonote_core (moneromooo-monero)
| * | | | | wallet: move some scoped_message_writer calls from the libsmoneromooo-monero2017-11-141-75/+34
| | | | | |
| * | | | | wallet: rejig to avoid prompting in wallet2moneromooo-monero2017-11-141-28/+18
| |/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | wallet2 is a library, and should not prompt for stdin. Instead, pass a function so simplewallet can prompt on stdin, and a GUI might display a window, etc.