Changelog
All notable changes to this project are documented in this file.
The format is based on Keep a Changelog. This project adheres to Semantic Versioning.
Unreleased
Added
- Add
KimchiProof.toJSON()andKimchiProof.fromJSON()https://github.com/o1-labs/o1js/pull/2594 - Add
KimchiVerificationKey.toString()andKimchiVerificationKey.fromString()https://github.com/o1-labs/o1js/pull/2594
Internal
- Change cache harness to only allow writes when
dumpmode is active. https://github.com/o1-labs/o1js/pull/2599
2.10.0 - 2025-09-27
Internal
- Added a new internal framework for testing compilation, proving, and verification time regression. https://github.com/o1-labs/o1js/pull/2451
Added
- Internal o1js and protocol constants, hashes and prefixes are now exported via the `Core´ namespace. https://github.com/o1-labs/o1js/pull/2421
- Support for string type input to
Transaction.fromJSONhttps://github.com/o1-labs/o1js/pull/2436 - Improved the runtime table API with a
RuntimeTableclass with better readability https://github.com/o1-labs/o1js/pull/2402
Fixed
- Fixed a verification key regression that was caused by incorrectly enabling a proof system feature that wasn't needed. https://github.com/o1-labs/o1js/pull/2449
- Fixed an edge case where not all the artifacts needed for the cache were stored properly, resulting in them being re-computed after loading the cache. https://github.com/o1-labs/o1js/pull/2460
Deprecated
- Deprecate the
Gates.addRuntimeTableConfigandGadgets.inTablefunctions in favor of theRuntimeTableclass API https://github.com/o1-labs/o1js/pull/2402
2.9.0 - 2025-09-02
Added
- Support for
ForeignField.Unsafe.fromFieldas an alternative constructor https://github.com/o1-labs/o1js/pull/2322
Fixed
- Fixed a performance regression that occurred when proving circuits. https://github.com/o1-labs/o1js/pull/2388
2.8.0 - 2025-08-01
Deprecated
- Deprecate the
CircuitAPI in favor of theZkFunctionAPI. https://github.com/o1-labs/o1js/pull/2245
Added
- Added the
ZkFunctionAPI, exposed via theExperimentalnamespace (Experimental.ZkFunction), which provides the same functionality as theCircuitAPI with a more ergonomic and consistent structure, inspired byZkProgram. https://github.com/o1-labs/o1js/pull/2245
Fixed
- Sourcemaps properly work with the .cjs distribution of
o1jsnow. https://github.com/o1-labs/o1js/pull/2285
2.7.0 - 2025-07-23
Added
- Lazy mode for prover index computation. https://github.com/o1-labs/o1js/pull/2143
- Added reverse functionality to
DynamicArrayand indexedforEachandforEachReversevariants. - Added
ZkProgram.analyzeSingleMethod(methodName: string)to analyze a single method of a ZkProgram. https://github.com/o1-labs/o1js/pull/2217- This is an addition to
ZkProgram.analyzeMethods()which analyzes all methods of a ZkProgram by executing them. - Now only a single method is analyzed at a time.
- This is an addition to
Changed
IndexedMerkleMaphas been promoted from theExperimentalnamespace and is now part of the public API. https://github.com/o1-labs/o1js/pull/2114
Fixed
- The
IndexedMerkleMaproot now includes the tree length in its root(commitment), addressing a vulnerability where a malicious user could insert a larger leaf and render the tree unreconstructable by others.
2.6.0 - 2025-05-30
Added
- API support for circuit chunking. https://github.com/o1-labs/o1js/pull/1905
- work in progress, still requires memory optimizations to be fully functional
- Dynamic array provable type. https://github.com/o1-labs/o1js/pull/1848
2.5.0
Fixed
- Correct handling of actions and events lists as well as internal
AccountUpdateconsistency tests for the new V2 API. https://github.com/o1-labs/o1js/pull/2134
Added
- Improved developer experience and build process.
https://github.com/o1-labs/o1js/pull/2076
- o1js-bindings is no longer a submodule (same directory structure)
- compiled artifacts are now gitignored
npm run build:bindings-downloaddownloads compiled artifacts from githubnpm run build:bindings-remotetriggers a github workflow to build the compiled artifacts then downloads them
- Added bitwise operation methods (xor, not, and, or) to
UInt8class. https://github.com/o1-labs/o1js/pull/2144
Changed
- Bump up Mina to the commit 5a9145feaba3138cd1a1090d8421a8e67a5485e1 https://github.com/o1-labs/o1js/pull/2126
- Bump up Mina to the commit eaca9201, to include the latest changes reg. the move of the Rust codebase to the repository proof-systems. https://github.com/o1-labs/o1js/pull/2128
- Added verification key validity checks to
LocalBlockchain. https://github.com/o1-labs/o1js/pull/2171
2.4.0 - 2025-04-01
Added
- Support of runtime tables https://github.com/o1-labs/o1js/pull/1858
- Experimental Introducing
MinaProgram, a new powerful API for interacting with Mina Protocol. https://github.com/o1-labs/o1js/pull/2095- New functions and types for
MinaProgram
- New functions and types for
- Export various internal functions and types. https://github.com/o1-labs/o1js/pull/2083
- Export part of the core cryptography layer via the
Corenamespace. https://github.com/o1-labs/o1js/pull/2083 - Experimental New bindings layer for new API types. https://github.com/o1-labs/o1js/pull/2032
- Experimental New API types for https://github.com/o1-labs/o1js/pull/2042
AccountUpdate,Account,Authorization,Permissionsetc.- New transaction construction API
new ZkappCommand(). https://github.com/o1-labs/o1js/pull/2042
- Bump up Rust version to 1.79.0. Bindings now depends on nightly-2024-06-13. https://github.com/o1-labs/o1js/pull/2063
setVerificationKeyUnsafestatic method toSmartContract#2091toBits()andfromBits()methods added forUInt32andUInt64classes. https://github.com/o1-labs/o1js/pull/2099- Provable BigInt exposed through the
createProvableBigInt()class factory https://github.com/o1-labs/o1js/pull/2008
2.3.0
Added
toandfromare added as query parameters forfetchActionsandfetchEventshttps://github.com/o1-labs/o1js/pull/2066- Exported the type
FlexibleBytes, previously being used only internally https://github.com/o1-labs/o1js/pull/2015. - Gadgets for 224, 384 and 512 bit variants of SHA2 https://github.com/o1-labs/o1js/pull/1957
setFeeandsetFeePerSnarkCostforTransactionandPendingTransactionhttps://github.com/o1-labs/o1js/pull/1968- Doc comments for various ZkProgram methods https://github.com/o1-labs/o1js/pull/1974
MerkleList.popOption()for popping the last element and also learning if there was one https://github.com/o1-labs/o1js/pull/1997- Added custom header support for
Fetchmethods such asfetchEvents,fetchActionsetc. and toMinainstance. Also added two new methodssetMinaDefaultHeadersandsetArchiveDefaultHeadershttps://github.com/o1-labs/o1js/pull/2004 - Added new method
CircuitString.setEncoding()to change default behavior of theCircuitStringencoding, possible value is"ascii" | "uft-8"default to"ascii". Also added an optionalencoding: CircuitStringEncodingparameter in.toString()and.fromString()to switch encoding temporary. - Added style rules for contributors https://github.com/o1-labs/o1js/pull/2012
- Add new helper functions
Bool.anyTrue(xs)andBool.allTrue(xs). https://github.com/o1-labs/o1js/pull/2038
Changed
- Sort order for actions now includes the transaction sequence number and the exact account id sequence https://github.com/o1-labs/o1js/pull/1917
- Updated typedoc version for generating docs https://github.com/o1-labs/o1js/pull/1973
- Enable to pass normal JS values (e.g.,
bigintinstead ofField) to ZkProgram provers https://github.com/o1-labs/o1js/pull/1934- Also improves the supported JS values for a few important types like
SignatureandUIntX
- Also improves the supported JS values for a few important types like
- ECDSA
verifySignedHash()accepts hashBytesdirectly for easy use with alternative hash functions https://github.com/o1-labs/o1js/pull/2005
Fixed
- Fix behavior of
initializeBindings()when called concurrently, to improve error messages in common failure scenarios https://github.com/o1-labs/o1js/pull/1996 - Fix
ZkProgrampublic input/output types https://github.com/o1-labs/o1js/pull/1998
2.2.0 - 2024-12-10
Added
ZkProgramto support non-pure provable types as inputs and outputs https://github.com/o1-labs/o1js/pull/1828- APIs for recursively proving a ZkProgram method from within another
https://github.com/o1-labs/o1js/pull/1931
https://github.com/o1-labs/o1js/pull/1932
let recursive = Experimental.Recursive(program);recursive.<methodName>(...args): Promise<PublicOutput>recursive.<methodName>.if(condition, ...args): Promise<PublicOutput>- This also works within the same program, as long as the return value is type-annotated
- Add
enforceTransactionLimitsparameter on Network https://github.com/o1-labs/o1js/issues/1910 - Method for optional types to assert none https://github.com/o1-labs/o1js/pull/1922
- Increased maximum supported amount of methods in a
SmartContractorZkProgramto 30. https://github.com/o1-labs/o1js/pull/1918 - Expose low-level conversion methods
Proof.{_proofToBase64,_proofFromBase64}https://github.com/o1-labs/o1js/pull/1928 - Expose
maxProofsVerified()and aProofclass directly on ZkPrograms https://github.com/o1-labs/o1js/pull/1933
Changed
- Changed an internal type to improve IntelliSense on ZkProgram methods https://github.com/o1-labs/o1js/pull/1933
- Updated o1js nix devshell to build rust on all executions of
npm run build:update-bindings
Fixed
- Compiling stuck in the browser for recursive zkprograms https://github.com/o1-labs/o1js/pull/1906
- Error message in
rangeCheck16gadget https://github.com/o1-labs/o1js/pull/1920 - Deprecate
testnetnetworkIdin favor ofdevnethttps://github.com/o1-labs/o1js/pull/1938 - Fix event data type inconsistency between LocalBlockchain and Mina https://github.com/o1-labs/o1js/pull/1975
2.1.0 - 2024-11-13
Added
- Support secp256r1 in elliptic curve and ECDSA gadgets https://github.com/o1-labs/o1js/pull/1885
Fixed
- Witness generation error in
Gadgets.arrayGet()when accessing out-of-bounds indices https://github.com/o1-labs/o1js/pull/1886
2.0.0
Breaking Changes
- The
divMod32()gadget was modified to acceptnBitsinstead ofquotientBits, and assert it is in the range [0, 2**255) to address an issue previously where the bound onquotientBitswas too low https://github.com/o1-labs/o1js/pull/1763. Provable.equal()now turns both types into canonical form before comparing them https://github.com/o1-labs/o1js/pull/1759- Removed implicit version
Provable.equal(x, y)where you didn't have to pass in the type
- Removed implicit version
- The return signature of a zkProgram has changed.
https://github.com/o1-labs/o1js/pull/1809
- A zkProgram method must now explicitly define the return type of the method when the method has a public or auxiliary output defined.
- The return type of a proven method has changed as a result of this.
- Various breaking constraint changes in internal methods or circuits because of audit fix.
- Removal of various deprecated methods and functions.
- Promotion of various methods and functions to stable as part of change.
- A slightly modified encryption and decryption algorithm. https://github.com/o1-labs/o1js/pull/1729
- Promotion of
TokenContractV2toTokenContractwith a correct amount of maximum account updates.
Added
ZkProgrammethods now supportauxiliaryOutput. https://github.com/o1-labs/o1js/pull/1809- Each program method now accepts an optional property
auxiliaryOutput - Auxiliary output is additional output that the zkProgram method returns
- Each program method now accepts an optional property
- New method
toCanonical()in theProvable<T>interface to protect against incompleteness of certain operations on malicious witness inputs https://github.com/o1-labs/o1js/pull/1759 divMod64()division modulo 2^64 that returns the remainder and quotient of the operationaddMod64()addition modulo 2^64- Bitwise OR via
{UInt32, UInt64}.or() - BLAKE2B hash function gadget. https://github.com/o1-labs/o1js/pull/1767
1.9.1 - 2024-10-15
Fixes
- Performance regression when compiling recursive circuits is fixed https://github.com/o1-labs/o1js/pull/1874
- Decouple offchain state instances from their definitions https://github.com/o1-labs/o1js/pull/1834
1.9.0 - 2024-10-15
Added
- Added
VerificationKey.dummy()method to get the dummy value of a verification key https://github.com/o1-labs/o1js/pull/1852 @rpanic
Changed
- Make
Proofa normal provable type, that can be witnessed and composed into Structs https://github.com/o1-labs/o1js/pull/1847, https://github.com/o1-labs/o1js/pull/1851- ZkProgram and SmartContract now also support private inputs that are not proofs themselves, but contain proofs nested within a Struct or array
- Only
SelfProofcan still not be nested because it needs special treatment
Fixes
- Fix verification of serialized proofs done before compiling any circuits https://github.com/o1-labs/o1js/pull/1857
1.8.0 - 2024-09-18
Added
- Added
verifyEthersmethod to verify Ethereum signatures using the EIP-191 message hashing standard. https://github.com/o1-labs/o1js/pull/1815- Added
fromEthersmethod for parsing and converting Ethereum public keys intoForeignCurvepoints, supporting both compressed and uncompressed formats. - Added
fromHexmethod for converting hexadecimal strings intoForeignCurvepoints.
- Added
Fixes
- Fix incorrect behavior of optional proving for zkPrograms where
myProgram.setProofsEnabled(false)wouldn't work when called beforemyProgram.compile(). https://github.com/o1-labs/o1js/pull/1827 - Fix incorrect behavior of
state.fetch()for custom token contracts. @rpanic https://github.com/o1-labs/o1js/pull/1853
1.7.0 - 2024-09-04
Added
- Added
Encryption.encryptV2()andEncryption.decryptV2()for an updated encryption algorithm that guarantees cipher text integrity.- Also added
Encryption.encryptBytes()andEncryption.decryptBytes()using the same algorithm.
- Also added
- New option
proofsEnabledforzkProgram(default value:true), to quickly test circuit logic with proofs disabled https://github.com/o1-labs/o1js/pull/1805- Additionally added
MyProgram.proofsEnabledto get the internal value ofproofsEnabledandMyProgram.setProofsEnabled(proofsEnabled)to set the value dynamically.
- Additionally added
Deprecated
this.sender.getAndRequireSignature()/getUnconstrained()deprecated in favor ofV2versions due to a vulnerability https://github.com/o1-labs/o1js/pull/1799
Fixes
- Fix behavior of
Int64.modV2()when the input is negative and the remainder should be 0 https://github.com/o1-labs/o1js/pull/1797
1.6.0 - 2024-07-23
Added
SmartContract.emitEventIf()to conditionally emit an event https://github.com/o1-labs/o1js/pull/1746- Added
Encryption.encryptV2()andEncryption.decryptV2()for an updated encryption algorithm that guarantees cipher text integrity.- Also added
Encryption.encryptBytes()andEncryption.decryptBytes()using the same algorithm.
- Also added
Changed
- Reduced maximum bit length for
xor,not, andand, operations from 254 to 240 bits to prevent overflow vulnerabilities. https://github.com/o1-labs/o1js/pull/1745 - Allow using
Typeinstead ofType.provablein APIs that expect a provable type https://github.com/o1-labs/o1js/pull/1751- Example:
Provable.witness(Bytes32, () => bytes)
- Example:
- Automatically wrap and unwrap
UnconstrainedinfromValueandtoValue, so that we don't need to deal with "unconstrained" values outside provable code https://github.com/o1-labs/o1js/pull/1751
1.5.0 - 2024-07-09
Breaking changes
- Fixed a vulnerability in
OffchainStatewhere it didn't store theIndexedMerkleTreelength onchain and left it unconstrained https://github.com/o1-labs/o1js/pull/1676
Added
- A warning about the current reducer API limitations, as well as a mention of active work to mitigate them was added to doc comments and examples https://github.com/o1-labs/o1js/pull/1728
ForeignField-based representation of scalars viaScalarFieldhttps://github.com/o1-labs/o1js/pull/1705- Introduced new V2 methods for nullifier operations:
isUnusedV2(),assertUnusedV2(), andsetUsedV2()https://github.com/o1-labs/o1js/pull/1715 Int64.create()method for safe instance creation with canonical zero representation https://github.com/o1-labs/o1js/pull/1735- New V2 methods for
Int64operations:fromObjectV2,divV2()https://github.com/o1-labs/o1js/pull/1735 Experimental.BatchReducerto reduce actions in batches https://github.com/o1-labs/o1js/pull/1676- Avoids the account update limit
- Handles arbitrary numbers of pending actions thanks to recursive validation of the next batch
- Add conditional versions of all preconditions:
.requireEqualsIf()https://github.com/o1-labs/o1js/pull/1676 AccountUpdate.createIf()to conditionally add an account update to the current transaction https://github.com/o1-labs/o1js/pull/1676IndexedMerkleMap.setIf()to set a key-value pair conditionally https://github.com/o1-labs/o1js/pull/1676Provable.assertEqualIf()to conditionally assert that two values are equal https://github.com/o1-labs/o1js/pull/1676- Add
offchainState.setContractClass()which enables us to declare the connected contract at the top level, without creating a contract instance https://github.com/o1-labs/o1js/pull/1676- This is enough to call
offchainState.compile()
- This is enough to call
- More low-level methods to interact with
MerkleListhttps://github.com/o1-labs/o1js/pull/1676popIfUnsafe(),toArrayUnconstrained()andlengthUnconstrained()
Changed
- Improve error message when o1js global state is accessed in an invalid way https://github.com/o1-labs/o1js/pull/1676
- Start developing an internal framework for local zkapp testing https://github.com/o1-labs/o1js/pull/1676
- Internally upgrade o1js to TypeScript 5.4 https://github.com/o1-labs/o1js/pull/1676
Deprecated
- Deprecated
Nullifier.isUnused(),Nullifier.assertUnused(), andNullifier.setUsed()methods https://github.com/o1-labs/o1js/pull/1715 createEcdsa,createForeignCurve,ForeignCurveandEcdsaSignaturedeprecated in favor ofV2versions due to a security vulnerability found in the current implementation https://github.com/o1-labs/o1js/pull/1703Int64constructor, recommendingInt64.create()instead https://github.com/o1-labs/o1js/pull/1735- Original
div()andfromObject, methods in favor of V2 versions https://github.com/o1-labs/o1js/pull/1735 - Deprecate
AccountUpdate.defaultAccountUpdate()in favor ofAccountUpdate.default()https://github.com/o1-labs/o1js/pull/1676
Fixed
- Fix reversed order of account updates when using
TokenContract.approveAccountUpdates()https://github.com/o1-labs/o1js/pull/1722 - Fixed the static
check()method in Struct classes to properly handle inheritance, preventing issues with under-constrained circuits. Added error handling to avoid using Struct directly as a field type. https://github.com/o1-labs/o1js/pull/1707 - Fixed that
Optioncould not be used as@stateor event https://github.com/o1-labs/o1js/pull/1736
1.4.0 - 2024-06-25
Added
- SHA256 low-level API exposed via
Gadgets.SHA256. https://github.com/o1-labs/o1js/pull/1689 @Shigoto-dev19 - Added the option to specify custom feature flags for sided loaded proofs in
the
DynamicProofclass. https://github.com/o1-labs/o1js/pull/1688- Feature flags are required to tell Pickles what proof structure it should expect when side loading dynamic proofs and verification keys.
FeatureFlagsis now exported and provides a set of helper functions to compute feature flags correctly.
Deprecated
MerkleMap.computeRootAndKey()deprecated in favor ofMerkleMap.computeRootAndKeyV2()due to a potential issue of computing hash collisions in key indices https://github.com/o1-labs/o1js/pull/1694
1.3.1 - 2024-06-11
Breaking Changes
- Improve efficiency of
Experimental.OffchainStateimplementation https://github.com/o1-labs/o1js/pull/1672- Comes with breaking changes to the internal circuits of
OffchainState - Also, introduce
offchainState.commitments()to initialize the state commitments onchain. UsingOffchainStateCommitments.empty()no longer works.
- Comes with breaking changes to the internal circuits of
Added
Experimental.IndexedMerkleMap, a better primitive for Merkleized storage https://github.com/o1-labs/o1js/pull/1666 https://github.com/o1-labs/o1js/pull/1671- Uses 4-8x fewer constraints than
MerkleMap - In contrast to
MerkleTreeandMerkleMap,IndexedMerkleMaphas a high-level API that can be used in provable code
- Uses 4-8x fewer constraints than
- Added
Ecdsa.verifyV2()andEcdsa.verifySignedHashV2methods to theEcdsaclass. https://github.com/o1-labs/o1js/pull/1669
Deprecated
Int64.isPositive()andInt64.mod()deprecated because they behave incorrectly on-0https://github.com/o1-labs/o1js/pull/1660- This can pose an attack surface, since it is easy to maliciously pick either
the
+0or the-0representation - Use
Int64.isPositiveV2()andInt64.modV2()instead - Also deprecated
Int64.neg()in favor ofInt64.negV2(), for compatibility with v2 version ofInt64that will useInt64.checkV2()
- This can pose an attack surface, since it is easy to maliciously pick either
the
Ecdsa.verify()andEcdsa.verifySignedHash()deprecated in favor ofEcdsa.verifyV2()andEcdsa.verifySignedHashV2()due to a security vulnerability found in the current implementation https://github.com/o1-labs/o1js/pull/1669
Fixed
- Fix handling of fetch response for non-existing accounts https://github.com/o1-labs/o1js/pull/1679
1.3.0 - 2024-05-23
Added
- Added
base64Encode()andbase64Decode(byteLength)methods to theBytesclass. https://github.com/o1-labs/o1js/pull/1659
Fixes
- Fix type inference for
method.returns(Type), to require a matching return signature https://github.com/o1-labs/o1js/pull/1653 - Fix
Struct.empty()returning a garbage object when one of the base types doesn't supportempty()https://github.com/o1-labs/o1js/pull/1657 - Fix
Option.value_exn Noneerror when using certain custom gates in combination with recursion https://github.com/o1-labs/o1js/issues/1336 https://github.com/MinaProtocol/mina/pull/15588
1.2.0 - 2024-05-14
Added
- Offchain state MVP exported under
Experimental.OffchainStatehttps://github.com/o1-labs/o1js/pull/1630 https://github.com/o1-labs/o1js/pull/1652- allows you to store any number of fields and key-value maps on your zkApp
- implemented using actions which define an offchain Merkle tree
Optionfor defining an optional version of any provable type https://github.com/o1-labs/o1js/pull/1630MerkleTree.clone()andMerkleTree.getLeaf(), new convenience methods for merkle trees https://github.com/o1-labs/o1js/pull/1630MerkleList.forEach(), a simple and safe way for iterating over aMerkleListUnconstrained.provableWithEmpty()to create an unconstrained provable type with a knownempty()value https://github.com/o1-labs/o1js/pull/1630Permissions.VerificationKey, a namespace for verification key permissions https://github.com/o1-labs/o1js/pull/1639- Includes more accurate names for the
impossibleandproofpermissions for verification keys, which are now calledimpossibleDuringCurrentVersionandproofDuringCurrentVersionrespectively.
- Includes more accurate names for the
Changed
State()now optionally accepts an initial value as input parameter https://github.com/o1-labs/o1js/pull/1630- Example:
@state(Field) x = State(Field(1)); - Initial values will be set in the default
init()method - You no longer need a custom
init()method to set initial values
- Example:
Fixes
- Fix absolute imports which prevented compilation in some TS projects that used o1js https://github.com/o1-labs/o1js/pull/1628
1.1.0 - 2024-04-30
Added
- Exposed sideloaded verification keys
https://github.com/o1-labs/o1js/pull/1606 @rpanic
- Added Proof type
DynamicProofthat allows verification through specifying a verification key in-circuit
- Added Proof type
Provable.witnessFields()to easily witness a tuple of field elements https://github.com/o1-labs/o1js/pull/1229- Example for implementing RSA verification in o1js
https://github.com/o1-labs/o1js/pull/1229
@Shigoto-dev19
- Check out https://github.com/o1-labs/o1js/blob/main/src/examples/crypto/rsa/rsa.ts and tests in the same folder
Changed
Gadgets.rangeCheck64()now returns individual range-checked limbs for advanced use cases https://github.com/o1-labs/o1js/pull/1229
Fixed
- Fixed issue in
UInt64.rightShift()where it incorrectly performed a left shift instead of a right shift. https://github.com/o1-labs/o1js/pull/1617 - Fixed issue in
ForeignField.toBits()where high limbs were under-constrained for input length less than 176. https://github.com/o1-labs/o1js/pull/1617 - Make
dummyBase64Proof()lazy. Significant speed up when generating many account updates with authorizationProofwhile proofs turned off. https://github.com/o1-labs/o1js/pull/1624
1.0.1 - 2024-04-22
Breaking changes
- Native curve improvements https://github.com/o1-labs/o1js/pull/1530
- Change the internal representation of
Scalarfrom 255 Bools to 1 Bool and 1 Field (low bit and high 254 bits) - Make
Group.scale()support all scalars (previously did not support 0, 1 and -1) - Make
Group.scale()directly acceptFieldelements, and much more efficient than previous methods of scaling by Fields- As a result,
Signature.verify()andNullifier.verify()use much fewer constraints
- As a result,
- Fix
Scalar.fromBits()to not produce a shifted scalar; shifting is no longer exposed to users ofScalar.
- Change the internal representation of
- Add assertion to the foreign EC addition gadget that prevents degenerate cases
https://github.com/o1-labs/o1js/pull/1545
- Fixes soundness of ECDSA; slightly increases its constraints from ~28k to 29k
- Breaks circuits that used EC addition, like ECDSA
Mina.LocalBlockchain()andProof.fromJSON()are made async https://github.com/o1-labs/o1js/pull/1583- These were the last remaining sync APIs that depended on an async setup task; making them async enables removing top-level await
Mina.LocalBlockchainno longer supports the network kind configuration https://github.com/o1-labs/o1js/pull/1581Poseidon.hashToGroup()now returns aGroupdirectly, and constrains it to be deterministic https://github.com/o1-labs/o1js/pull/1546- Added
Poseidon.Unsafe.hashToGroup()as a more efficient, non-deterministic version for advanced use cases
- Added
- A
Transaction'sprovemethod no longer returns the proofs promise directly, but rather returns aTransactionpromise, the resolved value of which contains aproofsprop. https://github.com/o1-labs/o1js/pull/1567 - The
Transactiontype now has two type paramsProven extends booleanandSigned extends boolean, which are used to conditionally show/hide relevant state. https://github.com/o1-labs/o1js/pull/1567 - Improved functionality of
MerkleListandMerkleListIteratorfor easier traversal ofMerkleLists. https://github.com/o1-labs/o1js/pull/1562 - Simplified internal logic of reducer.
https://github.com/o1-labs/o1js/pull/1577
contract.getActions()now returns aMerkleList
- Add
toValue()andfromValue()interface toProvable<T>to encode how provable types map to plain JS values https://github.com/o1-labs/o1js/pull/1271- You can now return the plain value from a
Provable.witness()callback, and it will be transformed into the provable type
- You can now return the plain value from a
- Remove
Account()constructor which was no different fromAccountUpdate.create().account, and exportAccounttype instead. https://github.com/o1-labs/o1js/pull/1598
Added
- Export
EventsunderAccountUpdate.Events. https://github.com/o1-labs/o1js/pull/1563 Mina.transactionhas been reworked such that one can call methods directly on the returned promise (now aTransactionPromise). This enables a fluent / method-chaining API. https://github.com/o1-labs/o1js/pull/1567TransactionPendingPromiseenables callingwaitdirectly on the promise returned by callingsendon aTransaction. https://github.com/o1-labs/o1js/pull/1567initializeBindings()to explicitly trigger setup work that is needed when running provable code https://github.com/o1-labs/o1js/pull/1583- calling this function is optional
Changed
- Remove top-level await https://github.com/o1-labs/o1js/pull/1583
- To simplify integration with bundlers like webpack
- Make
MerkleTree.{nodes,zeroes}public properties https://github.com/o1-labs/o1js/pull/1555- This makes it possible to clone merkle trees, which is often needed
Fixed
- Fix error when computing Merkle map witnesses, introduced in the last version
due to the
toBits()change https://github.com/o1-labs/o1js/pull/1559 - Improved error message when compiling a program that has no methods. https://github.com/o1-labs/o1js/pull/1563
0.18.0 - 2024-04-09
Breaking changes
- Async circuits. Require all smart contract and zkprogram methods to be
async https://github.com/o1-labs/o1js/pull/1477
- This change allows you to use
awaitinside your methods. Change the method signature by adding theasynckeyword. - Don't forget to add
awaitto all contract calls!await MyContract.myMethod(); - To declare a return value from a method, use the new
@method.returns()decorator
- This change allows you to use
- Require the callback to
Mina.transaction()to be async https://github.com/o1-labs/o1js/pull/1468 - Change
{SmartContract,ZkProgram}.analyzeMethods()to be async https://github.com/o1-labs/o1js/pull/1450Provable.runAndCheck(),Provable.constraintSystem()and{SmartContract,ZkProgram}.digest()are also async now
- Remove deprecated APIs
- Remove
CircuitValue,prop,arrayPropandmatrixProphttps://github.com/o1-labs/o1js/pull/1507 - Remove
Mina.accountCreationFee(),Mina.BerkeleyQANet, all APIs which accept private keys for feepayers,Token,AccountUpdate.tokenSymbol,SmartContract.{token, setValue, setPermissions}, "assert" methods for preconditions,MerkleTee.calculateRootSlow(),Scalar.fromBigInt(),UInt64.lt()and friends, deprecated static methods onGroup, utility methods onCircuitlikeCircuit.if(),Field.isZero(),isReadyandshutdown()https://github.com/o1-labs/o1js/pull/1515
- Remove
- Remove
privateKeyfrom the accepted arguments ofSmartContract.deploy()https://github.com/o1-labs/o1js/pull/1515 - Efficient comparisons. Support arbitrary bit lengths for
Fieldcomparisons and massively reduce their constraints https://github.com/o1-labs/o1js/pull/1523Field.assertLessThan()goes from 510 to 24 constraints,Field.lessThan()from 509 to 38- Moderately improve other comparisons:
UInt64.assertLessThan()from 27 to 14,UInt64.lessThan()from 27 to 15,UInt32similar. - Massively improve
Field.isEven(), addField.isOdd() PrivateKey.toPublicKey()from 358 to 119 constraints thanks toisOdd()- Add
Gadgets.ForeignField.assertLessThanOrEqual()and support two variables as input toForeignField.assertLessThan()
- Remove
this.senderwhich unintuitively did not prove that its value was the actual sender of the transaction https://github.com/o1-labs/o1js/pull/1464 @julio4 Replaced by more explicit APIs:this.sender.getUnconstrained()which has the old behavior ofthis.sender, and returns an unconstrained value (which means that the prover can set it to any value they want)this.sender.getAndRequireSignature()which requires a signature from the sender's public key and therefore proves that whoever created the transaction really owns the sender account
Reducer.reduce()requires the maximum number of actions per method as an explicit (optional) argument https://github.com/o1-labs/o1js/pull/1450- The default value is 1 and should work for most existing contracts
new UInt64()andUInt64.from()no longer unsafely accept a field element as input. https://github.com/o1-labs/o1js/pull/1438 @julio4 As a replacement,UInt64.Unsafe.fromField()was introduced- This prevents you from accidentally creating a
UInt64without proving that it fits in 64 bits - Equivalent changes were made to
UInt32
- This prevents you from accidentally creating a
- Fixed vulnerability in
Field.to/fromBits()outlined in #1023 by imposing a limit of 254 bits https://github.com/o1-labs/o1js/pull/1461 - Remove
Field.rangeCheckHelper()which was too low-level and easy to misuse https://github.com/o1-labs/o1js/pull/1485- Also, rename the misleadingly named
Gadgets.isInRangeN()toGadgets.isDefinitelyInRangeN()
- Also, rename the misleadingly named
- Rename
Bool.Unsafe.ofField()toBool.Unsafe.fromField()https://github.com/o1-labs/o1js/pull/1485 - Replace the namespaced type exports
Gadgets.Field3andGadgets.ForeignField.SumwithField3andForeignFieldSum- Unfortunately, the namespace didn't play well with auto-imports in TypeScript
- Add
Gadgets.rangeCheck3x12()and fix proof system bug that prevented it from working https://github.com/o1-labs/o1js/pull/1534 - Update transaction version and other bindings changes to ensure berkeley compatibility https://github.com/o1-labs/o1js/pull/1542
Added
Provable.witnessAsync()to introduce provable values from an async callback https://github.com/o1-labs/o1js/pull/1468- Internal benchmarking tooling to keep track of performance https://github.com/o1-labs/o1js/pull/1481
- Add
toInputmethod forGroupinstance https://github.com/o1-labs/o1js/pull/1483
Changed
field.assertBool()now also returns theFieldas aBoolfor ergonomics https://github.com/o1-labs/o1js/pull/1523
0.17.0 - 2024-03-06
Breaking changes
- Fixed parity between
Mina.LocalBlockchainandMina.Networkto have the same behaviors https://github.com/o1-labs/o1js/pull/1422 https://github.com/o1-labs/o1js/pull/1480- Changed the
TransactionIdtype toTransaction. Additionally addedPendingTransactionandRejectedTransactiontypes to better represent the state of a transaction. Transaction.safeSend()andPendingTransaction.safeWait()are introduced to return aIncludedTransactionorRejectedTransactionobject without throwing errors.transaction.send()throws an error if the transaction was not successful for bothMina.LocalBlockchainandMina.Networkand returns aPendingTransactionobject if it was successful. Usetransaction.safeSendto send a transaction that will not throw an error and either return aPendingTransactionorRejectedTransaction.transaction.wait()throws an error if the transaction was not successful for bothMina.LocalBlockchainandMina.Networkand returns aIncludedTransactionobject if it was successful. Usetransaction.safeWaitto send a transaction that will not throw an error and either return aIncludedTransactionorRejectedTransaction.transaction.hash()is no longer a function, it is now a property that returns the hash of the transaction.- Changed
Transaction.isSuccesstoTransaction.statusto better represent the state of a transaction.
- Changed the
- Improved efficiency of computing
AccountUpdate.callDataby packing field elements into as few field elements as possible https://github.com/o1-labs/o1js/pull/1458- This leads to a large reduction in the number of constraints used when
inputs to a zkApp method are many field elements (e.g. a long list of
Bools)
- This leads to a large reduction in the number of constraints used when
inputs to a zkApp method are many field elements (e.g. a long list of
- Return events in the
LocalBlockchainin reverse chronological order (latest events at the beginning) to match the behavior of theNetworkhttps://github.com/o1-labs/o1js/pull/1460
Added
- Support for custom network identifiers other than
mainnetortestnethttps://github.com/o1-labs/o1js/pull/1444 PrivateKey.randomKeypair()to generate private and public key in one command https://github.com/o1-labs/o1js/pull/1446setNumberOfWorkers()to allow developer to override the number of workers used during compilation and proof generation/verification https://github.com/o1-labs/o1js/pull/1456
Changed
- Improve all-around performance by reverting the Apple silicon workaround (https://github.com/o1-labs/o1js/pull/683) as the root problem is now fixed upstream https://github.com/o1-labs/o1js/pull/1456
- Improved error message when trying to use
fetchActions/fetchEventswith a missing Archive Node endpoint https://github.com/o1-labs/o1js/pull/1459
Deprecated
SmartContract.tokenis deprecated in favor of new methods onTokenContracthttps://github.com/o1-labs/o1js/pull/1446TokenContract.deriveTokenId()to get the ID of the managed tokenTokenContract.internal.{send, mint, burn}to perform token operations from within the contract
Fixed
- Mitigate security hazard of deploying token contracts https://github.com/o1-labs/o1js/issues/1439
- Make
Circuithandle types with a.provableproperty (like those used in ECDSA) https://github.com/o1-labs/o1js/pull/1471- To support offchain, non-Pickles proofs of ECDSA signatures
0.16.1
Breaking changes
- Remove
AccountUpdate.childrenandAccountUpdate.parentproperties https://github.com/o1-labs/o1js/pull/1402- Also removes the optional
AccountUpdatesLayoutargument toapprove() - Adds
AccountUpdateTreeandAccountUpdateForest, new classes that represent a layout of account updates explicitly - Both of the new types are now accepted as inputs to
approve() accountUpdate.extractTree()to obtain the tree associated with an account update in the current transaction context.
- Also removes the optional
- Remove
Experimental.CallbackAPI https://github.com/o1-labs/o1js/pull/1430
Added
MerkleList<T>to enable provable operations on a dynamically-sized list https://github.com/o1-labs/o1js/pull/1398- including
MerkleListIterator<T>to iterate over a merkle list
- including
TokenContract, a new base smart contract class for token contracts https://github.com/o1-labs/o1js/pull/1384- Usage example:
https://github.com/o1-labs/o1js/blob/main/src/lib/mina/token/token-contract.unit-test.ts
- Usage example:
TokenAccountUpdateIterator, a primitive to iterate over all token account updates in a transaction https://github.com/o1-labs/o1js/pull/1398- this is used to implement
TokenContractunder the hood
- this is used to implement
Fixed
- Mainnet support. https://github.com/o1-labs/o1js/pull/1437
0.16.0
Breaking changes
- Protocol change that adds a "transaction version" to the permission to set
verification keys https://github.com/MinaProtocol/mina/pull/14407
- See the relevant RFC for the motivation behind this change
- Breaks all deployed contracts, as it changes the account update layout
Added
- Provable type
Packed<T>to pack small field elements into fewer field elements https://github.com/o1-labs/o1js/pull/1376 - Provable type
Hashed<T>to represent provable types by their hash https://github.com/o1-labs/o1js/pull/1377- This also exposes
Poseidon.hashPacked()to efficiently hash an arbitrary type
- This also exposes
Changed
- Reduce number of constraints of ECDSA verification by 5% https://github.com/o1-labs/o1js/pull/1376
0.15.4
Changed
- Improve performance of Wasm Poseidon hashing by a factor of 13x
https://github.com/o1-labs/o1js/pull/1378
- Speeds up local blockchain tests without proving by ~40%
- Improve performance of Field inverse https://github.com/o1-labs/o1js/pull/1373
- Speeds up proving by ~2-4%
Added
- Configurable
networkIdwhen declaring a Mina instance. https://github.com/o1-labs/o1js/pull/1387- Defaults to
"testnet", the other option is"mainnet" - The
networkIdparameter influences the algorithm used for signatures, and ensures that testnet transactions can't be replayed on mainnet
- Defaults to
0.15.3
Added
- SHA256 hash function exposed via
Hash.SHA2_256orGadgets.SHA256. https://github.com/o1-labs/o1js/pull/1285
Changed
Mina.accountCreationFee()is deprecated in favor ofMina.getNetworkConstants().accountCreationFee. https://github.com/o1-labs/o1js/pull/1367
Fixed
- Fix approving of complex account update layouts https://github.com/o1-labs/o1js/pull/1364
0.15.2
Fixed
- Fix bug in
Hash.hash()which always resulted in an error https://github.com/o1-labs/o1js/pull/1346
0.15.1
Breaking changes
- Rename
Gadgets.rotate()toGadgets.rotate64()to better reflect the amount of bits the gadget operates on. https://github.com/o1-labs/o1js/pull/1259 - Rename
Gadgets.{leftShift(), rightShift()}toGadgets.{leftShift64(), rightShift64()}to better reflect the amount of bits the gadget operates on. https://github.com/o1-labs/o1js/pull/1259
Added
- Non-native elliptic curve operations exposed through
createForeignCurve()class factory https://github.com/o1-labs/o1js/pull/1007 - ECDSA signature verification exposed through
createEcdsa()class factory https://github.com/o1-labs/o1js/pull/1240 https://github.com/o1-labs/o1js/pull/1007 https://github.com/o1-labs/o1js/pull/1307- For an example, see
./src/examples/crypto/ecdsa
- For an example, see
- Keccak/SHA3 hash function exposed on
Keccaknamespace https://github.com/o1-labs/o1js/pull/1291 Hashnamespace which holds all hash functions https://github.com/o1-labs/o1js/pull/999Bytes, provable type to hold a byte array, which serves as input and output for Keccak variantsUInt8, provable type to hold a single byte, which is constrained to be in the 0 to 255 range
Gadgets.rotate32()for rotation over 32 bit values https://github.com/o1-labs/o1js/pull/1259Gadgets.leftShift32()for left shift over 32 bit values https://github.com/o1-labs/o1js/pull/1259Gadgets.divMod32()division modulo 2^32 that returns the remainder and quotient of the operation https://github.com/o1-labs/o1js/pull/1259Gadgets.rangeCheck32()range check for 32 bit values https://github.com/o1-labs/o1js/pull/1259Gadgets.addMod32()addition modulo 2^32 https://github.com/o1-labs/o1js/pull/1259- Expose new bitwise gadgets on
UInt32andUInt64https://github.com/o1-labs/o1js/pull/1259- bitwise XOR via
{UInt32, UInt64}.xor() - bitwise NOT via
{UInt32, UInt64}.not() - bitwise ROTATE via
{UInt32, UInt64}.rotate() - bitwise LEFTSHIFT via
{UInt32, UInt64}.leftShift() - bitwise RIGHTSHIFT via
{UInt32, UInt64}.rightShift() - bitwise AND via
{UInt32, UInt64}.and()
- bitwise XOR via
- Example for using actions to store a map data structure https://github.com/o1-labs/o1js/pull/1300
Provable.constraintSystem()and{ZkProgram,SmartContract}.analyzeMethods()return asummary()method to return a summary of the constraints used by a method https://github.com/o1-labs/o1js/pull/1007assert()asserts that a given statement is true https://github.com/o1-labs/o1js/pull/1285
Fixed
- Fix stack overflows when calling provable methods with large inputs https://github.com/o1-labs/o1js/pull/1334
- Fix
Local.setProofsEnabled()which would not get picked up bydeploy()https://github.com/o1-labs/o1js/pull/1330 - Remove usage of private class fields in core types like
Field, for better type compatibility between different o1js versions https://github.com/o1-labs/o1js/pull/1319
0.15.0
Breaking changes
ZkProgram.compile()now returns the verification key and its hash, to be consistent withSmartContract.compile()https://github.com/o1-labs/o1js/pull/1292 @rpanic
Added
- Foreign field arithmetic exposed through the
createForeignField()class factory https://github.com/o1-labs/snarkyjs/pull/985 Cryptonamespace which exposes elliptic curve and finite field arithmetic on bigints, as well as example curve parameters https://github.com/o1-labs/o1js/pull/1240Gadgets.ForeignField.assertMul()for efficiently constraining products of sums in non-native arithmetic https://github.com/o1-labs/o1js/pull/1262Unconstrainedfor safely maintaining unconstrained values in provable code https://github.com/o1-labs/o1js/pull/1262Gadgets.rangeCheck8()to assert that a value fits in 8 bits https://github.com/o1-labs/o1js/pull/1288
Changed
- Change precondition APIs to use "require" instead of "assert" as the verb, to
distinguish them from provable assertions.
@LuffySama-Dev
this.x.getAndAssertEquals()is nowthis.x.getAndRequireEquals()https://github.com/o1-labs/o1js/pull/1263this.x.assertEquals(x)is nowthis.x.requireEquals(x)https://github.com/o1-labs/o1js/pull/1263this.account.x.getAndAssertEquals(x)is nowthis.account.x.requireEquals(x)https://github.com/o1-labs/o1js/pull/1265this.account.x.assertBetween()is nowthis.account.x.requireBetween()https://github.com/o1-labs/o1js/pull/1265this.network.x.getAndAssertEquals()is nowthis.network.x.getAndRequireEquals()https://github.com/o1-labs/o1js/pull/1265
Provable.constraintSystem()and{ZkProgram,SmartContract}.analyzeMethods()return aprint()method for pretty-printing the constraint system https://github.com/o1-labs/o1js/pull/1240
Fixed
- Fix missing recursive verification of proofs in smart contracts https://github.com/o1-labs/o1js/pull/1302
0.14.2
Breaking changes
- Change return signature of
ZkProgram.analyzeMethods()to be a keyed object https://github.com/o1-labs/o1js/pull/1223
Added
- Provable non-native field arithmetic:
Gadgets.ForeignField.{add, sub, sumchain}()for addition and subtraction https://github.com/o1-labs/o1js/pull/1220Gadgets.ForeignField.{mul, inv, div}()for multiplication and division https://github.com/o1-labs/o1js/pull/1223
- Comprehensive internal testing of constraint system layouts generated by new gadgets https://github.com/o1-labs/o1js/pull/1241 https://github.com/o1-labs/o1js/pull/1220
Changed
Lightnetnamespace API updates with addedlistAcquiredKeyPairs()method https://github.com/o1-labs/o1js/pull/1256- Expose raw provable methods of a
ZkProgramonzkProgram.rawMethodshttps://github.com/o1-labs/o1js/pull/1241 - Reduce number of constraints needed by
rotate(),leftShift()and,rightShift()gadgets https://github.com/o1-labs/o1js/pull/1201
Fixed
- Add a parameter to
checkZkappTransactionfor block length to check for transaction inclusion. This fixes a case whereTransaction.wait()only checked the latest block, which led to an error once the transaction was included in a block that was not the latest. https://github.com/o1-labs/o1js/pull/1239
0.14.1
Added
Gadgets.not(), new provable method to support bitwise not. https://github.com/o1-labs/o1js/pull/1198Gadgets.leftShift() / Gadgets.rightShift(), new provable methods to support bitwise shifting. https://github.com/o1-labs/o1js/pull/1194Gadgets.and(), new provable method to support bitwise and. https://github.com/o1-labs/o1js/pull/1193Gadgets.multiRangeCheck()andGadgets.compactMultiRangeCheck(), two building blocks for non-native arithmetic with bigints of size up to 264 bits. https://github.com/o1-labs/o1js/pull/1216
Fixed
- Removed array reversal of fetched actions, since they are returned in the correct order. https://github.com/o1-labs/o1js/pull/1258
0.14.0
Breaking changes
- Constraint optimizations in Field methods and core crypto changes break all verification keys https://github.com/o1-labs/o1js/pull/1171 https://github.com/o1-labs/o1js/pull/1178
Changed
ZkProgramhas moved out of theExperimentalnamespace and is now available as a top-level import directly.Experimental.ZkProgramhas been deprecated.ZkProgramgets a new input argumentname: stringwhich is required in the non-experimental API. The name is used to identify a ZkProgram when caching prover keys. https://github.com/o1-labs/o1js/pull/1200
Added
Lightnetnamespace to interact with the account manager provided by the lightnet Mina network https://github.com/o1-labs/o1js/pull/1167- Internal support for several custom gates (range check, bitwise operations, foreign field operations) and lookup tables https://github.com/o1-labs/o1js/pull/1176
Gadgets.rangeCheck64(), new provable method to do efficient 64-bit range checks using lookup tables https://github.com/o1-labs/o1js/pull/1181Gadgets.rotate(), new provable method to support bitwise rotation for native field elements. https://github.com/o1-labs/o1js/pull/1182Gadgets.xor(), new provable method to support bitwise xor for native field elements. https://github.com/o1-labs/o1js/pull/1177Proof.dummy()to create dummy proofs https://github.com/o1-labs/o1js/pull/1188- You can use this to write ZkPrograms that handle the base case and the inductive case in the same method.
Changed
- Use cached prover keys in
compile()when running in Node.js https://github.com/o1-labs/o1js/pull/1187- Caching is configurable by passing a custom
Cache(new export) tocompile() - By default, prover keys are stored in an OS-dependent cache directory;
~/.cache/pickleson Mac and Linux
- Caching is configurable by passing a custom
- Use cached setup points (SRS and Lagrange bases) when running in Node.js
https://github.com/o1-labs/o1js/pull/1197
- Also, speed up SRS generation by using multiple threads
- Together with caching of prover keys, this speeds up compilation time by
roughly
- 86% when everything is cached
- 34% when nothing is cached
0.13.1
Breaking changes
- Changes to some verification keys caused by changing the way
Structorders object properties. https://github.com/o1-labs/o1js/pull/1124 @Comdex- To recover existing verification keys and behavior, change the order of properties in your Struct definitions to be alphabetical
- The
customObjectKeysoption is removed fromStruct
Changed
- Improve prover performance by ~25% https://github.com/o1-labs/o1js/pull/1092
- Change internal representation of field elements to be JS bigint instead of Uint8Array
- Consolidate internal framework for testing equivalence of two implementations
0.13.0
Breaking changes
- Changes to verification keys caused by updates to the proof system. This breaks all deployed contracts https://github.com/o1-labs/o1js/pull/1016
0.12.2
Changed
- Renamed SnarkyJS to o1js https://github.com/o1-labs/o1js/pull/1104
- Reduce loading time of the library by 3-4x https://github.com/o1-labs/o1js/pull/1073
- Improve error when forgetting
transaction.prove()https://github.com/o1-labs/o1js/pull/1095
0.12.1
Added
- Added a method
createTestNullifierto the Nullifier class for testing purposes. It is recommended to use mina-signer to create Nullifiers in production, since it does not leak the private key of the user. TheNullifier.createTestNullifiermethod requires the private key as an input outside of the users wallet. https://github.com/o1-labs/o1js/pull/1026 - Added
field.isEvento check if a Field element is odd or even. https://github.com/o1-labs/o1js/pull/1026
Fixed
- Revert verification key hash change from previous release to stay compatible with the current testnet https://github.com/o1-labs/o1js/pull/1032
0.12.0
Breaking Changes
- Fix the default verification key hash that was generated for AccountUpdates.
This change adopts the default mechanism provided by Mina Protocol
https://github.com/o1-labs/o1js/pull/1021
- Please be aware that this alteration results in a breaking change affecting the verification key of already deployed contracts.
0.11.4
Fixed
- NodeJS error caused by invalid import https://github.com/o1-labs/o1js/issues/1012
0.11.3
Fixed
- Fix commonJS version of o1js, again https://github.com/o1-labs/o1js/pull/1006
0.11.2
Fixed
- Fix commonJS version of o1js https://github.com/o1-labs/o1js/pull/1005
0.11.1
Breaking changes
Groupoperations now generate a different set of constraints. This breaks deployed contracts, because the circuit changed. https://github.com/o1-labs/o1js/pull/967
Added
- Implemented
Nullifieras a new primitive https://github.com/o1-labs/o1js/pull/882- mina-signer can now be used to generate a Nullifier, which can be consumed by zkApps using the newly added Nullifier Struct
Changed
- Improve error message
Can't evaluate prover code outside an as_prover blockhttps://github.com/o1-labs/o1js/pull/998
Fixed
- Fix unsupported use of
windowwhen running o1js in workers https://github.com/o1-labs/o1js/pull/1002
0.11.0
Breaking changes
- Rewrite of
Provable.if()causes breaking changes to all deployed contracts https://github.com/o1-labs/o1js/pull/889 - Remove all deprecated methods and properties on
Fieldhttps://github.com/o1-labs/o1js/pull/902 - The
Field(x)constructor and other Field methods no longer accept abooleanas input. Instead, you can now pass in abigintto all Field methods. https://github.com/o1-labs/o1js/pull/902 - Remove redundant
signFeePayer()method https://github.com/o1-labs/o1js/pull/935
Added
- Add
field.assertNotEquals()to assert that a field element does not equal some value https://github.com/o1-labs/o1js/pull/902- More efficient than
field.equals(x).assertFalse()
- More efficient than
- Add
scalar.toConstant(),scalar.toBigInt(),Scalar.from(),privateKey.toBigInt(),PrivateKey.fromBigInt()https://github.com/o1-labs/o1js/pull/935 Poseidon.hashToGroupenables hashing to a group https://github.com/o1-labs/o1js/pull/887
Changed
- Make stack traces more readable https://github.com/o1-labs/o1js/pull/890
- Stack traces thrown from o1js are cleaned up by filtering out unnecessary lines and other noisy details
- Remove optional
zkappKeyargument insmartContract.init(), and instead assert thatprovedStateis false wheninit()is called https://github.com/o1-labs/o1js/pull/908 - Improve assertion error messages on
Fieldmethods https://github.com/o1-labs/o1js/issues/743 https://github.com/o1-labs/o1js/pull/902 - Publicly expose the internal details of the
Fieldtype https://github.com/o1-labs/o1js/pull/902
Deprecated
- Utility methods on
Circuitare deprecated in favor of the same methods onProvablehttps://github.com/o1-labs/o1js/pull/889Circuit.if(),Circuit.witness(),Circuit.log()and others replaced byProvable.if(),Provable.witness(),Provable.log()- Under the hood, some of these methods were rewritten in TypeScript
- Deprecate
field.isZero()https://github.com/o1-labs/o1js/pull/902
Fixed
- Fix running o1js in Node.js on Windows https://github.com/o1-labs/o1js-bindings/pull/19 @wizicer
- Fix error reporting from GraphQL requests https://github.com/o1-labs/o1js/pull/919
- Resolved an
Out of Memory errorexperienced on iOS devices (iPhones and iPads) during the initialization of the WASM memory https://github.com/o1-labs/o1js-bindings/pull/26 - Fix
field.greaterThan()and other comparison methods outside provable code https://github.com/o1-labs/o1js/issues/858 https://github.com/o1-labs/o1js/pull/902 - Fix
field.assertBool()https://github.com/o1-labs/o1js/issues/469 https://github.com/o1-labs/o1js/pull/902 - Fix
Field(bigint)wherebigintis larger than the field modulus https://github.com/o1-labs/o1js/issues/432 https://github.com/o1-labs/o1js/pull/902- The new behaviour is to use the modular residual of the input
- No longer fail on missing signature in
tx.send(). This fixes the flow of deploying a zkApp from a UI via a wallet https://github.com/o1-labs/o1js/pull/931 @marekyggdrasil
0.10.1
Changed
- Allow ZkPrograms to return their public output
https://github.com/o1-labs/o1js/pull/874
https://github.com/o1-labs/o1js/pull/876
- new option
ZkProgram({ publicOutput?: Provable<any>, ... });publicOutputhas to match the return type of all ZkProgram methods. - the
publicInputoption becomes optional; if not provided, methods no longer expect the public input as first argument - full usage example: https://github.com/o1-labs/o1js/blob/f95cf2903e97292df9e703b74ee1fc3825df826d/src/examples/program.ts
- new option
0.10.0
Breaking Changes
- All references to
actionsHashare renamed toactionStateto better mirror what is used in Mina protocol APIs https://github.com/o1-labs/o1js/pull/833- This change affects function parameters and returned object keys throughout the API
- No longer make
MayUseToken.InheritFromParentthe defaultmayUseTokenvalue on the caller if one zkApp method calls another one; this removes the need to manually overridemayUseTokenin several known cases https://github.com/o1-labs/o1js/pull/863- Causes a breaking change to the verification key of deployed contracts that use zkApp composability
Added
this.state.getAndAssertEquals()as a shortcut forlet x = this.state.get(); this.state.assertEquals(x);https://github.com/o1-labs/o1js/pull/863- also added
.getAndAssertEquals()onthis.accountandthis.networkfields
- also added
- Support for fallback endpoints when making network requests, allowing users to
provide an array of endpoints for GraphQL network requests.
https://github.com/o1-labs/o1js/pull/871
- Endpoints are fetched two at a time, and the result returned from the faster response
reducer.forEach(actions, ...)as a shortcut forreducer.reduce()when you don't need astatehttps://github.com/o1-labs/o1js/pull/863- New export
TokenIdwhich supersedesToken.Id;TokenId.deriveId()replacesToken.Id.getId()https://github.com/o1-labs/o1js/pull/863 - Add
Permissions.allImpossible()for the set of permissions where nothing is allowed (more convenient thanPermissions.default()when you want to make most actions impossible) https://github.com/o1-labs/o1js/pull/863
Changed
- Massive improvement of memory consumption, thanks to a refactor of o1js'
worker usage https://github.com/o1-labs/o1js/pull/872
- Memory reduced by up to 10x; see the PR for details
- Side effect:
CircuitAPI becomes async, for exampleMyCircuit.prove(...)becomesawait MyCircuit.prove(...)
- Token APIs
this.token.{send,burn,mint}()now accept anAccountUpdateorSmartContractas from / to input https://github.com/o1-labs/o1js/pull/863 - Improve
Transaction.toPretty()output by adding account update labels in most methods that create account updates https://github.com/o1-labs/o1js/pull/863 - Raises the limit of actions/events per transaction from 16 to 100, providing users with the ability to submit a larger number of events/actions in a single transaction. https://github.com/o1-labs/o1js/pull/883.
Deprecated
- Deprecate both
shutdown()andawait isReady, which are no longer needed https://github.com/o1-labs/o1js/pull/872
Fixed
SmartContract.deploy()now throws an error when no verification key is found https://github.com/o1-labs/o1js/pull/885- The old, confusing behaviour was to silently not update the verification key (but still update some permissions to "proof", breaking the zkApp)
0.9.8
Fixed
- Fix fetching the
accesspermission on accounts https://github.com/o1-labs/o1js/pull/851 - Fix
fetchActionshttps://github.com/o1-labs/o1js/pull/844 https://github.com/o1-labs/o1js/pull/854 @Comdex - Updated
Mina.TransactionId.isSuccessto accurately verify zkApp transaction status after usingMina.TransactionId.wait(). https://github.com/o1-labs/o1js/pull/826- This change ensures that the function correctly checks for transaction completion and provides the expected result.
0.9.7
Added
smartContract.fetchActions()andMina.fetchActions(), asynchronous methods to fetch actions directly from an archive node https://github.com/o1-labs/o1js/pull/843 @Comdex
Changed
Circuit.runAndCheck()now usessnarkyto create a constraint system and witnesses, and check constraints. It closely matches behavior during proving and can be used to test provable code without having to create an expensive proof https://github.com/o1-labs/o1js/pull/840
Fixed
- Fixes two issues that were temporarily reintroduced in the 0.9.6 release https://github.com/o1-labs/o1js/issues/799 https://github.com/o1-labs/o1js/issues/530
0.9.6
Breaking changes
- Circuits changed due to an internal rename of "sequence events" to "actions" which included a change to some hash prefixes; this breaks all deployed contracts.
- Temporarily reintroduces 2 known issues as a result of reverting a fix
necessary for network redeployment:
- https://github.com/o1-labs/o1js/issues/799
- https://github.com/o1-labs/o1js/issues/530
- Please note that we plan to address these issues in a future release. In the
meantime, to work around this breaking change, you can try calling
fetchAccountfor each account involved in a transaction before executing theMina.transactionblock.
- Improve number of constraints needed for Merkle tree hashing
https://github.com/o1-labs/o1js/pull/820
- This breaks deployed zkApps which use
MerkleWitness.calculateRoot(), because the circuit is changed - You can make your existing contracts compatible again by switching to
MerkleWitness.calculateRootSlow(), which has the old circuit
- This breaks deployed zkApps which use
- Renamed function parameters: The
getActionfunction now accepts a new object structure for its parameters. https://github.com/o1-labs/o1js/pull/828- The previous object keys,
fromActionHashandendActionHash, have been replaced byfromActionStateandendActionState.
- The previous object keys,
Added
zkProgram.analyzeMethods()to obtain metadata about a ZkProgram's methods https://github.com/o1-labs/o1js/pull/829 @maht0rz
Fixed
- Improved Event Handling in o1js https://github.com/o1-labs/o1js/pull/825
- Updated the internal event type to better handle events emitted in different zkApp transactions and when multiple zkApp transactions are present within a block.
- The internal event type now includes event data and transaction information as separate objects, allowing for more accurate information about each event and its associated transaction.
- Removed multiple best tip blocks when fetching action data
https://github.com/o1-labs/o1js/pull/817
- Implemented a temporary fix that filters out multiple best tip blocks, if they exist, while fetching actions. This fix will be removed once the related issue in the Archive-Node-API repository (https://github.com/o1-labs/Archive-Node-API/issues/7) is resolved.
- New
fromActionStateandendActionStateparameters for fetchActions function in o1js https://github.com/o1-labs/o1js/pull/828- Allows fetching only necessary actions to compute the latest actions state
- Eliminates the need to retrieve the entire actions history of a zkApp
- Utilizes
actionStateTwofield returned by Archive Node API as a safe starting point for deriving the most recent action hash
0.9.5
- Update the zkApp verification key from within one of its own methods, via proof https://github.com/o1-labs/o1js/pull/812
Breaking changes
- Change type of verification key returned by
SmartContract.compile()to matchVerificationKeyhttps://github.com/o1-labs/o1js/pull/812
Fixed
- Failing
Mina.transactionon Berkeley because of unsatisfied constraints caused by dummy data before we fetched account state https://github.com/o1-labs/o1js/pull/807- Previously, you could work around this by calling
fetchAccount()for every account involved in a transaction. This is not necessary anymore.
- Previously, you could work around this by calling
- Update the zkApp verification key from within one of its own methods, via proof https://github.com/o1-labs/o1js/pull/812
0.9.4
Fixed
getActionsto handle multiple actions with multiple Account Updates https://github.com/o1-labs/o1js/pull/801
0.9.3
Added
- Use
fetchEvents()to fetch events for a specified zkApp from a GraphQL endpoint that implements this schema.Mina.Networkaccepts an additional endpoint which points to a GraphQL server. https://github.com/o1-labs/o1js/pull/749- Use the
minaproperty for the Mina node. - Use
archivefor the archive node.
- Use the
- Use
getActionsto fetch actions for a specified zkApp from a GraphQL endpoint GraphQL endpoint that implements the same schema asfetchEvents. https://github.com/o1-labs/o1js/pull/788
Fixed
- Added the missing export of
Mina.TransactionIdhttps://github.com/o1-labs/o1js/pull/785 - Added an option to specify
tokenIdasFieldinfetchAccount()https://github.com/o1-labs/o1js/pull/787 @rpanic
0.9.2
Added
this.network.timestampis added back and is implemented on top ofthis.network.globalSlotSinceGenesishttps://github.com/o1-labs/o1js/pull/755
Changed
- On-chain value
globalSlotis replaced by the clearercurrentSlothttps://github.com/o1-labs/o1js/pull/755currentSlotrefers to the slot at which the transaction will be included in a block.- the only supported method is
currentSlot.assertBetween()becausecurrentSlot.get()is impossible to implement since the value is determined in the future andcurrentSlot.assertEquals()is error-prone
Fixed
- Incorrect counting of limit on events and actions https://github.com/o1-labs/o1js/pull/758
- Type error when using
Circuit.arrayin on-chain state or events https://github.com/o1-labs/o1js/pull/758 - Bug when using
Circuit.witnessoutside the prover https://github.com/o1-labs/o1js/pull/774
0.9.1
Fixed
- Bug when using
this.<state>.get()outside a transaction https://github.com/o1-labs/o1js/pull/754
0.9.0
Added
Transaction.fromJSONto recover transaction object from JSON https://github.com/o1-labs/o1js/pull/705- New precondition:
provedState, a boolean which is true if the entire on-chain state of this account was last modified by a proof https://github.com/o1-labs/o1js/pull/741- Same API as all preconditions:
this.account.provedState.assertEquals(Bool(true)) - Can be used to assert that the state wasn't tampered with by the zkApp developer using non-contract logic, for example, before deploying the zkApp
- Same API as all preconditions:
- New on-chain value
globalSlot, to make assertions about the current time https://github.com/o1-labs/o1js/pull/649- example:
this.globalSlot.get(),this.globalSlot.assertBetween(lower, upper) - Replaces
network.timestamp,network.globalSlotSinceGenesisandnetwork.globalSlotSinceHardFork. https://github.com/o1-labs/o1js/pull/560
- example:
- New permissions:
accessto control whether account updates for this account can be used at all https://github.com/o1-labs/o1js/pull/500setTimingto control who can update the account'stimingfield https://github.com/o1-labs/o1js/pull/685- Example:
this.permissions.set({ ...Permissions.default(), access: Permissions.proofOrSignature() })
- Expose low-level view into the PLONK gates created by a smart contract method
https://github.com/o1-labs/o1js/pull/687
MyContract.analyzeMethods().<method name>.gates
Changed
- BREAKING CHANGE: Modify signature algorithm used by
Signature.{create,verify}to be compatible with mina-signer https://github.com/o1-labs/o1js/pull/710- Signatures created with mina-signer's
client.signFields()can now be verified inside a SNARK! - Breaks existing deployed smart contracts which use
Signature.verify()
- Signatures created with mina-signer's
- BREAKING CHANGE: Circuits changed due to core protocol and cryptography changes; this breaks all deployed contracts.
- BREAKING CHANGE: Change structure of
Accounttype which is returned byMina.getAccount()https://github.com/o1-labs/o1js/pull/741- for example,
account.appState->account.zkapp.appState - full new type (exported as
Types.Account): https://github.com/o1-labs/o1js/blob/0be70cb8ceb423976f348980e9d6238820758cc0/src/provable/gen/transaction.ts#L515
- for example,
- Test accounts hard-coded in
LocalBlockchainnow have default permissions, not permissions allowing everything. Fixes some unintuitive behaviour in tests, like requiring no signature when using these accounts to send MINA https://github.com/o1-labs/o1js/issues/638
Removed
- Preconditions
timestampandglobalSlotSinceHardForkhttps://github.com/o1-labs/o1js/pull/560timestampis expected to come back as a wrapper for the newglobalSlot
0.8.0
Added
this.account.<field>.set()as a unified API to update fields on the account https://github.com/o1-labs/o1js/pull/643- covers
permissions,verificationKey,zkappUri,tokenSymbol,delegate,votingFor - exists on
SmartContract.accountandAccountUpdate.account
- covers
this.senderto get the public key of the transaction's sender https://github.com/o1-labs/o1js/pull/652- To get the sender outside a smart contract, there's now
Mina.sender()
- To get the sender outside a smart contract, there's now
tx.wait()is now implemented. It waits for the transactions inclusion in a block https://github.com/o1-labs/o1js/pull/645wait()also now takes an optionaloptionsparameter to specify the polling interval or maximum attempts.wait(options?: { maxAttempts?: number; interval?: number }): Promise<void>;
Circuit.constraintSystemFromKeypair(keypair)to inspect the circuit at a low level https://github.com/o1-labs/o1js/pull/529- Works with a
keypair(prover + verifier key) generated with theCircuitAPI
- Works with a
Mina.faucet()can now be used to programmatically fund an address on the testnet, using the faucet provided by faucet.minaprotocol.com https://github.com/o1-labs/o1js/pull/693
Changed
- BREAKING CHANGE: Constraint changes in
sign(),requireSignature()andcreateSigned()onAccountUpdate/SmartContract. This means that smart contracts using these methods in their proofs won't be able to create valid proofs against old deployed verification keys. https://github.com/o1-labs/o1js/pull/637 Mina.transactionnow takes a public key as the fee payer argument (passing in a private key is deprecated) https://github.com/o1-labs/o1js/pull/652- Before:
Mina.transaction(privateKey, ...). Now:Mina.transaction(publicKey, ...) AccountUpdate.fundNewAccount()now enables funding multiple accounts at once, and deprecates theinitialBalanceargument
- Before:
- New option
enforceTransactionLimitsforLocalBlockchain(default value:true), to disable the enforcement of protocol transaction limits (maximum events, maximum sequence events and enforcing certain layout ofAccountUpdates depending on their authorization) https://github.com/o1-labs/o1js/pull/620 - Change the default
sendpermissions (for sending MINA or tokens) that get set when deploying a zkApp, fromsignature()toproof()https://github.com/o1-labs/o1js/pull/648 - Functions for making assertions and comparisons have been renamed to their
long form, instead of the initial abbreviation. Old function names have been
deprecated https://github.com/o1-labs/o1js/pull/681
.lt->.lessThan.lte->.lessThanOrEqual.gt->.greaterThan.gte->greaterThanOrEqual.assertLt->.assertLessThan.assertLte->.assertLessThanOrEqual.assertGt->.assertGreaterThan.assertGte->assertGreaterThanOrEqual.assertBoolean->.assertBool
Deprecated
this.setPermissions()in favor ofthis.account.permissions.set()https://github.com/o1-labs/o1js/pull/643this.tokenSymbol.set()in favor ofthis.account.tokenSymbol.set()this.setValue()in favor ofthis.account.<field>.set()
Mina.transaction(privateKey: PrivateKey, ...)in favor of new signatureMina.transaction(publicKey: PublicKey, ...)AccountUpdate.createSigned(privateKey: PrivateKey)in favor of new signatureAccountUpdate.createSigned(publicKey: PublicKey)https://github.com/o1-labs/o1js/pull/637.lt,.lte,gt,gte,.assertLt,.assertLte,.assertGt,.assertGtehave been deprecated. https://github.com/o1-labs/o1js/pull/681
Fixed
- Fixed Apple silicon performance issue https://github.com/o1-labs/o1js/issues/491
- Type inference for Structs with instance methods
https://github.com/o1-labs/o1js/pull/567
- also fixes
Struct.fromJSON
- also fixes
SmartContract.fetchEventsfixed when multiple event types existed https://github.com/o1-labs/o1js/issues/627- Error when using reduce with a
Structas state type https://github.com/o1-labs/o1js/pull/689 - Fix use of stale cached accounts in
Mina.transactionhttps://github.com/o1-labs/o1js/issues/430
0.7.3
Fixed
- Bug in
deploy()when initializing a contract that already exists https://github.com/o1-labs/o1js/pull/588
Deprecated
Mina.BerkeleyQANetin favor of the clearer-namedMina.Networkhttps://github.com/o1-labs/o1js/pull/588
0.7.2
Added
MerkleMapandMerkleMapWitnesshttps://github.com/o1-labs/o1js/pull/546- Lots of doc comments! https://github.com/o1-labs/o1js/pull/580
Fixed
- Bug in
Circuit.logprinting account updates https://github.com/o1-labs/o1js/pull/578
0.7.1
Fixed
- Testnet-incompatible signatures in v0.7.0 https://github.com/o1-labs/o1js/pull/565
0.7.0
Added
- Added an optional string parameter to certain
assertmethods https://github.com/o1-labs/o1js/pull/470 Struct, a new primitive for declaring composite, SNARK-compatible types https://github.com/o1-labs/o1js/pull/416- With this, we also added a way to include auxiliary, non-field element data in composite types
- Added
VerificationKey, which is aStructwith auxiliary data, to pass verification keys to a@method - BREAKING CHANGE: Change names related to circuit types:
AsFieldsAndAux<T>->Provable<T>,AsFieldElement<T>->ProvablePure<T>,circuitValue->provable - BREAKING CHANGE: Change all
ofFieldsandofBitsmethods on circuit types tofromFieldsandfromBits
- New option
proofsEnabledforLocalBlockchain(default value:true), to quickly test transaction logic with proofs disabled https://github.com/o1-labs/o1js/pull/462- with
proofsEnabled: true, proofs now get verified locally https://github.com/o1-labs/o1js/pull/423
- with
SmartContract.approve()to approve a tree of child account updates https://github.com/o1-labs/o1js/pull/428 https://github.com/o1-labs/o1js/pull/534- AccountUpdates are now valid
@methodarguments, andapprove()is intended to be used on them when passed to a method - Also replaces
Experimental.accountUpdateFromCallback()
- AccountUpdates are now valid
Circuit.log()to easily log Fields and other provable types inside a method, with the same API asconsole.log()https://github.com/o1-labs/o1js/pull/484SmartContract.init()is a new method on the baseSmartContractthat will be called only during the first deploy (not if you re-deploy later to upgrade the contract) https://github.com/o1-labs/o1js/pull/543- Overriding
init()is the new recommended way to add custom state initialization logic.
- Overriding
transaction.toPretty()andaccountUpdate.toPretty()for debugging transactions by printing only the pieces that differ from default account updates https://github.com/o1-labs/o1js/pull/428AccountUpdate.attachToTransaction()for explicitly adding an account update to the current transaction. This replaces some previous behaviour where an account update got attached implicitly https://github.com/o1-labs/o1js/pull/484SmartContract.requireSignature()andAccountUpdate.requireSignature()as a simpler, better-named replacement for.sign()https://github.com/o1-labs/o1js/pull/558
Changed
- BREAKING CHANGE:
tx.send()is now asynchronous: old:send(): TransactionIdnew:send(): Promise<TransactionId>andtx.send()now directly waits for the network response, as opposed totx.send().wait()https://github.com/o1-labs/o1js/pull/423 - Sending transactions to
LocalBlockchainnow involves Circuit.witnesscan now be called outside circuits, where it will just directly return the callback result https://github.com/o1-labs/o1js/pull/484- The
FeePayerSpec, which is used to specify properties of the transaction viaMina.transaction(), now has another optional parameter to specify the nonce manually.Mina.transaction({ feePayerKey: feePayer, nonce: 1 }, () => {})https://github.com/o1-labs/o1js/pull/497 - BREAKING CHANGE: Static methods of type
.fromString(),.fromNumber()and.fromBigInt()onField,UInt64,UInt32andInt64are no longer supported https://github.com/o1-labs/o1js/pull/519- use
Field(number | string | bigint)andUInt64.from(number | string | bigint)
- use
- Move several features out of 'experimental'
https://github.com/o1-labs/o1js/pull/555
ReducerreplacesExperimental.ReducerMerkleTreeandMerkleWitnessreplaceExperimental.{MerkleTree,MerkleWitness}- In a
SmartContract,this.tokenreplacesthis.experimental.token
Deprecated
CircuitValuedeprecated in favor ofStructhttps://github.com/o1-labs/o1js/pull/416- Static props
Field.zero,Field.one,Field.minusOnedeprecated in favor ofField(number)https://github.com/o1-labs/o1js/pull/524 SmartContract.sign()andAccountUpdate.sign()in favor of.requireSignature()https://github.com/o1-labs/o1js/pull/558
Fixed
- Uint comparisons and division fixed inside the prover https://github.com/o1-labs/o1js/pull/503
- Callback arguments are properly passed into method invocations https://github.com/o1-labs/o1js/pull/516
- Removed internal type
JSONValuefrom public interfaces https://github.com/o1-labs/o1js/pull/536 - Returning values from a zkApp https://github.com/o1-labs/o1js/pull/461
Fixed
- Callback arguments are properly passed into method invocations https://github.com/o1-labs/o1js/pull/516
0.6.1
Fixed
- Proof verification on the web version https://github.com/o1-labs/o1js/pull/476
0.6.0
Added
reducer.getActionspartially implemented for local testing https://github.com/o1-labs/o1js/pull/327gteandassertGtemethods onUInt32,UInt64https://github.com/o1-labs/o1js/pull/349- Return sent transaction
hashforRemoteBlockchainhttps://github.com/o1-labs/o1js/pull/399
Changed
- BREAKING CHANGE: Rename the
Partyclass toAccountUpdate. Also, rename other occurrences of "party" to "account update". https://github.com/o1-labs/o1js/pull/393 - BREAKING CHANGE: Don't require the account address as input to
SmartContract.compile(),SmartContract.digest()andSmartContract.analyzeMethods()https://github.com/o1-labs/o1js/pull/406- This works because the address / public key is now a variable in the method circuit; it used to be a constant
- BREAKING CHANGE: Move
ZkProgramtoExperimental.ZkProgram
0.5.4
Fixed
- Running o1js inside a web worker https://github.com/o1-labs/o1js/issues/378
0.5.3
Fixed
- Infinite loop when compiling in web version https://github.com/o1-labs/o1js/issues/379, by @maht0rz
0.5.2
Fixed
- Crash of the web version introduced in 0.5.0
- Issue with
Experimental.MerkleWitnesshttps://github.com/o1-labs/o1js/pull/368
0.5.1
Fixed
fetchAccounthttps://github.com/o1-labs/o1js/pull/350
0.5.0
Added
- Recursive proofs. RFC: https://github.com/o1-labs/o1js/issues/89, PRs:
https://github.com/o1-labs/o1js/pull/245
https://github.com/o1-labs/o1js/pull/250
https://github.com/o1-labs/o1js/pull/261
- Enable smart contract methods to take previous proofs as arguments, and verify them in the circuit
- Add
ZkProgram, a new primitive which represents a collection of circuits that produce instances of the same proof. So, it's a more general version ofSmartContract, without any of the Mina-related API.ZkProgramis suitable for rollup-type systems and offchain usage of Pickles + Kimchi.
- zkApp composability -- calling other zkApps from inside zkApps. RFC: https://github.com/o1-labs/o1js/issues/303, PRs: https://github.com/o1-labs/o1js/pull/285, https://github.com/o1-labs/o1js/pull/296, https://github.com/o1-labs/o1js/pull/294, https://github.com/o1-labs/o1js/pull/297
- Events support via
SmartContract.events,this.emitEvent. RFC: https://github.com/o1-labs/o1js/issues/248, PR: https://github.com/o1-labs/o1js/pull/272fetchEventspartially implemented for local testing: https://github.com/o1-labs/o1js/pull/323
- Payments:
this.send({ to, amount })as an easier API for sending Mina from smart contracts https://github.com/o1-labs/o1js/pull/325Party.send()to transfer Mina between any accounts, for example, from users to smart contracts
SmartContract.digest()to quickly compute a hash of the contract's circuit. This is used by the zkApp CLI to figure out whethercompileshould be re-run or a cached verification key can be used. https://github.com/o1-labs/o1js/pull/268Circuit.constraintSystem()for creating a circuit from a function, counting the number of constraints and computing a digest of the circuit https://github.com/o1-labs/o1js/pull/279this.account.isNewto assert that an account did not (or did) exist before the transaction https://github.com/MinaProtocol/mina/pull/11524LocalBlockchain.setTimestampand other setters for network state, to test network preconditions locally https://github.com/o1-labs/o1js/pull/329- Experimental APIs are now collected under the
Experimentalimport, or onthis.experimentalin a smart contract. - Custom tokens (experimental), via
this.token. RFC: https://github.com/o1-labs/o1js/issues/233, PR: https://github.com/o1-labs/o1js/pull/273, - Actions / sequence events support (experimental), via
Experimental.Reducer. RFC: https://github.com/o1-labs/o1js/issues/265, PR: https://github.com/o1-labs/o1js/pull/274 - Merkle tree implementation (experimental) via
Experimental.MerkleTreehttps://github.com/o1-labs/o1js/pull/343
Changed
- BREAKING CHANGE: Make on-chain state consistent with other preconditions - throw an error when state is not explicitly constrained https://github.com/o1-labs/o1js/pull/267
CircuitValueimprovements https://github.com/o1-labs/o1js/pull/269, https://github.com/o1-labs/o1js/pull/306, https://github.com/o1-labs/o1js/pull/341- Added a base constructor, so overriding the constructor on classes that
extend
CircuitValueis now optional. When overriding, the base constructor can be called without arguments, as previously:super(). When not overriding, the expected arguments are all the@props on the class, in the order they were defined in:new MyCircuitValue(prop1, prop2). CircuitValue.fromObject({ prop1, prop2 })is a new, better-typed alternative for using the base constructor.- Fixed: the overridden constructor is now free to have any argument structure -- previously, arguments had to be the props in their declared order. I.e., the behaviour that's now used by the base constructor used to be forced on all constructors, which is no longer the case.
- Added a base constructor, so overriding the constructor on classes that
extend
Mina.transactionimprovements- Support zkApp proofs when there are other account updates in the same transaction block https://github.com/o1-labs/o1js/pull/280
- Support multiple independent zkApp proofs in one transaction block https://github.com/o1-labs/o1js/pull/296
- Add previously unimplemented preconditions, like
this.network.timestamphttps://github.com/o1-labs/o1js/pull/324 https://github.com/MinaProtocol/mina/pull/11577 - Improve error messages thrown from Wasm, by making Rust's
paniclog to the JS console https://github.com/MinaProtocol/mina/pull/11644 - Not user-facing, but essential: Smart contracts fully constrain the account updates they create, inside the circuit https://github.com/o1-labs/o1js/pull/278
Fixed
- Fix comparisons on
UInt32andUInt64(UInt32.lt,UInt32.gt, etc) https://github.com/o1-labs/o1js/issues/174, https://github.com/o1-labs/o1js/issues/101. PR: https://github.com/o1-labs/o1js/pull/307
0.4.3
Added
- Implement the
precondition RFC:
- new fields
this.accountandthis.networkon bothSmartContractandParty this.<account|network>.<property>.get()to use on-chain values in a circuit, e.g. account balance or block heightthis.<account|network>.<property>.{assertEqual, assertBetween, assertNothing}()to constrain what values to allow for these
- new fields
CircuitString, a snark-compatible string type with methods like.append()https://github.com/o1-labs/o1js/pull/155bool.assertTrue(),bool.assertFalse()as convenient aliases for existing functionalityLedger.verifyPartyProofwhich can check if a proof on a transaction is valid https://github.com/o1-labs/o1js/pull/208- Memo field in APIs like
Mina.transactionto attach arbitrary messages https://github.com/o1-labs/o1js/pull/244 - This changelog
Changed
- Huge snark performance improvements (2-10x) for most zkApps https://github.com/MinaProtocol/mina/pull/11053
- Performance improvements in node with > 4 CPUs, for all snarks https://github.com/MinaProtocol/mina/pull/11292
- Substantial reduction of o1js' size https://github.com/MinaProtocol/mina/pull/11166
Removed
- Unused functions
callandcallUnproved, which were embryonic versions of what is now thetransactionAPI to call smart contract methods - Some unimplemented fields on
SmartContract
Fixed
- zkApp proving on web https://github.com/o1-labs/o1js/issues/226