What’s New in o1js: February 2024

Bridging the gap between Web2 and Web3

image

o1js can now generate proofs of SHA-256 cryptographic hash function within a circuit. This opens up a world of possibilities for various applications in decentralized and traditional systems. For example, you can verify a Merkle tree with SHA-256 hashes or validate Bitcoin block headers for a Bitcoin light client.

Added

  • Configurable NetworkId when declaring a Mina instance. (0.15.4, #1387)
    - Defaults to “testnet”, the other option is “mainnet”
    - The networkId parameter influences the algorithm used for signatures and ensures that testnet transactions can’t be replayed on mainnet
  • SHA256 hash function exposed via Hash.SHA2_256 or Gadgets.SHA256. (0.15.3, #1285)
  • Provable type Packed<T> to pack small field elements into fewer field elements (0.16.0, #1376)
  • Provable type Hashed<T> to represent provable types by their hash (0.16.0, #1377)
    - This also exposes Poseidon.hashPacked() to efficiently hash an arbitrary type

Changed

  • Improve performance of Wasm Poseidon hashing by a factor of 13x (0.15.4, #1378)
    - Speeds up local blockchain tests without proving by ~40%
  • Improve performance of Field inverse (0.15.4, #1373)
    - Speeds up proving by ~2–4%
  • Mina.accountCreationFee() is deprecated in favor of Mina.getNetworkConstants().accountCreationFee. (0.15.3, #1367)
    - Mina.getNetworkConstants() returns:
    - default network constants if used outside of the transaction scope.
    - actual network constants if used within the transaction scope.

Fixed

  • Fix approving of complex account update layouts (0.15.3, #1364)

Breaking Changes

  • Protocol change that adds a “transaction version” to the permission to set verification keys (0.16.0, MinaProtocol/mina #14407)
    - See the relevant Verification Key Permissions RFC for the motivation behind this change.
    - Breaks all deployed contracts, as it changes the account update layout

zkApp CLI Updates

We continue to develop the zkApp CLI with the developer experience in mind.

Added

  • Lightnet! The most efficient way to deploy and run a lightweight Mina blockchain network for testing purposes is to spin up a lightweight Mina network (Lightnet) in a single Docker container. Lightnet is a resource-efficient solution with fast startup and syncing times. Lightnet lets you test your zkApp locally on an accurate representation of the Mina blockchain before you test with a live network.
    - Use the zkApp CLI to start Lightnet zk lightnet start
    - Use zk lightnet --help to see all the options
  • Developer documentation for using Lightnet:
    - zkApp docs Testing zkApps with Lightnet. (#780)
    - zkApp CLI README (#562) @45930
  • Possibility to configure the target network to testnet or mainnet during the zk config process. (0.16.1, #564)

Changed

  • Update project scaffold tsconfig to handle esnext and es2022 targets. (0.16.2, #570)
  • Dependencies updated. (0.16.2, #573)
  • Bump minor version to 0.17.0. (0.17.0, #574)

Shout outs

A strong community helps us build and deliver better software faster. We are always grateful for community members who contribute, engage, explore, and share knowledge.

Thank you to our developers who test, build, and contribute.

We see an uptick in docs use, including new issues and fixes. Thanks to our many docs contributors who submit updates and quick fixes. Did you know you can click EDIT THIS PAGE on any docs page to submit a simple fix?

  • @LuffySama-Dev continues to contribute significant updates and fixes to zkApp docs.
  • @45930 for updating the zkApp CLI README to include Lightnet in response to Discord conversations.

Are you building zkApps with o1js? Help us celebrate you. Tag @o1_labs on Twitter/X when you share your work.

To stay up to date

Follow the official o1Labs @o1_labs on Twitter/X.

To participate

Mina Protocol Discord is the most popular place where Mina enthusiasts and technical contributors gather to share knowledge.

Join us in these zkApps channels:

To contribute

To learn how you can help us improve the functionality and user experience, which in turn helps you build better projects, see: