wagyu
wagyu copied to clipboard
Zcash transaction builder
Summary
- Implement Zcash transaction builder
- Implement test suite for Zcash transaction builder
Implementation WIP in feature/zcash-transactions.
- [x] t-addr -> t-addr
- [x] t-addr -> z-addr
- [x] z-addr-> t-addr
- [x] z-addr -> z-addr
Note: All z-addresses refer to sapling addresses.
Looking forward to z-addr -> t-addr/z-addr! Well done @raychu86 @howardwu!
Current implementation generates sapling spends and outputs with valid proofs.
Shielded outputs have been tested with real transactions (successfully broadcasting the crafted transaction hexes), however shielded spends have not. This is because sapling spends require a the latest state of the sapling tree state in order to determine a valid anchor and nullifier.
Further research is underway regarding tests for real sapling spends.
Testing proposal:
- Run a zcash node
- Extract a serialize sapling tree state or note witnesses using GDB or LLDB.
- Import the serialized value into wagyu transaction builder
- Generate the transaction hex
- Broadcast the transaction via zcash-cli
Preliminary implementation for Zcash transaction builder is complete with real transaction tests.
NOTE: Sending real transactions with sapling spends require the most recent sapling tree state (current tests use gdb/lldb dives into the Zcash node to retrieve this information). gdb/lldb scraping for state information was only used for testing and future development will be require a separate stateful client.
Current scraping techniques only allows us to obtain the commitment tree witnesses and anchor separately, however the ideal implementation should obtain the full tree or the incremental witnesses.
Thanks again @raychu86! This is fantastic!
One question about sapling witnesses: couldn't you extract the commitment tree witnesses and anchors from the light client? The client includes a sqlite DB for the most recent witnesses. See: https://github.com/str4d/librustzcash/blob/preview/zcash_client_backend/src/sqlite.rs
Would this help?
Thanks for the pointer! That would most likely work.
I'll look into that avenue and do some testing to see if I can further simplify/untangle the transaction building process.