Skip to content

Commit

Permalink
readme update gitignore and build script
Browse files Browse the repository at this point in the history
  • Loading branch information
Bartosz Nowak committed Oct 25, 2023
1 parent e7d1e26 commit 940a12b
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 6 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,6 @@ Cargo.lock
# MSVC Windows builds of rustc generate these, which store debugging information
*.pdb

*.run
*.run
*.a
*.so
30 changes: 26 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,37 @@ Bridge the gap between Swift and the `noir_rs` library, offering Swift developer
- 🌉 Effortless interfacing between Swift and Rust.
- 🔒 Secure zkSNARK proof generation and verification.

## 📦 Build
## 📦 Rust Build

```bash
cargo build
```

## 🧪 Testing
## 🧪 Rust Testing

Ensure the reliability and robustness of your bridge with the provided tests:

```bash
cargo test
```

## 📦 Swift Build

```bash
# copy barretenberg lib to the swift directory
cp target/debug/build/barretenberg-<hash>/out/lib/libbarretenberg.a swift/
# copy noir_swift lib to the swift directory
cp target/debug/libnoir_swift.a swift/

cd swift

# compile swift project
./build

# run the program
./main.run
```

## 🎯 Quick Usage

We provide two main functions for the bridge:
Expand All @@ -35,8 +52,13 @@ We provide two main functions for the bridge:
2. **verify_swift**: Verifies a given zkSNARK proof against a circuit and its verification key.

```rust
fn prove_swift(circuit_bytecode: String, initial_witness_vec_raw: Vec<i128>) -> Result<Proof, String>
fn verify_swift(circuit_bytecode: String, proof: Proof) -> Result<bool, String>
pub struct Proof {
pub proof: Vec<u8>,
pub verification_key: Vec<u8>,
}

fn prove_swift(circuit_bytecode: String, initial_witness_vec_raw: Vec<i32>) -> Option<Proof>;
fn verify_swift(circuit_bytecode: String, proof: Proof) -> Option<bool>;
```

## 🔍 Example
Expand Down
2 changes: 1 addition & 1 deletion swift/build.sh
Original file line number Diff line number Diff line change
@@ -1 +1 @@
swiftc -L ../target/debug/ -lnoir_swift -lbarretenberg -lstdc++ -lssl -lcrypto -import-objc-header bridging-header.h main.swift ../generated/noir_swift/noir_swift.swift ../generated/SwiftBridgeCore.swift -o main.run
swiftc -L . -lnoir_swift -lbarretenberg -lstdc++ -lssl -lcrypto -import-objc-header bridging-header.h main.swift ../generated/noir_swift/noir_swift.swift ../generated/SwiftBridgeCore.swift -o main.run

0 comments on commit 940a12b

Please sign in to comment.