Giter VIP home page Giter VIP logo

pcd's Introduction

Proof-carrying data (PCD)

This arkworks library describes an interface and contains an implementation for proof-carrying data (PCD).

PCD (introduced in [CT10]) is a cryptographic primitive that allows the incremental verification of a distributed computation that can continue indefinitely. A computation defined by a (possibly infinite) directed acyclic graph is augmented by attaching a succinct proof of correctness to each message, allowing any intermediate state of the computation to be verified efficiently. PCD is a generalization of IVC [Val08], or incrementally-verifiable computation, which is PCD in the case of a linear computation (that is, the graph is a path graph).

This library is released under the MIT License and the Apache v2 License (see License).

WARNING: This is an academic proof-of-concept prototype, and in particular has not received careful code review. This implementation is NOT ready for production use.

The PCD interface is here and relies on a cycle of elliptic curves (e.g. the MNT cycle). Separate CircuitSpecificSetupPCD and UniversalSetupPCD interfaces are included depending on the underlying SNARK type(s). Note that the underlying main SNARK and helper SNARK do not have to be the same, although both must implement either CircuitSpecificSetupSNARK or UniversalSetupSNARK.

Build guide

The library compiles on the stable toolchain of the Rust compiler. To install the latest version of Rust, first install rustup by following the instructions here, or via your platform's package manager. Once rustup is installed, install the Rust toolchain by invoking:

rustup install stable

After that, use cargo, the standard Rust build tool, to build the libraries:

git clone https://github.com/arkworks-rs/pcd.git
cd pcd
cargo build

Tests

This library comes with comprehensive unit and integration tests. Run the tests with:

cargo test --all

License

The crates in this repo are licensed under either of the following licenses, at your discretion.

Unless you explicitly state otherwise, any contribution submitted for inclusion in this library by you shall be dual licensed as above (as defined in the Apache v2 License), without any additional terms or conditions.

References

[CT10] Proof-Carrying Data and Hearsay Arguments from Signature Cards
Alessandro Chiesa and Eran Tromer
ITCS 2010

[Val08] Incrementally Verifiable Computation or Proofs of Knowledge Imply Time/Space Efficiency
Paul Valiant
TCC 2008

pcd's People

Contributors

drewstone avatar npwardberkeley avatar pratyush avatar weikengchen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pcd's Issues

Code does not compiles :(

Hello devs, excuses but looks like it can't be build

-- cargo --version
cargo 1.61.0 (a028ae42f 2022-04-29)
-- rustc --version
rustc 1.61.0 (fe5b13d68 2022-05-18)

error[E0432]: unresolved import `ark_std::iterable`
 --> /Users/user/.cargo/git/checkouts/algebra-7e23afa68841b66e/0ece17d/ec/src/msm/variable_base/mod.rs:2:31
  |
2 | use ark_std::{borrow::Borrow, iterable::Iterable, ops::AddAssign, vec::Vec};
  |                               ^^^^^^^^ could not find `iterable` in `ark_std`

For more information about this error, try `rustc --explain E0432`.
error: could not compile `ark-ec` due to previous error
warning: build failed, waiting for other jobs to finish...

Get errors when build the project

I get errors when build the project, it sees something with the poly-commit crate is wrong
$ cargo build
Compiling ppv-lite86 v0.2.10
Compiling rand_core v0.5.1
Compiling lazy_static v1.4.0
Compiling pin-project-lite v0.2.4
Compiling cfg-if v1.0.0
Compiling subtle v1.0.0
Compiling ahash v0.4.7
Compiling bench-utils v0.1.0 (https://github.com/arkworks-rs/utils#b37f1c8f)
Compiling byte-tools v0.3.1
Compiling opaque-debug v0.2.3
Compiling typenum v1.12.0
Compiling num-traits v0.2.14
Compiling tracing-core v0.1.17
Compiling zeroize v1.2.0
Compiling hashbrown v0.9.1
Compiling rand_chacha v0.2.2
Compiling tracing-subscriber v0.2.15
Compiling tracing v0.1.22
Compiling rand v0.7.3
Compiling generic-array v0.12.3
Compiling num-integer v0.1.44
Compiling digest v0.8.1
Compiling crypto-mac v0.7.0
Compiling ark-std v0.1.0 (https://github.com/arkworks-rs/utils#b37f1c8f)
Compiling blake2 v0.8.1
Compiling ark-serialize v0.1.0 (https://github.com/arkworks-rs/algebra#1ebaf957)
Compiling num-bigint v0.3.1
Compiling ark-ff-macros v0.1.0 (https://github.com/arkworks-rs/algebra#1ebaf957)
Compiling ark-ff v0.1.0 (https://github.com/arkworks-rs/algebra#1ebaf957)
Compiling ark-ec v0.1.0 (https://github.com/arkworks-rs/algebra#1ebaf957)
Compiling ark-relations v0.1.0 (https://github.com/arkworks-rs/snark#f3d9b35a)
Compiling ark-poly v0.1.0 (https://github.com/arkworks-rs/algebra#1ebaf957)
Compiling ark-snark v0.1.0 (https://github.com/arkworks-rs/snark#f3d9b35a)
Compiling ark-r1cs-std v0.1.0 (https://github.com/arkworks-rs/r1cs-std#d9e02004)
Compiling ark-bls12-381 v0.1.0 (https://github.com/arkworks-rs/curves#cd887218)
Compiling ark-ed-on-bls12-381 v0.1.0 (https://github.com/arkworks-rs/curves#cd887218)
Compiling ark-nonnative-field v0.0.4 (https://github.com/arkworks-rs/nonnative#759cb696)
Compiling ark-mnt4-298 v0.1.0 (https://github.com/arkworks-rs/curves#cd887218)
Compiling ark-mnt6-298 v0.1.0 (https://github.com/arkworks-rs/curves#cd887218)
Compiling ark-ed-on-mnt4-298 v0.1.0 (https://github.com/arkworks-rs/curves#cd887218)
Compiling ark-crypto-primitives v0.1.0 (https://github.com/arkworks-rs/crypto-primitives?branch=main#fde39ab7)
Compiling ark-poly-commit v0.1.0 (https://github.com/arkworks-rs/poly-commit?branch=constraints#a005c2d0)
error[E0432]: unresolved import crate::PrepareVar
--> /Users/ton/.cargo/git/checkouts/poly-commit-b5b028659d8ad793/a005c2d/src/marlin_pc/constraints.rs:9:61
|
9 | BTreeMap, BTreeSet, BatchLCProof, LinearCombinationVar, PrepareVar, String, ToString, Vec,
| ^^^^^^^^^^ no PrepareVar in the root

error[E0433]: failed to resolve: use of undeclared crate or module tracing
--> /Users/ton/.cargo/git/checkouts/poly-commit-b5b028659d8ad793/a005c2d/src/marlin_pc/constraints.rs:66:7
|
66 | #[tracing::instrument(target = "r1cs", skip(self, cs))]
| ^^^^^^^ use of undeclared crate or module tracing

error[E0433]: failed to resolve: use of undeclared crate or module tracing
--> /Users/ton/.cargo/git/checkouts/poly-commit-b5b028659d8ad793/a005c2d/src/marlin_pc/constraints.rs:173:7
|
173 | #[tracing::instrument(target = "r1cs", skip(cs, val))]
| ^^^^^^^ use of undeclared crate or module tracing

error[E0433]: failed to resolve: use of undeclared crate or module tracing
--> /Users/ton/.cargo/git/checkouts/poly-commit-b5b028659d8ad793/a005c2d/src/marlin_pc/constraints.rs:243:7
|
243 | #[tracing::instrument(target = "r1cs", skip(self))]
| ^^^^^^^ use of undeclared crate or module tracing

error[E0433]: failed to resolve: use of undeclared crate or module tracing
--> /Users/ton/.cargo/git/checkouts/poly-commit-b5b028659d8ad793/a005c2d/src/marlin_pc/constraints.rs:279:7
|
279 | #[tracing::instrument(target = "r1cs", skip(self))]
| ^^^^^^^ use of undeclared crate or module tracing

error[E0433]: failed to resolve: use of undeclared crate or module tracing
--> /Users/ton/.cargo/git/checkouts/poly-commit-b5b028659d8ad793/a005c2d/src/marlin_pc/constraints.rs:410:7
|
410 | #[tracing::instrument(target = "r1cs", skip(unprepared))]
| ^^^^^^^ use of undeclared crate or module tracing

error[E0433]: failed to resolve: use of undeclared crate or module tracing
--> /Users/ton/.cargo/git/checkouts/poly-commit-b5b028659d8ad793/a005c2d/src/marlin_pc/constraints.rs:494:7
|
494 | #[tracing::instrument(target = "r1cs", skip(cs, f))]
| ^^^^^^^ use of undeclared crate or module tracing

error[E0433]: failed to resolve: use of undeclared crate or module tracing
--> /Users/ton/.cargo/git/checkouts/poly-commit-b5b028659d8ad793/a005c2d/src/marlin_pc/constraints.rs:631:7
|
631 | #[tracing::instrument(target = "r1cs", skip(cs, value_gen))]
| ^^^^^^^ use of undeclared crate or module tracing

error[E0433]: failed to resolve: use of undeclared crate or module tracing
--> /Users/ton/.cargo/git/checkouts/poly-commit-b5b028659d8ad793/a005c2d/src/marlin_pc/constraints.rs:676:7
|
676 | #[tracing::instrument(target = "r1cs", skip(self))]
| ^^^^^^^ use of undeclared crate or module tracing

error[E0433]: failed to resolve: use of undeclared crate or module tracing
--> /Users/ton/.cargo/git/checkouts/poly-commit-b5b028659d8ad793/a005c2d/src/marlin_pc/constraints.rs:705:7
|
705 | #[tracing::instrument(target = "r1cs", skip(self))]
| ^^^^^^^ use of undeclared crate or module tracing

error[E0433]: failed to resolve: use of undeclared crate or module tracing
--> /Users/ton/.cargo/git/checkouts/poly-commit-b5b028659d8ad793/a005c2d/src/marlin_pc/constraints.rs:766:7
|
766 | #[tracing::instrument(target = "r1cs", skip(unprepared))]
| ^^^^^^^ use of undeclared crate or module tracing

error[E0433]: failed to resolve: use of undeclared crate or module tracing
--> /Users/ton/.cargo/git/checkouts/poly-commit-b5b028659d8ad793/a005c2d/src/marlin_pc/constraints.rs:783:7
|
783 | #[tracing::instrument(target = "r1cs", skip(unprepared))]
| ^^^^^^^ use of undeclared crate or module tracing

error[E0433]: failed to resolve: use of undeclared crate or module tracing
--> /Users/ton/.cargo/git/checkouts/poly-commit-b5b028659d8ad793/a005c2d/src/marlin_pc/constraints.rs:813:7
|
813 | #[tracing::instrument(target = "r1cs", skip(cs, f))]
| ^^^^^^^ use of undeclared crate or module tracing

error[E0433]: failed to resolve: use of undeclared crate or module tracing
--> /Users/ton/.cargo/git/checkouts/poly-commit-b5b028659d8ad793/a005c2d/src/marlin_pc/constraints.rs:922:7
|
922 | #[tracing::instrument(target = "r1cs", skip(cs, value_gen))]
| ^^^^^^^ use of undeclared crate or module tracing

error[E0433]: failed to resolve: use of undeclared crate or module tracing
--> /Users/ton/.cargo/git/checkouts/poly-commit-b5b028659d8ad793/a005c2d/src/marlin_pc/constraints.rs:1022:7
|
1022 | #[tracing::instrument(target = "r1cs", skip(unprepared))]
| ^^^^^^^ use of undeclared crate or module tracing

error[E0433]: failed to resolve: use of undeclared crate or module tracing
--> /Users/ton/.cargo/git/checkouts/poly-commit-b5b028659d8ad793/a005c2d/src/marlin_pc/constraints.rs:1086:7
|
1086 | #[tracing::instrument(target = "r1cs", skip(cs, value_gen))]
| ^^^^^^^ use of undeclared crate or module tracing

error[E0433]: failed to resolve: use of undeclared crate or module tracing
--> /Users/ton/.cargo/git/checkouts/poly-commit-b5b028659d8ad793/a005c2d/src/marlin_pc/constraints.rs:1180:7
|
1180 | #[tracing::instrument(target = "r1cs", skip(cs, value_gen))]
| ^^^^^^^ use of undeclared crate or module tracing

error[E0433]: failed to resolve: use of undeclared crate or module tracing
--> /Users/ton/.cargo/git/checkouts/poly-commit-b5b028659d8ad793/a005c2d/src/marlin_pc/constraints.rs:1290:7
|
1290 | #[tracing::instrument(
| ^^^^^^^ use of undeclared crate or module tracing

error[E0433]: failed to resolve: use of undeclared crate or module tracing
--> /Users/ton/.cargo/git/checkouts/poly-commit-b5b028659d8ad793/a005c2d/src/marlin_pc/constraints.rs:1655:7
|
1655 | #[tracing::instrument(
| ^^^^^^^ use of undeclared crate or module tracing

error[E0433]: failed to resolve: use of undeclared crate or module tracing
--> /Users/ton/.cargo/git/checkouts/poly-commit-b5b028659d8ad793/a005c2d/src/marlin_pc/constraints.rs:1848:7
|
1848 | #[tracing::instrument(
| ^^^^^^^ use of undeclared crate or module tracing

error[E0407]: method create_labeled_commitment_gadget is not a member of trait PCCheckVar
--> /Users/ton/.cargo/git/checkouts/poly-commit-b5b028659d8ad793/a005c2d/src/marlin_pc/constraints.rs:1956:5
|
1956 | / fn create_labeled_commitment_gadget(
1957 | | label: String,
1958 | | commitment: Self::CommitmentVar,
1959 | | degree_bound: Option<FpVar<<CycleE::E1 as PairingEngine>::Fr>>,
... |
1965 | | }
1966 | | }
| |_____^ not a member of trait PCCheckVar

error[E0407]: method create_prepared_labeled_commitment_gadget is not a member of trait PCCheckVar
--> /Users/ton/.cargo/git/checkouts/poly-commit-b5b028659d8ad793/a005c2d/src/marlin_pc/constraints.rs:1968:5
|
1968 | / fn create_prepared_labeled_commitment_gadget(
1969 | | label: String,
1970 | | prepared_commitment: Self::PreparedCommitmentVar,
1971 | | degree_bound: Option<FpVar<<CycleE::E1 as PairingEngine>::Fr>>,
... |
1977 | | }
1978 | | }
| |_____^ not a member of trait PCCheckVar

error: aborting due to 22 previous errors

Use crates-io dependencies

Using git as dependencies will downstream break the library in case of
unreleased unstable active development.

It is desirable to use properly published and tagged dependencies in
order to improve overall stability.

PCD uses Marlin with Poseidon with hardcoded parameters that do not guarantee to be secure

This is a note that the current PCD uses the constraints branch of Marlin, which uses a hardcoded Poseidon parameters, regardless of the curves and fields of the proof systems. This has two problems:

(1) \alpha may not work for all the fields. Recall that Poseidon uses a nonlinear function y = x^\alpha. There is a requirement that \alpha does not divide the order of the field. This immediately means that the current parameters are "insecure" under a number of the curves and fields due to collisions.

(2) Hardcoded parameters are never a good practice. Ideally, we can replace it by running the ChaChaRng over a small seed, to generate all the parameters needed for Poseidon.

This, however, requires a general-purpose and nice Poseidon sponge implemented in arkworks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.