Commit graph

234 commits

Author SHA1 Message Date
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
Riccardo Spagni
539f511eb1
Merge pull request #2368
b0b7e0f0 Spend proof without txkey (stoffu)
2017-11-25 19:48:56 +02:00
stoffu
b0b7e0f09a
Spend proof without txkey 2017-11-21 16:49:16 +09:00
stoffu
be1c01298a
fix for tx proof: use exception instead of error_str when signature gen failed 2017-11-21 16:48:22 +09: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
Riccardo Spagni
cdab85db41
Merge pull request #2701
867b67c4 Wallet API: override update subdir when built from src (Jaquee)
2017-11-14 15:15:25 +02:00
moneromooo-monero
ccf53a566c
track double spending in the txpool
Transactions in the txpool are marked when another transaction
is seen double spending one or more of its inputs.
This is then exposed wherever appropriate.

Note that being marked with this "double spend seen" flag does
NOT mean this transaction IS a double spend and will never be
mined: it just means that the network has seen at least another
transaction spending at least one of the same inputs, so care
should be taken to wait for a few confirmations before acting
upon that transaction (ie, mostly of use for merchants wanting
to accept unconfirmed transactions).
2017-11-06 00:05:44 +00:00
Riccardo Spagni
32b083d8bd
Merge pull request #2546
b2d416f2 Distinguish "not enough money" and "not enough unlocked money" (binaryFate)
2017-11-06 01:53:43 +02:00
Jaquee
867b67c4fd Wallet API: override update subdir when built from src 2017-10-29 15:17:31 +01:00
Jaquee
086b7db2c7 Wallet API: default values for account and subaddr index 2017-10-22 18:15:23 +02:00
binaryFate
b2d416f211 Distinguish "not enough money" and "not enough unlocked money"
Fix #1530
2017-10-16 15:14:09 +02:00
Jaquee
97c2e449ce wallet2+API: use separate callbacks for lightwallets 2017-10-15 17:58:28 +02:00
Jaquee
d92618675b walletAPI: correct confirmations in txHistory for unsynced wallets 2017-10-15 17:58:28 +02:00
Jaquee
9442b04302 walletAPI: lightwallet exceptions 2017-10-15 17:57:45 +02:00
Jaquee
fc9229342d walletAPI: add lightwallet login() and importWalletRequest() 2017-10-15 17:57:43 +02:00
Jaquee
79207743b8 walletAPI: init() lightwallet and SSL support 2017-10-15 17:56:35 +02:00
Jaquee
dde5a1fc36 walletAPI: add tx unlock_time 2017-10-15 17:54:17 +02:00
kenshi84
53ad5a0f42
Subaddresses 2017-10-07 13:06:21 +09:00
moneromooo-monero
5d65a75b69
move checkpoints in a separate library 2017-09-25 21:16:26 +01:00
moneromooo-monero
44434c8a37
wallet2_api: check whether dynamic_cast returns NULL
CID 161844
2017-09-25 15:48:27 +01:00
moneromooo-monero
5475692ed5
wallet2_api: remove an unused, uninitialized, field
Silences CID 161874
2017-09-25 15:48:21 +01:00
moneromooo-monero
b2763ace06
wallet2_api: init error code to "no error" in the ctor
CID 161872
2017-09-25 15:48:16 +01:00
m2049r
6ee1116d75 store is optional during close and defaults to true; except during descruction 2017-09-23 00:52:09 +02:00
Jaquee
d58700e003 WalletAPI: only allow trusted daemon when importing key images 2017-08-21 08:11:12 +02:00
Jaquee
8a9bbd26d3 WalletAPI: copy wallet data when creating a view only wallet 2017-08-21 08:11:12 +02:00
Riccardo Spagni
b6fc7f283f
Merge pull request #2270
1307e3cc WalletAPI: add getDefaultDataDir() (Jaquee)
2017-08-15 20:51:11 +02:00
Riccardo Spagni
4c24eb050b
Merge pull request #2238
ad4649ac Enable verifying wallet password with having to load wallet. (m2049r)
2017-08-15 20:46:09 +02:00
Jaquee
1307e3cc12 WalletAPI: add getDefaultDataDir() 2017-08-09 12:38:29 +02:00
Riccardo Spagni
bfd2532ea5
Merge pull request #2247
a839a6fa Wallet API: add tx unlock time (Jaquee)
2017-08-07 23:34:06 +02:00
moneromooo-monero
61770ec2da
change mixin to ring size in user visible places 2017-08-07 21:12:27 +01:00
Riccardo Spagni
3db039828e
Merge pull request #2254
e31aac80 walletAPI: add getRefreshFromBlockHeight() (Jaquee)
48c0cb1b wallet api: pause refresh while commiting tx (Jaquee)
f233c01c CMakeLists.txt - ios/xcode fix (Jaquee)
2017-08-07 16:01:40 +02:00
Jaquee
e31aac80e5 walletAPI: add getRefreshFromBlockHeight() 2017-08-05 19:23:55 +02:00
Jaquee
48c0cb1ba6 wallet api: pause refresh while commiting tx 2017-08-05 19:21:23 +02:00
Jaquee
a839a6fa8a Wallet API: add tx unlock time 2017-08-03 21:37:45 +02:00
m2049r
ad4649ac81 Enable verifying wallet password with having to load wallet. 2017-08-03 01:45:45 +02:00
m2049r
600353e2b2 fix wallet callback signatures 2017-08-02 01:23:53 +02:00
moneromooo-monero
4e13ab306a
wallet_api: fix missing transaction parameter in callback
It was unused, so harmless

Reported by erikd on IRC
2017-06-13 19:34:51 +01:00
Jaquee
740bc24c95 Wallet API: Set seed lang when recovering form keys 2017-05-23 14:01:23 +02:00
Riccardo Spagni
81b370d5a1
Merge pull request #2012
bbf4c210 Wallet API: add spend/view key getters (Jaquee)
2017-05-05 11:35:03 +02:00
Jaquee
bbf4c21048 Wallet API: add spend/view key getters 2017-05-02 16:48:38 +02:00
moneromooo-monero
6df83b3efb
wallet: add sweep_below function
It sweeps all outputs below the given threshold

This is available via the existing sweep_all RPC, by setting
amount_threshold the desired amount (in atomic units)
2017-04-24 19:50:37 +01:00
Jaquee
0a7885bf19
Wallet API: fix Cold signing split tx 2017-04-02 14:19:21 +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
moneromooo-monero
d023831327
use const references in catch blocks 2017-03-18 12:56:07 +00:00
Jaquee
9ae33b51fb
wallet api: fix parameters in wallet2callbackImpl 2017-03-03 15:49:12 +01:00
Riccardo Spagni
e24cd86c18
Merge pull request #1827
db1c7d80 wallet api: add missing mining options (Jaquee)
2017-03-03 14:31:28 +02:00
Jaquee
db1c7d80b1
wallet api: add missing mining options 2017-03-02 14:09:04 +01:00