Commit Graph

67 Commits

Author SHA1 Message Date
Jack Grigg 3a15b1637e Move serialized Zcash address length constants into zcash/Address.hpp 2016-09-13 14:21:49 +12:00
Jack Grigg 16d140f4a2 Add support for encrypting spending keys 2016-09-13 14:21:49 +12:00
Simon 4eb1a96f9a Add public field 'memo' to JSOutput to enable creation of notes with custom memos. 2016-09-08 21:46:13 -07:00
zkbot 485ace0a1b Auto merge of #1311 - ebfull:cleanup-pp, r=ebfull
Deallocate the public parameters during Shutdown.

This also has it deallocated in `GenerateParams` and `test_bitcoin`. The virtual destructor probably isn't necessary but I added it just in case we need it some other time.
2016-09-02 03:03:45 +00:00
Jack Grigg 5abaca1af6 Fix the failing test! 2016-09-01 13:00:02 +12:00
Jack Grigg ac91ebbe92 Add test showing that the witness cache isn't being serialised 2016-09-01 12:47:44 +12:00
Jack Grigg 32a103aab7 Changes after review 2016-09-01 11:48:15 +12:00
Jack Grigg be86b6c332 Add test for GetNoteDecryptor() 2016-08-31 18:57:32 +12:00
Jack Grigg 02e674555e Add wallet method for finding spendable notes in a CTransaction 2016-08-30 00:29:49 +12:00
Jack Grigg 5db5e42ec3 Add optional bool to disable computation of proof in JSDescription constructor 2016-08-30 00:29:49 +12:00
Sean Bowe 7ee82c4361 Deallocate the public parameters during Shutdown. 2016-08-26 16:55:43 -06:00
Daira Hopwood ea92aba9fe Move bigint arithmetic implementations to libsnark. 2016-08-22 15:46:58 -06:00
Sean Bowe f0dab51cf3 Implement zkSNARK compression. 2016-08-22 00:36:12 -06:00
zkbot 365845216b Auto merge of #1268 - ThisIsNotOfficialCodeItsJustForks:t1130-upgrade-libsodium, r=ebfull
Upgrade libsodium for AVX2-detection bugfix.

Upgrades libsodium to bring in an AVX2-detection bugfix (to help with #1130).
2016-08-22 02:34:30 +00:00
zkbot 7e556172d9 Auto merge of #1236 - tomrittervg:tomrittervg-comments-1, r=ebfull
Clarify comment about nonce space for Note Encryption
2016-08-18 23:38:36 +00:00
Taylor Hornby 2902ac7ce8 Use libsodium's s < L check, instead checking that libsodium checks that. 2016-08-18 16:38:20 -06:00
Tom Ritter 36d5f42948 Update NoteEncryption.hpp 2016-08-18 16:51:15 -05:00
zkbot 28a30f7801 Auto merge of #1254 - ebfull:tx-structure-changes, r=bitcartel
Change memo field size and relocate `ciphertexts` field of JoinSplit description

Closes #1190
Closes #1187
2016-08-18 16:49:47 +00:00
ebfull 2ee6ed64eb Add parenthesis around macro value definition 2016-08-18 10:43:58 -06:00
Sean Bowe f5e5707d4c Change memo field size and relocate `ciphertexts` field of JoinSplit description. 2016-08-15 09:39:14 -06:00
Tom Ritter 2dd950ecae Clarify comment about nonce space for Note Encryption 2016-08-11 13:48:47 -05:00
Jack Grigg 7c929cf5bc Add support for spending keys to the basic key store 2016-08-09 17:38:25 +12:00
Simon d81c31f5fb Extend try catch block around calls to libsnark, per discussion in #1126. 2016-07-29 00:02:22 -07:00
Sean Bowe 25d2197043 Remove more from libsnark, and fix potential remote-DoS. 2016-07-21 18:34:59 -06:00
Sean Bowe bf76024eb7 Pass our constraint system to libsnark, so that it doesn't need to (de)serialize it in the proving key. 2016-07-15 10:45:59 -06:00
Sean Bowe 1fad6b87e5 Initialize libsodium in this routine, which is now necessary because libsnark uses its PRNG. 2016-07-15 10:45:22 -06:00
zkbot 6caacc892e Auto merge of #1058 - ebfull:coin-cache, r=ebfull
Flush to disk more consistently by accounting memory usage of serials/anchors in cache.

Closes #626.

It's important that this at least *approximates* the memory usage, so that we flush the cache to disk as expected. It's okay that we overestimate. The serials are stored in keys in the `boost::unordered_map`, so we can simply use that map's `DynamicMemoryUsage`. The anchors are another story.
2016-07-11 17:23:19 +00:00
Sean Bowe 2668a1bc13 Remove the rest of libzerocash. 2016-07-10 20:25:02 -06:00
Sean Bowe 7f3c7a683b Flush to disk more consistently by accounting memory usage of serials/anchors in cache. 2016-06-27 10:52:34 -06:00
zkbot 62a2d12672 Auto merge of #1026 - ebfull:address-serialization, r=ebfull
Zcash address encoding

We need to encode Zcash addresses so they aren't as large and unweildy. We're using Base58Check just like upstream does, and to ensure the first character is "z" in our addresses we must use two bytes for the version string. Two bytes gives us an extra character for free, so this PR targets the beginning of addresses to have "zc".

```
$ ./src/zcash-cli zcrawkeygen
{
    "zcaddress" : "tnvaj4ZbZG83tj4RwZcFeLgJoSt8nw1ZvSCG8EMyowAsXTQgJPat77Y43BVdVCrwrbLy7GG9msJDYdn5hmreHmkXAkX17hb",
    "zcsecretkey" : "SKzkxCRWvscKnroSFyhCqhY332KcDMH4LLNdK2TsSvbmr3CGAB8B",
    "zcviewingkey" : "10aa74046f31cbe5eaa8965d1e104853234c3d6c6e45f9c497ca3a025d159755"
}
```

This PR also encodes the spending keys with a prefix that targets "SK". The spec needs to be updated with these changes.

Testnet addresses will start with "tn".

Closes #572
2016-06-16 18:52:30 +00:00
Sean Bowe 62b7cd6173 Do not encode leading bytes in `PaymentAddress` serialization; this is a task for a higher-level API. 2016-06-15 14:58:30 -06:00
Sean Bowe c5f766b9b1 Change merkle tree depth to 29. 2016-06-03 20:42:15 -06:00
Sean Bowe 83e018b160 Remove redundant constraints. 2016-06-03 20:27:51 -06:00
Taylor Hornby 6aae9d1a55 Sign JoinSplit transactions 2016-05-30 11:05:31 -06:00
zkbot 8ff7c0752e Auto merge of #954 - ebfull:fix-cpourtx-structure, r=ebfull
CPourTx structural changes

* Enable binary serialization of proofs and the proving key (closes #799) and make the proofs fixed-size.
* Reorder fields of CPourTx to match the spec (closes #927)
2016-05-25 16:33:31 +00:00
Sean Bowe 9285bba885 Enable binary serializations of proofs and r1cs keys, and make the `CPourTx` proof field fixed-size. 2016-05-24 11:08:31 -06:00
Sean Bowe defe37a6d4 Enforce first four bits are zero for all spending keys and phi. 2016-05-24 11:07:09 -06:00
Sean Bowe 1bcdec40a4 Refactor PRF_gadget to hand responsibility to PRF_addr_a_pk_gadget for creating the '0' argument to the PRF. 2016-05-23 10:43:25 -06:00
Taylor Hornby bf2e3122ac Remove the Merkle tree hash function's fixed point. 2016-05-16 20:20:36 -06:00
Sean Bowe 81469bbb83 `Note` values should be little-endian byte order. 2016-05-12 16:45:12 -06:00
Sean Bowe 032164d5d5 Rename hmac -> mac in circuit. 2016-05-12 16:45:12 -06:00
Sean Bowe a9640f67f1 Rename ZCASH_ constants to ZC_. 2016-05-12 16:45:07 -06:00
Sean Bowe 53ab7c06ba Use inheritance for PRF gadgets. 2016-05-12 16:44:49 -06:00
Sean Bowe 5975bf1c32 Added public zkSNARK parameter generation utility. 2016-05-12 16:44:49 -06:00
Daira Hopwood dbab243725 zkSNARK: Add constraint that the total value in a JoinSplit is a 64-bit integer. 2016-05-12 16:44:30 -06:00
Sean Bowe 59c3d926c6 zkSNARK: Enforce merkle authentication path from nonzero-valued public inputs to root. 2016-05-12 16:44:30 -06:00
Sean Bowe fcece37f00 zkSNARK: Witness commitments to input notes. 2016-05-12 16:44:30 -06:00
Sean Bowe e5f7c49d55 zkSNARK: Ensure that values balance correctly. 2016-05-12 16:44:30 -06:00
Sean Bowe 5e61a78fec zkSNARK: Enforce disclosure of commitments to output notes. 2016-05-12 16:44:30 -06:00
Sean Bowe 6b010d9bfd zkSNARK: Enforce that new output notes have unique `rho` to prevent faerie gold attack. 2016-05-12 16:44:30 -06:00