GithubHelp home page GithubHelp logo

Comments (4)

dannywillems avatar dannywillems commented on August 26, 2024

Can you give a bit more info pls? What do you want exactly?

from zeth.

AntoineRondelet avatar AntoineRondelet commented on August 26, 2024

Sure, thanks for the message @dannywillems!

As of now, the "Proof Consumer" (PC for short) is just implemented as a bunch of Python scripts (see the pyClient folder). These scripts execute a "mock" scenario with Alice, Bob and Charlie doing Ether or ERC20 transfers in zero knowledge (the scripts call the "Proof Generator" via RPC calls and use the received proofs to call the "Mix" function of the Mixer smart contract, to effectively do private transfers).
In this issue, we propose to enhance usability of zeth by having a better way to interact with the Proof Generator and the Mixer smart contract to do private asset transfer. In fact, rather than writing your script describing the scenario you'd like to test; it'd be great to have a CLI that enables the user to enter the payment informations, then call the PG on the given inputs to get a proof and then call the Mixer to execute the transfers.

from zeth.

AntoineRondelet avatar AntoineRondelet commented on August 26, 2024

As mentioned on the comment above, the purpose of this issue is to have a basic CLI to enable users to do payments via the Zeth contract.
Thus, the basic functionalities desired are:

  • Payment, something like zeth pay [options and args]
  • Receive a payment zeth receive [options and args], see #11 (note we logged the addresses of the inserted commitments on the Mixer contract to ease this check). Here we basically need to listen to the mixer events to try to decrypt the ciphertexts logged/emitted (are we the recipients?) + we need to recompute the commitment(s) and check it(them) against the one(s) appended in the merkle tree to make sure the payment is valid. Note, this command should be quite similar to the one to run a note recovery procedure (imagine a hardware failure that yields a loss of the content of the coin store), something like zeth scan/recover --keyfile [yourViewingKeyFile] --depth [depthOfTheScan]. This would scan the blockchain up to the specified depth and try to repopulate the coinstore - ie: run the receive function constantly from the specified depth to the last block - (here we assume that the content of the keystore was backed up). If a payment is successfully received, then we write the note in a file in the coinstore (like already done in the test scripts, see

    zeth/pyClient/zethUtils.py

    Lines 104 to 120 in 61a224a

    def receive(ciphertext, decryption_key, username):
    recovered_plaintext = ""
    try:
    recovered_plaintext = decrypt(ciphertext, decryption_key)
    print("[INFO] {} recovered one plaintext".format(username))
    print("[INFO] {} received a payment!".format(username))
    # Just as an example we write the received coin in the coinstore
    print("[INFO] Writing the received note in the coinstore")
    coinstore_dir = os.environ['ZETH_COINSTORE']
    coin_filename = "{}_{}.json".format(username, int(round(time.time() * 1000)))
    path_to_coin = os.path.join(coinstore_dir, coin_filename)
    file = open(path_to_coin, "w")
    file.write(recovered_plaintext)
    file.close()
    except Exception as e:
    print("[ERROR] in receive. Might not be the recipient! (msg: {})".format(e))
    return recovered_plaintext
    ).

I wrote some more infos on how the flow would work, here some time ago: https://github.com/clearmatics/zeth/tree/master/coinstore

from zeth.

AntoineRondelet avatar AntoineRondelet commented on August 26, 2024

Closing this issue since the corresponding PR has been merged

from zeth.

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.