feat: Add offline payment pallet with Groth16 ZK proofs #439
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
This PR introduces the pallet-encointer-offline-payment which enables privacy-preserving offline payments using Groth16
zero-knowledge proofs on the BN254 curve.
Use Case
Encointer community currencies are designed for local economies where internet connectivity may be unreliable. The offline payment
system allows:
This enables POS payments in areas with spotty connectivity - the payment can be generated offline and settled later when connectivity is restored.
Design Choices
Groth16 on BN254:
Backgound:

criteria:
Why not noir?
Poseidon Hash:
Commitment Scheme:
Trusted Setup:
Specification
Storage:
Extrinsics:
Circuit Public Inputs:
Circuit Constraints:
Files Added
Dependencies
ark-bn254 = "0.4.0" # BN254 curve
ark-groth16 = "0.4.0" # Groth16 proving system
ark-crypto-primitives = "0.4.0" # Poseidon sponge
ark-r1cs-std = "0.4.0" # R1CS gadgets
Testing
cargo test -p pallet-encointer-offline-payment
33 tests pass, including e2e_zk_payment_works