diff --git a/src/Makefile.zcash.include b/src/Makefile.zcash.include index 341ba2736..59aeb861f 100644 --- a/src/Makefile.zcash.include +++ b/src/Makefile.zcash.include @@ -1,5 +1,6 @@ bin_PROGRAMS += \ - zcash/GenerateParams + zcash/GenerateParams \ + zcash/CreateJoinSplit # tool for generating our public parameters zcash_GenerateParams_SOURCES = zcash/GenerateParams.cpp @@ -9,3 +10,13 @@ zcash_GenerateParams_LDADD = \ $(LIBBITCOIN_UTIL) \ $(LIBBITCOIN_CRYPTO) \ $(LIBZCASH_LIBS) + +# tool for profiling the creation of joinsplits +zcash_CreateJoinSplit_SOURCES = zcash/CreateJoinSplit.cpp +zcash_CreateJoinSplit_LDADD = \ + $(LIBBITCOIN_COMMON) \ + $(LIBBITCOIN_UTIL) \ + $(LIBBITCOIN_CRYPTO) \ + $(LIBZCASH) \ + $(BOOST_LIBS) \ + $(LIBZCASH_LIBS) diff --git a/src/zcash/CreateJoinSplit.cpp b/src/zcash/CreateJoinSplit.cpp new file mode 100644 index 000000000..65dc7f65c --- /dev/null +++ b/src/zcash/CreateJoinSplit.cpp @@ -0,0 +1,32 @@ +// Copyright (c) 2016 The Zcash developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + +#include "../util.h" +#include "primitives/transaction.h" +#include "zcash/JoinSplit.hpp" + +using namespace libzcash; + +int main(int argc, char **argv) +{ + auto p = ZCJoinSplit::Unopened(); + p->loadVerifyingKey((ZC_GetParamsDir() / "sprout-verifying.key").string()); + p->setProvingKeyPath((ZC_GetParamsDir() / "sprout-proving.key").string()); + p->loadProvingKey(); + + // construct a proof. + + for (int i = 0; i < 5; i++) { + uint256 anchor = ZCIncrementalMerkleTree().root(); + uint256 pubKeyHash; + + JSDescription jsdesc(*p, + pubKeyHash, + anchor, + {JSInput(), JSInput()}, + {JSOutput(), JSOutput()}, + 0, + 0); + } +}