Giter VIP home page Giter VIP logo

Comments (4)

howardwu avatar howardwu commented on June 6, 2024 2

@gakonst pointed out that only the transaction needs to incorporate the network_id for replay prevention and support for multiple networks (similar to EIP155).

Thus, we propose the following architecture. Accounts will not include an is_testnet boolean or network_id byte. Instead, we update DPC as follows:

  1. The inner_snark_gadget adds as public input one network_id byte, and
  2. The Transaction struct adds one network_id byte, which miners will use as public input to verify the inner_snark proof.

For simplicity, we set the Aleo mainnet to ID 0 and the first Aleo testnet to ID 1.

from snarkos.

howardwu avatar howardwu commented on June 6, 2024 1

@kobigurk proposed using an integer instead of a boolean flag to differentiate mainnet from testnet accounts in order to allow support for multiple testnets.

In our architecture, to prevent replay attacks and support multiple testnets simultaneously, we can introduce one byte network_id to the account private key, where the MSB is set to 0 if the account is a mainnet account, and 1 if the account is a testnet account. Thus, mainnets would occupy 0-127 and testnets would occupy 128-255 as their network_id.

Then, the account public key would be produced as follows:

let commit_input = to_bytes![private_key.pk_sig, private_key.sk_prf, private_key.metadata, private_key.network_id]?;
let commitment = C::AccountCommitment::commit(parameters, &commit_input, &private_key.r_pk)?;

To prevent replay attacks across networks, we update DPC as follows:

  1. The inner_snark_gadget adds as public input one network_id byte, and
  2. The Transaction struct adds one network_id byte, which miners will use as public input to verify the inner_snark proof.

from snarkos.

howardwu avatar howardwu commented on June 6, 2024

#129

from snarkos.

gakonst avatar gakonst commented on June 6, 2024

Since #129 is merged, should this be closed? @howardwu

from snarkos.

Related Issues (20)

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.