Skip to content

Bulletproof rewinding proposed (and tested) for a single range proof #329

Closed
@hansieodendaal

Description

@hansieodendaal

Hi there,

I would like to know how open the dalek-cryptography/bulletproofs maintainers and community are to add Bulletproofs rewinding functionality to the crate.

We use dalek-cryptography/bulletproofs in our project and have a need to do wallet recovery from seed values. I have implemented Bulletproof rewinding in a fork on main that is similar to what other projects have done (e.g. Grin), demonstrated from a user perspective in this test.

The user calls pub fn prove_single_with_rewind_key instead of pub fn prove_single, with two additional parameters, pvt_rewind_key: &Scalar and extra_data: &[u8; 23]. The 23 bytes extra_data can be any message a user wants to embed within the proof. Internally, pvt_rewind_key is converted into a rewind nonce and a private nonce:

rewind_nonce = H( H(pub_key_from_pvt_key(pvt_rewind_key)), commitment)
private_nonce = H( H(pvt_rewind_key), commitment)

With the Party and Dealer's algorithm:

image

  1. a_blinding is replaced by rewind_nonce
  2. s_blinding is replaced by XOR(rewind_nonce, merge_into_word(value, extra_data))

image

  1. t_1_blinding is replaced by private_nonce
  2. t_2_blinding is replaced by private_nonce

Usage:

  • Verifying the proof with pub fn verify_single still works exactly as it did before.
  • The owner and delegated 3rd parties can use pub fn get_rewind_nonce_from_pub_key to retrieve rewind_nonce for a specific commitment.
  • The owner can use pub fn get_private_nonce_from_pvt_key to retrieve private_nonce for a specific commitment.
  • The owner and delegated 3rd parties can use pub fn rewind_single_get_value_only to rewind a proof for a given commitment, to get the value and 23 bytes extra_data only. If the wrong rewind_nonce is provided, garbage data will be returned.
  • The owner can use pub fn rewind_single_get_commitment_data to rewind the proof for a given commitment, returning the value, blinding factor and 23 bytes extra_data upon success.

Thank you kindly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions