Add Silent Payments Support - #587
Conversation
e065256 to
4923edd
Compare
4923edd to
c5b5977
Compare
2554014 to
b39d529
Compare
b39d529 to
ecbd31f
Compare
|
Still have plenty of tasks to do on this PR but wanted to provide a checkpoint given the number of changes. I can break this into multiple PRs if preferred. I expect commits 7887701 through c516610 to remain stable. Core Changes:
Silent Payments Changes:
TODOs:
|
9434786 to
c8be414
Compare
|
Summary of changes since March update:
TestingTargeted testsGeneral testsDEFAULT_PYTEST_MARKS = "not onetime and not veryslow and not manual and not bitcoind" |
5777d81 to
847108c
Compare
847108c to
106990f
Compare
|
Commit |
|
Commit e08bd9c modifies the default silent payment signing flow. The wallet coordinator should be responsible for verifying the PSBT and finalizing for broadcast when silent payments are involved. |
|
am I the one blocking this with HW tests ? Please, open libngu changes as separate libngu PR. |
I consider this PR stable and ready for critical review. Confirming this PR on real hardware would be great!
I'll get on that. Thank you! |
external/ckcc-protocol - Add bip375 and bip376 constants external/libngu - Expose ec_pubkey_combine - Expose ec_pubkey_tweak_mul - Add bip352_encode
Add bip352 crypto primitives / helpers Add bip352 tagged hashes
Add bip374 tagged hashes Add dleq bip374 reference generate_dleq_proof, verify_dleq_proof functions
Extend psbt handling with silent payment specific functions Incorporate validation functions from bip375 test vectors - psbt_structure, input_eligibility, ecdh_coverage Add private key derivation helper functions
Only store key_data for short_values - remove key_type Only serialize PSBT_OUT_SCRIPT if self.script has a value Adjust v2 script assert to not required if sp_v0_info is present
Provides silent payments testing framework with access to MockPSBT
Use devtest/verify_sp_outputs.py for simulator testing Add testing/test_bip375_vectors.py and testing/bip375_test_vectors.json - Correct input eligibility ecdh share assumptions Add devtest/unit_silentpayments.py to perform unit testing via simulator Mirror psbt fields in testing/psbt.py
Add testing/test_bip352_vectors.py and testing/bip352_test_vectors.json - Verify SP sending and receiving test vectors
Integrate preview silent payment address as output in auth:interact Integrate silent payments in signing workflow Add sp_hrp property to chains.py Add silent payments fields to psbt.py
Add sp_spend support to _derive_input_privkey Validate bip376 spend key derivation
Create end-to-end tests for SP in testing/test_silentpayments.py - Expose foreign_mk for partial ownership coverage test Integrate SP spend into psbt functions: consider_inputs, determine_my_signing_key, sign_it - Synthesize parsed_subpaths from PSBT_IN_SPEND_BIP32_DERIVATION - Set input.sp_idxs to placeholder to synthesize input is_owned - Implement SP input signing Refactor _compute_and_store_ecdh_shares and _derive_input_privkey to leverage input.sp_idxs
Add test to validate 'Contribute Shares?' UX Simplify SP preview and signing code paths
Add silent payments label change tests - Detect presence or absence of 'Change back:' in UI story Add multi-signer incomplete coverage scenario tests
Verify SP spend path was derived from m/352h Add signature verification for taproot inputs and SP outputs
Include key-value pairs: spscan, deriv, name, xfp, key_exp in bip352 dictionary Add bip352 test block to test_export_coldcard Support 127 character limit for silent payments v0
Mixed inputs SP spend and P2TR Reject non-SIGHASH_ALL Reject psbt v0 send to SP output
Remove MockPSBT from verify_sp_outputs Test test_sp_spend_to_labeled_change_address should sign transaction Replace _serialize_psbt with read_psbt Replace single use compute_foreign_share with generate_dleq_proof Remove unnecessary int-byte conversions in test_bip352_vectors.py
Convert validate_bip376_spend to validate_silent_payment_inputs Use accounts to validate sp spend material and mark output.is_change Introduce reusable sp_derive_path function Fix change detection issue raised by previous test hygiene commit - Signing was restored for test_sp_spend_labeled_change_detected Fix psbt exception in consider_outputs with sp change - Add apply_label_to_spend_key primitive - Match spend public key to labeled spend public key for change New tests: sp spend to non sp output sp spend rejection tests - unknown account, incorrect sp spend derivation path sp change output with foreign keys is allowed but displays warning Changed test: sp spend to label change - fix label spend key derivation, use sp input
…r multiple outputs Per BIP-375: sort by spend key then output index in ascending order for each scan key group to determine ordering of the k value - Fix compute_silent_payment_output_scripts to match spec - Update bip375_test_vectors.json to version 1.1.1
Discourage broadcasting silent payments directly from the device. The wallet coordinator should be responsible for verifying the PSBT and finalizing for broadcast. - Users can restore the default ColdCard behavior by using the Danger Zone -> SP Final Export setting. - USB API was not modified.
e08bd9c to
812d7c6
Compare
|
Last force push makes the following changes:
|
Finally consider this PR ready for review and feedback to determine next steps.
TODOs:
verify silent payments labeled address handlingverify multi sig silent payment workflowsaddress edge cases / attack scenariosScreenshots
Updated UX with - silent payment address - appended to - to address -
Contribute Shares Prompt