Code Monkey home page Code Monkey logo

Comments (3)

ignopeverell avatar ignopeverell commented on July 17, 2024

As long as it's consistent it doesn't really matter. Signs make sense in algebra but aren't equivalent when translated to elliptic curve points. In the code I chose to follow the Jedusor paper, where one takes the r-value of change minus inputs and outputs are added afterward. Makes sense?

from grin.

melaurent avatar melaurent commented on July 17, 2024

I'm not quite sure I understand. In the code, the signature of commit_sum is:
pub fn commit_sum(&sef, positive: Vec<Commitment>, negative: Vec<Commitment>) -> Result<Commitment, Error>
So commit_sum(inputs, outputs) is going to do inputs - outputs of the transaction we want to verify, and not outputs - inputs, which will give the inverse (x, -y) if the key kG is (x, y). You can try inverting the arguments, the y of the public key changes depending on their order. Sorry if I'm missing something here, but the excess is defined as outputs - inputs and not inputs - outputs right ?

from grin.

ignopeverell avatar ignopeverell commented on July 17, 2024

You're right, for some reason I read that line secp.commit_sum(output_commits, input_commits) instead of what it actually was (secp.commit_sum(output_commits, input_commits)). I must have been looking at it too late.

I'm about to push a fix to invert everything. As I said it doesn't really matter as far as validity is concerned but it will be more consistent with the literature.

from grin.

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.