Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: bitwise gadgets #733

Closed
barriebyron opened this issue Nov 16, 2023 · 3 comments
Closed

docs: bitwise gadgets #733

barriebyron opened this issue Nov 16, 2023 · 3 comments
Labels
docs Improvements or additions to documentation o1js

Comments

@barriebyron
Copy link
Contributor

barriebyron commented Nov 16, 2023

Let's document how devs can leverage the recent bitwise gadgets, starting with those landed in time for ZK Hack
From Nov What's new in o1js blog post:

Gadgets are amalgamations of the lowest level gates in the proof system (addition, multiplication) into more sophisticated boolean operations (XOR, NOT). This simplifies the process of creating new cryptographic primitives. In this case, the gadgets will form the basis of upcoming ECDSA signature verification. These gadgets will also allow the community to implement other crypto algorithms, such as SHA.
Gadgets.rangeCheck64(): A provable method for efficient 64-bit range checks using lookup tables. (0.14.0, #1181)
Gadgets.rotate(): A provable method to support bitwise rotation for native field elements. (0.14.0, #1182)
Gadgets.xor(): A provable method to support bitwise XOR operations for native field elements. (0.14.0, #1177)

list of merged gadgets: xor, and, rot, not, range checks, left shift and right shift
in review: ffadd, ffmul

In addition to the auto-generated reference docs https://docs.minaprotocol.com/zkapps/o1js-reference/modules#gadgets what content can help our devs build?

include: Gadgets.leftShift() / Gadgets.rightShift(), new provable methods to support bitwise shifting. #1194

@barriebyron barriebyron added docs Improvements or additions to documentation o1js labels Nov 16, 2023
@nicc nicc changed the title docs: gadgets docs: bitwise gadgets Nov 17, 2023
@barriebyron
Copy link
Contributor Author

Slack convo https://o1-labs.slack.com/archives/C028Q27R8UC/p1700233963459219 for context

Per @garwalsh suggestion, first create the explainer doc in the o1js with:

  • "deep dive" explainer doc: high-level description of what the gadgets are, what they can be used for in their current state (i.e. not integrated into higher-level APIs)

In the short term, this gets us out of the situation we are currently in, where we have functionality with no docs.
From there, we can work on a tutorial (love the idea of using keccak), but not until the tutorial audit is finished

two types of content about the gadgets: A tutorial showing how to use them and some sort of "deep dive" that explains them in detail

@barriebyron
Copy link
Contributor Author

Check out https://github.com/o1-labs/o1js/blob/main/src/lib/gadgets/gadgets.ts

Lots of copy and examples there to use

@barriebyron
Copy link
Contributor Author

from @garwalsh

Short overview of what gadgets are in general
A heading of "Bitwise Operators"
A list of each of the bitwise gadgets including the descriptions and examples from https://github.com/o1-labs/o1js/blob/main/src/lib/gadgets/gadgets.ts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Improvements or additions to documentation o1js
Projects
None yet
Development

No branches or pull requests

2 participants