Commit graph

46 commits

Author SHA1 Message Date
Jason Rhinelander 5e95cef882
Remove openssl, unbound, expat, OpenAlias
openssl is a miserable dependency to fight with, especially for
iOS/Android, and we use it for very little:

- it gets (mis)used to write base64 data to a file in wallet2 for things
  like multisig data.  However this mode is *not* enabled by default,
  basically completely unknown, completely unused, only exists in the
  cli wallet, and is just dumb.  (Honestly the justification given in
  the PR is that "Windows users might want it", presupposing that there
  exists Windows users who are capable of generating a multisig wallet
  in a CLI-only application and yet are incapable of dealing with binary
  files).

- it's a dependency of unbound (in order to do dnssec, I believe).
  Unbound itself is fairly useless for Oxen, so I've removed it too:
    - it does OpenAlias lookups, which are a Monero thing that has never
      been used outside Monero, doesn't work reliably (because it fails
      if the result isn't DNSSEC validated) and is pointless when we
      have ONS.

    - it does DNS resolution on seed nodes, but we have never set seed
      nodes by name and just use seed node IPs instead (which seems a
      bit better anyway since the DNS lookup leaks some metadata).

- it *was* being used for sha256, but an earlier commit in this PR
  already replaced that with libsodium (entirely coincidentally).

- for static deps, it enables HTTPS support for the wallet.  However
  only the CLI wallet actually supports this (the GUI and mobile wallets
  don't), and since oxend hasn't support this for a while I have strong
  doubts it is being used anywhere.  (Plus wallet3 will do everything
  encrypted using zmq/libsodium, so doesn't need this to be secure).
  Note here that it is *only* removed by this commit for static builds:
  if doing a system build that links to libcurl supporting HTTPS then
  HTTPS support will still work.

Libexpat is also gone because it was only there for libunbound.
2022-04-15 13:51:57 -03:00
Jason Rhinelander 265dca70ed Remove mining-related functions from wallet api 2021-01-08 18:16:06 -04:00
Jason Rhinelander 37159b2ba0 Export symbols and strip debug symbols from android static lib
This massively reduces the size.
2021-01-08 18:15:25 -04:00
Jason Rhinelander 60d4a3e242 wallet_api: unexpose fs:: in api; remove more deprecations; clean dirt
Using fs:: in wallet2_api is no good as it means dependent code would
have to use it, so instead convert all public paths to be taken as
utf8 string_view's and use fs::u8path(...) in the implementation to
convert them to the fs::path objects we need.

Remove some more deprecated functions (related to being able to import a
password-less wallet).

Modernize error code/string handling to use a pair rather than two
separate parameters methods, and remove the deprecated associated
interfaces.
2020-11-04 12:11:20 -04:00
Jason Rhinelander 63de78d1d0 Rename wallet api namespace Monero:: -> Wallet:: 2020-10-24 12:46:26 -03:00
Jason Rhinelander 1dd98f3dae std::filesystem
Converts all use of boost::filesystem to std::filesystem.

For macos and potentially other exotic systems where std::filesystem
isn't available, we use ghc::filesystem instead (which is a drop-in
replacement for std::filesystem, unlike boost::filesystem).

This also greatly changes how we handle filenames internally by holding
them in filesystem::path objects as soon as possible (using
fs::u8path()), rather than strings, which avoids a ton of issues around
unicode filenames.  As a result this lets us drop the boost::locale
dependency on Windows along with a bunch of messy Windows ifdef code,
and avoids the need for doing gross boost locale codecvt calls.
2020-10-24 12:45:37 -03:00
Jason Rhinelander 2083c58d35 wallet_api updates
- updates to use rpc::http_client instead of epee
- simplifies a bunch of json_rpc calls
- removes update checking
- fixes various other random compilation issues
2020-08-07 17:14:03 -03:00
Doyle abb8dfc48e Merge commit 'c4f75fe' into MergeUpstream3 2020-05-28 15:29:00 +10:00
Jason Rhinelander 5fd8939c6a Remove background mining
This was a useless feature to begin with.  According to a Monero
insider, this was introduced at the time with an intention of making it
on-by-default on every monerod instance everywhere, but because that was
such an overwhelmingly stupid idea, it never happened yet all this code
(which is probably used by no one anywhere ever) remains in the code
base.

Even if the idea wasn't dumb to start with, this will also become even
more pointless with pulse, so just drop it (it is over 1000 lines of
code, not even counting the extra headers pulled in to do things like
querying CPU usage and battery status).
2020-05-11 18:44:45 -03:00
Doyle e430b012e0 Merge commit '8600b3c69d1c5cb08b0e4e5c1270fbe95b6df81c' into MergeUpstream 2020-04-09 15:49:01 +10:00
xiphon cc18926eba wallet2_api: wallet recovery - seed offset passphrase support 2020-02-11 23:36:50 +00:00
xiphon 577324a954 wallet_manager: omit redundant disconnect, drop unused variable 2019-05-27 14:40:29 +00:00
Doyle 8f1e65522e Merge commit '98f4c8a' into LokiMergeUpstream 2019-05-01 17:04:00 +10:00
Doyle 892469ded1 Update monero copyright to 2019 pre-emptively to make merge simpler 2019-04-12 14:36:43 +10:00
Dusan Klinec 827f52add0
wallet: API changes to enable passphrase entry 2019-04-05 22:17:50 +02:00
binaryFate 1f2930ce0b Update 2019 copyright 2019-03-05 22:05:34 +01:00
Maxim Shishmarev fdaa45a53a Add API for staking from GUI wallet (#315)
* Enable staking in GUI wallet

* Move more helper functions into service_node_rules.h

* Move validation of arguments for staking into wallet2

* call stake validation from within create_stake_tx
2018-11-15 13:22:14 +11:00
moneromooo-monero 6e270fbd29
wallet2_api: fix for latest code changes 2018-09-22 23:00:34 +00:00
m2049r bce474be7d
query backing device 2018-09-19 18:25:38 +02:00
stoffu bcab579864
wallet: allow adjusting number of rounds for the key derivation function 2018-08-08 01:56:54 +09:00
stoffu 4510f417f9
Wallet API: add some missing override keyword
Also remove dust() from UnsignedTransactionImpl (already in PendingTransactionImpl)
2018-06-28 09:59:09 +09:00
stoffu 46e90b7780
Wallet API: add support for wallet creation from hardware device 2018-06-21 12:36:27 +09:00
stoffu f82c10dc96
WalletManagerImpl: reuse existing connection to daemon instead of reconnectivng every time 2018-04-07 14:06:29 +09:00
stoffu 0e7ad2e2c9
Wallet API: generalize 'bool testnet' to 'NetworkType nettype' 2018-03-05 23:59:16 +09:00
Riccardo Spagni 087a773247
Merge pull request #3104
939629e8 Wallet API: all recover options with password (m2049r)
2018-01-27 17:24:08 -08:00
xmr-eric 18216f19dd Update 2018 copyright 2018-01-26 10:03:20 -05:00
m2049r 939629e837 Wallet API: all recover options with password
also renamed memo => mnemonic in api method parms
2018-01-17 18:46:31 +01:00
moneromooo-monero 4c313324b1
Add N/N multisig tx generation and signing
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
2017-12-17 16:11:57 +00:00
Riccardo Spagni 2e54e7ff0b
Merge pull request #2824
51895fd7 split wallet and wallet_api (moneromooo-monero)
2017-11-25 19:53:35 +02:00
stoffu 998777ecd7
Tx proof (revised):
- 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
2017-11-18 20:44:27 +09:00
moneromooo-monero 51895fd7df
split wallet and wallet_api
This speeds up building a lot when wallet2.h (or something it
includes) changes, since all the API includes wallet2.h
2017-11-16 12:10:29 +00:00
m2049r 6ee1116d75 store is optional during close and defaults to true; except during descruction 2017-09-23 00:52:09 +02:00
m2049r ad4649ac81 Enable verifying wallet password with having to load wallet. 2017-08-03 01:45:45 +02:00
Jaquee a8646b0957
Wallet API: add hard fork info functions 2017-03-24 09:59:26 +01:00
Jaquee db1c7d80b1
wallet api: add missing mining options 2017-03-02 14:09:04 +01:00
Riccardo Spagni c3599fa7b9
update copyright year, fix occasional lack of newline at line end 2017-02-21 19:38:18 +02:00
Jaquee 774a21394a
Wallet API: Create wallet from keys 2017-01-30 23:28:09 +01:00
moneromooo-monero a813ab50fe
wallet2_api: add solo mining API 2017-01-09 10:12:55 +00:00
moneromooo-monero c0a0fcaff0
wallet2_api: some new APIs to access daemon state 2016-12-25 12:31:50 +00:00
moneromooo-monero 9a2cd72257
wallet2_api: add an API to the OpenAlias resolver 2016-12-17 13:05:17 +00:00
Randi Joseph b2adfa8c51 Bitmonero namespace renamed Monero. Bitmonero namespace alias added so that third party uses of the wallet api can transition. 2016-12-13 10:21:38 -05:00
moneromooo-monero fcd178ef33
wallet_api: add a few daemon related getters
Blockchain height, version, Mining hash rate...
2016-11-29 10:54:38 +00:00
moneromooo.monero af8a2600aa
wallet_api: txkey checking functions for the GUI 2016-11-05 15:24:05 +00:00
Jacob Brydolf 36a89ab435
libwallet_api: Added option to restore from specific height 2016-10-08 00:57:09 +02:00
Ilya Kitaev 8390bfa770 Wallet API : WalletManager::findWallets() added 2016-06-23 16:01:41 +03:00
Ilya Kitaev 12345d382c api implementation splitted over separate files 2016-06-23 15:50:17 +03:00