Commit Graph

53 Commits

Author SHA1 Message Date
Eirik Ogilvie-Wigley
5e360fb29f Add sapling spending keys to z_exportwallet 2018-09-14 15:07:15 -06:00
Eirik Ogilvie-Wigley
d6b31d59b5 Rename map to include sprout 2018-09-14 15:07:15 -06:00
Jack Grigg
94549326c9 Bugfix: Use time instead of block height for Sapling key metadata 2018-09-11 12:45:25 +01:00
Jack Grigg
70b4ad2dcd wallet: Switch from SaplingSpendingKey to SaplingExtendedSpendingKey
The wallet now only stores Sapling extended spending keys, and thus can
only be used with keys generated from an HDSeed via ZIP 32.

Note that not all Sapling keys in the wallet will correspond to the
wallet's HDSeed, as a standalone Sapling xsk can be imported via
z_importkey. However, it must have been generated from a seed itself,
and thus is more likely to be backed up elsewhere.
2018-09-03 10:45:37 +01:00
Jack Grigg
a4ac4fc3f4 wallet: Store Sapling key metadata indexed by ivk
Closes #3426.
2018-09-03 10:45:37 +01:00
Jack Grigg
e22c115e78 Move GetSpendingKeyForPaymentAddress visitor into wallet.h
Also fixes it to not use the global pwalletMain.
2018-08-27 11:13:49 +01:00
Jack Grigg
25d5e80cbe Rename *SpendingKey -> *SproutSpendingKey
Also GetPaymentAddresses -> GetSproutPaymentAddresses
2018-08-03 10:10:26 +01:00
Jack Grigg
4c77517772 Rename *ViewingKey* -> *SproutViewingKey* 2018-08-03 02:23:38 +01:00
Jack Grigg
5175a7f07b Pass SaplingPaymentAddress to store through the CKeyStore 2018-08-03 01:01:45 +01:00
Jay Graber
501de644ab Refactor into visitors and throw errors for invalid key or address. 2018-07-29 18:42:41 -07:00
Jay Graber
dd4c8a3c70 Add Sapling support to z_importkey 2018-07-29 16:15:06 -07:00
Jay Graber
2afc8eb0ec Add Sapling support to z_exportkey 2018-07-29 16:15:06 -07:00
Daniel Cousens
4519a766b6 move rpc* to rpc/ 2018-07-18 11:07:16 -06:00
Jack Grigg
e5eab182b5 Use boost::variant to represent shielded addresses and keys
libzcash::PaymentAddress has been renamed to libzcash::SproutPaymentAddress,
and a new typedef boost::variant is now libzcash::PaymentAddress. Similarly
for ViewingKey and SpendingKey.

A new class InvalidEncoding is introduced as the default boost::variant
option for each address and key type; it is used during decoding instead
of boost::optional.

All address and key storage functions in the wallet have been modified to
refer specifically to the Sprout types, as they are used very precisely.
In most other cases, the more general type is leveraged as much as possible,
and we convert to the Sprout type when necessary. This will be subsequently
wrapped in, or replaced with, context-specific functions once Sapling
types are implemented.
2018-05-11 17:14:49 -04:00
Pieter Wuille
3d31e09cbb Split key_io (address/key encodings) off from base58 2018-05-08 21:39:56 +01:00
Jack Grigg
8bf3a3d700 Introduce wrappers around CZCViewingKey 2018-05-08 21:39:55 +01:00
Jack Grigg
472f75bc2d Introduce wrappers around CZCSpendingKey 2018-05-08 21:39:55 +01:00
Jack Grigg
80ed13d545 Introduce wrappers around CZCPaymentAddress
This patch removes the need for the intermediary Base58 type
CZCPaymentAddress, by providing {Encode,Decode}PaymentAddress
functions that directly operate on the conversion between strings
and libzcash::PaymentAddress.
2018-05-08 21:39:55 +01:00
Pieter Wuille
f146029b0a Replace CBitcoinSecret with {Encode,Decode}Secret 2018-05-08 21:39:54 +01:00
Homu
0c1adf8281 Auto merge of #3201 - Eirik0:3190-dumpprivkey-help-text, r=str4d
Clarify help text of dumpprivkey

Closes #3190
2018-05-08 06:02:17 -07:00
Jack Grigg
b6be3e88bb Use CBitcoinAddress wrappers in Zcash-specific code 2018-05-03 01:13:04 +01:00
Pieter Wuille
07444da1db Introduce wrappers around CBitcoinAddress
This patch removes the need for the intermediary Base58 type
CBitcoinAddress, by providing {Encode,Decode,IsValid}Destination
function that directly operate on the conversion between strings
and CTxDestination.
2018-05-03 01:12:57 +01:00
Eirik Ogilvie-Wigley
df960a9ba7 Clarify help text of dumpprivkey 2018-04-23 15:14:56 -06:00
Jack Grigg
28915c30ca Fix z_importviewingkey startHeight parameter
Closes #2937.
2018-04-03 02:43:52 +01:00
Maxwell Gubler
f70cd24521 Fix syntax examples for z_importwallet and export 2018-02-20 16:46:12 -05:00
Homu
1683c2d5bf Auto merge of #2143 - str4d:1997-viewing-keys, r=str4d
Implement incoming viewing keys

Closes #1997.
2017-12-20 14:11:05 -08:00
Jack Grigg
bec2235148 Cleanup: Add braces for clarity 2017-12-20 11:18:59 +00:00
Jack Grigg
e85b33a52e Add RPC methods for exporting/importing viewing keys 2017-12-20 00:46:37 +00:00
Simon
ba1dbb3040 RPC dumpwallet and z_exportwallet updated to no longer allow
overwriting an existing file.
2017-11-16 22:29:37 -08:00
Nathan Wilcox
de422c066b [tests pass] Ensure importprivkey outputs the address in case key is already imported. 2017-09-18 15:30:42 +09:00
Nathan Wilcox
d187317083 [tests pass] Output address on new key import. 2017-09-18 15:30:42 +09:00
Jack Grigg
33589401ba Require that z_importkey height parameter be in valid range 2017-03-24 16:07:53 +13:00
Jack Grigg
b7e5b7d5ee Simplify z_importkey by making rescan a string
Transparently handles older boolean values as well.
2017-03-23 15:57:11 +13:00
Jack Grigg
a31ba7a0cb Usability improvements for z_importkey
- Add height parameter to z_importkey to reduce rescan range
- Change semantics of rescan parameter, so users can explicitly force a rescan
  for existing keys.

Closes #2032
2017-03-16 19:34:41 +13:00
Jonas Schnelli
a10a6e2a0e [Univalue] add univalue over subtree
similar to secp256k1 include and compile univalue over a subtree
2017-02-10 02:18:51 +00:00
Jack Grigg
0d37ae3a59 Migrate Zcash-specific code to UniValue 2017-02-10 00:52:57 +00:00
Jonas Schnelli
d014114d67 Remove JSON Spirit wrapper, remove JSON Spirit leftovers
- implement find_value() function for UniValue
- replace all Array/Value/Object types with UniValues, remove JSON Spirit to UniValue wrapper
- remove JSON Spirit sources
2017-02-10 00:35:24 +00:00
Jonas Schnelli
851f58f94e remove JSON Spirit UniValue wrapper 2017-02-10 00:35:24 +00:00
Jonas Schnelli
9756b7bd29 extend conversion to UniValue 2017-02-10 00:35:24 +00:00
Jeff Garzik
ed21d5bd4b Convert tree to using univalue. Eliminate all json_spirit uses. 2017-02-10 00:35:24 +00:00
zkbot
0edb3c0f16 Auto merge of #1978 - str4d:1941-scan-whole-chain-on-zkey-import, r=ebfull
Scan the whole chain whenever a z-key is imported

Closes #1941.
2017-01-20 00:02:12 +00:00
Simon
9064d73bf8 Fixes #1497 ZCA-009 by restricting data exporting to user defined folder.
Previously the RPC interface allowed z_exportwallet, backupwallet and
dumpwallet to write data to an arbitrary filename.  ZCA-009 demonstrates
how this is vulnerable.  The resolution is to only allow data to
written when the -exportdir has been configured.  Also filenames are
restricted to alphanumeric characters.
2017-01-16 10:56:06 -08:00
Jack Grigg
7e3a20f235 Scan the whole chain whenever a z-key is imported
Closes #1941.
2017-01-04 15:40:35 +01:00
Sean Bowe
58c4c0bba3 Change some Bitcoin strings to Zcash strings. 2016-10-26 13:29:05 -06:00
zkbot
27bc01a05b Auto merge of #1523 - bitcartel:master_1504_z_logging, r=bitcartel
Refine LogPrint debugging for z_* rpc calls

For #1504 ZCA011
2016-10-14 11:11:26 -04:00
Simon
438d1e45be Use -debug=zrpc for z_* rpc calls (#1504) 2016-10-12 15:46:24 -07:00
Simon
950f8ffdb6 Fixes #1491 by updating help message for rpc call z_importkey 2016-10-11 16:52:38 -07:00
Simon
3bff998b38 Rename methods to avoid using prefix of _ underscore which is reserved.
Added logging of explicit exception rather than a catch all.
Removed redundant spending key check.
Updated user facing help message.
2016-08-24 11:55:26 -07:00
Simon
0feffd1424 Don't mark wallet as dirty if key already exists.
Fix incorrect method name used in error message.
2016-08-24 11:19:33 -07:00
Simon
92444edc00 Add z_importwallet and z_exportwallet to handle keys for both
taddr and zaddr.  Restore behaviour of dumpwallet and importwallet
to only handle taddr.
2016-08-24 11:19:33 -07:00