0.6.0 • Published 25 days ago

o1js-pack v0.6.0

Weekly downloads
-
License
Apache-2.0
Repository
-
Last release
25 days ago

o1js Pack

Make the most of your zkApp state!

What is it

o1js Pack is a library for o1js that allows a zkApp developer to pack extra data into a single Field.

Usage in a zkApp

Smart Contract

The primary benefit of using this library in a smart contract is that it allows you to use more of your allotted 8 Fields of storage.

Check out example usage in a smart contract in Smart Contract Examples.

ZK Program

The benefit to using this library in a zk program is less obvious. In some cases, the number of gates required in a circuit is less using this library than with provable arrays. Especially in applications where the array is hashed many times, packing and unpacking ends up being more effecient than doing a lot of Poseidon hashes. In other cases, you may just prefer the API of o1js Pack compared to using provable arrays.

Check out example usage in a zk program in Zk Program Examples.

How to build

npm run build

How to run tests

npm run test src # non-proof tests
npm run test tests/provable # provable tests

Credits

Thanks to @mario_zito for seeding the idea for this library on Discord (Thread 1, Thread 2), and to @gregor for sounding out the early implementation.

Thanks to @iam-dev for early adoption!

License

Apache-2.0

0.6.0

25 days ago

0.5.4

3 months ago

0.5.3

3 months ago

0.5.2

3 months ago

0.5.1

3 months ago

0.5.0

4 months ago

0.4.4

4 months ago

0.4.1

7 months ago

0.4.3

6 months ago

0.4.2

7 months ago

0.4.0

8 months ago

0.3.1

8 months ago