Commit Graph

66 Commits

Author SHA1 Message Date
thotbot 3234b5fe62
Misc. wallet API and wallet2 changes 2024-03-09 16:01:30 +03:00
mj-xmr da9aa1f7f8
Copyright: Update to 2022 2022-03-04 06:59:20 +01:00
tobtoht 47e7a43270
wallet_api: enable set_strict_default_file_permissions 2021-10-22 05:40:23 +02:00
selsta 8e0b8ddb96
wallet/api: remove Bitmonero namespace alias 2021-06-08 23:29:41 +02:00
xiphon 76c16822d0 wallet2_api: implement runtime proxy configuration 2020-07-20 13:45:12 +00:00
SomaticFanatic 5ef0607da6 Update copyright year to 2020
Update copyright year to 2020
2020-05-06 22:36:54 -04:00
luigi1111 cc91c0221d
Merge pull request #6415
09abca7 wallet_api: checkUpdate - optional version and buildtag params (xiphon)
2020-04-21 08:52:57 -05:00
xiphon 09abca76ae wallet_api: checkUpdate - optional version and buildtag params 2020-04-02 00:31:43 +00: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
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
selsta 13785ec96b
wallet api/device: set estimated restore height if none is provided 2019-01-02 11:25:49 +01:00
m2049r bce474be7d
query backing device 2018-09-19 18:25:38 +02:00
stoffu a64f57fe42
wallet2: make --restricted-rpc available for wallet RPC only 2018-08-16 09:54:23 +09:00
stoffu bcab579864
wallet: allow adjusting number of rounds for the key derivation function 2018-08-08 01:56:54 +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 27a196b126
device: untangle cyclic depenency
When #3303 was merged, a cyclic dependency chain was generated:

    libdevice <- libcncrypto <- libringct <- libdevice

This was because libdevice needs access to a set of basic crypto operations
implemented in libringct such as scalarmultBase(), while libringct also needs
access to abstracted crypto operations implemented in libdevice such as
ecdhEncode(). To untangle this cyclic dependency chain, this patch splits libringct
into libringct_basic and libringct, where the basic crypto ops previously in
libringct are moved into libringct_basic. The cyclic dependency is now resolved
thanks to this separation:

    libcncrypto <- libringct_basic <- libdevice <- libcryptonote_basic <- libringct

This eliminates the need for crypto_device.cpp and rctOps_device.cpp.

Also, many abstracted interfaces of hw::device such as encrypt_payment_id() and
get_subaddress_secret_key() were previously implemented in libcryptonote_basic
(cryptonote_format_utils.cpp) and were then called from hw::core::device_default,
which is odd because libdevice is supposed to be independent of libcryptonote_basic.
Therefore, those functions were moved to device_default.cpp.
2018-03-14 21:00:15 +09:00
Riccardo Spagni 60c8544e77
Merge pull request #3347
9a6be3da wallet_manager: fixed typo deviuce/device.hpp (stoffu)
2018-03-08 18:42:24 +02:00
stoffu 0e7ad2e2c9
Wallet API: generalize 'bool testnet' to 'NetworkType nettype' 2018-03-05 23:59:16 +09:00
stoffu 9a6be3da25
wallet_manager: fixed typo deviuce/device.hpp 2018-03-05 11:57:30 +09:00
cslashm e745c1e38d Code modifications to integrate Ledger HW device into monero-wallet-cli.
The basic approach it to delegate all sensitive data (master key, secret
ephemeral key, key derivation, ....) and related operations to the device.
As device has low memory, it does not keep itself the values
(except for view/spend keys) but once computed there are encrypted (with AES
are equivalent) and return back to monero-wallet-cli. When they need to be
manipulated by the device, they are decrypted on receive.

Moreover, using the client for storing the value in encrypted form limits
the modification in the client code. Those values are transfered from one
C-structure to another one as previously.

The code modification has been done with the wishes to be open to any
other hardware wallet. To achieve that a C++ class hw::Device has been
introduced. Two initial implementations are provided: the "default", which
remaps all calls to initial Monero code, and  the "Ledger", which delegates
all calls to Ledger device.
2018-03-04 12:54:53 +01: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
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
Jaquee 867b67c4fd Wallet API: override update subdir when built from src 2017-10-29 15:17:31 +01:00
kenshi84 53ad5a0f42
Subaddresses 2017-10-07 13:06:21 +09:00
moneromooo-monero 44434c8a37
wallet2_api: check whether dynamic_cast returns NULL
CID 161844
2017-09-25 15:48:27 +01: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
moneromooo-monero 995969b190
wallet: fix set_log not handling 0,xxx style settings 2017-03-21 11:17:05 +00:00
Jaquee db1c7d80b1
wallet api: add missing mining options 2017-03-02 14:09:04 +01:00
moneromooo-monero 14d0e00235
wallet2_api: add updates check api 2017-02-22 13:03:45 +00:00
Riccardo Spagni c3599fa7b9
update copyright year, fix occasional lack of newline at line end 2017-02-21 19:38:18 +02:00
Riccardo Spagni 50fadea8fa
Merge pull request #1747
26bd7aac wallet_api: fix logging init via api (moneromooo-monero)
2017-02-21 11:28:58 +02:00
moneromooo-monero 26bd7aac03
wallet_api: fix logging init via api 2017-02-18 20:44:23 +00:00
moneromooo-monero 83ec209f42
simplewallet: validate hex input size 2017-02-14 19:45:46 +00:00
Lee Clagett ce7fcbb4ae Add server auth to monerod, and client auth to wallet-cli and wallet-rpc 2017-02-06 01:15:41 -05:00
Riccardo Spagni 5fb3f97a55
Merge pull request #1629
c02e1cb9 Updates to epee HTTP client code   - http_simple_client now uses std::chrono for timeouts   - http_simple_client accepts timeouts per connect / invoke call   - shortened names of epee http invoke functions   - invoke command functions only take relative path, connection     is not automatically performed (Lee Clagett)
2017-02-02 19:32:01 +02:00
Jaquee 774a21394a
Wallet API: Create wallet from keys 2017-01-30 23:28:09 +01:00
Lee Clagett c02e1cb943 Updates to epee HTTP client code
- http_simple_client now uses std::chrono for timeouts
  - http_simple_client accepts timeouts per connect / invoke call
  - shortened names of epee http invoke functions
  - invoke command functions only take relative path, connection
    is not automatically performed
2017-01-25 15:39:32 -05:00
moneromooo-monero 87c658f83b
wallet2_api: add API to set log categories 2017-01-16 21:14:44 +00:00
moneromooo-monero 5833d66f65
Change logging to easylogging++
This replaces the epee and data_loggers logging systems with
a single one, and also adds filename:line and explicit severity
levels. Categories may be defined, and logging severity set
by category (or set of categories). epee style 0-4 log level
maps to a sensible severity configuration. Log files now also
rotate when reaching 100 MB.

To select which logs to output, use the MONERO_LOGS environment
variable, with a comma separated list of categories (globs are
supported), with their requested severity level after a colon.
If a log matches more than one such setting, the last one in
the configuration string applies. A few examples:

This one is (mostly) silent, only outputting fatal errors:

MONERO_LOGS=*:FATAL

This one is very verbose:

MONERO_LOGS=*:TRACE

This one is totally silent (logwise):

MONERO_LOGS=""

This one outputs all errors and warnings, except for the
"verify" category, which prints just fatal errors (the verify
category is used for logs about incoming transactions and
blocks, and it is expected that some/many will fail to verify,
hence we don't want the spam):

MONERO_LOGS=*:WARNING,verify:FATAL

Log levels are, in decreasing order of priority:
FATAL, ERROR, WARNING, INFO, DEBUG, TRACE

Subcategories may be added using prefixes and globs. This
example will output net.p2p logs at the TRACE level, but all
other net* logs only at INFO:

MONERO_LOGS=*:ERROR,net*:INFO,net.p2p:TRACE

Logs which are intended for the user (which Monero was using
a lot through epee, but really isn't a nice way to go things)
should use the "global" category. There are a few helper macros
for using this category, eg: MGINFO("this shows up by default")
or MGINFO_RED("this is red"), to try to keep a similar look
and feel for now.

Existing epee log macros still exist, and map to the new log
levels, but since they're used as a "user facing" UI element
as much as a logging system, they often don't map well to log
severities (ie, a log level 0 log may be an error, or may be
something we want the user to see, such as an important info).
In those cases, I tried to use the new macros. In other cases,
I left the existing macros in. When modifying logs, it is
probably best to switch to the new macros with explicit levels.

The --log-level options and set_log commands now also accept
category settings, in addition to the epee style log levels.
2017-01-16 00:25:46 +00:00
moneromooo-monero a813ab50fe
wallet2_api: add solo mining API 2017-01-09 10:12:55 +00:00
Riccardo Spagni 1736b7ef6b
Merge pull request #1500
c0a0fcaf wallet2_api: some new APIs to access daemon state (moneromooo-monero)
2017-01-08 16:36:46 -08:00
moneromooo-monero c0a0fcaff0
wallet2_api: some new APIs to access daemon state 2016-12-25 12:31:50 +00:00