Giter Club home page Giter Club logo

bulletproofs's People

Contributors

anthonymikh avatar cathieyun avatar contrun avatar hdevalence avatar isislovecruft avatar jasondavies avatar kevaundray avatar lovesh avatar oleganza avatar rex4539 avatar roconnor-blockstream avatar rubdos avatar vickiniu avatar xoloki 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

bulletproofs's Issues

8 bits range proofs behaviour with numbers larger than u8

The code below adds 2 commitments with the value of 200 using 8 bits as size. 200 + 200 should overflow a u8, this code tries to find what value matches this commitment. Surprisingly (or not), the output I get is 400 which sounds ok since it's 200 + 200 but it is not an u8. Did I understand the 8 bits size wrong?

use rand::rngs::OsRng;
use curve25519_dalek_ng::scalar::Scalar;
use merlin::Transcript;
use bulletproofs::{BulletproofGens, PedersenGens, RangeProof};
use curve25519_dalek_ng::ristretto::RistrettoPoint;

fn main() {
	let nbits = 8;
	let ped_commits = PedersenGens::default();
	let bullet_gens = BulletproofGens::new(nbits, 1);
	let mut csprng: OsRng = OsRng::default();
	let blinding_factor = Scalar::random(&mut csprng);
	let mut prover_ts = Transcript::new("Test".as_bytes());
	let mut prover_ts2 = Transcript::new("Test".as_bytes());

	let (_proof, commitment) = RangeProof::prove_single( &bullet_gens,&ped_commits,&mut prover_ts,200,&blinding_factor, nbits,).expect("Oops!");
        let (_proof2, commitment2) = RangeProof::prove_single( &bullet_gens,&ped_commits,&mut prover_ts2,200,&blinding_factor, nbits,).expect("Oops!");

	// sum for c1 c2
	let vec_in = vec![commitment, commitment2];
	let res:RistrettoPoint = vec_in.iter()
		.map(|v|v.decompress().unwrap())
		.sum::<RistrettoPoint>();

	// brute force
        let bf_sum_inputs = blinding_factor + blinding_factor;
	for i in 0..u64::MAX {
		// proof for c3
		let mut prover_ts3 = Transcript::new("Test".as_bytes());
		let (_proof3, commitment3) = RangeProof::prove_single( &bullet_gens,&ped_commits,&mut prover_ts3,i,&bf_sum_inputs, nbits,).expect("Oops!");

		// sum for c3
		let vec_out = vec![commitment3];
		let res2:RistrettoPoint = vec_out.iter()
			.map(|v|v.decompress().unwrap())
			.sum::<RistrettoPoint>();

		// eq check
		if res == res2 {
			println!("Eq {}", i);
			break;
		} else {
			//println!("{}", i);
		}
	}
}

Question about "Q" in the InnerProductProof

Context:

The InnerProductProofs takes a few inputs including g_vec, h_vec, a_vec, b_vec, Q and basically gives a point P and a proof that we know a_vec, b_vec such that

(g_vec^a_vec) (h_vec^b_vec) Q^<a_vec, b_vec> = P

My question:

It seems to me that Q can be any point as long as finding a non trivial discrete log relation between elements of g_vec, h_vec and Q is hard. It particular, I think Q = RISTRETTO_BASEPOINT_POINT (aka self.pc_gens.B) would do. Well, as long as we didn't pick one of the points of g_vec or h_vec to be a known power of RISTRETTO_BASEPOINT_POINT.

In the range proof, this is how Q is defined:

// Get a challenge value to combine statements for the IPP
let w = self.transcript.challenge_scalar(b"w");
let Q = w * self.pc_gens.B;

I'm wondering what is the motivation for constructing it with a challenge. Do we need this point to not be predictable?

README example not compiling

This example doesn't compile with neither rust 1.61 (stable) nor rust 1.63 (nightly) as it contains a mistake. Line use curve25519_dalek::scalar::Scalar; must be replaced with use curve25519_dalek_ng::scalar::Scalar; for example to build correctly.

Also, extern crate statements are obsolete since rust 2018 edition and could be safely removed as README suggests using rust nightly which supports 2021 edition

Possibly stale dependency curve25519-dalek-ng, and strangeness with forks

Hi I am trying to understand what is happening around the following 2 repos and their forks:

The repo I am currently building depends on both of the forked repos mentioned above. I have some concerns around curve25519-dalek-ng because there have been no updates since 2021 while the original one receives updates fairly regularly. It seems that the original reason for creating the fork was not actually valid so I tried changing to using curve25519-dalek but since this bulletproos repo depends on curve25519-dalek-ng I can't change to curve25519-dalek unless I change to the original dalek bulletproofs repo. But the problem there is that if I want to use the original repo I must use the rust crate bulletproofs 2.0.0, which does not compile. Also, it's strange that this bulletproofs repo takes the crate identifier bulletproofs 4.0.0 (why are 2 different versions pointing to 2 different repos?).

What is the recommendation here? Could I make a PR to change this repo to use curve25519-dalek? Should I just fork both repos and do my own thing? Are the changes in curve25519-dalek not necessary for curve25519-dalek-ng?

@hdevalence @cathieyun

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.