Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/visoftsolutions/noir_swift
Swift-based zkSNARK Proving&Verifying tool for noir-lang
https://github.com/visoftsolutions/noir_swift
noir rust swift zksnarks
Last synced: about 1 month ago
JSON representation
Swift-based zkSNARK Proving&Verifying tool for noir-lang
- Host: GitHub
- URL: https://github.com/visoftsolutions/noir_swift
- Owner: visoftsolutions
- License: apache-2.0
- Created: 2023-10-23T12:00:20.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2023-12-16T17:57:37.000Z (about 1 year ago)
- Last Synced: 2024-04-14T01:53:41.888Z (8 months ago)
- Topics: noir, rust, swift, zksnarks
- Language: Swift
- Homepage:
- Size: 44.9 KB
- Stars: 1
- Watchers: 0
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
- awesome-noir - noir_swift - Proving and verifying Noir programs in Swift (and by extension macOS, IOS and watchOS) (Get Coding / Dev Tools)
README
# `noir_swift`: Swift-based zkSNARK Proving&Verifying tool for noir-lang
Welcome to Swift-Bridge, a seamless connector between the Swift programming ecosystem and the `noir_rs` Rust library. This bridge is designed to provide Swift developers with easy and efficient access to `noir_rs`'s zkSNARK proving functionalities, making it highly applicable in iOS, macOS, WatchOS, and other platforms that support Swift.
- ![Version](https://img.shields.io/badge/version-0.19.4-darkviolet)
## Key Highlights:
- **Swift Integration**: Custom-built for Swift developers, enabling native access to zkSNARK tools within the Swift environment.
- **Rust-Swift Bridge**: Offers a fluid connection between Swift and Rust, providing a smooth and efficient integration.
- **Security Focused**: Ensures top-notch security with advanced zkSNARK proof generation and verification capabilities, integral for privacy and scalability in computing.## Building & Testing Instructions:
### Building Rust Components:
```bash
cargo build
```### Testing Rust Components:
For high confidence in the bridge's reliability, utilize the included test suites:
```bash
cargo test
```### Building Swift Components:
```bash
# Transfer noir_swift library to Swift directory
cp target/debug/libnoir_swift.a swift/cd swift
# Compile Swift project
./build# Execute the program
./main.run
```## Usage:
Swift-Bridge mainly provides two crucial functions:
1. **Prove in Swift**: Create a zkSNARK proof using provided circuit bytecode and initial witness.
2. **Verify in Swift**: Authenticate a zkSNARK proof against its respective circuit and verification key.```rust
struct Proof {
proof: Vec,
verification_key: Vec,
}fn prove_swift(circuit_bytecode: String, initial_witness_vec_raw: Vec) -> Option;
fn verify_swift(circuit_bytecode: String, proof: Proof) -> Option;
```## Example:
Here's an example using a noir circuit to verify if x is different from y:
```swift
let BYTECODE = ""let witness = RustVec()
witness.push(value: 1) // x value
witness.push(value: 2) // y valueguard let proof = prove_swift(BYTECODE, witness) else {
return false
}let verdict = verify_swift(BYTECODE, proof) ?? false
print(verdict) // Outputs true if successful verification
```## Future Developments:
We are constantly working to improve the Swift-Bridge, focusing on enhancing its compatibility with a broader range of Swift-supported platforms and streamlining its integration into Swift-based projects.
Stay tuned for more updates and advancements in bridging Swift with the world of zkSNARKs!