├── .github └── workflows │ ├── algolia-search.yml │ ├── o1js-api-reference.yml │ └── test-tutorials.yml ├── .gitignore ├── .prettierignore ├── .prettierrc ├── CODEOWNERS ├── CONTRIBUTING.md ├── README.md ├── algolia-config.json ├── babel.config.js ├── docs ├── berkeley-upgrade │ ├── appendix.mdx │ ├── archive-migration │ │ ├── appendix.mdx │ │ ├── archive-migration-installation.mdx │ │ ├── archive-migration-prerequisites.mdx │ │ ├── debian-example.mdx │ │ ├── docker-example.mdx │ │ ├── index.mdx │ │ ├── mainnet-database-maintenance.mdx │ │ ├── migrating-archive-database-to-berkeley.mdx │ │ └── understanding-archive-migration.mdx │ ├── flags-configs.mdx │ ├── requirements.mdx │ └── upgrade-steps.mdx ├── exchange-operators │ ├── faq.mdx │ ├── index.mdx │ └── rosetta │ │ ├── build-from-sources.mdx │ │ ├── docker-compose.mdx │ │ ├── run-with-docker.mdx │ │ ├── samples │ │ ├── index.mdx │ │ ├── requests.mdx │ │ ├── scan-blocks.mdx │ │ ├── send-transactions.mdx │ │ ├── track-deposits.mdx │ │ └── using-signer.mdx │ │ └── send-requests.mdx ├── glossary.mdx ├── mina-protocol │ ├── block-producers.mdx │ ├── index.mdx │ ├── lifecycle-of-a-payment.mdx │ ├── proof-of-stake.mdx │ ├── scan-state.mdx │ ├── sending-a-payment.mdx │ ├── snark-workers.mdx │ ├── time-locked-accounts.mdx │ └── whats-in-a-block.mdx ├── mina-security.mdx ├── node-developers │ ├── bip44.mdx │ ├── code-review-guidelines.mdx │ ├── codebase-overview.mdx │ ├── contributing.mdx │ ├── graphql-api.mdx │ ├── index.mdx │ ├── repository-structure.mdx │ ├── sandbox-node.mdx │ └── style-guide.mdx ├── node-operators │ ├── archive-node │ │ ├── archive-redundancy.mdx │ │ ├── docker-compose.mdx │ │ ├── getting-started.mdx │ │ └── index.mdx │ ├── block-producer-node │ │ ├── connecting-to-devnet.mdx │ │ ├── connecting-to-the-network.mdx │ │ ├── docker-compose.mdx │ │ ├── getting-started.mdx │ │ ├── hot-cold-block-production.mdx │ │ └── index.mdx │ ├── data-and-history │ │ ├── index.mdx │ │ ├── querying-data.mdx │ │ └── rosetta.mdx │ ├── delegation-program │ │ ├── bp-sidecar.mdx │ │ ├── foundation-delegation-program.mdx │ │ ├── index.mdx │ │ └── uptime-tracking-system.mdx │ ├── faq.mdx │ ├── flags-configs.mdx │ ├── generating-a-keypair.mdx │ ├── index.mdx │ ├── logging.mdx │ ├── mina-cli-reference.mdx │ ├── mina-signer.mdx │ ├── requirements.mdx │ ├── seed-peers │ │ ├── docker-compose.mdx │ │ ├── getting-started.mdx │ │ └── index.mdx │ ├── snark-workers │ │ ├── docker-compose.mdx │ │ ├── getting-started.mdx │ │ └── index.mdx │ ├── staking-and-snarking.mdx │ ├── staking-service-guidelines.mdx │ └── troubleshooting.mdx ├── participate │ ├── bugs-and-feature-requests.mdx │ ├── careers.mdx │ ├── github.mdx │ └── office-hours.mdx ├── using-mina │ ├── how-to-delegate.mdx │ ├── how-to-send-and-receive.mdx │ ├── how-to-use-zkapp.mdx │ ├── install-a-wallet.mdx │ └── ledger-hardware-wallet.mdx ├── welcome.mdx └── zkapps │ ├── advanced │ ├── experimental.mdx │ └── zkapps-for-ethereum-developers.mdx │ ├── faq.mdx │ ├── front-end-integration-guides │ ├── angular.mdx │ └── next.mdx │ ├── o1js-reference │ ├── README.mdx │ ├── classes │ │ ├── AccountUpdate.mdx │ │ ├── AccountUpdateForest.mdx │ │ ├── AccountUpdateTree.mdx │ │ ├── AlmostForeignField.mdx │ │ ├── BaseMerkleWitness.mdx │ │ ├── Bool.mdx │ │ ├── CanonicalForeignField.mdx │ │ ├── Character.mdx │ │ ├── Circuit.mdx │ │ ├── CircuitString.mdx │ │ ├── DynamicProof.mdx │ │ ├── EcdsaSignature.mdx │ │ ├── Field.mdx │ │ ├── ForeignCurve.mdx │ │ ├── ForeignField.mdx │ │ ├── Group.mdx │ │ ├── Hashed.mdx │ │ ├── Int64.mdx │ │ ├── Keypair.mdx │ │ ├── Ledger.mdx │ │ ├── MerkleList.mdx │ │ ├── MerkleListIterator.mdx │ │ ├── MerkleMap.mdx │ │ ├── MerkleMapWitness.mdx │ │ ├── MerkleTree.mdx │ │ ├── Nullifier.mdx │ │ ├── Packed.mdx │ │ ├── PrivateKey.mdx │ │ ├── Proof.mdx │ │ ├── ProofBase.mdx │ │ ├── PublicKey.mdx │ │ ├── Scalar.mdx │ │ ├── ScalarField.mdx │ │ ├── SelfProof.mdx │ │ ├── Sign.mdx │ │ ├── Signature.mdx │ │ ├── SmartContract.mdx │ │ ├── TokenAccountUpdateIterator.mdx │ │ ├── TokenContract.mdx │ │ ├── TokenSymbol.mdx │ │ ├── UInt32.mdx │ │ ├── UInt64.mdx │ │ ├── UInt8.mdx │ │ ├── Unconstrained.mdx │ │ └── VerificationKey.mdx │ ├── functions │ │ ├── Bytes.mdx │ │ ├── ConstantField.mdx │ │ ├── MerkleListBase.mdx │ │ ├── MerkleWitness.mdx │ │ ├── Option.mdx │ │ ├── Reducer.mdx │ │ ├── State.mdx │ │ ├── Struct.mdx │ │ ├── VarField.mdx │ │ ├── WithHash.mdx │ │ ├── ZkProgram.mdx │ │ ├── addCachedAccount.mdx │ │ ├── assert.mdx │ │ ├── checkBitLength.mdx │ │ ├── checkZkappTransaction.mdx │ │ ├── circuitMain.mdx │ │ ├── conditionalSwap.mdx │ │ ├── createEcdsa.mdx │ │ ├── createForeignCurve.mdx │ │ ├── createForeignField.mdx │ │ ├── declareMethods.mdx │ │ ├── declareState.mdx │ │ ├── fetchAccount.mdx │ │ ├── fetchEvents.mdx │ │ ├── fetchLastBlock.mdx │ │ ├── fetchTransactionStatus.mdx │ │ ├── genericHash.mdx │ │ ├── initializeBindings.mdx │ │ ├── merkleListHash.mdx │ │ ├── method.mdx │ │ ├── provable.mdx │ │ ├── provablePure.mdx │ │ ├── public.mdx │ │ ├── readVarMessage.mdx │ │ ├── sendZkapp.mdx │ │ ├── setArchiveGraphqlEndpoint.mdx │ │ ├── setGraphqlEndpoint.mdx │ │ ├── setGraphqlEndpoints.mdx │ │ ├── setNumberOfWorkers.mdx │ │ ├── state-1.mdx │ │ ├── toConstantField.mdx │ │ ├── toFp.mdx │ │ ├── verify.mdx │ │ ├── withHashes.mdx │ │ └── withMessage.mdx │ ├── interfaces │ │ └── Permissions.mdx │ ├── namespaces │ │ ├── Crypto │ │ │ ├── README.mdx │ │ │ └── type-aliases │ │ │ │ ├── Curve.mdx │ │ │ │ └── CurveParams.mdx │ │ ├── Encryption │ │ │ ├── README.mdx │ │ │ ├── functions │ │ │ │ ├── decrypt.mdx │ │ │ │ ├── decryptBytes.mdx │ │ │ │ ├── encrypt.mdx │ │ │ │ └── encryptBytes.mdx │ │ │ └── type-aliases │ │ │ │ ├── CipherText.mdx │ │ │ │ └── CipherTextBytes.mdx │ │ ├── Experimental │ │ │ ├── README.mdx │ │ │ ├── classes │ │ │ │ ├── BatchReducer.mdx │ │ │ │ └── OffchainStateCommitments.mdx │ │ │ ├── functions │ │ │ │ ├── ActionBatch.mdx │ │ │ │ ├── IndexedMerkleMap.mdx │ │ │ │ ├── OffchainState.mdx │ │ │ │ └── memoizeWitness.mdx │ │ │ └── type-aliases │ │ │ │ ├── ActionBatch.mdx │ │ │ │ └── IndexedMerkleMap.mdx │ │ ├── Lightnet │ │ │ ├── README.mdx │ │ │ └── functions │ │ │ │ ├── acquireKeyPair.mdx │ │ │ │ ├── listAcquiredKeyPairs.mdx │ │ │ │ └── releaseKeyPair.mdx │ │ └── Mina │ │ │ ├── README.mdx │ │ │ ├── functions │ │ │ ├── LocalBlockchain.mdx │ │ │ ├── Network.mdx │ │ │ ├── TestPublicKey.mdx │ │ │ ├── currentSlot.mdx │ │ │ ├── currentTransaction.mdx │ │ │ ├── faucet.mdx │ │ │ ├── fetchActions.mdx │ │ │ ├── fetchEvents.mdx │ │ │ ├── filterGroups.mdx │ │ │ ├── getAccount.mdx │ │ │ ├── getActions.mdx │ │ │ ├── getBalance.mdx │ │ │ ├── getNetworkConstants.mdx │ │ │ ├── getNetworkId.mdx │ │ │ ├── getNetworkState.mdx │ │ │ ├── getProofsEnabled.mdx │ │ │ ├── hasAccount.mdx │ │ │ ├── sender.mdx │ │ │ ├── setActiveInstance.mdx │ │ │ ├── transaction.mdx │ │ │ └── waitForFunding.mdx │ │ │ ├── namespaces │ │ │ ├── TestPublicKey │ │ │ │ ├── README.mdx │ │ │ │ └── functions │ │ │ │ │ ├── fromBase58.mdx │ │ │ │ │ └── random.mdx │ │ │ └── Transaction │ │ │ │ ├── README.mdx │ │ │ │ └── functions │ │ │ │ └── fromJSON.mdx │ │ │ ├── type-aliases │ │ │ ├── ActionStates.mdx │ │ │ ├── FeePayerSpec.mdx │ │ │ ├── IncludedTransaction.mdx │ │ │ ├── NetworkConstants.mdx │ │ │ ├── PendingTransaction.mdx │ │ │ ├── PendingTransactionPromise.mdx │ │ │ ├── PendingTransactionStatus.mdx │ │ │ ├── RejectedTransaction.mdx │ │ │ ├── TestPublicKey.mdx │ │ │ └── Transaction.mdx │ │ │ └── variables │ │ │ └── activeInstance.mdx │ ├── type-aliases │ │ ├── Account.mdx │ │ ├── Bool.mdx │ │ ├── BoolVar.mdx │ │ ├── Bytes.mdx │ │ ├── Cache.mdx │ │ ├── CacheHeader.mdx │ │ ├── ConstantField.mdx │ │ ├── DeployArgs.mdx │ │ ├── Empty.mdx │ │ ├── FeatureFlags.mdx │ │ ├── Field.mdx │ │ ├── FlexibleProvable.mdx │ │ ├── FlexibleProvablePure.mdx │ │ ├── Group.mdx │ │ ├── InferProvable.mdx │ │ ├── JsonProof.mdx │ │ ├── MerkleListBase.mdx │ │ ├── MerkleListIteratorBase.mdx │ │ ├── Option.mdx │ │ ├── Provable.mdx │ │ ├── ProvableExtended.mdx │ │ ├── ProvableHashable-1.mdx │ │ ├── ProvableHashable.mdx │ │ ├── ProvablePure.mdx │ │ ├── ProvableType.mdx │ │ ├── ProvableTypePure.mdx │ │ ├── ProvableWithEmpty.mdx │ │ ├── Reducer.mdx │ │ ├── ScalarConst.mdx │ │ ├── State.mdx │ │ ├── Struct.mdx │ │ ├── ToProvable.mdx │ │ ├── TransactionPromise.mdx │ │ ├── TransactionStatus.mdx │ │ ├── TupleN.mdx │ │ ├── Undefined.mdx │ │ ├── VarField.mdx │ │ ├── Void.mdx │ │ ├── WithHash.mdx │ │ ├── WithProvable.mdx │ │ ├── Witness.mdx │ │ ├── ZkProgram.mdx │ │ └── ZkappPublicInput.mdx │ └── variables │ │ ├── Account.mdx │ │ ├── Bool.mdx │ │ ├── Cache.mdx │ │ ├── Crypto.mdx │ │ ├── Empty.mdx │ │ ├── FeatureFlags.mdx │ │ ├── Field.mdx │ │ ├── Gadgets.mdx │ │ ├── Group.mdx │ │ ├── Hash.mdx │ │ ├── Keccak.mdx │ │ ├── Permissions.mdx │ │ ├── Poseidon.mdx │ │ ├── ProvableType.mdx │ │ ├── TokenId.mdx │ │ ├── TransactionVersion.mdx │ │ ├── TupleN.mdx │ │ ├── Undefined.mdx │ │ ├── Void.mdx │ │ ├── ZkappPublicInput.mdx │ │ └── emptyHash.mdx │ ├── o1js │ ├── basic-concepts.md │ ├── bitwise-operations.mdx │ ├── circuit-writing-primer.mdx │ ├── custom-tokens.mdx │ ├── ecdsa.mdx │ ├── foreign-fields.mdx │ ├── gadgets.mdx │ ├── index.mdx │ ├── indexed-merkle-map.mdx │ ├── keccak.mdx │ ├── merkle-tree.mdx │ ├── recursion.mdx │ └── sha256.mdx │ ├── roadmap.mdx │ ├── standards.mdx │ ├── tutorials │ ├── 01-hello-world.mdx │ ├── 02-private-inputs-hash-functions.mdx │ ├── 03-deploying-to-a-network.mdx │ ├── 04-zkapp-ui-with-react.mdx │ ├── 05-common-types-and-functions.mdx │ ├── 06-offchain-storage.mdx │ ├── 07-oracle.mdx │ ├── 08-custom-tokens.mdx │ ├── 09-recursion.mdx │ ├── 10-account-updates.mdx │ ├── anonymous-message-board.mdx │ ├── index.mdx │ └── interacting-with-zkapps-server-side.mdx │ ├── writing-a-zkapp │ ├── feature-overview │ │ ├── actions-and-reducer.mdx │ │ ├── custom-tokens.mdx │ │ ├── events.mdx │ │ ├── fetch-events-and-actions.mdx │ │ ├── offchain-storage.mdx │ │ ├── on-chain-values.mdx │ │ ├── permissions.mdx │ │ ├── time-locked-accounts.mdx │ │ └── upgradability.mdx │ ├── index.mdx │ └── introduction-to-zkapps │ │ ├── getting-started-zkapps.mdx │ │ ├── how-to-deploy-a-zkapp.mdx │ │ ├── how-to-write-a-zkapp-ui.mdx │ │ ├── how-to-write-a-zkapp.mdx │ │ ├── how-zkapps-work.mdx │ │ ├── install-zkapp-cli.mdx │ │ ├── interact-with-mina.md │ │ ├── secure-zkapps.mdx │ │ ├── smart-contracts.mdx │ │ ├── testing-zkapps-lightnet.mdx │ │ └── testing-zkapps-locally.mdx │ └── zkapp-development-frameworks.mdx ├── docusaurus.config.js ├── examples ├── exchange-operators │ ├── nodejs │ │ ├── dprint.json │ │ ├── index.ts │ │ ├── package-lock.json │ │ ├── package.json │ │ └── tsconfig.json │ └── rosetta_samples.py └── zkapps │ ├── 01-hello-world │ ├── .eslintrc.cjs │ ├── .gitattributes │ ├── .github │ │ └── workflows │ │ │ └── ci.yml │ ├── .gitignore │ ├── .husky │ │ └── pre-commit │ ├── .npmignore │ ├── .prettierignore │ ├── .prettierrc │ ├── 01output.png │ ├── LICENSE │ ├── README.md │ ├── babel.config.cjs │ ├── config.json │ ├── jest-resolver.cjs │ ├── jest.config.js │ ├── package-lock.json │ ├── package.json │ ├── src │ │ ├── Square.ts │ │ ├── index.ts │ │ └── main.ts │ └── tsconfig.json │ ├── 02-private-inputs-and-hash-functions │ ├── .eslintrc.cjs │ ├── .gitattributes │ ├── .github │ │ └── workflows │ │ │ └── ci.yml │ ├── .gitignore │ ├── .husky │ │ └── pre-commit │ ├── .npmignore │ ├── .prettierignore │ ├── .prettierrc │ ├── 02output.png │ ├── LICENSE │ ├── README.md │ ├── babel.config.cjs │ ├── config.json │ ├── jest-resolver.cjs │ ├── jest.config.js │ ├── package-lock.json │ ├── package.json │ ├── src │ │ ├── IncrementSecret.ts │ │ ├── index.ts │ │ └── main.ts │ └── tsconfig.json │ ├── 04-zkapp-browser-ui │ ├── contracts │ │ ├── .eslintrc.cjs │ │ ├── .gitattributes │ │ ├── .github │ │ │ └── workflows │ │ │ │ └── ci.yml │ │ ├── .gitignore │ │ ├── .npmignore │ │ ├── .prettierignore │ │ ├── .prettierrc │ │ ├── LICENSE │ │ ├── README.md │ │ ├── babel.config.cjs │ │ ├── config.json │ │ ├── jest-resolver.cjs │ │ ├── jest.config.js │ │ ├── package-lock.json │ │ ├── package.json │ │ ├── src │ │ │ ├── Add.test.ts │ │ │ ├── Add.ts │ │ │ ├── index.ts │ │ │ └── interact.ts │ │ └── tsconfig.json │ └── ui │ │ ├── .gitignore │ │ ├── README.md │ │ ├── app │ │ ├── layout.tsx │ │ ├── page.tsx │ │ ├── reactCOIServiceWorker.tsx │ │ ├── zkappWorker.ts │ │ └── zkappWorkerClient.ts │ │ ├── components │ │ └── GradientBG.js │ │ ├── ghp-postbuild.js │ │ ├── next.config.mjs │ │ ├── package-lock.json │ │ ├── package.json │ │ ├── public │ │ ├── assets │ │ │ ├── HeroMinaLogo.svg │ │ │ ├── arrow-right-small.svg │ │ │ ├── button-hover-light.png │ │ │ ├── favicon.ico │ │ │ ├── fonts │ │ │ │ ├── ABCMonumentGrotesk-Bold.woff │ │ │ │ ├── ABCMonumentGrotesk-Bold.woff2 │ │ │ │ ├── ABCMonumentGrotesk-Light.woff │ │ │ │ ├── ABCMonumentGrotesk-Light.woff2 │ │ │ │ ├── ABCMonumentGrotesk-Regular.woff │ │ │ │ └── ABCMonumentGrotesk-Regular.woff2 │ │ │ ├── hash-pattern.png │ │ │ ├── hero-mina-logo.svg │ │ │ └── mina-gradient-bg.png │ │ └── coi-serviceworker.min.js │ │ ├── styles │ │ ├── Home.module.css │ │ └── globals.css │ │ └── tsconfig.json │ ├── 05-common-types-and-functions │ ├── .eslintrc.cjs │ ├── .gitattributes │ ├── .github │ │ └── workflows │ │ │ └── ci.yml │ ├── .gitignore │ ├── .husky │ │ └── pre-commit │ ├── .npmignore │ ├── .prettierignore │ ├── .prettierrc │ ├── 05output.png │ ├── LICENSE │ ├── README.md │ ├── babel.config.cjs │ ├── config.json │ ├── jest-resolver.cjs │ ├── jest.config.js │ ├── package-lock.json │ ├── package.json │ ├── src │ │ ├── BasicMerkleTreeContract.ts │ │ ├── LedgerContract.ts │ │ ├── index.ts │ │ └── main.ts │ └── tsconfig.json │ ├── 07-oracles │ ├── LICENSE │ ├── README.md │ ├── contracts │ │ ├── .eslintrc.cjs │ │ ├── .gitattributes │ │ ├── .github │ │ │ └── workflows │ │ │ │ └── ci.yml │ │ ├── .gitignore │ │ ├── .husky │ │ │ └── pre-commit │ │ ├── .npmignore │ │ ├── .prettierignore │ │ ├── .prettierrc │ │ ├── LICENSE │ │ ├── README.md │ │ ├── babel.config.cjs │ │ ├── config.json │ │ ├── jest-resolver.cjs │ │ ├── jest.config.js │ │ ├── package-lock.json │ │ ├── package.json │ │ ├── src │ │ │ ├── OracleExample.test.ts │ │ │ ├── OracleExample.ts │ │ │ ├── OracleExampleScaffold.ts │ │ │ └── index.ts │ │ └── tsconfig.json │ └── oracle │ │ ├── .eslintrc.json │ │ ├── .gitignore │ │ ├── README.md │ │ ├── app │ │ ├── api │ │ │ └── credit-score │ │ │ │ └── route.ts │ │ ├── favicon.ico │ │ ├── globals.css │ │ ├── layout.tsx │ │ ├── page.module.css │ │ └── page.tsx │ │ ├── next.config.js │ │ ├── package-lock.json │ │ ├── package.json │ │ ├── public │ │ ├── next.svg │ │ └── vercel.svg │ │ ├── scripts │ │ └── keygen.js │ │ └── tsconfig.json │ ├── 09-recursion │ ├── .eslintrc.cjs │ ├── .gitattributes │ ├── .github │ │ └── workflows │ │ │ └── ci.yml │ ├── .husky │ │ └── pre-commit │ ├── .npmignore │ ├── .prettierignore │ ├── .prettierrc │ ├── LICENSE │ ├── README.md │ ├── babel.config.cjs │ ├── config.json │ ├── jest-resolver.cjs │ ├── jest.config.js │ ├── package-lock.json │ ├── package.json │ ├── src │ │ ├── Add.ts │ │ ├── rollup.ts │ │ └── vote.ts │ └── tsconfig.json │ ├── 10-account-updates │ ├── .eslintrc.cjs │ ├── .gitattributes │ ├── .github │ │ └── workflows │ │ │ └── ci.yml │ ├── .gitignore │ ├── .husky │ │ └── pre-commit │ ├── .npmignore │ ├── .prettierignore │ ├── .prettierrc │ ├── LICENSE │ ├── README.md │ ├── babel.config.cjs │ ├── config.json │ ├── deploy_txn.png │ ├── jest-resolver.cjs │ ├── jest.config.js │ ├── package-lock.json │ ├── package.json │ ├── src │ │ ├── ProofsOnlyZkApp.ts │ │ ├── SecondaryZkApp.ts │ │ ├── index.ts │ │ └── main.ts │ ├── tsconfig.json │ ├── txn1-copy.png │ ├── txn1.png │ └── txn2.png │ ├── anonymous-message-board │ ├── .eslintrc.cjs │ ├── .gitattributes │ ├── .github │ │ └── workflows │ │ │ └── ci.yml │ ├── .gitignore │ ├── .npmignore │ ├── .prettierignore │ ├── .prettierrc │ ├── LICENSE │ ├── README.md │ ├── babel.config.cjs │ ├── config.json │ ├── jest-resolver.cjs │ ├── jest.config.js │ ├── package-lock.json │ ├── package.json │ ├── src │ │ └── message.ts │ └── tsconfig.json │ ├── feature-overview │ ├── .eslintrc.cjs │ ├── .prettierignore │ ├── .prettierrc │ ├── babel.config.cjs │ ├── config.json │ ├── package-lock.json │ ├── package.json │ ├── src │ │ └── upgradability │ │ │ ├── AddV1.ts │ │ │ ├── AddV2.ts │ │ │ ├── AddV3.ts │ │ │ └── upgrade.test.ts │ └── tsconfig.json │ └── interacting-with-zkApps-server-side │ ├── .eslintrc.cjs │ ├── .gitattributes │ ├── .github │ └── workflows │ │ └── ci.yml │ ├── .gitignore │ ├── .husky │ └── pre-commit │ ├── .npmignore │ ├── .prettierignore │ ├── .prettierrc │ ├── LICENSE │ ├── README.md │ ├── babel.config.cjs │ ├── config.json │ ├── jest-resolver.cjs │ ├── jest.config.js │ ├── package-lock.json │ ├── package.json │ ├── run.sh │ ├── src │ ├── Square.ts │ ├── index.ts │ ├── main.ts │ └── utils.ts │ └── tsconfig.json ├── i18n ├── fr │ └── docusaurus-plugin-content-docs │ │ └── current │ │ └── intro.md └── ru │ └── docusaurus-plugin-content-docs │ └── current │ └── intro.md ├── package-lock.json ├── package.json ├── scripts ├── tutorial-runner.ts └── update-sidebars-o1js-api.js ├── sidebars.js ├── src ├── components │ ├── common │ │ ├── Button.module.scss │ │ ├── Button.tsx │ │ ├── ResponsiveVideo.module.scss │ │ ├── ResponsiveVideo.tsx │ │ ├── Subhead.module.scss │ │ └── Subhead.tsx │ └── features │ │ ├── HomepageFeatures.module.scss │ │ └── HomepageFeatures.tsx ├── constants.ts ├── scss │ ├── base │ │ ├── _reset.scss │ │ ├── _reset_docusaurus.scss │ │ └── _typography.scss │ ├── custom.scss │ └── utilities │ │ ├── _mixins.scss │ │ └── _variables.scss └── theme │ ├── Admonition │ ├── index.tsx │ └── styles.module.scss │ ├── BackToTopButton │ ├── BackToTopButton.module.scss │ └── index.tsx │ ├── CodeBlock │ └── CopyButton │ │ ├── index.js │ │ └── styles.module.css │ ├── DocItem │ ├── Footer │ │ ├── DocItemFooter.module.scss │ │ └── index.js │ ├── Layout │ │ ├── DocItemLayout.module.scss │ │ └── index.js │ └── TOC │ │ └── Desktop │ │ └── index.js │ ├── Footer │ ├── Footer.module.scss │ └── index.tsx │ └── Icon │ ├── ExternalLink │ ├── index.tsx │ └── styles.module.css │ └── Menu │ └── index.tsx ├── static ├── .nojekyll ├── Mina_Foundation_Addresses.csv ├── O1_Labs_addresses.csv ├── assets │ ├── economicsWhitepaper.pdf │ └── technicalWhitepaper.pdf ├── font │ ├── MonumentGrotesk-Bold.woff │ ├── MonumentGrotesk-Bold.woff2 │ ├── MonumentGrotesk-Mono.woff │ ├── MonumentGrotesk-Regular.woff │ └── MonumentGrotesk-Regular.woff2 ├── img │ ├── 10_time_locked_accounts.png │ ├── 11_Mina_Berkeley_Upgrade.png │ ├── 1_zkApps_Off-Chain_Performance.jpg │ ├── 2_zkApps_Examples.jpg │ ├── 3_zkApps_Structure.jpg │ ├── 4_select_berkeley_auro.png │ ├── 4_zkApps_Prover_Function.jpg │ ├── 5_zkApps_Verifier_Function.jpg │ ├── 6_zkApps_DeploySmartContract.jpg │ ├── 76R2bpU.png │ ├── 7_zkApps_DeploySmartContract.jpg │ ├── 8_Snapps_SubmitTransaction.jpg │ ├── 8_zkApps_DeploySmartContract.jpg │ ├── 9_zkApps_Off-Chain_State.jpg │ ├── A3o18oN.png │ ├── Clorio.png │ ├── Clorio_receive.png │ ├── Copy_icon.png │ ├── Copy_icon_2.png │ ├── Documents_FAQFork_Mobile 1.jpg │ ├── Documents_FAQFork_Tablet 1.jpg │ ├── Documents_SNARKS_p3-01 1.jpg │ ├── Documents_SNARKS_p3-01_Tablet 1.png │ ├── FaVTmWD.png │ ├── Github.png │ ├── Github64.png │ ├── JGlawxh.png │ ├── LedgerLive.png │ ├── Medium.png │ ├── Mina.png │ ├── Mina_Explorer.png │ ├── Mina_Provider_Header.png │ ├── QaqfbXG.png │ ├── RY8umxW.png │ ├── Reddit.png │ ├── Staking_MINA.png │ ├── Telegram.png │ ├── TelegramSmall.svg │ ├── Twitter.png │ ├── YouTube.svg │ ├── ZJXLozR.png │ ├── angular-integration-guide │ │ ├── auro-1.png │ │ └── faucet.png │ ├── auro.png │ ├── banner-o1js.png │ ├── clorio_delegate.png │ ├── clorio_send.png │ ├── common │ │ ├── button-hover-dark.png │ │ ├── button-hover-light.png │ │ ├── light_chain.png │ │ ├── mina-logo.png │ │ ├── private_powerful.png │ │ └── programmable_money.png │ ├── fDBZog9.png │ ├── favicon.ico │ ├── footer │ │ └── background_large.png │ ├── hQvFVfp.png │ ├── homepage │ │ └── zkapp_developers.png │ ├── jzYrmZf.png │ ├── kQASfTN.png │ ├── mY4MzW0.png │ ├── mina_background.jpg │ ├── mina_staking_pallad.png │ ├── onlinestringtools.png │ ├── random.png │ ├── receive_MINA.png │ ├── receive_mina_pallad.png │ ├── send_MINA.png │ ├── send_mina_pallad.png │ ├── staking_power_delegate.png │ ├── tECFm3I.png │ ├── timelocked.png │ ├── tutorial-10-deploy_txn.png │ ├── tutorial-10-txn1.png │ ├── tutorial-10-txn2.png │ ├── tutorial-11-txn2.png │ ├── y6dM2FT.png │ └── zk-cli.png └── svg │ ├── common │ ├── arrow_right_small.svg │ ├── arrow_up_medium.svg │ ├── burger_menu.svg │ ├── chevron_up.svg │ ├── external_link.svg │ ├── logo.svg │ └── mina_logo.svg │ ├── homepage │ ├── about_mina.svg │ ├── node_operators.svg │ ├── participate.svg │ └── using_mina.svg │ └── socials │ ├── discord_24x24.svg │ ├── discord_dark_24x24.svg │ ├── facebook_24x24.svg │ ├── github_24x24.svg │ ├── telegram_24x24.svg │ ├── twitter_24x24.svg │ ├── wechat_24x24.svg │ └── youtube_24x24.svg ├── tsconfig.json └── vercel.json /.github/workflows/algolia-search.yml: -------------------------------------------------------------------------------- 1 | # 2 | # algolia-search.yml 3 | # 4 | # Create a search index for Algolia Search when code is pushed to main. 5 | # 6 | 7 | name: Algolia-Search 8 | 9 | on: 10 | push: 11 | branches: 12 | - main 13 | workflow_dispatch: {} 14 | jobs: 15 | wait-for-vercel: 16 | runs-on: ubuntu-latest 17 | steps: 18 | - run: sleep 300s 19 | shell: bash 20 | algolia-search: 21 | runs-on: ubuntu-latest 22 | needs: [wait-for-vercel] 23 | steps: 24 | - uses: actions/checkout@v2 25 | - name: Run algolia/docsearch-scraper 26 | run: | 27 | docker pull algolia/docsearch-scraper 28 | docker run \ 29 | -e ALGOLIA_APP_ID=${{ secrets.ALGOLIA_APP_ID }} \ 30 | -e API_KEY=${{ secrets.ALGOLIA_ADMIN_API_KEY }} \ 31 | -e "CONFIG=$(cat ./algolia-config.json | jq -r tostring)" \ 32 | algolia/docsearch-scraper 33 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Dependencies 2 | node_modules 3 | /**/*/node_modules 4 | 5 | # Production 6 | /**/*/build 7 | /**/*/dist 8 | /**/*/out 9 | build 10 | dist 11 | 12 | # Generated files 13 | .docusaurus 14 | .cache-loader 15 | 16 | 17 | # Misc 18 | .env 19 | .DS_Store 20 | .env.local 21 | .env.development.local 22 | .env.test.local 23 | .env.production.local 24 | 25 | npm-debug.log* 26 | yarn-debug.log* 27 | yarn-error.log* 28 | 29 | *.swp 30 | 31 | .vscode/ 32 | .idea/ 33 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | # NodeJS 2 | node_modules 3 | build 4 | 5 | # Editor 6 | .vscode 7 | 8 | # System 9 | .DS_Store 10 | -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "semi": true, 3 | "singleQuote": true, 4 | "tabWidth": 2, 5 | "trailingComma": "es5" 6 | } 7 | -------------------------------------------------------------------------------- /CODEOWNERS: -------------------------------------------------------------------------------- 1 | # Require PRs to be approved by someone from this team: 2 | * @o1-labs/docs-reviewers 3 | -------------------------------------------------------------------------------- /babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [require.resolve('@docusaurus/core/lib/babel/preset')], 3 | }; 4 | -------------------------------------------------------------------------------- /docs/exchange-operators/rosetta/send-requests.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: Sending requests 3 | description: Learn about Mina-specific request/response models 4 | --- 5 | 6 | # Sending requests 7 | 8 | After the Rosetta app is running, you can send requests to it. 9 | To run a `/network/list` request: 10 | 11 | curl -L -X POST 'http://localhost:3087/network/list' \ 12 | -H 'Content-Type: application/json' \ 13 | -H 'Accept: application/json' -d '{}' 14 | 15 | In the case of successful setups, you see a response similar to this one: 16 | 17 | 18 | ```json 19 | {"network_identifiers":[{"blockchain":"mina","network":"mainnet"}]} 20 | ``` 21 | 22 | You must pass the `network_identifier` object as a parameter to all other endpoints. In Mina Rosetta implementation, it exists only for the network you run Rosetta for, so this array always contains one object. 23 | 24 | Learn how to use Rosetta API for different use cases. See in the [Code Samples](samples) section. -------------------------------------------------------------------------------- /docs/node-developers/bip44.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: "BIP44 Information" 3 | hide_title: true 4 | --- 5 | 6 | # BIP44 Information 7 | 8 | | index | hexa | symbol | coin | 9 | |:------|:-----------|:-------|:----------------------------------| 10 | | 12586 | 0x8000312a | MINA | [Mina](https://minaprotocol.com/) | 11 | 12 | Mina uses the 5 level [BIP32](https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki) path format specified in [BIP44](https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki) 13 | 14 | ``` 15 | m / purpose' / coin_type' / account' / change / address_index 16 | ``` 17 | 18 | Keypairs are derived by varying only the ``account`` while keeping the ``change`` and ``address_index`` zero. 19 | 20 | # BIP32 path format 21 | 22 | ``` 23 | m / 44' / 12586' / account' / 0 / 0 24 | ``` 25 | 26 | # Examples 27 | 28 | | account | path | 29 | |:--------|:------------------------| 30 | | 0 | m/44'/12586'/0'/0/0 | 31 | | 271 | m/44'/12586'/271'/0/0 | 32 | -------------------------------------------------------------------------------- /docs/node-developers/index.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Overview" 3 | hide_title: true 4 | --- 5 | 6 | # Node Developers 7 | 8 | Explore the codebase on [GitHub](https://github.com/MinaProtocol/mina). 9 | 10 | To start contributing code to Mina, see the [Contributing Guide](/node-developers/contributing). The [protocol](https://github.com/MinaProtocol/mina/tree/master/src) and [CLI](https://github.com/MinaProtocol/mina/tree/master/src/app/cli) are written in OCaml. All levels of experience in any or all of these tools is welcome. 11 | 12 | Other documents relevant to contributing code include: 13 | 14 | - [Style Guide](/node-developers/style-guide) 15 | - [Code Review Guidelines](/node-developers/code-review-guidelines) 16 | - [Repository Structure](/node-developers/directory-structure) 17 | - [BIP44 Information](/node-developers/bip44-information) 18 | 19 | Mina is entirely open source. The code is distributed under the terms of the [Apache License 2.0](https://github.com/MinaProtocol/mina/blob/master/LICENSE). 20 | -------------------------------------------------------------------------------- /docs/participate/careers.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: Careers 3 | --- 4 | 5 | # Careers 6 | 7 | If you're looking for another way to get involved with Mina, consider exploring the following career opportunities at Mina Foundation and Mina ecosystem partners. 8 | 9 | 10 | ### Mina Foundation 11 | [Mina Foundation Careers Page](https://apply.workable.com/mina-foundation/) 12 | 13 | ### Mina Ecosystem Partners 14 | 15 | - o1Labs [Careers](https://boards.greenhouse.io/o1labs) - Incubators of the Mina Protocol 16 | - =nil; Foundation [Careers](https://nil.foundation/careers/) - Creators of the zkBridge bridge from Mina to Ethereum 17 | - Viable Systems [Careers](https://www.viablesystems.io/rust-jobs) - Tools to help improve the performance of the Mina nodes and overall network 18 | 19 | Are you a Mina ecosystem partner? Select "EDIT THIS PAGE" at the top of this page to submit a pull request to add your company blog. Thank you for helping grow the Mina ecosystem. 20 | -------------------------------------------------------------------------------- /docs/welcome.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | id: welcome 3 | title: "Welcome" 4 | description: Mina is building a gateway between the real world and crypto — and the infrastructure for the secure, democratic future we all deserve. 5 | slug: / 6 | --- 7 | 8 | import HomepageFeatures from "@site/src/components/features/HomepageFeatures"; 9 | 10 | # Welcome 11 | 12 | 13 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/functions/Bytes.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | function Bytes(size: number): typeof Bytes 3 | ``` 4 | 5 | A provable type representing an array of bytes. 6 | 7 | ```ts 8 | class Bytes32 extends Bytes(32) {} 9 | 10 | let bytes = Bytes32.fromHex('deadbeef'); 11 | ``` 12 | 13 | ## Parameters 14 | 15 | • **size**: `number` 16 | 17 | ## Returns 18 | 19 | *typeof* `Bytes` 20 | 21 | ## Source 22 | 23 | [lib/provable/wrapped-classes.ts:16](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/wrapped-classes.ts#L16) 24 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/functions/ConstantField.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | function ConstantField(x: bigint | ConstantFieldVar): ConstantField 3 | ``` 4 | 5 | ## Parameters 6 | 7 | • **x**: `bigint` \| `ConstantFieldVar` 8 | 9 | ## Returns 10 | 11 | [`ConstantField`](../type-aliases/ConstantField.mdx) 12 | 13 | ## Source 14 | 15 | [lib/provable/field.ts:1246](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/field.ts#L1246) 16 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/functions/MerkleListBase.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | function MerkleListBase(): ProvableHashable> 3 | ``` 4 | 5 | ## Type parameters 6 | 7 | • **T** 8 | 9 | ## Returns 10 | 11 | [`ProvableHashable`](../type-aliases/ProvableHashable.mdx)\<[`MerkleListBase`](../type-aliases/MerkleListBase.mdx)\<`T`\>\> 12 | 13 | ## Source 14 | 15 | [lib/provable/merkle-list.ts:46](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-list.ts#L46) 16 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/functions/MerkleWitness.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | function MerkleWitness(height: number): typeof BaseMerkleWitness 3 | ``` 4 | 5 | Returns a circuit-compatible Witness for a specific Tree height. 6 | 7 | ## Parameters 8 | 9 | • **height**: `number` 10 | 11 | Height of the Merkle Tree that this Witness belongs to. 12 | 13 | ## Returns 14 | 15 | *typeof* [`BaseMerkleWitness`](../classes/BaseMerkleWitness.mdx) 16 | 17 | A circuit-compatible Merkle Witness. 18 | 19 | ## Source 20 | 21 | [lib/provable/merkle-tree.ts:240](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-tree.ts#L240) 22 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/functions/Reducer.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | function Reducer(reducer: { 3 | "actionType": T; 4 | }): ReducerReturn 5 | ``` 6 | 7 | ## Type parameters 8 | 9 | • **T** *extends* [`FlexibleProvablePure`](../type-aliases/FlexibleProvablePure.mdx)\<`any`\> 10 | 11 | • **A** *extends* `any` = [`InferProvable`](../type-aliases/InferProvable.mdx)\<`T`\> 12 | 13 | ## Parameters 14 | 15 | • **reducer** 16 | 17 | • **reducer.actionType**: `T` 18 | 19 | ## Returns 20 | 21 | `ReducerReturn`\<`A`\> 22 | 23 | ## Source 24 | 25 | [lib/mina/actions/reducer.ts:17](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/actions/reducer.ts#L17) 26 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/functions/State.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | function State(defaultValue?: A): State 3 | ``` 4 | 5 | ## Type parameters 6 | 7 | • **A** 8 | 9 | ## Parameters 10 | 11 | • **defaultValue?**: `A` 12 | 13 | ## Returns 14 | 15 | [`State`](../type-aliases/State.mdx)\<`A`\> 16 | 17 | ## Source 18 | 19 | [lib/mina/state.ts:91](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/state.ts#L91) 20 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/functions/VarField.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | function VarField(x: VarFieldVar): VarField 3 | ``` 4 | 5 | ## Parameters 6 | 7 | • **x**: `VarFieldVar` 8 | 9 | ## Returns 10 | 11 | [`VarField`](../type-aliases/VarField.mdx) 12 | 13 | ## Source 14 | 15 | [lib/provable/field.ts:1242](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/field.ts#L1242) 16 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/functions/WithHash.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | function WithHash(type: ProvableHashable): ProvableHashable> 3 | ``` 4 | 5 | ## Type parameters 6 | 7 | • **T** 8 | 9 | ## Parameters 10 | 11 | • **type**: [`ProvableHashable`](../type-aliases/ProvableHashable.mdx)\<`T`\> 12 | 13 | ## Returns 14 | 15 | [`ProvableHashable`](../type-aliases/ProvableHashable.mdx)\<[`WithHash`](../type-aliases/WithHash.mdx)\<`T`\>\> 16 | 17 | ## Source 18 | 19 | [lib/provable/merkle-list.ts:28](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-list.ts#L28) 20 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/functions/addCachedAccount.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | function addCachedAccount(partialAccount: PartialAccount, graphqlEndpoint: string): void 3 | ``` 4 | 5 | Adds an account to the local cache, indexed by a GraphQL endpoint. 6 | 7 | ## Parameters 8 | 9 | • **partialAccount**: `PartialAccount` 10 | 11 | • **graphqlEndpoint**: `string`= `networkConfig.minaEndpoint` 12 | 13 | ## Returns 14 | 15 | `void` 16 | 17 | ## Source 18 | 19 | [lib/mina/fetch.ts:418](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/fetch.ts#L418) 20 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/functions/assert.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | function assert(stmt: boolean | Bool, message?: string): asserts stmt 3 | ``` 4 | 5 | Assert that a statement is true. If the statement is false, throws an error with the given message. 6 | Can be used in provable code. 7 | 8 | ## Parameters 9 | 10 | • **stmt**: `boolean` \| [`Bool`](../classes/Bool.mdx) 11 | 12 | • **message?**: `string` 13 | 14 | ## Returns 15 | 16 | `asserts stmt` 17 | 18 | ## Source 19 | 20 | [lib/provable/gadgets/common.ts:57](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/gadgets/common.ts#L57) 21 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/functions/checkBitLength.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | function checkBitLength( 3 | name: string, 4 | length: number, 5 | maxLength: number): void 6 | ``` 7 | 8 | ## Parameters 9 | 10 | • **name**: `string` 11 | 12 | • **length**: `number` 13 | 14 | • **maxLength**: `number`= `Fp.sizeInBits` 15 | 16 | ## Returns 17 | 18 | `void` 19 | 20 | ## Source 21 | 22 | [lib/provable/field.ts:1180](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/field.ts#L1180) 23 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/functions/checkZkappTransaction.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | function checkZkappTransaction(transactionHash: string, blockLength: number): Promise<{ 3 | "failureReason": string[][][]; 4 | "success": false; 5 | } | { 6 | "failureReason": null; 7 | "success": true; 8 | }> 9 | ``` 10 | 11 | ## Parameters 12 | 13 | • **transactionHash**: `string` 14 | 15 | • **blockLength**: `number`= `20` 16 | 17 | ## Returns 18 | 19 | `Promise`\<\{ 20 | `"failureReason"`: `string`[][][]; 21 | `"success"`: `false`; 22 | \} \| \{ 23 | `"failureReason"`: `null`; 24 | `"success"`: `true`; 25 | \}\> 26 | 27 | ## Source 28 | 29 | [lib/mina/fetch.ts:517](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/fetch.ts#L517) 30 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/functions/circuitMain.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | function circuitMain( 3 | target: typeof Circuit, 4 | propertyName: string, 5 | _descriptor?: PropertyDescriptor): any 6 | ``` 7 | 8 | ## Parameters 9 | 10 | • **target**: *typeof* [`Circuit`](../classes/Circuit.mdx) 11 | 12 | • **propertyName**: `string` 13 | 14 | • **\_descriptor?**: `PropertyDescriptor` 15 | 16 | ## Returns 17 | 18 | `any` 19 | 20 | ## Source 21 | 22 | [lib/proof-system/circuit.ts:192](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/circuit.ts#L192) 23 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/functions/conditionalSwap.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | function conditionalSwap( 3 | b: Bool, 4 | x: Field, 5 | y: Field): [Field, Field] 6 | ``` 7 | 8 | ## Parameters 9 | 10 | • **b**: [`Bool`](../classes/Bool.mdx) 11 | 12 | • **x**: [`Field`](../classes/Field.mdx) 13 | 14 | • **y**: [`Field`](../classes/Field.mdx) 15 | 16 | ## Returns 17 | 18 | [[`Field`](../type-aliases/Field.mdx), [`Field`](../type-aliases/Field.mdx)] 19 | 20 | ## Source 21 | 22 | [lib/provable/merkle-tree.ts:251](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-tree.ts#L251) 23 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/functions/createEcdsa.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | function createEcdsa(curve: CurveParams | typeof ForeignCurve): typeof EcdsaSignature 3 | ``` 4 | 5 | Create a class [EcdsaSignature](../classes/EcdsaSignature.mdx) for verifying ECDSA signatures on the given curve. 6 | 7 | ## Parameters 8 | 9 | • **curve**: `CurveParams` \| *typeof* [`ForeignCurve`](../classes/ForeignCurve.mdx) 10 | 11 | ## Returns 12 | 13 | *typeof* [`EcdsaSignature`](../classes/EcdsaSignature.mdx) 14 | 15 | ## Source 16 | 17 | [lib/provable/crypto/foreign-ecdsa.ts:246](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/crypto/foreign-ecdsa.ts#L246) 18 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/functions/fetchLastBlock.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | function fetchLastBlock(graphqlEndpoint: string): Promise> 3 | ``` 4 | 5 | Fetches the last block on the Mina network. 6 | 7 | ## Parameters 8 | 9 | • **graphqlEndpoint**: `string`= `networkConfig.minaEndpoint` 10 | 11 | ## Returns 12 | 13 | `Promise`\<`PreconditionBaseTypes`\<\{\}\>\> 14 | 15 | ## Source 16 | 17 | [lib/mina/fetch.ts:461](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/fetch.ts#L461) 18 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/functions/fetchTransactionStatus.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | function fetchTransactionStatus(txId: string, graphqlEndpoint: string): Promise 3 | ``` 4 | 5 | Fetches the status of a transaction. 6 | 7 | ## Parameters 8 | 9 | • **txId**: `string` 10 | 11 | • **graphqlEndpoint**: `string`= `networkConfig.minaEndpoint` 12 | 13 | ## Returns 14 | 15 | `Promise`\<[`TransactionStatus`](../type-aliases/TransactionStatus.mdx)\> 16 | 17 | ## Source 18 | 19 | [lib/mina/fetch.ts:598](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/fetch.ts#L598) 20 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/functions/genericHash.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | function genericHash( 3 | provable: ProvableHashable, 4 | prefix: string, 5 | value: T): Field 6 | ``` 7 | 8 | ## Type parameters 9 | 10 | • **T** 11 | 12 | ## Parameters 13 | 14 | • **provable**: [`ProvableHashable`](../type-aliases/ProvableHashable.mdx)\<`T`\> 15 | 16 | • **prefix**: `string` 17 | 18 | • **value**: `T` 19 | 20 | ## Returns 21 | 22 | [`Field`](../classes/Field.mdx) 23 | 24 | ## Source 25 | 26 | [lib/provable/merkle-list.ts:755](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-list.ts#L755) 27 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/functions/initializeBindings.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | function initializeBindings(): Promise 3 | ``` 4 | 5 | A function that has to finish before any bindings exports can be used. 6 | 7 | ## Returns 8 | 9 | `Promise`\<`void`\> 10 | 11 | ## Source 12 | 13 | [snarky.d.ts:763](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/snarky.d.ts#L763) 14 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/functions/merkleListHash.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | function merkleListHash(provable: ProvableHashable, prefix: string): (hash: Field, value: T) => Field 3 | ``` 4 | 5 | ## Type parameters 6 | 7 | • **T** 8 | 9 | ## Parameters 10 | 11 | • **provable**: [`ProvableHashable`](../type-aliases/ProvableHashable.mdx)\<`T`\> 12 | 13 | • **prefix**: `string`= `''` 14 | 15 | ## Returns 16 | 17 | `Function` 18 | 19 | > ### Parameters 20 | > 21 | > • **hash**: [`Field`](../classes/Field.mdx) 22 | > 23 | > • **value**: `T` 24 | > 25 | > ### Returns 26 | > 27 | > [`Field`](../classes/Field.mdx) 28 | > 29 | 30 | ## Source 31 | 32 | [lib/provable/merkle-list.ts:765](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-list.ts#L765) 33 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/functions/provable.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | function provable(typeObj: A, options?: {}): InferredProvable 3 | ``` 4 | 5 | ## Type parameters 6 | 7 | • **A** 8 | 9 | ## Parameters 10 | 11 | • **typeObj**: `A` 12 | 13 | • **options?** 14 | 15 | **Deprecated** 16 | 17 | ## Returns 18 | 19 | `InferredProvable`\<`A`, [`Field`](../classes/Field.mdx)\> 20 | 21 | ## Source 22 | 23 | [lib/provable/types/provable-derivers.ts:78](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/provable-derivers.ts#L78) 24 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/functions/provablePure.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | function provablePure(typeObj: A): ProvablePureExtended, InferValue, InferJson> 3 | ``` 4 | 5 | ## Type parameters 6 | 7 | • **A** 8 | 9 | ## Parameters 10 | 11 | • **typeObj**: `A` 12 | 13 | ## Returns 14 | 15 | `ProvablePureExtended`\<[`InferProvable`](../type-aliases/InferProvable.mdx)\<`A`\>, `InferValue`\<`A`\>, `InferJson`\<`A`\>\> 16 | 17 | ## Source 18 | 19 | [lib/provable/types/provable-derivers.ts:80](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/provable-derivers.ts#L80) 20 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/functions/public.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | function public_( 3 | target: any, 4 | _key: string | symbol, 5 | index: number): void 6 | ``` 7 | 8 | ## Parameters 9 | 10 | • **target**: `any` 11 | 12 | • **\_key**: `string` \| `symbol` 13 | 14 | • **index**: `number` 15 | 16 | ## Returns 17 | 18 | `void` 19 | 20 | ## Source 21 | 22 | [lib/proof-system/circuit.ts:156](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/circuit.ts#L156) 23 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/functions/readVarMessage.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | function readVarMessage( 3 | methodName: string, 4 | varName: string, 5 | varDescription: string): string 6 | ``` 7 | 8 | ## Parameters 9 | 10 | • **methodName**: `string` 11 | 12 | • **varName**: `string` 13 | 14 | • **varDescription**: `string` 15 | 16 | ## Returns 17 | 18 | `string` 19 | 20 | ## Source 21 | 22 | [lib/provable/field.ts:1222](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/field.ts#L1222) 23 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/functions/sendZkapp.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | function sendZkapp( 3 | json: string, 4 | graphqlEndpoint: string, 5 | __namedParameters: { 6 | "timeout": defaultTimeout; 7 | }): Promise<[undefined, FetchError] | [FetchResponse, undefined]> 8 | ``` 9 | 10 | Sends a zkApp command (transaction) to the specified GraphQL endpoint. 11 | 12 | ## Parameters 13 | 14 | • **json**: `string` 15 | 16 | • **graphqlEndpoint**: `string`= `networkConfig.minaEndpoint` 17 | 18 | • **\_\_namedParameters**= `{}` 19 | 20 | • **\_\_namedParameters.timeout**: `undefined` \| `number`= `defaultTimeout` 21 | 22 | ## Returns 23 | 24 | `Promise`\<[`undefined`, `FetchError`] \| [`FetchResponse`\<`SendZkAppResponse`\>, `undefined`]\> 25 | 26 | ## Source 27 | 28 | [lib/mina/fetch.ts:618](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/fetch.ts#L618) 29 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/functions/setArchiveGraphqlEndpoint.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | function setArchiveGraphqlEndpoint(graphqlEndpoint: string): void 3 | ``` 4 | 5 | Sets up a GraphQL endpoint to be used for fetching information from an Archive Node. 6 | 7 | ## Parameters 8 | 9 | • **graphqlEndpoint**: `string` 10 | 11 | ## Returns 12 | 13 | `void` 14 | 15 | ## Source 16 | 17 | [lib/mina/fetch.ts:134](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/fetch.ts#L134) 18 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/functions/setGraphqlEndpoint.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | function setGraphqlEndpoint(graphqlEndpoint: string): void 3 | ``` 4 | 5 | ## Parameters 6 | 7 | • **graphqlEndpoint**: `string` 8 | 9 | ## Returns 10 | 11 | `void` 12 | 13 | ## Source 14 | 15 | [lib/mina/fetch.ts:112](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/fetch.ts#L112) 16 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/functions/setGraphqlEndpoints.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | function setGraphqlEndpoints(__namedParameters: string[]): void 3 | ``` 4 | 5 | ## Parameters 6 | 7 | • **\_\_namedParameters**: `string`[] 8 | 9 | ## Returns 10 | 11 | `void` 12 | 13 | ## Source 14 | 15 | [lib/mina/fetch.ts:105](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/fetch.ts#L105) 16 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/functions/toConstantField.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | function toConstantField( 3 | x: Field, 4 | methodName: string, 5 | varName: string, 6 | varDescription: string): ConstantField 7 | ``` 8 | 9 | ## Parameters 10 | 11 | • **x**: [`Field`](../classes/Field.mdx) 12 | 13 | • **methodName**: `string` 14 | 15 | • **varName**: `string`= `'x'` 16 | 17 | • **varDescription**: `string`= `'field element'` 18 | 19 | ## Returns 20 | 21 | [`ConstantField`](../type-aliases/ConstantField.mdx) 22 | 23 | ## Source 24 | 25 | [lib/provable/field.ts:1197](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/field.ts#L1197) 26 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/functions/toFp.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | function toFp(x: string | number | bigint | Field): bigint 3 | ``` 4 | 5 | ## Parameters 6 | 7 | • **x**: `string` \| `number` \| `bigint` \| [`Field`](../classes/Field.mdx) 8 | 9 | ## Returns 10 | 11 | `bigint` 12 | 13 | ## Source 14 | 15 | [lib/provable/field.ts:1156](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/field.ts#L1156) 16 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/functions/verify.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | function verify(proof: ProofBase | JsonProof, verificationKey: string | VerificationKey): Promise 3 | ``` 4 | 5 | ## Parameters 6 | 7 | • **proof**: [`ProofBase`](../classes/ProofBase.mdx)\<`any`, `any`\> \| [`JsonProof`](../type-aliases/JsonProof.mdx) 8 | 9 | • **verificationKey**: `string` \| [`VerificationKey`](../classes/VerificationKey.mdx) 10 | 11 | ## Returns 12 | 13 | `Promise`\<`boolean`\> 14 | 15 | ## Source 16 | 17 | [lib/proof-system/zkprogram.ts:109](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/zkprogram.ts#L109) 18 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/functions/withHashes.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | function withHashes( 3 | data: T[], 4 | nextHash: (hash: Field, value: T) => Field, 5 | emptyHash: Field): { 6 | "data": WithHash[]; 7 | "hash": Field; 8 | } 9 | ``` 10 | 11 | ## Type parameters 12 | 13 | • **T** 14 | 15 | ## Parameters 16 | 17 | • **data**: `T`[] 18 | 19 | • **nextHash** 20 | 21 | • **emptyHash**: [`Field`](../classes/Field.mdx) 22 | 23 | ## Returns 24 | 25 | ```ts 26 | { 27 | "data": WithHash[]; 28 | "hash": Field; 29 | } 30 | ``` 31 | 32 | ### data 33 | 34 | ```ts 35 | data: WithHash[]; 36 | ``` 37 | 38 | ### hash 39 | 40 | ```ts 41 | hash: Field; 42 | ``` 43 | 44 | ## Source 45 | 46 | [lib/provable/merkle-list.ts:773](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-list.ts#L773) 47 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/functions/withMessage.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | function withMessage(error: unknown, message?: string): unknown 3 | ``` 4 | 5 | ## Parameters 6 | 7 | • **error**: `unknown` 8 | 9 | • **message?**: `string` 10 | 11 | ## Returns 12 | 13 | `unknown` 14 | 15 | ## Source 16 | 17 | [lib/provable/field.ts:1174](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/field.ts#L1174) 18 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/namespaces/Crypto/README.mdx: -------------------------------------------------------------------------------- 1 | ## Index 2 | 3 | | Member | Description | 4 | | :------ | :------ | 5 | | [Curve](type-aliases/Curve.mdx) | - | 6 | | [CurveParams](type-aliases/CurveParams.mdx) | Parameters defining an elliptic curve in short Weierstraß form | 7 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/namespaces/Crypto/type-aliases/Curve.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | type Curve: CurveAffine; 3 | ``` 4 | 5 | ## Source 6 | 7 | [lib/provable/crypto/crypto.ts:29](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/crypto/crypto.ts#L29) 8 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/namespaces/Crypto/type-aliases/CurveParams.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | type CurveParams: CurveParams_; 3 | ``` 4 | 5 | Parameters defining an elliptic curve in short Weierstraß form 6 | y^2 = x^3 + ax + b 7 | 8 | ## Source 9 | 10 | [lib/provable/crypto/crypto.ts:27](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/crypto/crypto.ts#L27) 11 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/namespaces/Encryption/README.mdx: -------------------------------------------------------------------------------- 1 | ## Index 2 | 3 | | Member | Description | 4 | | :------ | :------ | 5 | | [CipherText](type-aliases/CipherText.mdx) | - | 6 | | [CipherTextBytes](type-aliases/CipherTextBytes.mdx) | - | 7 | | [decrypt](functions/decrypt.mdx) | Decrypts a [CipherText](type-aliases/CipherText.mdx) using a [PrivateKey](../../classes/PrivateKey.mdx). | 8 | | [decryptBytes](functions/decryptBytes.mdx) | Decrypts a [CipherText](type-aliases/CipherText.mdx) using a [PrivateKey](../../classes/PrivateKey.mdx). | 9 | | [encrypt](functions/encrypt.mdx) | Public Key Encryption, encrypts Field elements using a [PublicKey](../../classes/PublicKey.mdx). | 10 | | [encryptBytes](functions/encryptBytes.mdx) | Public Key Encryption, encrypts Bytes using a [PublicKey](../../classes/PublicKey.mdx). | 11 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/namespaces/Encryption/functions/decrypt.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | function decrypt(__namedParameters: CipherText, privateKey: PrivateKey): Field[] 3 | ``` 4 | 5 | Decrypts a [CipherText](../type-aliases/CipherText.mdx) using a [PrivateKey](../../../classes/PrivateKey.mdx). 6 | 7 | ## Parameters 8 | 9 | • **\_\_namedParameters**: [`CipherText`](../type-aliases/CipherText.mdx) 10 | 11 | • **privateKey**: [`PrivateKey`](../../../classes/PrivateKey.mdx) 12 | 13 | ## Returns 14 | 15 | [`Field`](../../../classes/Field.mdx)[] 16 | 17 | ## Source 18 | 19 | [lib/provable/crypto/encryption.ts:28](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/crypto/encryption.ts#L28) 20 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/namespaces/Encryption/functions/decryptBytes.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | function decryptBytes(cipherText: CipherTextBytes, privateKey: PrivateKey): Bytes 3 | ``` 4 | 5 | Decrypts a [CipherText](../type-aliases/CipherText.mdx) using a [PrivateKey](../../../classes/PrivateKey.mdx). 6 | 7 | ## Parameters 8 | 9 | • **cipherText**: [`CipherTextBytes`](../type-aliases/CipherTextBytes.mdx) 10 | 11 | • **privateKey**: [`PrivateKey`](../../../classes/PrivateKey.mdx) 12 | 13 | ## Returns 14 | 15 | `Bytes` 16 | 17 | ## Source 18 | 19 | [lib/provable/crypto/encryption.ts:129](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/crypto/encryption.ts#L129) 20 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/namespaces/Encryption/functions/encrypt.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | function encrypt(message: Field[], otherPublicKey: PublicKey): CipherText 3 | ``` 4 | 5 | Public Key Encryption, encrypts Field elements using a [PublicKey](../../../classes/PublicKey.mdx). 6 | 7 | ## Parameters 8 | 9 | • **message**: [`Field`](../../../classes/Field.mdx)[] 10 | 11 | • **otherPublicKey**: [`PublicKey`](../../../classes/PublicKey.mdx) 12 | 13 | ## Returns 14 | 15 | [`CipherText`](../type-aliases/CipherText.mdx) 16 | 17 | ## Source 18 | 19 | [lib/provable/crypto/encryption.ts:64](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/crypto/encryption.ts#L64) 20 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/namespaces/Encryption/functions/encryptBytes.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | function encryptBytes(message: Bytes, otherPublicKey: PublicKey): CipherTextBytes 3 | ``` 4 | 5 | Public Key Encryption, encrypts Bytes using a [PublicKey](../../../classes/PublicKey.mdx). 6 | 7 | ## Parameters 8 | 9 | • **message**: `Bytes` 10 | 11 | • **otherPublicKey**: [`PublicKey`](../../../classes/PublicKey.mdx) 12 | 13 | ## Returns 14 | 15 | [`CipherTextBytes`](../type-aliases/CipherTextBytes.mdx) 16 | 17 | ## Source 18 | 19 | [lib/provable/crypto/encryption.ts:97](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/crypto/encryption.ts#L97) 20 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/namespaces/Encryption/type-aliases/CipherText.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | type CipherText: { 3 | "cipherText": Field[]; 4 | "publicKey": Group; 5 | }; 6 | ``` 7 | 8 | ## Type declaration 9 | 10 | ### cipherText 11 | 12 | ```ts 13 | cipherText: Field[]; 14 | ``` 15 | 16 | ### publicKey 17 | 18 | ```ts 19 | publicKey: Group; 20 | ``` 21 | 22 | ## Source 23 | 24 | [lib/provable/crypto/encryption.ts:19](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/crypto/encryption.ts#L19) 25 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/namespaces/Encryption/type-aliases/CipherTextBytes.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | type CipherTextBytes: CipherText & { 3 | "messageLength": number; 4 | }; 5 | ``` 6 | 7 | ## Type declaration 8 | 9 | ### messageLength 10 | 11 | ```ts 12 | messageLength: number; 13 | ``` 14 | 15 | ## Source 16 | 17 | [lib/provable/crypto/encryption.ts:23](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/crypto/encryption.ts#L23) 18 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/namespaces/Experimental/functions/memoizeWitness.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | function memoizeWitness(type: FlexibleProvable, compute: () => T): T 3 | ``` 4 | 5 | Like Provable.witness, but memoizes the witness during transaction construction 6 | for reuse by the prover. This is needed to witness non-deterministic values. 7 | 8 | ## Type parameters 9 | 10 | • **T** 11 | 12 | ## Parameters 13 | 14 | • **type**: [`FlexibleProvable`](../../../type-aliases/FlexibleProvable.mdx)\<`T`\> 15 | 16 | • **compute** 17 | 18 | ## Returns 19 | 20 | `T` 21 | 22 | ## Source 23 | 24 | [index.ts:163](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/index.ts#L163) 25 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/namespaces/Experimental/type-aliases/ActionBatch.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | type ActionBatch: BatchReducer_.ActionBatch; 3 | ``` 4 | 5 | ## Type parameters 6 | 7 | • **Action** 8 | 9 | ## Source 10 | 11 | [index.ts:213](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/index.ts#L213) 12 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/namespaces/Experimental/type-aliases/IndexedMerkleMap.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | type IndexedMerkleMap: IndexedMerkleMapBase; 3 | ``` 4 | 5 | ## Source 6 | 7 | [index.ts:166](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/index.ts#L166) 8 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/namespaces/Lightnet/README.mdx: -------------------------------------------------------------------------------- 1 | ## Index 2 | 3 | | Member | Description | 4 | | :------ | :------ | 5 | | [acquireKeyPair](functions/acquireKeyPair.mdx) | Gets random key pair (public and private keys) from account manager | 6 | | [listAcquiredKeyPairs](functions/listAcquiredKeyPairs.mdx) | Gets previously acquired key pairs list. | 7 | | [releaseKeyPair](functions/releaseKeyPair.mdx) | Releases previously acquired key pair by public key. | 8 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/namespaces/Lightnet/functions/listAcquiredKeyPairs.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | function listAcquiredKeyPairs(options: { 3 | "lightnetAccountManagerEndpoint": string; 4 | }): Promise<{ 5 | "privateKey": PrivateKey; 6 | "publicKey": PublicKey; 7 | }[] | null> 8 | ``` 9 | 10 | Gets previously acquired key pairs list. 11 | 12 | ## Parameters 13 | 14 | • **options** 15 | 16 | • **options.lightnetAccountManagerEndpoint?**: `string` 17 | 18 | Account manager endpoint to fetch from 19 | 20 | ## Returns 21 | 22 | `Promise`\<\{ 23 | `"privateKey"`: [`PrivateKey`](../../../classes/PrivateKey.mdx); 24 | `"publicKey"`: [`PublicKey`](../../../classes/PublicKey.mdx); 25 | \}[] \| `null`\> 26 | 27 | Key pairs list or null if the request failed 28 | 29 | ## Source 30 | 31 | [lib/mina/fetch.ts:923](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/fetch.ts#L923) 32 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/namespaces/Lightnet/functions/releaseKeyPair.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | function releaseKeyPair(options: { 3 | "lightnetAccountManagerEndpoint": string; 4 | "publicKey": string; 5 | }): Promise 6 | ``` 7 | 8 | Releases previously acquired key pair by public key. 9 | 10 | ## Parameters 11 | 12 | • **options** 13 | 14 | • **options.lightnetAccountManagerEndpoint?**: `string` 15 | 16 | Account manager endpoint to fetch from 17 | 18 | • **options.publicKey**: `string` 19 | 20 | Public key of previously acquired key pair to release 21 | 22 | ## Returns 23 | 24 | `Promise`\<`string` \| `null`\> 25 | 26 | Response message from the account manager as string or null if the request failed 27 | 28 | ## Source 29 | 30 | [lib/mina/fetch.ts:886](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/fetch.ts#L886) 31 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/namespaces/Mina/functions/TestPublicKey.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | function TestPublicKey(key: PrivateKey): TestPublicKey 3 | ``` 4 | 5 | ## Parameters 6 | 7 | • **key**: [`PrivateKey`](../../../classes/PrivateKey.mdx) 8 | 9 | ## Returns 10 | 11 | [`TestPublicKey`](../type-aliases/TestPublicKey.mdx) 12 | 13 | ## Source 14 | 15 | [lib/mina/local-blockchain.ts:51](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/local-blockchain.ts#L51) 16 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/namespaces/Mina/functions/currentSlot.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | function currentSlot(): UInt32 3 | ``` 4 | 5 | ## Returns 6 | 7 | [`UInt32`](../../../classes/UInt32.mdx) 8 | 9 | The current slot number, according to the active Mina instance. 10 | 11 | ## Source 12 | 13 | [lib/mina/mina-instance.ts:137](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/mina-instance.ts#L137) 14 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/namespaces/Mina/functions/currentTransaction.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | function currentTransaction(): undefined | CurrentTransaction 3 | ``` 4 | 5 | ## Returns 6 | 7 | `undefined` \| `CurrentTransaction` 8 | 9 | ## Source 10 | 11 | [lib/mina/transaction-context.ts:16](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/transaction-context.ts#L16) 12 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/namespaces/Mina/functions/faucet.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | function faucet(pub: PublicKey, network: string): Promise 3 | ``` 4 | 5 | Requests the [testnet faucet](https://faucet.minaprotocol.com/api/v1/faucet) to fund a public key. 6 | 7 | ## Parameters 8 | 9 | • **pub**: [`PublicKey`](../../../classes/PublicKey.mdx) 10 | 11 | • **network**: `string`= `'berkeley-qanet'` 12 | 13 | ## Returns 14 | 15 | `Promise`\<`void`\> 16 | 17 | ## Source 18 | 19 | [lib/mina/mina.ts:514](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/mina.ts#L514) 20 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/namespaces/Mina/functions/filterGroups.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | function filterGroups(xs: AuthorizationKind[]): { 3 | "proof": proofCount; 4 | "signedPair": pairs.pairs; 5 | "signedSingle": singleCount; 6 | } 7 | ``` 8 | 9 | ## Parameters 10 | 11 | • **xs**: `AuthorizationKind`[] 12 | 13 | ## Returns 14 | 15 | ```ts 16 | { 17 | "proof": proofCount; 18 | "signedPair": pairs.pairs; 19 | "signedSingle": singleCount; 20 | } 21 | ``` 22 | 23 | ### proof 24 | 25 | ```ts 26 | proof: number = proofCount; 27 | ``` 28 | 29 | ### signedPair 30 | 31 | ```ts 32 | signedPair: number = pairs.pairs; 33 | ``` 34 | 35 | ### signedSingle 36 | 37 | ```ts 38 | signedSingle: number = singleCount; 39 | ``` 40 | 41 | ## Source 42 | 43 | [lib/mina/transaction-validation.ts:130](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/transaction-validation.ts#L130) 44 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/namespaces/Mina/functions/getAccount.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | function getAccount(publicKey: PublicKey, tokenId?: Field): Account 3 | ``` 4 | 5 | ## Parameters 6 | 7 | • **publicKey**: [`PublicKey`](../../../classes/PublicKey.mdx) 8 | 9 | • **tokenId?**: [`Field`](../../../classes/Field.mdx) 10 | 11 | ## Returns 12 | 13 | [`Account`](../../../type-aliases/Account.mdx) 14 | 15 | The account data associated to the given public key. 16 | 17 | ## Source 18 | 19 | [lib/mina/mina-instance.ts:144](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/mina-instance.ts#L144) 20 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/namespaces/Mina/functions/getActions.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | function getActions( 3 | publicKey: PublicKey, 4 | actionStates?: ActionStates, 5 | tokenId?: Field): { 6 | "actions": string[][]; 7 | "hash": string; 8 | }[] 9 | ``` 10 | 11 | ## Parameters 12 | 13 | • **publicKey**: [`PublicKey`](../../../classes/PublicKey.mdx) 14 | 15 | • **actionStates?**: [`ActionStates`](../type-aliases/ActionStates.mdx) 16 | 17 | • **tokenId?**: [`Field`](../../../classes/Field.mdx) 18 | 19 | ## Returns 20 | 21 | \{ 22 | `"actions"`: `string`[][]; 23 | `"hash"`: `string`; 24 | \}[] 25 | 26 | A list of emitted sequencing actions associated to the given public key. 27 | 28 | ## Source 29 | 30 | [lib/mina/mina-instance.ts:208](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/mina-instance.ts#L208) 31 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/namespaces/Mina/functions/getBalance.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | function getBalance(publicKey: PublicKey, tokenId?: Field): UInt64 3 | ``` 4 | 5 | ## Parameters 6 | 7 | • **publicKey**: [`PublicKey`](../../../classes/PublicKey.mdx) 8 | 9 | • **tokenId?**: [`Field`](../../../classes/Field.mdx) 10 | 11 | ## Returns 12 | 13 | [`UInt64`](../../../classes/UInt64.mdx) 14 | 15 | The balance associated to the given public key. 16 | 17 | ## Source 18 | 19 | [lib/mina/mina-instance.ts:179](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/mina-instance.ts#L179) 20 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/namespaces/Mina/functions/getNetworkConstants.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | function getNetworkConstants(): NetworkConstants 3 | ``` 4 | 5 | ## Returns 6 | 7 | [`NetworkConstants`](../type-aliases/NetworkConstants.mdx) 8 | 9 | Data associated with the current Mina network constants. 10 | 11 | ## Source 12 | 13 | [lib/mina/mina-instance.ts:165](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/mina-instance.ts#L165) 14 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/namespaces/Mina/functions/getNetworkId.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | function getNetworkId(): NetworkId 3 | ``` 4 | 5 | ## Returns 6 | 7 | `NetworkId` 8 | 9 | The current Mina network ID. 10 | 11 | ## Source 12 | 13 | [lib/mina/mina-instance.ts:158](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/mina-instance.ts#L158) 14 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/namespaces/Mina/functions/getNetworkState.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | function getNetworkState(): PreconditionBaseTypes<{}> 3 | ``` 4 | 5 | ## Returns 6 | 7 | `PreconditionBaseTypes`\<\{\}\> 8 | 9 | Data associated with the current state of the Mina network. 10 | 11 | ## Source 12 | 13 | [lib/mina/mina-instance.ts:172](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/mina-instance.ts#L172) 14 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/namespaces/Mina/functions/getProofsEnabled.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | function getProofsEnabled(): boolean 3 | ``` 4 | 5 | ## Returns 6 | 7 | `boolean` 8 | 9 | ## Source 10 | 11 | [lib/mina/mina-instance.ts:216](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/mina-instance.ts#L216) 12 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/namespaces/Mina/functions/hasAccount.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | function hasAccount(publicKey: PublicKey, tokenId?: Field): boolean 3 | ``` 4 | 5 | Checks if an account exists within the ledger. 6 | 7 | ## Parameters 8 | 9 | • **publicKey**: [`PublicKey`](../../../classes/PublicKey.mdx) 10 | 11 | • **tokenId?**: [`Field`](../../../classes/Field.mdx) 12 | 13 | ## Returns 14 | 15 | `boolean` 16 | 17 | ## Source 18 | 19 | [lib/mina/mina-instance.ts:151](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/mina-instance.ts#L151) 20 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/namespaces/Mina/functions/sender.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | function sender(): PublicKey 3 | ``` 4 | 5 | Returns the public key of the current transaction's sender account. 6 | 7 | Throws an error if not inside a transaction, or the sender wasn't passed in. 8 | 9 | ## Returns 10 | 11 | [`PublicKey`](../../../classes/PublicKey.mdx) 12 | 13 | ## Source 14 | 15 | [lib/mina/mina.ts:463](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/mina.ts#L463) 16 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/namespaces/Mina/functions/setActiveInstance.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | function setActiveInstance(m: Mina): void 3 | ``` 4 | 5 | Set the currently used Mina instance. 6 | 7 | ## Parameters 8 | 9 | • **m**: `Mina` 10 | 11 | ## Returns 12 | 13 | `void` 14 | 15 | ## Source 16 | 17 | [lib/mina/mina-instance.ts:126](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/mina-instance.ts#L126) 18 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/namespaces/Mina/functions/waitForFunding.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | function waitForFunding(address: string): Promise 3 | ``` 4 | 5 | ## Parameters 6 | 7 | • **address**: `string` 8 | 9 | ## Returns 10 | 11 | `Promise`\<`void`\> 12 | 13 | ## Source 14 | 15 | [lib/mina/mina.ts:490](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/mina.ts#L490) 16 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/namespaces/Mina/namespaces/TestPublicKey/README.mdx: -------------------------------------------------------------------------------- 1 | ## Index 2 | 3 | | Member | Description | 4 | | :------ | :------ | 5 | | [fromBase58](functions/fromBase58.mdx) | - | 6 | | [random](functions/random.mdx) | - | 7 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/namespaces/Mina/namespaces/TestPublicKey/functions/fromBase58.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | function fromBase58(base58: string): TestPublicKey 3 | ``` 4 | 5 | ## Parameters 6 | 7 | • **base58**: `string` 8 | 9 | ## Returns 10 | 11 | [`TestPublicKey`](../../../type-aliases/TestPublicKey.mdx) 12 | 13 | ## Source 14 | 15 | [lib/mina/local-blockchain.ts:64](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/local-blockchain.ts#L64) 16 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/namespaces/Mina/namespaces/TestPublicKey/functions/random.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | function random(count: N): N extends 1 ? TestPublicKey : TupleN 3 | ``` 4 | 5 | ## Type parameters 6 | 7 | • **N** *extends* `number` = `1` 8 | 9 | ## Parameters 10 | 11 | • **count**: `N`= `undefined` 12 | 13 | ## Returns 14 | 15 | `N` *extends* `1` ? [`TestPublicKey`](../../../type-aliases/TestPublicKey.mdx) : [`TupleN`](../../../../../type-aliases/TupleN.mdx)\<[`TestPublicKey`](../../../type-aliases/TestPublicKey.mdx), `N`\> 16 | 17 | ## Source 18 | 19 | [lib/mina/local-blockchain.ts:55](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/local-blockchain.ts#L55) 20 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/namespaces/Mina/namespaces/Transaction/README.mdx: -------------------------------------------------------------------------------- 1 | ## Index 2 | 3 | | Member | Description | 4 | | :------ | :------ | 5 | | [fromJSON](functions/fromJSON.mdx) | - | 6 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/namespaces/Mina/namespaces/Transaction/functions/fromJSON.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | function fromJSON(json: ZkappCommand): Transaction 3 | ``` 4 | 5 | ## Parameters 6 | 7 | • **json**: `ZkappCommand` 8 | 9 | ## Returns 10 | 11 | [`Transaction`](../../../type-aliases/Transaction.mdx)\<`false`, `false`\> 12 | 13 | ## Source 14 | 15 | [lib/mina/transaction.ts:85](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/transaction.ts#L85) 16 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/namespaces/Mina/type-aliases/ActionStates.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | type ActionStates: { 3 | "endActionState": Field; 4 | "fromActionState": Field; 5 | }; 6 | ``` 7 | 8 | ## Type declaration 9 | 10 | ### endActionState? 11 | 12 | ```ts 13 | optional endActionState: Field; 14 | ``` 15 | 16 | ### fromActionState? 17 | 18 | ```ts 19 | optional fromActionState: Field; 20 | ``` 21 | 22 | ## Source 23 | 24 | [lib/mina/mina-instance.ts:62](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/mina-instance.ts#L62) 25 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/namespaces/Mina/type-aliases/FeePayerSpec.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | type FeePayerSpec: PublicKey | { 3 | "fee": number | string | UInt64; 4 | "memo": string; 5 | "nonce": number; 6 | "sender": PublicKey; 7 | } | undefined; 8 | ``` 9 | 10 | Allows you to specify information about the fee payer account and the transaction. 11 | 12 | ## Source 13 | 14 | [lib/mina/mina-instance.ts:52](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/mina-instance.ts#L52) 15 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/namespaces/Mina/type-aliases/NetworkConstants.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | type NetworkConstants: { 3 | "accountCreationFee": UInt64; 4 | "genesisTimestamp": UInt64; 5 | "slotTime": UInt64; 6 | }; 7 | ``` 8 | 9 | ## Type declaration 10 | 11 | ### accountCreationFee 12 | 13 | ```ts 14 | accountCreationFee: UInt64; 15 | ``` 16 | 17 | ### genesisTimestamp 18 | 19 | ```ts 20 | genesisTimestamp: UInt64; 21 | ``` 22 | 23 | ### slotTime 24 | 25 | ```ts 26 | slotTime: UInt64; 27 | ``` 28 | 29 | Duration of 1 slot in millisecondw 30 | 31 | ## Source 32 | 33 | [lib/mina/mina-instance.ts:67](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/mina-instance.ts#L67) 34 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/namespaces/Mina/type-aliases/PendingTransactionPromise.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | type PendingTransactionPromise: Promise & { 3 | "wait": PendingTransaction["wait"]; 4 | }; 5 | ``` 6 | 7 | A `Promise` with an additional `wait` method, which calls 8 | into the inner `TransactionStatus`'s `wait` method upon its resolution. 9 | 10 | ## Type declaration 11 | 12 | ### wait 13 | 14 | ```ts 15 | wait: PendingTransaction["wait"]; 16 | ``` 17 | 18 | Equivalent to calling the resolved `PendingTransaction`'s `wait` method. 19 | 20 | ## Source 21 | 22 | [lib/mina/transaction.ts:376](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/transaction.ts#L376) 23 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/namespaces/Mina/type-aliases/PendingTransactionStatus.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | type PendingTransactionStatus: "pending" | "rejected"; 3 | ``` 4 | 5 | ## Source 6 | 7 | [lib/mina/transaction.ts:151](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/transaction.ts#L151) 8 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/namespaces/Mina/type-aliases/TestPublicKey.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | type TestPublicKey: PublicKey & { 3 | "key": PrivateKey; 4 | }; 5 | ``` 6 | 7 | ## Type declaration 8 | 9 | ### key 10 | 11 | ```ts 12 | key: PrivateKey; 13 | ``` 14 | 15 | ## Source 16 | 17 | [lib/mina/local-blockchain.ts:51](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/local-blockchain.ts#L51) 18 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/namespaces/Mina/variables/activeInstance.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | activeInstance: Mina; 3 | ``` 4 | 5 | ## Source 6 | 7 | [lib/mina/mina-instance.ts:108](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/mina-instance.ts#L108) 8 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/type-aliases/Account.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | type Account: Types.Account; 3 | ``` 4 | 5 | ## Source 6 | 7 | [lib/mina/account.ts:19](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/account.ts#L19) 8 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/type-aliases/Bool.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | type Bool: Bool; 3 | ``` 4 | 5 | ## Source 6 | 7 | [lib/provable/wrapped.ts:70](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/wrapped.ts#L70) 8 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/type-aliases/BoolVar.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | type BoolVar: FieldVar; 3 | ``` 4 | 5 | ## Source 6 | 7 | [lib/provable/bool.ts:14](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/bool.ts#L14) 8 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/type-aliases/Bytes.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | type Bytes: InternalBytes; 3 | ``` 4 | 5 | ## Source 6 | 7 | [lib/provable/wrapped-classes.ts:16](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/wrapped-classes.ts#L16) 8 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/type-aliases/CacheHeader.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | type CacheHeader: 3 | | StepKeyHeader<"step-pk"> 4 | | StepKeyHeader<"step-vk"> 5 | | WrapKeyHeader<"wrap-pk"> 6 | | WrapKeyHeader<"wrap-vk"> 7 | | PlainHeader<"srs"> 8 | | PlainHeader & CommonHeader; 9 | ``` 10 | 11 | A header that is passed to the caching layer, to support rich caching strategies. 12 | 13 | Both `uniqueId` and `programId` can safely be used as a file path. 14 | 15 | ## Source 16 | 17 | [lib/proof-system/cache.ts:106](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/cache.ts#L106) 18 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/type-aliases/ConstantField.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | type ConstantField: Field & { 3 | "value": ConstantFieldVar; 4 | }; 5 | ``` 6 | 7 | ## Type declaration 8 | 9 | ### value 10 | 11 | ```ts 12 | value: ConstantFieldVar; 13 | ``` 14 | 15 | ## Source 16 | 17 | [lib/provable/field.ts:1246](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/field.ts#L1246) 18 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/type-aliases/DeployArgs.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | type DeployArgs: { 3 | "verificationKey": { 4 | "data": string; 5 | "hash": string | Field; 6 | }; 7 | } | undefined; 8 | ``` 9 | 10 | ## Source 11 | 12 | [lib/mina/zkapp.ts:1248](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/zkapp.ts#L1248) 13 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/type-aliases/Empty.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | type Empty: Undefined; 3 | ``` 4 | 5 | ## Source 6 | 7 | [lib/proof-system/zkprogram.ts:85](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/zkprogram.ts#L85) 8 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/type-aliases/Field.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | type Field: Field; 3 | ``` 4 | 5 | ## Source 6 | 7 | [lib/provable/wrapped.ts:42](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/wrapped.ts#L42) 8 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/type-aliases/FlexibleProvable.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | type FlexibleProvable: Provable | Struct; 3 | ``` 4 | 5 | ## Type parameters 6 | 7 | • **T** 8 | 9 | ## Source 10 | 11 | [lib/provable/types/struct.ts:61](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/struct.ts#L61) 12 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/type-aliases/FlexibleProvablePure.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | type FlexibleProvablePure: ProvablePure | StructPure; 3 | ``` 4 | 5 | ## Type parameters 6 | 7 | • **T** 8 | 9 | ## Source 10 | 11 | [lib/provable/types/struct.ts:62](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/struct.ts#L62) 12 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/type-aliases/Group.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | type Group: Group; 3 | ``` 4 | 5 | ## Source 6 | 7 | [lib/provable/wrapped.ts:76](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/wrapped.ts#L76) 8 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/type-aliases/InferProvable.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | type InferProvable: GenericInferProvable; 3 | ``` 4 | 5 | ## Type parameters 6 | 7 | • **T** 8 | 9 | ## Source 10 | 11 | [lib/provable/types/provable-derivers.ts:65](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/provable-derivers.ts#L65) 12 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/type-aliases/JsonProof.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | type JsonProof: { 3 | "maxProofsVerified": 0 | 1 | 2; 4 | "proof": string; 5 | "publicInput": string[]; 6 | "publicOutput": string[]; 7 | }; 8 | ``` 9 | 10 | ## Type declaration 11 | 12 | ### maxProofsVerified 13 | 14 | ```ts 15 | maxProofsVerified: 0 | 1 | 2; 16 | ``` 17 | 18 | ### proof 19 | 20 | ```ts 21 | proof: string; 22 | ``` 23 | 24 | ### publicInput 25 | 26 | ```ts 27 | publicInput: string[]; 28 | ``` 29 | 30 | ### publicOutput 31 | 32 | ```ts 33 | publicOutput: string[]; 34 | ``` 35 | 36 | ## Source 37 | 38 | [lib/proof-system/zkprogram.ts:146](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/zkprogram.ts#L146) 39 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/type-aliases/MerkleListBase.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | type MerkleListBase: { 3 | "data": Unconstrained[]>; 4 | "hash": Field; 5 | }; 6 | ``` 7 | 8 | Common base type for [MerkleList](../classes/MerkleList.mdx) and [MerkleListIterator](../classes/MerkleListIterator.mdx) 9 | 10 | ## Type parameters 11 | 12 | • **T** 13 | 14 | ## Type declaration 15 | 16 | ### data 17 | 18 | ```ts 19 | data: Unconstrained[]>; 20 | ``` 21 | 22 | ### hash 23 | 24 | ```ts 25 | hash: Field; 26 | ``` 27 | 28 | ## Source 29 | 30 | [lib/provable/merkle-list.ts:46](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-list.ts#L46) 31 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/type-aliases/Option.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | type Option: { 3 | "isSome": Bool; 4 | "value": T; 5 | } & { 6 | "assertSome": T; 7 | "orElse": T; 8 | }; 9 | ``` 10 | 11 | ## Type declaration 12 | 13 | ### isSome 14 | 15 | ```ts 16 | isSome: Bool; 17 | ``` 18 | 19 | ### value 20 | 21 | ```ts 22 | value: T; 23 | ``` 24 | 25 | ## Type declaration 26 | 27 | ### assertSome() 28 | 29 | #### Parameters 30 | 31 | • **message?**: `string` 32 | 33 | #### Returns 34 | 35 | `T` 36 | 37 | ### orElse() 38 | 39 | #### Parameters 40 | 41 | • **defaultValue**: `T` \| `V` 42 | 43 | #### Returns 44 | 45 | `T` 46 | 47 | ## Type parameters 48 | 49 | • **T** 50 | 51 | • **V** = `any` 52 | 53 | ## Source 54 | 55 | [lib/provable/option.ts:37](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/option.ts#L37) 56 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/type-aliases/ProvableExtended.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | type ProvableExtended: Provable & ProvableExtension; 3 | ``` 4 | 5 | ## Type parameters 6 | 7 | • **T** 8 | 9 | • **TValue** = `any` 10 | 11 | • **TJson** = `any` 12 | 13 | ## Source 14 | 15 | [lib/provable/types/struct.ts:49](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/struct.ts#L49) 16 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/type-aliases/ProvableHashable-1.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | type ProvableHashable: ProvableWithEmpty & { 3 | "toInput": (x: T) => HashInput; 4 | }; 5 | ``` 6 | 7 | ## Type declaration 8 | 9 | ### toInput() 10 | 11 | ```ts 12 | toInput: (x: T) => HashInput; 13 | ``` 14 | 15 | #### Parameters 16 | 17 | • **x**: `T` 18 | 19 | #### Returns 20 | 21 | `HashInput` 22 | 23 | ## Type parameters 24 | 25 | • **T** 26 | 27 | • **TValue** = `any` 28 | 29 | ## Source 30 | 31 | [lib/provable/types/provable-intf.ts:124](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/provable-intf.ts#L124) 32 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/type-aliases/ProvableHashable.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | type ProvableHashable: Provable & Hashable; 3 | ``` 4 | 5 | ## Type parameters 6 | 7 | • **T** 8 | 9 | • **V** = `any` 10 | 11 | ## Source 12 | 13 | [lib/provable/crypto/poseidon.ts:32](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/crypto/poseidon.ts#L32) 14 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/type-aliases/ProvableType.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | type ProvableType: WithProvable>; 3 | ``` 4 | 5 | ## Type parameters 6 | 7 | • **T** = `any` 8 | 9 | • **V** = `any` 10 | 11 | ## Source 12 | 13 | [lib/provable/types/provable-intf.ts:132](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/provable-intf.ts#L132) 14 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/type-aliases/ProvableTypePure.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | type ProvableTypePure: WithProvable>; 3 | ``` 4 | 5 | ## Type parameters 6 | 7 | • **T** = `any` 8 | 9 | • **V** = `any` 10 | 11 | ## Source 12 | 13 | [lib/provable/types/provable-intf.ts:133](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/provable-intf.ts#L133) 14 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/type-aliases/ProvableWithEmpty.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | type ProvableWithEmpty: Provable & { 3 | "empty": () => T; 4 | }; 5 | ``` 6 | 7 | ## Type declaration 8 | 9 | ### empty() 10 | 11 | ```ts 12 | empty: () => T; 13 | ``` 14 | 15 | #### Returns 16 | 17 | `T` 18 | 19 | ## Type parameters 20 | 21 | • **T** 22 | 23 | • **TValue** = `any` 24 | 25 | ## Source 26 | 27 | [lib/provable/types/provable-intf.ts:118](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/provable-intf.ts#L118) 28 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/type-aliases/Reducer.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | type Reducer: { 3 | "actionType": FlexibleProvablePure; 4 | }; 5 | ``` 6 | 7 | ## Type parameters 8 | 9 | • **Action** 10 | 11 | ## Type declaration 12 | 13 | ### actionType 14 | 15 | ```ts 16 | actionType: FlexibleProvablePure; 17 | ``` 18 | 19 | ## Source 20 | 21 | [lib/mina/actions/reducer.ts:17](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/actions/reducer.ts#L17) 22 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/type-aliases/ScalarConst.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | type ScalarConst: [0, bigint]; 3 | ``` 4 | 5 | ## Source 6 | 7 | [lib/provable/scalar.ts:20](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/scalar.ts#L20) 8 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/type-aliases/Struct.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | type Struct: ProvableExtended> & Constructor & { 3 | "_isStruct": true; 4 | }; 5 | ``` 6 | 7 | ## Type declaration 8 | 9 | ### \_isStruct 10 | 11 | ```ts 12 | _isStruct: true; 13 | ``` 14 | 15 | ## Type parameters 16 | 17 | • **T** 18 | 19 | ## Source 20 | 21 | [lib/provable/types/struct.ts:140](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/struct.ts#L140) 22 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/type-aliases/ToProvable.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | type ToProvable: A extends { 3 | "provable": infer P; 4 | } ? P : A; 5 | ``` 6 | 7 | ## Type parameters 8 | 9 | • **A** *extends* [`WithProvable`](WithProvable.mdx)\<`any`\> 10 | 11 | ## Source 12 | 13 | [lib/provable/types/provable-intf.ts:135](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/provable-intf.ts#L135) 14 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/type-aliases/TransactionStatus.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | type TransactionStatus: "INCLUDED" | "PENDING" | "UNKNOWN"; 3 | ``` 4 | 5 | INCLUDED: A transaction that is on the longest chain 6 | 7 | PENDING: A transaction either in the transition frontier or in transaction pool but is not on the longest chain 8 | 9 | UNKNOWN: The transaction has either been snarked, reached finality through consensus or has been dropped 10 | 11 | ## Source 12 | 13 | [lib/mina/graphql.ts:216](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/graphql.ts#L216) 14 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/type-aliases/TupleN.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | type TupleN: N extends N ? number extends N ? [...T[]] : [...TupleRec] : never; 3 | ``` 4 | 5 | tuple type that has the length as generic parameter 6 | 7 | ## Type parameters 8 | 9 | • **T** 10 | 11 | • **N** *extends* `number` 12 | 13 | ## Source 14 | 15 | [lib/util/types.ts:28](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/util/types.ts#L28) 16 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/type-aliases/Undefined.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | type Undefined: undefined; 3 | ``` 4 | 5 | ## Source 6 | 7 | [lib/proof-system/zkprogram.ts:82](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/zkprogram.ts#L82) 8 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/type-aliases/VarField.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | type VarField: Field & { 3 | "value": VarFieldVar; 4 | }; 5 | ``` 6 | 7 | ## Type declaration 8 | 9 | ### value 10 | 11 | ```ts 12 | value: VarFieldVar; 13 | ``` 14 | 15 | ## Source 16 | 17 | [lib/provable/field.ts:1242](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/field.ts#L1242) 18 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/type-aliases/Void.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | type Void: undefined; 3 | ``` 4 | 5 | ## Source 6 | 7 | [lib/proof-system/zkprogram.ts:87](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/zkprogram.ts#L87) 8 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/type-aliases/WithHash.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | type WithHash: { 3 | "element": T; 4 | "previousHash": Field; 5 | }; 6 | ``` 7 | 8 | ## Type parameters 9 | 10 | • **T** 11 | 12 | ## Type declaration 13 | 14 | ### element 15 | 16 | ```ts 17 | element: T; 18 | ``` 19 | 20 | ### previousHash 21 | 22 | ```ts 23 | previousHash: Field; 24 | ``` 25 | 26 | ## Source 27 | 28 | [lib/provable/merkle-list.ts:28](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-list.ts#L28) 29 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/type-aliases/WithProvable.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | type WithProvable: { 3 | "provable": A; 4 | } | A; 5 | ``` 6 | 7 | ## Type parameters 8 | 9 | • **A** 10 | 11 | ## Source 12 | 13 | [lib/provable/types/provable-intf.ts:130](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/provable-intf.ts#L130) 14 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/type-aliases/Witness.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | type Witness: { 3 | "isLeft": boolean; 4 | "sibling": Field; 5 | }[]; 6 | ``` 7 | 8 | ## Source 9 | 10 | [lib/provable/merkle-tree.ts:16](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-tree.ts#L16) 11 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/type-aliases/ZkProgram.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | type ZkProgram: ReturnType; 3 | ``` 4 | 5 | ## Type parameters 6 | 7 | • **Config** *extends* \{ 8 | `"methods"`: `{ [I in string]: Object }`; 9 | `"publicInput"`: [`ProvableTypePure`](ProvableTypePure.mdx); 10 | `"publicOutput"`: [`ProvableTypePure`](ProvableTypePure.mdx); 11 | \} 12 | 13 | • **Methods** *extends* `{ [I in keyof Config["methods"]]: Method>, InferProvableOrVoid>, Config["methods"][I]> }` 14 | 15 | ## Source 16 | 17 | [lib/proof-system/zkprogram.ts:174](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/zkprogram.ts#L174) 18 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/variables/Account.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | Account: GenericProvableExtended; 3 | ``` 4 | 5 | ## Source 6 | 7 | [lib/mina/account.ts:19](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/account.ts#L19) 8 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/variables/Bool.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | const Bool: typeof Bool & (...args: [boolean | FieldVar | Bool]) => Bool; 3 | ``` 4 | 5 | A boolean value. You can create it like this: 6 | 7 | ## Example 8 | 9 | ``` 10 | const b = Bool(true); 11 | ``` 12 | 13 | You can also combine multiple Bools with boolean operations: 14 | 15 | ## Example 16 | 17 | ```ts 18 | const c = Bool(false); 19 | 20 | const d = b.or(c).and(false).not(); 21 | 22 | d.assertTrue(); 23 | ``` 24 | 25 | Bools are often created by methods on other types such as `Field.equals()`: 26 | 27 | ```ts 28 | const b: Bool = Field(5).equals(6); 29 | ``` 30 | 31 | ## Source 32 | 33 | [lib/provable/wrapped.ts:70](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/wrapped.ts#L70) 34 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/variables/Cache.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | Cache: { 3 | "FileSystem": (cacheDirectory: string, debug?: boolean) => Cache; 4 | "FileSystemDefault": Cache; 5 | "None": Cache; 6 | }; 7 | ``` 8 | 9 | ## Type declaration 10 | 11 | ### FileSystem() 12 | 13 | ```ts 14 | FileSystem: (cacheDirectory: string, debug?: boolean) => Cache; 15 | ``` 16 | 17 | #### Parameters 18 | 19 | • **cacheDirectory**: `string` 20 | 21 | • **debug?**: `boolean` 22 | 23 | #### Returns 24 | 25 | [`Cache`](../type-aliases/Cache.mdx) 26 | 27 | ### FileSystemDefault 28 | 29 | ```ts 30 | FileSystemDefault: Cache; 31 | ``` 32 | 33 | ### None 34 | 35 | ```ts 36 | None: Cache; 37 | ``` 38 | 39 | ## Source 40 | 41 | [lib/proof-system/cache.ts:37](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/cache.ts#L37) 42 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/variables/Crypto.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | const Crypto: { 3 | "CurveParams": CurveParams_; 4 | "createCurve": {}; 5 | }; 6 | ``` 7 | 8 | ## Type declaration 9 | 10 | ### CurveParams 11 | 12 | ```ts 13 | CurveParams: {} = CurveParams_; 14 | ``` 15 | 16 | Parameters defining an elliptic curve in short Weierstraß form 17 | y^2 = x^3 + ax + b 18 | 19 | ### createCurve() 20 | 21 | Create elliptic curve arithmetic methods. 22 | 23 | #### Parameters 24 | 25 | • **params**: `CurveParams` 26 | 27 | #### Returns 28 | 29 | ```ts 30 | {} 31 | ``` 32 | 33 | ## Source 34 | 35 | [lib/provable/crypto/crypto.ts:8](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/crypto/crypto.ts#L8) 36 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/variables/Empty.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | Empty: ProvablePureExtended; 3 | ``` 4 | 5 | ## Source 6 | 7 | [lib/proof-system/zkprogram.ts:85](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/zkprogram.ts#L85) 8 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/variables/Group.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | const Group: typeof Group & (...args: [{ 3 | "x": | string 4 | | number 5 | | bigint 6 | | FieldVar 7 | | Field; 8 | "y": | string 9 | | number 10 | | bigint 11 | | FieldVar 12 | | Field; 13 | }]) => Group; 14 | ``` 15 | 16 | An element of a Group. 17 | 18 | ## Source 19 | 20 | [lib/provable/wrapped.ts:76](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/wrapped.ts#L76) 21 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/variables/ProvableType.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | ProvableType: { 3 | "get": ToProvable; 4 | "synthesize": T; 5 | }; 6 | ``` 7 | 8 | ## Type declaration 9 | 10 | ### get() 11 | 12 | #### Type parameters 13 | 14 | • **A** *extends* `unknown` 15 | 16 | #### Parameters 17 | 18 | • **type**: `A` 19 | 20 | #### Returns 21 | 22 | [`ToProvable`](../type-aliases/ToProvable.mdx)\<`A`\> 23 | 24 | ### synthesize() 25 | 26 | Create some value of type `T` from its provable type description. 27 | 28 | #### Type parameters 29 | 30 | • **T** 31 | 32 | #### Parameters 33 | 34 | • **type**: [`ProvableType`](../type-aliases/ProvableType.mdx)\<`T`, `any`\> 35 | 36 | #### Returns 37 | 38 | `T` 39 | 40 | ## Source 41 | 42 | [lib/provable/types/provable-intf.ts:132](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/types/provable-intf.ts#L132) 43 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/variables/TokenId.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | const TokenId: { 3 | "default": Field; 4 | "derive": Field; 5 | "fromBase58": Field; 6 | "toBase58": string; 7 | }; 8 | ``` 9 | 10 | ## Type declaration 11 | 12 | ### default 13 | 14 | ```ts 15 | default: Field; 16 | ``` 17 | 18 | ### derive() 19 | 20 | #### Parameters 21 | 22 | • **tokenOwner**: [`PublicKey`](../classes/PublicKey.mdx) 23 | 24 | • **parentTokenId**: [`Field`](../classes/Field.mdx)= `undefined` 25 | 26 | #### Returns 27 | 28 | [`Field`](../classes/Field.mdx) 29 | 30 | ### fromBase58() 31 | 32 | #### Parameters 33 | 34 | • **base58**: `string` 35 | 36 | #### Returns 37 | 38 | [`Field`](../classes/Field.mdx) 39 | 40 | ### toBase58() 41 | 42 | #### Parameters 43 | 44 | • **t**: [`Field`](../classes/Field.mdx) 45 | 46 | #### Returns 47 | 48 | `string` 49 | 50 | ## Source 51 | 52 | [lib/mina/account-update.ts:666](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/account-update.ts#L666) 53 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/variables/TransactionVersion.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | const TransactionVersion: { 3 | "current": () => UInt32; 4 | }; 5 | ``` 6 | 7 | ## Type declaration 8 | 9 | ### current() 10 | 11 | ```ts 12 | current: () => UInt32; 13 | ``` 14 | 15 | #### Returns 16 | 17 | [`UInt32`](../classes/UInt32.mdx) 18 | 19 | ## Source 20 | 21 | [lib/mina/account-update.ts:119](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/account-update.ts#L119) 22 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/variables/Undefined.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | Undefined: ProvablePureExtended; 3 | ``` 4 | 5 | ## Source 6 | 7 | [lib/proof-system/zkprogram.ts:82](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/zkprogram.ts#L82) 8 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/variables/Void.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | Void: ProvablePureExtended; 3 | ``` 4 | 5 | ## Source 6 | 7 | [lib/proof-system/zkprogram.ts:87](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/proof-system/zkprogram.ts#L87) 8 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/variables/ZkappPublicInput.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | ZkappPublicInput: ProvablePureExtended<{ 3 | "accountUpdate": Field; 4 | "calls": Field; 5 | }, { 6 | "accountUpdate": Field; 7 | "calls": Field; 8 | }, { 9 | "accountUpdate": Field; 10 | "calls": Field; 11 | }>; 12 | ``` 13 | 14 | ## Type declaration 15 | 16 | ### accountUpdate 17 | 18 | ```ts 19 | accountUpdate: Field = Field; 20 | ``` 21 | 22 | ### calls 23 | 24 | ```ts 25 | calls: Field = Field; 26 | ``` 27 | 28 | ## Source 29 | 30 | [lib/mina/account-update.ts:2050](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/mina/account-update.ts#L2050) 31 | -------------------------------------------------------------------------------- /docs/zkapps/o1js-reference/variables/emptyHash.mdx: -------------------------------------------------------------------------------- 1 | ```ts 2 | const emptyHash: Field; 3 | ``` 4 | 5 | ## Source 6 | 7 | [lib/provable/merkle-list.ts:24](https://github.com/o1-labs/o1js/blob/6ebbc23710f6de023fea6d83dc93c5a914c571f2/src/lib/provable/merkle-list.ts#L24) 8 | -------------------------------------------------------------------------------- /docs/zkapps/o1js/gadgets.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: Gadgets 3 | hide_title: true 4 | description: How gadgets work in o1js. 5 | keywords: 6 | - smart contracts 7 | - zkapp 8 | - gadgets 9 | - bitwise 10 | - o1js 11 | - blockchain 12 | --- 13 | 14 | # Gadgets 15 | 16 | Gadgets are small, reusable low-level building blocks that simplify the process of creating new cryptographic primitives. Most gadgets build upon custom gates and act as low-level accelerators in the proof system. 17 | 18 | In o1js, you can import these provable and helper methods from the `Gadgets` namespace: 19 | 20 | - [Bitwise Operations](/zkapps/o1js/bitwise-operations) 21 | - [Foreign Field Arithmetic](/zkapps/o1js/ecdsa) 22 | 23 | See the type declaration for [Gadgets](/zkapps/o1js-reference/variables/Gadgets) in the o1js Reference documentation. 24 | -------------------------------------------------------------------------------- /docs/zkapps/roadmap.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: zkApps and o1js Roadmap 3 | hide_title: true 4 | sidebar_label: Roadmap 5 | description: zkApps and o1js roadmap, features, enhancements, and future development plans. 6 | keywords: 7 | - zkapps 8 | - roadmap 9 | - o1js 10 | - zkapps development 11 | - zkapps features 12 | - smart contracts 13 | - zero knowledge proofs 14 | - zk 15 | --- 16 | 17 | import Subhead from '@site/src/components/common/Subhead'; 18 | 19 | # zkApps and o1js Roadmap 20 | 21 | High-level overview of features available now, next, and later 22 | 23 | o1js banner 27 | 28 | To stay up to date with zkApps and o1js, follow the [o1Labs blog posts](https://www.o1labs.org/blog). 29 | -------------------------------------------------------------------------------- /examples/exchange-operators/nodejs/dprint.json: -------------------------------------------------------------------------------- 1 | { 2 | "incremental": true, 3 | "indentWidth": 2, 4 | "lineWidth": 100, 5 | "typescript": { 6 | "arrowFunction.useParentheses": "force", 7 | "quoteProps": "asNeeded", 8 | "semiColons": "asi" 9 | }, 10 | "markdown": { 11 | "textWrap": "always" 12 | }, 13 | "includes": ["**.{json,md,ts}"], 14 | "excludes": ["target"], 15 | "plugins": [ 16 | "https://plugins.dprint.dev/json-0.19.2.wasm", 17 | "https://plugins.dprint.dev/markdown-0.16.4.wasm", 18 | "https://plugins.dprint.dev/typescript-0.89.3.wasm" 19 | ] 20 | } 21 | -------------------------------------------------------------------------------- /examples/exchange-operators/nodejs/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "mina-rosetta-sample", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "type": "module", 7 | "scripts": { 8 | "sample": "node --enable-source-maps --no-warnings= --loader ts-node/esm index.ts" 9 | }, 10 | "author": "", 11 | "license": "ISC", 12 | "dependencies": { 13 | "axios": "^1.6.8", 14 | "mina-signer": "^3.0.7" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /examples/zkapps/01-hello-world/.eslintrc.cjs: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | env: { 4 | browser: true, 5 | node: true, 6 | jest: true, 7 | }, 8 | extends: ['eslint:recommended', 'plugin:o1js/recommended'], 9 | parser: '@typescript-eslint/parser', 10 | parserOptions: { 11 | ecmaVersion: 'latest', 12 | }, 13 | plugins: ['@typescript-eslint', 'o1js'], 14 | rules: {}, 15 | }; 16 | -------------------------------------------------------------------------------- /examples/zkapps/01-hello-world/.gitattributes: -------------------------------------------------------------------------------- 1 | # Use line endings appropriate for the system. This prevents Git from 2 | # complaining about project template line endings when committing on Windows. 3 | * text=auto eol=lf 4 | -------------------------------------------------------------------------------- /examples/zkapps/01-hello-world/.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | # 2 | # ci.yml 3 | # 4 | # Run tests for all pushed commits and opened pull requests on Github. 5 | # 6 | 7 | name: CI 8 | on: [push, pull_request] 9 | jobs: 10 | test: 11 | runs-on: ubuntu-latest 12 | timeout-minutes: 10 13 | steps: 14 | - name: Set up NodeJS 15 | uses: actions/setup-node@v2 16 | with: 17 | node-version: '16' 18 | - name: Git checkout 19 | uses: actions/checkout@v2 20 | - name: NPM ci, build, & test 21 | run: | 22 | npm ci 23 | npm run build --if-present 24 | npm test 25 | env: 26 | CI: true 27 | -------------------------------------------------------------------------------- /examples/zkapps/01-hello-world/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | build -------------------------------------------------------------------------------- /examples/zkapps/01-hello-world/.husky/pre-commit: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . "$(dirname "$0")/_/husky.sh" 3 | 4 | npx lint-staged 5 | -------------------------------------------------------------------------------- /examples/zkapps/01-hello-world/.npmignore: -------------------------------------------------------------------------------- 1 | # TypeScript files 2 | src 3 | 4 | # Editor 5 | .vscode 6 | 7 | # System 8 | .DS_Store 9 | -------------------------------------------------------------------------------- /examples/zkapps/01-hello-world/.prettierignore: -------------------------------------------------------------------------------- 1 | # NodeJS 2 | node_modules 3 | build 4 | coverage 5 | .husky 6 | 7 | # Editor 8 | .vscode 9 | 10 | # System 11 | .DS_Store 12 | 13 | # Misc 14 | LICENSE 15 | -------------------------------------------------------------------------------- /examples/zkapps/01-hello-world/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "semi": true, 3 | "singleQuote": true, 4 | "tabWidth": 2, 5 | "trailingComma": "es5" 6 | } 7 | -------------------------------------------------------------------------------- /examples/zkapps/01-hello-world/01output.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MinaProtocol/docs2/2e7d64c9a6aa5362757a0cbdf3616face39151a0/examples/zkapps/01-hello-world/01output.png -------------------------------------------------------------------------------- /examples/zkapps/01-hello-world/babel.config.cjs: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [['@babel/preset-env', { targets: { node: 'current' } }]], 3 | }; 4 | -------------------------------------------------------------------------------- /examples/zkapps/01-hello-world/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": 1, 3 | "deployAliases": {} 4 | } -------------------------------------------------------------------------------- /examples/zkapps/01-hello-world/jest-resolver.cjs: -------------------------------------------------------------------------------- 1 | module.exports = (request, options) => { 2 | return options.defaultResolver(request, { 3 | ...options, 4 | packageFilter: (pkg) => { 5 | // When importing o1js, we specify the Node ESM import as Jest by default imports the web version 6 | if (pkg.name === 'o1js') { 7 | return { 8 | ...pkg, 9 | main: pkg.exports.node.import, 10 | }; 11 | } 12 | if (pkg.name === 'node-fetch') { 13 | return { ...pkg, main: pkg.main }; 14 | } 15 | return { 16 | ...pkg, 17 | main: pkg.module || pkg.main, 18 | }; 19 | }, 20 | }); 21 | }; 22 | -------------------------------------------------------------------------------- /examples/zkapps/01-hello-world/jest.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('@ts-jest/dist/types').InitialOptionsTsJest} */ 2 | export default { 3 | verbose: true, 4 | preset: 'ts-jest/presets/default-esm', 5 | testEnvironment: 'node', 6 | globals: { 7 | 'ts-jest': { 8 | useESM: true, 9 | }, 10 | }, 11 | transform: { 12 | '^.+\\.(t)s$': 'ts-jest', 13 | '^.+\\.(j)s$': 'babel-jest', 14 | }, 15 | resolver: '/jest-resolver.cjs', 16 | transformIgnorePatterns: [ 17 | '/node_modules/(?!o1js/node_modules/tslib)', 18 | ], 19 | }; 20 | -------------------------------------------------------------------------------- /examples/zkapps/01-hello-world/src/Square.ts: -------------------------------------------------------------------------------- 1 | import { Field, SmartContract, state, State, method } from 'o1js'; 2 | 3 | export class Square extends SmartContract { 4 | @state(Field) num = State(); 5 | 6 | init() { 7 | super.init(); 8 | this.num.set(Field(3)); 9 | } 10 | 11 | @method async update(square: Field) { 12 | const currentState = this.num.get(); 13 | this.num.requireEquals(currentState); 14 | square.assertEquals(currentState.mul(currentState)); 15 | this.num.set(square); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /examples/zkapps/01-hello-world/src/index.ts: -------------------------------------------------------------------------------- 1 | import { Square } from './Square.js'; 2 | 3 | export { Square }; 4 | -------------------------------------------------------------------------------- /examples/zkapps/01-hello-world/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES2019", 4 | "module": "es2022", 5 | "lib": ["dom", "esnext"], 6 | "outDir": "./build", 7 | "rootDir": ".", 8 | "strict": true, 9 | "strictPropertyInitialization": false, // to enable generic constructors, e.g. on CircuitValue 10 | "skipLibCheck": true, 11 | "forceConsistentCasingInFileNames": true, 12 | "esModuleInterop": true, 13 | "moduleResolution": "node", 14 | "experimentalDecorators": true, 15 | "emitDecoratorMetadata": true, 16 | "allowJs": true, 17 | "declaration": true, 18 | "sourceMap": true, 19 | "noFallthroughCasesInSwitch": true, 20 | "allowSyntheticDefaultImports": true, 21 | "isolatedModules": true 22 | }, 23 | "include": ["./src"], 24 | "exclude": ["./src/**/*.test.ts"] 25 | } 26 | -------------------------------------------------------------------------------- /examples/zkapps/02-private-inputs-and-hash-functions/.eslintrc.cjs: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | env: { 4 | browser: true, 5 | node: true, 6 | jest: true, 7 | }, 8 | extends: ['eslint:recommended', 'plugin:o1js/recommended'], 9 | parser: '@typescript-eslint/parser', 10 | parserOptions: { 11 | ecmaVersion: 'latest', 12 | }, 13 | plugins: ['@typescript-eslint', 'o1js'], 14 | rules: {}, 15 | }; 16 | -------------------------------------------------------------------------------- /examples/zkapps/02-private-inputs-and-hash-functions/.gitattributes: -------------------------------------------------------------------------------- 1 | # Use line endings appropriate for the system. This prevents Git from 2 | # complaining about project template line endings when committing on Windows. 3 | * text=auto eol=lf 4 | -------------------------------------------------------------------------------- /examples/zkapps/02-private-inputs-and-hash-functions/.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | # 2 | # ci.yml 3 | # 4 | # Run tests for all pushed commits and opened pull requests on Github. 5 | # 6 | 7 | name: CI 8 | on: [push, pull_request] 9 | jobs: 10 | test: 11 | runs-on: ubuntu-latest 12 | timeout-minutes: 10 13 | steps: 14 | - name: Set up NodeJS 15 | uses: actions/setup-node@v2 16 | with: 17 | node-version: '16' 18 | - name: Git checkout 19 | uses: actions/checkout@v2 20 | - name: NPM ci, build, & test 21 | run: | 22 | npm ci 23 | npm run build --if-present 24 | npm test 25 | env: 26 | CI: true 27 | -------------------------------------------------------------------------------- /examples/zkapps/02-private-inputs-and-hash-functions/.gitignore: -------------------------------------------------------------------------------- 1 | # NodeJS 2 | node_modules 3 | build 4 | package-lock.json 5 | coverage 6 | 7 | # Editor 8 | .vscode 9 | 10 | # System 11 | .DS_Store 12 | 13 | # Never commit keys to Git! 14 | keys 15 | -------------------------------------------------------------------------------- /examples/zkapps/02-private-inputs-and-hash-functions/.husky/pre-commit: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . "$(dirname "$0")/_/husky.sh" 3 | 4 | npx lint-staged 5 | -------------------------------------------------------------------------------- /examples/zkapps/02-private-inputs-and-hash-functions/.npmignore: -------------------------------------------------------------------------------- 1 | # TypeScript files 2 | src 3 | 4 | # Editor 5 | .vscode 6 | 7 | # System 8 | .DS_Store 9 | -------------------------------------------------------------------------------- /examples/zkapps/02-private-inputs-and-hash-functions/.prettierignore: -------------------------------------------------------------------------------- 1 | # NodeJS 2 | node_modules 3 | build 4 | coverage 5 | .husky 6 | 7 | # Editor 8 | .vscode 9 | 10 | # System 11 | .DS_Store 12 | 13 | # Misc 14 | LICENSE 15 | -------------------------------------------------------------------------------- /examples/zkapps/02-private-inputs-and-hash-functions/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "semi": true, 3 | "singleQuote": true, 4 | "tabWidth": 2, 5 | "trailingComma": "es5" 6 | } 7 | -------------------------------------------------------------------------------- /examples/zkapps/02-private-inputs-and-hash-functions/02output.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MinaProtocol/docs2/2e7d64c9a6aa5362757a0cbdf3616face39151a0/examples/zkapps/02-private-inputs-and-hash-functions/02output.png -------------------------------------------------------------------------------- /examples/zkapps/02-private-inputs-and-hash-functions/babel.config.cjs: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [['@babel/preset-env', { targets: { node: 'current' } }]], 3 | }; 4 | -------------------------------------------------------------------------------- /examples/zkapps/02-private-inputs-and-hash-functions/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": 1, 3 | "deployAliases": {} 4 | } -------------------------------------------------------------------------------- /examples/zkapps/02-private-inputs-and-hash-functions/jest-resolver.cjs: -------------------------------------------------------------------------------- 1 | module.exports = (request, options) => { 2 | return options.defaultResolver(request, { 3 | ...options, 4 | packageFilter: (pkg) => { 5 | // When importing o1js, we specify the Node ESM import as Jest by default imports the web version 6 | if (pkg.name === 'o1js') { 7 | return { 8 | ...pkg, 9 | main: pkg.exports.node.import, 10 | }; 11 | } 12 | if (pkg.name === 'node-fetch') { 13 | return { ...pkg, main: pkg.main }; 14 | } 15 | return { 16 | ...pkg, 17 | main: pkg.module || pkg.main, 18 | }; 19 | }, 20 | }); 21 | }; 22 | -------------------------------------------------------------------------------- /examples/zkapps/02-private-inputs-and-hash-functions/jest.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('@ts-jest/dist/types').InitialOptionsTsJest} */ 2 | export default { 3 | verbose: true, 4 | preset: 'ts-jest/presets/default-esm', 5 | testEnvironment: 'node', 6 | globals: { 7 | 'ts-jest': { 8 | useESM: true, 9 | }, 10 | }, 11 | transform: { 12 | '^.+\\.(t)s$': 'ts-jest', 13 | '^.+\\.(j)s$': 'babel-jest', 14 | }, 15 | resolver: '/jest-resolver.cjs', 16 | transformIgnorePatterns: [ 17 | '/node_modules/(?!o1js/node_modules/tslib)', 18 | ], 19 | }; 20 | -------------------------------------------------------------------------------- /examples/zkapps/02-private-inputs-and-hash-functions/src/IncrementSecret.ts: -------------------------------------------------------------------------------- 1 | import { Field, SmartContract, state, State, method, Poseidon } from 'o1js'; 2 | 3 | export class IncrementSecret extends SmartContract { 4 | @state(Field) x = State(); 5 | 6 | @method async initState(salt: Field, firstSecret: Field) { 7 | this.x.set(Poseidon.hash([salt, firstSecret])); 8 | } 9 | 10 | @method async incrementSecret(salt: Field, secret: Field) { 11 | const x = this.x.get(); 12 | this.x.requireEquals(x); 13 | 14 | Poseidon.hash([salt, secret]).assertEquals(x); 15 | this.x.set(Poseidon.hash([salt, secret.add(1)])); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /examples/zkapps/02-private-inputs-and-hash-functions/src/index.ts: -------------------------------------------------------------------------------- 1 | import { IncrementSecret } from './IncrementSecret.js'; 2 | 3 | export { IncrementSecret }; 4 | -------------------------------------------------------------------------------- /examples/zkapps/02-private-inputs-and-hash-functions/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES2019", 4 | "module": "es2022", 5 | "lib": ["dom", "esnext"], 6 | "outDir": "./build", 7 | "rootDir": ".", 8 | "strict": true, 9 | "strictPropertyInitialization": false, // to enable generic constructors, e.g. on CircuitValue 10 | "skipLibCheck": true, 11 | "forceConsistentCasingInFileNames": true, 12 | "esModuleInterop": true, 13 | "moduleResolution": "node", 14 | "experimentalDecorators": true, 15 | "emitDecoratorMetadata": true, 16 | "allowJs": true, 17 | "declaration": true, 18 | "sourceMap": true, 19 | "noFallthroughCasesInSwitch": true, 20 | "allowSyntheticDefaultImports": true, 21 | "isolatedModules": true 22 | }, 23 | "include": ["./src"], 24 | "exclude": ["./src/**/*.test.ts"] 25 | } 26 | -------------------------------------------------------------------------------- /examples/zkapps/04-zkapp-browser-ui/contracts/.eslintrc.cjs: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | env: { 4 | browser: true, 5 | node: true, 6 | jest: true, 7 | }, 8 | extends: [ 9 | 'eslint:recommended', 10 | 'plugin:@typescript-eslint/eslint-recommended', 11 | 'plugin:@typescript-eslint/recommended', 12 | 'plugin:o1js/recommended', 13 | ], 14 | parser: '@typescript-eslint/parser', 15 | parserOptions: { 16 | ecmaVersion: 'latest', 17 | }, 18 | plugins: ['@typescript-eslint', 'o1js'], 19 | rules: { 20 | 'no-constant-condition': 'off', 21 | 'prefer-const': 'off', 22 | }, 23 | }; 24 | -------------------------------------------------------------------------------- /examples/zkapps/04-zkapp-browser-ui/contracts/.gitattributes: -------------------------------------------------------------------------------- 1 | # Use line endings appropriate for the system. This prevents Git from 2 | # complaining about project template line endings when committing on Windows. 3 | * text=auto eol=lf 4 | -------------------------------------------------------------------------------- /examples/zkapps/04-zkapp-browser-ui/contracts/.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: zkApp tests 2 | on: 3 | push: 4 | pull_request: 5 | workflow_dispatch: {} 6 | jobs: 7 | test: 8 | timeout-minutes: 30 9 | runs-on: ${{ matrix.os }} 10 | strategy: 11 | fail-fast: true 12 | matrix: 13 | node: [18, 20] 14 | os: [ubuntu-latest] 15 | steps: 16 | - name: Set up NodeJS 17 | uses: actions/setup-node@v4 18 | with: 19 | node-version: ${{ matrix.node }} 20 | - name: Git checkout 21 | uses: actions/checkout@v4 22 | - name: NPM ci, build, & test 23 | run: | 24 | npm ci 25 | npm run build --if-present 26 | npm test 27 | env: 28 | CI: true 29 | -------------------------------------------------------------------------------- /examples/zkapps/04-zkapp-browser-ui/contracts/.gitignore: -------------------------------------------------------------------------------- 1 | # NodeJS 2 | node_modules 3 | build 4 | coverage 5 | 6 | # Editor 7 | .vscode 8 | 9 | # System 10 | .DS_Store 11 | 12 | # Never commit keys to Git! 13 | keys 14 | -------------------------------------------------------------------------------- /examples/zkapps/04-zkapp-browser-ui/contracts/.npmignore: -------------------------------------------------------------------------------- 1 | # TypeScript files 2 | src 3 | 4 | # Editor 5 | .vscode 6 | 7 | # System 8 | .DS_Store 9 | 10 | # Never reveal your keys! 11 | keys 12 | -------------------------------------------------------------------------------- /examples/zkapps/04-zkapp-browser-ui/contracts/.prettierignore: -------------------------------------------------------------------------------- 1 | # NodeJS 2 | node_modules 3 | build 4 | coverage 5 | .husky 6 | 7 | # Editor 8 | .vscode 9 | 10 | # System 11 | .DS_Store 12 | 13 | # Misc 14 | LICENSE 15 | -------------------------------------------------------------------------------- /examples/zkapps/04-zkapp-browser-ui/contracts/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "semi": true, 3 | "singleQuote": true, 4 | "tabWidth": 2, 5 | "trailingComma": "es5" 6 | } 7 | -------------------------------------------------------------------------------- /examples/zkapps/04-zkapp-browser-ui/contracts/README.md: -------------------------------------------------------------------------------- 1 | # Mina zkApp: 04 Zkapp Browser Ui 2 | 3 | This template uses TypeScript. 4 | 5 | ## How to build 6 | 7 | ```sh 8 | npm run build 9 | ``` 10 | 11 | ## How to run tests 12 | 13 | ```sh 14 | npm run test 15 | npm run testw # watch mode 16 | ``` 17 | 18 | ## How to run coverage 19 | 20 | ```sh 21 | npm run coverage 22 | ``` 23 | 24 | ## License 25 | 26 | [Apache-2.0](LICENSE) 27 | -------------------------------------------------------------------------------- /examples/zkapps/04-zkapp-browser-ui/contracts/babel.config.cjs: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [['@babel/preset-env', { targets: { node: 'current' } }]], 3 | }; 4 | -------------------------------------------------------------------------------- /examples/zkapps/04-zkapp-browser-ui/contracts/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": 1, 3 | "deployAliases": {} 4 | } -------------------------------------------------------------------------------- /examples/zkapps/04-zkapp-browser-ui/contracts/jest-resolver.cjs: -------------------------------------------------------------------------------- 1 | module.exports = (request, options) => { 2 | return options.defaultResolver(request, { 3 | ...options, 4 | packageFilter: (pkg) => { 5 | // When importing o1js, we specify the Node ESM import as Jest by default imports the web version 6 | if (pkg.name === 'o1js') { 7 | return { 8 | ...pkg, 9 | main: pkg.exports.node.import, 10 | }; 11 | } 12 | if (pkg.name === 'node-fetch') { 13 | return { ...pkg, main: pkg.main }; 14 | } 15 | return { 16 | ...pkg, 17 | main: pkg.module || pkg.main, 18 | }; 19 | }, 20 | }); 21 | }; 22 | -------------------------------------------------------------------------------- /examples/zkapps/04-zkapp-browser-ui/contracts/jest.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('@ts-jest/dist/types').InitialOptionsTsJest} */ 2 | export default { 3 | verbose: true, 4 | preset: 'ts-jest/presets/default-esm', 5 | testEnvironment: 'node', 6 | globals: { 7 | 'ts-jest': { 8 | useESM: true, 9 | }, 10 | }, 11 | testTimeout: 1_000_000, 12 | transform: { 13 | '^.+\\.(t)s$': 'ts-jest', 14 | '^.+\\.(j)s$': 'babel-jest', 15 | }, 16 | resolver: '/jest-resolver.cjs', 17 | transformIgnorePatterns: [ 18 | '/node_modules/(?!(tslib|o1js/node_modules/tslib))', 19 | ], 20 | modulePathIgnorePatterns: ['/build/'], 21 | moduleNameMapper: { 22 | '^(\\.{1,2}/.+)\\.js$': '$1', 23 | }, 24 | }; 25 | -------------------------------------------------------------------------------- /examples/zkapps/04-zkapp-browser-ui/contracts/src/Add.ts: -------------------------------------------------------------------------------- 1 | import { Field, SmartContract, state, State, method } from 'o1js'; 2 | 3 | /** 4 | * Basic Example 5 | * See https://docs.minaprotocol.com/zkapps for more info. 6 | * 7 | * The Add contract initializes the state variable 'num' to be a Field(1) value by default when deployed. 8 | * When the 'update' method is called, the Add contract adds Field(2) to its 'num' contract state. 9 | * 10 | * This file is safe to delete and replace with your own contract. 11 | */ 12 | export class Add extends SmartContract { 13 | @state(Field) num = State(); 14 | 15 | init() { 16 | super.init(); 17 | this.num.set(Field(1)); 18 | } 19 | 20 | @method async update() { 21 | const currentState = this.num.getAndRequireEquals(); 22 | const newState = currentState.add(2); 23 | this.num.set(newState); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /examples/zkapps/04-zkapp-browser-ui/contracts/src/index.ts: -------------------------------------------------------------------------------- 1 | import { Add } from './Add.js'; 2 | 3 | export { Add }; 4 | -------------------------------------------------------------------------------- /examples/zkapps/04-zkapp-browser-ui/contracts/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es2020", 4 | "module": "es2022", 5 | "lib": ["dom", "esnext"], 6 | "outDir": "./build", 7 | "rootDir": ".", 8 | "strict": true, 9 | "strictPropertyInitialization": false, // to enable generic constructors, e.g. on CircuitValue 10 | "skipLibCheck": true, 11 | "forceConsistentCasingInFileNames": true, 12 | "esModuleInterop": true, 13 | "moduleResolution": "node", 14 | "experimentalDecorators": true, 15 | "emitDecoratorMetadata": true, 16 | "allowJs": true, 17 | "declaration": true, 18 | "sourceMap": true, 19 | "noFallthroughCasesInSwitch": true, 20 | "allowSyntheticDefaultImports": true, 21 | "useDefineForClassFields": false, 22 | }, 23 | "include": ["./src"], 24 | } 25 | -------------------------------------------------------------------------------- /examples/zkapps/04-zkapp-browser-ui/ui/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | .yarn/install-state.gz 8 | 9 | # testing 10 | /coverage 11 | 12 | # next.js 13 | /.next/ 14 | /out/ 15 | 16 | # production 17 | /build 18 | 19 | # misc 20 | .DS_Store 21 | *.pem 22 | 23 | # debug 24 | npm-debug.log* 25 | yarn-debug.log* 26 | yarn-error.log* 27 | 28 | # local env files 29 | .env*.local 30 | 31 | # vercel 32 | .vercel 33 | 34 | # typescript 35 | *.tsbuildinfo 36 | next-env.d.ts 37 | -------------------------------------------------------------------------------- /examples/zkapps/04-zkapp-browser-ui/ui/app/layout.tsx: -------------------------------------------------------------------------------- 1 | import "../styles/globals.css"; 2 | 3 | export const metadata = { 4 | title: 'Mina zkApp UI', 5 | description: 'built with o1js', 6 | icons: { 7 | icon: '/assets/favicon.ico', 8 | }, 9 | }; 10 | 11 | export default function RootLayout({ children }: { children: React.ReactNode }) { 12 | return ( 13 | 14 | {children} 15 | 16 | ); 17 | } 18 | -------------------------------------------------------------------------------- /examples/zkapps/04-zkapp-browser-ui/ui/app/reactCOIServiceWorker.tsx: -------------------------------------------------------------------------------- 1 | export {}; 2 | 3 | function loadCOIServiceWorker() { 4 | if ( 5 | typeof window !== 'undefined' && 6 | window.location.hostname != 'localhost' 7 | ) { 8 | const coi = window.document.createElement('script'); 9 | coi.setAttribute('src', '/04-zkapp-browser-ui/coi-serviceworker.min.js'); // update if your repo name changes for 'npm run deploy' to work correctly 10 | window.document.head.appendChild(coi); 11 | } 12 | } 13 | 14 | loadCOIServiceWorker(); 15 | -------------------------------------------------------------------------------- /examples/zkapps/04-zkapp-browser-ui/ui/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ui", 3 | "version": "0.1.0", 4 | "private": true, 5 | "type": "module", 6 | "scripts": { 7 | "dev": "next dev", 8 | "build": "next build --no-lint", 9 | "start": "next start", 10 | "lint": "next lint", 11 | "ts-watch": "tsc --noEmit --incremental --watch", 12 | "deploy": "next build --no-lint && touch out/.nojekyll && node ./ghp-postbuild && git add -f out && git commit -m \"Deploy gh-pages\" && cd .. && git subtree push --prefix ui/out origin gh-pages" 13 | }, 14 | "dependencies": { 15 | "coi-serviceworker": "^0.1.7", 16 | "comlink": "^4.4.1", 17 | "next": "14.2.3", 18 | "o1js": "^1.*", 19 | "react": "^18", 20 | "react-dom": "^18" 21 | }, 22 | "devDependencies": { 23 | "@types/node": "^22", 24 | "@types/react": "^18", 25 | "@types/react-dom": "^18", 26 | "typescript": "^5" 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /examples/zkapps/04-zkapp-browser-ui/ui/public/assets/arrow-right-small.svg: -------------------------------------------------------------------------------- 1 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /examples/zkapps/04-zkapp-browser-ui/ui/public/assets/button-hover-light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MinaProtocol/docs2/2e7d64c9a6aa5362757a0cbdf3616face39151a0/examples/zkapps/04-zkapp-browser-ui/ui/public/assets/button-hover-light.png -------------------------------------------------------------------------------- /examples/zkapps/04-zkapp-browser-ui/ui/public/assets/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MinaProtocol/docs2/2e7d64c9a6aa5362757a0cbdf3616face39151a0/examples/zkapps/04-zkapp-browser-ui/ui/public/assets/favicon.ico -------------------------------------------------------------------------------- /examples/zkapps/04-zkapp-browser-ui/ui/public/assets/fonts/ABCMonumentGrotesk-Bold.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MinaProtocol/docs2/2e7d64c9a6aa5362757a0cbdf3616face39151a0/examples/zkapps/04-zkapp-browser-ui/ui/public/assets/fonts/ABCMonumentGrotesk-Bold.woff -------------------------------------------------------------------------------- /examples/zkapps/04-zkapp-browser-ui/ui/public/assets/fonts/ABCMonumentGrotesk-Bold.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MinaProtocol/docs2/2e7d64c9a6aa5362757a0cbdf3616face39151a0/examples/zkapps/04-zkapp-browser-ui/ui/public/assets/fonts/ABCMonumentGrotesk-Bold.woff2 -------------------------------------------------------------------------------- /examples/zkapps/04-zkapp-browser-ui/ui/public/assets/fonts/ABCMonumentGrotesk-Light.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MinaProtocol/docs2/2e7d64c9a6aa5362757a0cbdf3616face39151a0/examples/zkapps/04-zkapp-browser-ui/ui/public/assets/fonts/ABCMonumentGrotesk-Light.woff -------------------------------------------------------------------------------- /examples/zkapps/04-zkapp-browser-ui/ui/public/assets/fonts/ABCMonumentGrotesk-Light.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MinaProtocol/docs2/2e7d64c9a6aa5362757a0cbdf3616face39151a0/examples/zkapps/04-zkapp-browser-ui/ui/public/assets/fonts/ABCMonumentGrotesk-Light.woff2 -------------------------------------------------------------------------------- /examples/zkapps/04-zkapp-browser-ui/ui/public/assets/fonts/ABCMonumentGrotesk-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MinaProtocol/docs2/2e7d64c9a6aa5362757a0cbdf3616face39151a0/examples/zkapps/04-zkapp-browser-ui/ui/public/assets/fonts/ABCMonumentGrotesk-Regular.woff -------------------------------------------------------------------------------- /examples/zkapps/04-zkapp-browser-ui/ui/public/assets/fonts/ABCMonumentGrotesk-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MinaProtocol/docs2/2e7d64c9a6aa5362757a0cbdf3616face39151a0/examples/zkapps/04-zkapp-browser-ui/ui/public/assets/fonts/ABCMonumentGrotesk-Regular.woff2 -------------------------------------------------------------------------------- /examples/zkapps/04-zkapp-browser-ui/ui/public/assets/hash-pattern.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MinaProtocol/docs2/2e7d64c9a6aa5362757a0cbdf3616face39151a0/examples/zkapps/04-zkapp-browser-ui/ui/public/assets/hash-pattern.png -------------------------------------------------------------------------------- /examples/zkapps/04-zkapp-browser-ui/ui/public/assets/mina-gradient-bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MinaProtocol/docs2/2e7d64c9a6aa5362757a0cbdf3616face39151a0/examples/zkapps/04-zkapp-browser-ui/ui/public/assets/mina-gradient-bg.png -------------------------------------------------------------------------------- /examples/zkapps/05-common-types-and-functions/.eslintrc.cjs: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | env: { 4 | browser: true, 5 | node: true, 6 | jest: true, 7 | }, 8 | extends: ['eslint:recommended', 'plugin:o1js/recommended'], 9 | parser: '@typescript-eslint/parser', 10 | parserOptions: { 11 | ecmaVersion: 'latest', 12 | }, 13 | plugins: ['@typescript-eslint', 'o1js'], 14 | rules: {}, 15 | }; 16 | -------------------------------------------------------------------------------- /examples/zkapps/05-common-types-and-functions/.gitattributes: -------------------------------------------------------------------------------- 1 | # Use line endings appropriate for the system. This prevents Git from 2 | # complaining about project template line endings when committing on Windows. 3 | * text=auto eol=lf 4 | -------------------------------------------------------------------------------- /examples/zkapps/05-common-types-and-functions/.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | # 2 | # ci.yml 3 | # 4 | # Run tests for all pushed commits and opened pull requests on Github. 5 | # 6 | 7 | name: CI 8 | on: [push, pull_request] 9 | jobs: 10 | test: 11 | runs-on: ubuntu-latest 12 | timeout-minutes: 10 13 | steps: 14 | - name: Set up NodeJS 15 | uses: actions/setup-node@v2 16 | with: 17 | node-version: '16' 18 | - name: Git checkout 19 | uses: actions/checkout@v2 20 | - name: NPM ci, build, & test 21 | run: | 22 | npm ci 23 | npm run build --if-present 24 | npm test 25 | env: 26 | CI: true 27 | -------------------------------------------------------------------------------- /examples/zkapps/05-common-types-and-functions/.gitignore: -------------------------------------------------------------------------------- 1 | # NodeJS 2 | node_modules 3 | build 4 | coverage 5 | 6 | # Editor 7 | .vscode 8 | 9 | # System 10 | .DS_Store 11 | 12 | # Never commit keys to Git! 13 | keys 14 | -------------------------------------------------------------------------------- /examples/zkapps/05-common-types-and-functions/.husky/pre-commit: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . "$(dirname "$0")/_/husky.sh" 3 | 4 | npx lint-staged 5 | -------------------------------------------------------------------------------- /examples/zkapps/05-common-types-and-functions/.npmignore: -------------------------------------------------------------------------------- 1 | # TypeScript files 2 | src 3 | 4 | # Editor 5 | .vscode 6 | 7 | # System 8 | .DS_Store 9 | -------------------------------------------------------------------------------- /examples/zkapps/05-common-types-and-functions/.prettierignore: -------------------------------------------------------------------------------- 1 | # NodeJS 2 | node_modules 3 | build 4 | coverage 5 | .husky 6 | 7 | # Editor 8 | .vscode 9 | 10 | # System 11 | .DS_Store 12 | 13 | # Misc 14 | LICENSE 15 | -------------------------------------------------------------------------------- /examples/zkapps/05-common-types-and-functions/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "semi": true, 3 | "singleQuote": true, 4 | "tabWidth": 2, 5 | "trailingComma": "es5" 6 | } 7 | -------------------------------------------------------------------------------- /examples/zkapps/05-common-types-and-functions/05output.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MinaProtocol/docs2/2e7d64c9a6aa5362757a0cbdf3616face39151a0/examples/zkapps/05-common-types-and-functions/05output.png -------------------------------------------------------------------------------- /examples/zkapps/05-common-types-and-functions/babel.config.cjs: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [['@babel/preset-env', { targets: { node: 'current' } }]], 3 | }; 4 | -------------------------------------------------------------------------------- /examples/zkapps/05-common-types-and-functions/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": 1, 3 | "deployAliases": {} 4 | } -------------------------------------------------------------------------------- /examples/zkapps/05-common-types-and-functions/jest-resolver.cjs: -------------------------------------------------------------------------------- 1 | module.exports = (request, options) => { 2 | return options.defaultResolver(request, { 3 | ...options, 4 | packageFilter: (pkg) => { 5 | // When importing o1js, we specify the Node ESM import as Jest by default imports the web version 6 | if (pkg.name === 'o1js') { 7 | return { 8 | ...pkg, 9 | main: pkg.exports.node.import, 10 | }; 11 | } 12 | if (pkg.name === 'node-fetch') { 13 | return { ...pkg, main: pkg.main }; 14 | } 15 | return { 16 | ...pkg, 17 | main: pkg.module || pkg.main, 18 | }; 19 | }, 20 | }); 21 | }; 22 | -------------------------------------------------------------------------------- /examples/zkapps/05-common-types-and-functions/jest.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('@ts-jest/dist/types').InitialOptionsTsJest} */ 2 | export default { 3 | verbose: true, 4 | preset: 'ts-jest/presets/default-esm', 5 | testEnvironment: 'node', 6 | globals: { 7 | 'ts-jest': { 8 | useESM: true, 9 | }, 10 | }, 11 | transform: { 12 | '^.+\\.(t)s$': 'ts-jest', 13 | '^.+\\.(j)s$': 'babel-jest', 14 | }, 15 | resolver: '/jest-resolver.cjs', 16 | transformIgnorePatterns: [ 17 | '/node_modules/(?!o1js/node_modules/tslib)', 18 | ], 19 | }; 20 | -------------------------------------------------------------------------------- /examples/zkapps/05-common-types-and-functions/src/index.ts: -------------------------------------------------------------------------------- 1 | import { LedgerContract } from './LedgerContract.js'; 2 | 3 | export { LedgerContract }; 4 | -------------------------------------------------------------------------------- /examples/zkapps/05-common-types-and-functions/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES2020", 4 | "module": "es2022", 5 | "lib": ["dom", "esnext"], 6 | "outDir": "./build", 7 | "rootDir": ".", 8 | "strict": true, 9 | "strictPropertyInitialization": false, // to enable generic constructors, e.g. on CircuitValue 10 | "skipLibCheck": true, 11 | "forceConsistentCasingInFileNames": true, 12 | "esModuleInterop": true, 13 | "moduleResolution": "node", 14 | "experimentalDecorators": true, 15 | "emitDecoratorMetadata": true, 16 | "allowJs": true, 17 | "declaration": true, 18 | "sourceMap": true, 19 | "noFallthroughCasesInSwitch": true, 20 | "allowSyntheticDefaultImports": true, 21 | "isolatedModules": true 22 | }, 23 | "include": ["./src"], 24 | "exclude": ["./src/**/*.test.ts"] 25 | } 26 | -------------------------------------------------------------------------------- /examples/zkapps/07-oracles/README.md: -------------------------------------------------------------------------------- 1 | # Oracle Example 2 | 3 | Monorepo for [Tutorial 7: Oracles](https://docs.minaprotocol.com/zkapps/tutorials/oracle). Check it out! :) 4 | -------------------------------------------------------------------------------- /examples/zkapps/07-oracles/contracts/.eslintrc.cjs: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | env: { 4 | browser: true, 5 | node: true, 6 | jest: true, 7 | }, 8 | extends: [ 9 | 'eslint:recommended', 10 | 'plugin:@typescript-eslint/eslint-recommended', 11 | 'plugin:@typescript-eslint/recommended', 12 | 'plugin:o1js/recommended', 13 | ], 14 | parser: '@typescript-eslint/parser', 15 | parserOptions: { 16 | ecmaVersion: 'latest', 17 | }, 18 | plugins: ['@typescript-eslint', 'o1js'], 19 | rules: { 20 | 'no-constant-condition': 'off', 21 | 'prefer-const': 'off', 22 | }, 23 | }; 24 | -------------------------------------------------------------------------------- /examples/zkapps/07-oracles/contracts/.gitattributes: -------------------------------------------------------------------------------- 1 | # Use line endings appropriate for the system. This prevents Git from 2 | # complaining about project template line endings when committing on Windows. 3 | * text=auto eol=lf 4 | -------------------------------------------------------------------------------- /examples/zkapps/07-oracles/contracts/.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | # 2 | # ci.yml 3 | # 4 | # Run tests for all pushed commits and opened pull requests on Github. 5 | # 6 | 7 | name: CI 8 | on: [push, pull_request] 9 | jobs: 10 | test: 11 | runs-on: ubuntu-latest 12 | timeout-minutes: 10 13 | steps: 14 | - name: Set up NodeJS 15 | uses: actions/setup-node@v2 16 | with: 17 | node-version: '16' 18 | - name: Git checkout 19 | uses: actions/checkout@v2 20 | - name: NPM ci, build, & test 21 | run: | 22 | npm install 23 | npm run build --if-present 24 | npm test 25 | env: 26 | CI: true 27 | -------------------------------------------------------------------------------- /examples/zkapps/07-oracles/contracts/.gitignore: -------------------------------------------------------------------------------- 1 | # NodeJS 2 | node_modules 3 | build 4 | coverage 5 | 6 | # Editor 7 | .vscode 8 | 9 | # System 10 | .DS_Store 11 | 12 | # Never commit keys to Git! 13 | keys 14 | -------------------------------------------------------------------------------- /examples/zkapps/07-oracles/contracts/.husky/pre-commit: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . "$(dirname "$0")/_/husky.sh" 3 | 4 | npx lint-staged 5 | -------------------------------------------------------------------------------- /examples/zkapps/07-oracles/contracts/.npmignore: -------------------------------------------------------------------------------- 1 | # TypeScript files 2 | src 3 | 4 | # Editor 5 | .vscode 6 | 7 | # System 8 | .DS_Store 9 | 10 | # Never reveal your keys! 11 | keys 12 | -------------------------------------------------------------------------------- /examples/zkapps/07-oracles/contracts/.prettierignore: -------------------------------------------------------------------------------- 1 | # NodeJS 2 | node_modules 3 | build 4 | coverage 5 | .husky 6 | 7 | # Editor 8 | .vscode 9 | 10 | # System 11 | .DS_Store 12 | 13 | # Misc 14 | LICENSE 15 | -------------------------------------------------------------------------------- /examples/zkapps/07-oracles/contracts/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "semi": true, 3 | "singleQuote": true, 4 | "tabWidth": 2, 5 | "trailingComma": "es5" 6 | } 7 | -------------------------------------------------------------------------------- /examples/zkapps/07-oracles/contracts/README.md: -------------------------------------------------------------------------------- 1 | # Mina zkApp: Oracle Example 2 | 3 | A Mina smart contract that verifies the authenticity of a signed API response (generated by the code in the [oracle](../oracle/)) repository then emits an event with the user's id if their credit score exceeds 700. It was created for [Tutorial 7: Oracles](https://docs.minaprotocol.com/zkapps/tutorials/oracle). 4 | 5 | This template uses TypeScript. 6 | 7 | ## How to build 8 | 9 | ```sh 10 | npm run build 11 | ``` 12 | 13 | ## How to run tests 14 | 15 | ```sh 16 | npm run test 17 | npm run testw # watch mode 18 | ``` 19 | 20 | ## How to run coverage 21 | 22 | ```sh 23 | npm run coverage 24 | ``` 25 | 26 | ## License 27 | 28 | [Apache-2.0](LICENSE) 29 | -------------------------------------------------------------------------------- /examples/zkapps/07-oracles/contracts/babel.config.cjs: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [['@babel/preset-env', { targets: { node: 'current' } }]], 3 | }; 4 | -------------------------------------------------------------------------------- /examples/zkapps/07-oracles/contracts/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": 1, 3 | "deployAliases": {} 4 | } -------------------------------------------------------------------------------- /examples/zkapps/07-oracles/contracts/jest-resolver.cjs: -------------------------------------------------------------------------------- 1 | module.exports = (request, options) => { 2 | return options.defaultResolver(request, { 3 | ...options, 4 | packageFilter: (pkg) => { 5 | // When importing o1js, we specify the Node ESM import as Jest by default imports the web version 6 | if (pkg.name === 'o1js') { 7 | return { 8 | ...pkg, 9 | main: pkg.exports.node.import, 10 | }; 11 | } 12 | if (pkg.name === 'node-fetch') { 13 | return { ...pkg, main: pkg.main }; 14 | } 15 | return { 16 | ...pkg, 17 | main: pkg.module || pkg.main, 18 | }; 19 | }, 20 | }); 21 | }; 22 | -------------------------------------------------------------------------------- /examples/zkapps/07-oracles/contracts/jest.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('@ts-jest/dist/types').InitialOptionsTsJest} */ 2 | export default { 3 | verbose: true, 4 | preset: 'ts-jest/presets/default-esm', 5 | testEnvironment: 'node', 6 | globals: { 7 | 'ts-jest': { 8 | useESM: true, 9 | }, 10 | }, 11 | testTimeout: 1_000_000, 12 | transform: { 13 | '^.+\\.(t)s$': 'ts-jest', 14 | '^.+\\.(j)s$': 'babel-jest', 15 | }, 16 | resolver: '/jest-resolver.cjs', 17 | transformIgnorePatterns: [ 18 | '/node_modules/(?!(tslib|o1js/node_modules/tslib))', 19 | ], 20 | modulePathIgnorePatterns: ['/build/'], 21 | moduleNameMapper: { 22 | '^(\\.{1,2}/.+)\\.js$': '$1', 23 | }, 24 | }; 25 | -------------------------------------------------------------------------------- /examples/zkapps/07-oracles/contracts/src/OracleExampleScaffold.ts: -------------------------------------------------------------------------------- 1 | import { 2 | Field, 3 | Signature, 4 | SmartContract, 5 | method 6 | } from 'o1js'; 7 | 8 | // The public key of our trusted data provider 9 | const ORACLE_PUBLIC_KEY = 10 | 'B62qoAE4rBRuTgC42vqvEyUqCGhaZsW58SKVW4Ht8aYqP9UTvxFWBgy'; 11 | 12 | export class OracleExample extends SmartContract { 13 | // Define zkApp state 14 | // Define zkApp events 15 | 16 | init() { 17 | // Initialize zkApp state 18 | super.init(); 19 | // Specify that caller should include signature with tx instead of proof 20 | this.requireSignature(); 21 | } 22 | 23 | @method async verify(id: Field, creditScore: Field, signature: Signature) { 24 | // Get the oracle public key from the zkApp state 25 | // Evaluate whether the signature is valid for the provided data 26 | // Check that the signature is valid 27 | // Check that the provided credit score is 700 or higher 28 | // Emit an event containing the verified user's id 29 | } 30 | } -------------------------------------------------------------------------------- /examples/zkapps/07-oracles/contracts/src/index.ts: -------------------------------------------------------------------------------- 1 | import { OracleExample } from './OracleExample.js'; 2 | 3 | export { OracleExample }; 4 | -------------------------------------------------------------------------------- /examples/zkapps/07-oracles/contracts/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es2020", 4 | "module": "es2022", 5 | "lib": ["dom", "esnext"], 6 | "outDir": "./build", 7 | "rootDir": ".", 8 | "strict": true, 9 | "strictPropertyInitialization": false, // to enable generic constructors, e.g. on CircuitValue 10 | "skipLibCheck": true, 11 | "forceConsistentCasingInFileNames": true, 12 | "esModuleInterop": true, 13 | "moduleResolution": "node", 14 | "experimentalDecorators": true, 15 | "emitDecoratorMetadata": true, 16 | "allowJs": true, 17 | "declaration": true, 18 | "sourceMap": true, 19 | "noFallthroughCasesInSwitch": true, 20 | "allowSyntheticDefaultImports": true 21 | }, 22 | "include": ["./src"] 23 | } 24 | -------------------------------------------------------------------------------- /examples/zkapps/07-oracles/oracle/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "next/core-web-vitals" 3 | } 4 | -------------------------------------------------------------------------------- /examples/zkapps/07-oracles/oracle/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # next.js 12 | /.next/ 13 | /out/ 14 | 15 | # production 16 | /build 17 | 18 | # misc 19 | .DS_Store 20 | *.pem 21 | 22 | # debug 23 | npm-debug.log* 24 | yarn-debug.log* 25 | yarn-error.log* 26 | 27 | # local env files 28 | .env*.local 29 | 30 | # vercel 31 | .vercel 32 | 33 | # typescript 34 | *.tsbuildinfo 35 | next-env.d.ts 36 | -------------------------------------------------------------------------------- /examples/zkapps/07-oracles/oracle/app/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MinaProtocol/docs2/2e7d64c9a6aa5362757a0cbdf3616face39151a0/examples/zkapps/07-oracles/oracle/app/favicon.ico -------------------------------------------------------------------------------- /examples/zkapps/07-oracles/oracle/app/layout.tsx: -------------------------------------------------------------------------------- 1 | import './globals.css' 2 | import type { Metadata } from 'next' 3 | import { Inter } from 'next/font/google' 4 | 5 | const inter = Inter({ subsets: ['latin'] }) 6 | 7 | export const metadata: Metadata = { 8 | title: 'Create Next App', 9 | description: 'Generated by create next app', 10 | } 11 | 12 | export default function RootLayout({ 13 | children, 14 | }: { 15 | children: React.ReactNode 16 | }) { 17 | return ( 18 | 19 | {children} 20 | 21 | ) 22 | } 23 | -------------------------------------------------------------------------------- /examples/zkapps/07-oracles/oracle/next.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('next').NextConfig} */ 2 | const nextConfig = {} 3 | 4 | module.exports = nextConfig 5 | -------------------------------------------------------------------------------- /examples/zkapps/07-oracles/oracle/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "oracle", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "dev": "next dev", 7 | "build": "next build", 8 | "start": "next start", 9 | "lint": "next lint", 10 | "keygen": "node scripts/keygen.js" 11 | }, 12 | "dependencies": { 13 | "mina-signer": "^2.1.1", 14 | "next": "13.5.4", 15 | "react": "^18", 16 | "react-dom": "^18" 17 | }, 18 | "devDependencies": { 19 | "@types/node": "^20", 20 | "@types/react": "^18", 21 | "@types/react-dom": "^18", 22 | "eslint": "^8", 23 | "eslint-config-next": "13.5.4", 24 | "typescript": "^5" 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /examples/zkapps/07-oracles/oracle/public/vercel.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /examples/zkapps/07-oracles/oracle/scripts/keygen.js: -------------------------------------------------------------------------------- 1 | const Client = require('mina-signer'); 2 | const client = new Client({ network: process.env.NETWORK_KIND ?? 'testnet' }); 3 | 4 | async function generateKeypair() { 5 | const keypair = client.genKeys(); 6 | console.log({ 7 | privateKey: keypair.privateKey, 8 | publicKey: keypair.publicKey, 9 | }); 10 | } 11 | 12 | generateKeypair(); 13 | -------------------------------------------------------------------------------- /examples/zkapps/07-oracles/oracle/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es5", 4 | "lib": ["dom", "dom.iterable", "esnext"], 5 | "allowJs": true, 6 | "skipLibCheck": true, 7 | "strict": true, 8 | "noEmit": true, 9 | "esModuleInterop": true, 10 | "module": "esnext", 11 | "moduleResolution": "bundler", 12 | "resolveJsonModule": true, 13 | "isolatedModules": true, 14 | "jsx": "preserve", 15 | "incremental": true, 16 | "plugins": [ 17 | { 18 | "name": "next" 19 | } 20 | ], 21 | "paths": { 22 | "@/*": ["./*"] 23 | } 24 | }, 25 | "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"], 26 | "exclude": ["node_modules"] 27 | } 28 | -------------------------------------------------------------------------------- /examples/zkapps/09-recursion/.eslintrc.cjs: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | env: { 4 | browser: true, 5 | node: true, 6 | jest: true, 7 | }, 8 | extends: ['eslint:recommended', 'plugin:o1js/recommended'], 9 | parser: '@typescript-eslint/parser', 10 | parserOptions: { 11 | ecmaVersion: 'latest', 12 | }, 13 | plugins: ['@typescript-eslint', 'o1js'], 14 | rules: {}, 15 | }; 16 | -------------------------------------------------------------------------------- /examples/zkapps/09-recursion/.gitattributes: -------------------------------------------------------------------------------- 1 | # Use line endings appropriate for the system. This prevents Git from 2 | # complaining about project template line endings when committing on Windows. 3 | * text=auto eol=lf 4 | -------------------------------------------------------------------------------- /examples/zkapps/09-recursion/.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | # 2 | # ci.yml 3 | # 4 | # Run tests for all pushed commits and opened pull requests on Github. 5 | # 6 | 7 | name: CI 8 | on: [push, pull_request] 9 | jobs: 10 | test: 11 | runs-on: ubuntu-latest 12 | timeout-minutes: 10 13 | steps: 14 | - name: Set up NodeJS 15 | uses: actions/setup-node@v2 16 | with: 17 | node-version: '16' 18 | - name: Git checkout 19 | uses: actions/checkout@v2 20 | - name: NPM ci, build, & test 21 | run: | 22 | npm ci 23 | npm run build --if-present 24 | npm test 25 | env: 26 | CI: true 27 | -------------------------------------------------------------------------------- /examples/zkapps/09-recursion/.husky/pre-commit: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . "$(dirname "$0")/_/husky.sh" 3 | 4 | npx lint-staged 5 | -------------------------------------------------------------------------------- /examples/zkapps/09-recursion/.npmignore: -------------------------------------------------------------------------------- 1 | # TypeScript files 2 | src 3 | 4 | # Editor 5 | .vscode 6 | 7 | # System 8 | .DS_Store 9 | -------------------------------------------------------------------------------- /examples/zkapps/09-recursion/.prettierignore: -------------------------------------------------------------------------------- 1 | # NodeJS 2 | node_modules 3 | build 4 | coverage 5 | .husky 6 | 7 | # Editor 8 | .vscode 9 | 10 | # System 11 | .DS_Store 12 | 13 | # Misc 14 | LICENSE 15 | -------------------------------------------------------------------------------- /examples/zkapps/09-recursion/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "semi": true, 3 | "singleQuote": true, 4 | "tabWidth": 2, 5 | "trailingComma": "es5" 6 | } 7 | -------------------------------------------------------------------------------- /examples/zkapps/09-recursion/babel.config.cjs: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [['@babel/preset-env', { targets: { node: 'current' } }]], 3 | }; 4 | -------------------------------------------------------------------------------- /examples/zkapps/09-recursion/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": 1, 3 | "deployAliases": {} 4 | } -------------------------------------------------------------------------------- /examples/zkapps/09-recursion/jest-resolver.cjs: -------------------------------------------------------------------------------- 1 | module.exports = (request, options) => { 2 | return options.defaultResolver(request, { 3 | ...options, 4 | packageFilter: (pkg) => { 5 | // When importing o1js, we specify the Node ESM import as Jest by default imports the web version 6 | if (pkg.name === 'o1js') { 7 | return { 8 | ...pkg, 9 | main: pkg.exports.node.import, 10 | }; 11 | } 12 | if (pkg.name === 'node-fetch') { 13 | return { ...pkg, main: pkg.main }; 14 | } 15 | return { 16 | ...pkg, 17 | main: pkg.module || pkg.main, 18 | }; 19 | }, 20 | }); 21 | }; 22 | -------------------------------------------------------------------------------- /examples/zkapps/09-recursion/jest.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('@ts-jest/dist/types').InitialOptionsTsJest} */ 2 | export default { 3 | verbose: true, 4 | preset: 'ts-jest/presets/default-esm', 5 | testEnvironment: 'node', 6 | globals: { 7 | 'ts-jest': { 8 | useESM: true, 9 | }, 10 | }, 11 | transform: { 12 | '^.+\\.(t)s$': 'ts-jest', 13 | '^.+\\.(j)s$': 'babel-jest', 14 | }, 15 | resolver: '/jest-resolver.cjs', 16 | transformIgnorePatterns: [ 17 | '/node_modules/(?!o1js/node_modules/tslib)', 18 | ], 19 | }; 20 | -------------------------------------------------------------------------------- /examples/zkapps/09-recursion/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES2019", 4 | "module": "es2022", 5 | "lib": ["dom", "esnext"], 6 | "outDir": "./build", 7 | "rootDir": ".", 8 | "strict": true, 9 | "strictPropertyInitialization": false, // to enable generic constructors, e.g. on CircuitValue 10 | "skipLibCheck": true, 11 | "forceConsistentCasingInFileNames": true, 12 | "esModuleInterop": true, 13 | "moduleResolution": "node", 14 | "experimentalDecorators": true, 15 | "emitDecoratorMetadata": true, 16 | "allowJs": true, 17 | "declaration": true, 18 | "sourceMap": true, 19 | "noFallthroughCasesInSwitch": true, 20 | "allowSyntheticDefaultImports": true, 21 | "isolatedModules": true 22 | }, 23 | "include": ["./src"], 24 | "exclude": ["./src/**/*.test.ts"] 25 | } 26 | -------------------------------------------------------------------------------- /examples/zkapps/10-account-updates/.eslintrc.cjs: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | env: { 4 | browser: true, 5 | node: true, 6 | jest: true, 7 | }, 8 | extends: [ 9 | 'eslint:recommended', 10 | 'plugin:@typescript-eslint/eslint-recommended', 11 | 'plugin:@typescript-eslint/recommended', 12 | 'plugin:o1js/recommended', 13 | ], 14 | parser: '@typescript-eslint/parser', 15 | parserOptions: { 16 | ecmaVersion: 'latest', 17 | }, 18 | plugins: ['@typescript-eslint', 'o1js'], 19 | rules: { 20 | 'no-constant-condition': 'off', 21 | 'prefer-const': 'off', 22 | }, 23 | }; 24 | -------------------------------------------------------------------------------- /examples/zkapps/10-account-updates/.gitattributes: -------------------------------------------------------------------------------- 1 | # Use line endings appropriate for the system. This prevents Git from 2 | # complaining about project template line endings when committing on Windows. 3 | * text=auto eol=lf 4 | -------------------------------------------------------------------------------- /examples/zkapps/10-account-updates/.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | # 2 | # ci.yml 3 | # 4 | # Run tests for all pushed commits and opened pull requests on Github. 5 | # 6 | 7 | name: CI 8 | on: [push, pull_request] 9 | jobs: 10 | test: 11 | runs-on: ubuntu-latest 12 | timeout-minutes: 10 13 | steps: 14 | - name: Set up NodeJS 15 | uses: actions/setup-node@v2 16 | with: 17 | node-version: '16' 18 | - name: Git checkout 19 | uses: actions/checkout@v2 20 | - name: NPM ci, build, & test 21 | run: | 22 | npm install 23 | npm run build --if-present 24 | npm test 25 | env: 26 | CI: true 27 | -------------------------------------------------------------------------------- /examples/zkapps/10-account-updates/.gitignore: -------------------------------------------------------------------------------- 1 | # NodeJS 2 | node_modules 3 | build 4 | coverage 5 | 6 | # Editor 7 | .vscode 8 | 9 | # System 10 | .DS_Store 11 | 12 | # Never commit keys to Git! 13 | keys 14 | -------------------------------------------------------------------------------- /examples/zkapps/10-account-updates/.husky/pre-commit: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . "$(dirname "$0")/_/husky.sh" 3 | 4 | npx lint-staged 5 | -------------------------------------------------------------------------------- /examples/zkapps/10-account-updates/.npmignore: -------------------------------------------------------------------------------- 1 | # TypeScript files 2 | src 3 | 4 | # Editor 5 | .vscode 6 | 7 | # System 8 | .DS_Store 9 | 10 | # Never reveal your keys! 11 | keys 12 | -------------------------------------------------------------------------------- /examples/zkapps/10-account-updates/.prettierignore: -------------------------------------------------------------------------------- 1 | # NodeJS 2 | node_modules 3 | build 4 | coverage 5 | .husky 6 | 7 | # Editor 8 | .vscode 9 | 10 | # System 11 | .DS_Store 12 | 13 | # Misc 14 | LICENSE 15 | -------------------------------------------------------------------------------- /examples/zkapps/10-account-updates/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "semi": true, 3 | "singleQuote": true, 4 | "tabWidth": 2, 5 | "trailingComma": "es5" 6 | } 7 | -------------------------------------------------------------------------------- /examples/zkapps/10-account-updates/babel.config.cjs: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [['@babel/preset-env', { targets: { node: 'current' } }]], 3 | }; 4 | -------------------------------------------------------------------------------- /examples/zkapps/10-account-updates/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": 1, 3 | "deployAliases": {} 4 | } 5 | -------------------------------------------------------------------------------- /examples/zkapps/10-account-updates/deploy_txn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MinaProtocol/docs2/2e7d64c9a6aa5362757a0cbdf3616face39151a0/examples/zkapps/10-account-updates/deploy_txn.png -------------------------------------------------------------------------------- /examples/zkapps/10-account-updates/jest-resolver.cjs: -------------------------------------------------------------------------------- 1 | module.exports = (request, options) => { 2 | return options.defaultResolver(request, { 3 | ...options, 4 | packageFilter: (pkg) => { 5 | // When importing o1js, we specify the Node ESM import as Jest by default imports the web version 6 | if (pkg.name === 'o1js') { 7 | return { 8 | ...pkg, 9 | main: pkg.exports.node.import, 10 | }; 11 | } 12 | if (pkg.name === 'node-fetch') { 13 | return { ...pkg, main: pkg.main }; 14 | } 15 | return { 16 | ...pkg, 17 | main: pkg.module || pkg.main, 18 | }; 19 | }, 20 | }); 21 | }; 22 | -------------------------------------------------------------------------------- /examples/zkapps/10-account-updates/jest.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('@ts-jest/dist/types').InitialOptionsTsJest} */ 2 | export default { 3 | verbose: true, 4 | preset: 'ts-jest/presets/default-esm', 5 | testEnvironment: 'node', 6 | globals: { 7 | 'ts-jest': { 8 | useESM: true, 9 | }, 10 | }, 11 | transform: { 12 | '^.+\\.(t)s$': 'ts-jest', 13 | '^.+\\.(j)s$': 'babel-jest', 14 | }, 15 | resolver: '/jest-resolver.cjs', 16 | transformIgnorePatterns: [ 17 | '/node_modules/(?!(tslib|o1js/node_modules/tslib))', 18 | ], 19 | modulePathIgnorePatterns: ['/build/'], 20 | moduleNameMapper: { 21 | '^(\\.{1,2}/.+)\\.js$': '$1', 22 | }, 23 | }; 24 | -------------------------------------------------------------------------------- /examples/zkapps/10-account-updates/src/SecondaryZkApp.ts: -------------------------------------------------------------------------------- 1 | import { 2 | Field, 3 | SmartContract, 4 | state, 5 | State, 6 | method, 7 | DeployArgs, 8 | Permissions, 9 | } from 'o1js'; 10 | 11 | export class SecondaryZkApp extends SmartContract { 12 | @state(Field) num = State(); 13 | 14 | async deploy() { 15 | await super.deploy(); 16 | this.account.permissions.set({ 17 | ...Permissions.default(), 18 | }); 19 | } 20 | 21 | @method async init() { 22 | this.account.provedState.getAndRequireEquals(); 23 | this.account.provedState.get().assertFalse(); 24 | 25 | super.init(); 26 | this.num.set(Field(12)); 27 | } 28 | 29 | @method async add(incrementBy: Field) { 30 | this.account.provedState.getAndRequireEquals(); 31 | this.account.provedState.get().assertTrue(); 32 | 33 | const num = this.num.getAndRequireEquals(); 34 | this.num.set(num.add(incrementBy)); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /examples/zkapps/10-account-updates/src/index.ts: -------------------------------------------------------------------------------- 1 | export {}; 2 | -------------------------------------------------------------------------------- /examples/zkapps/10-account-updates/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es2020", 4 | "module": "es2022", 5 | "lib": ["dom", "esnext"], 6 | "outDir": "./build", 7 | "rootDir": ".", 8 | "strict": true, 9 | "strictPropertyInitialization": false, // to enable generic constructors, e.g. on CircuitValue 10 | "skipLibCheck": true, 11 | "forceConsistentCasingInFileNames": true, 12 | "esModuleInterop": true, 13 | "moduleResolution": "node", 14 | "experimentalDecorators": true, 15 | "emitDecoratorMetadata": true, 16 | "allowJs": true, 17 | "declaration": true, 18 | "sourceMap": true, 19 | "noFallthroughCasesInSwitch": true, 20 | "allowSyntheticDefaultImports": true 21 | }, 22 | "include": ["./src"] 23 | } 24 | -------------------------------------------------------------------------------- /examples/zkapps/10-account-updates/txn1-copy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MinaProtocol/docs2/2e7d64c9a6aa5362757a0cbdf3616face39151a0/examples/zkapps/10-account-updates/txn1-copy.png -------------------------------------------------------------------------------- /examples/zkapps/10-account-updates/txn1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MinaProtocol/docs2/2e7d64c9a6aa5362757a0cbdf3616face39151a0/examples/zkapps/10-account-updates/txn1.png -------------------------------------------------------------------------------- /examples/zkapps/10-account-updates/txn2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MinaProtocol/docs2/2e7d64c9a6aa5362757a0cbdf3616face39151a0/examples/zkapps/10-account-updates/txn2.png -------------------------------------------------------------------------------- /examples/zkapps/anonymous-message-board/.eslintrc.cjs: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | env: { 4 | browser: true, 5 | node: true, 6 | jest: true, 7 | }, 8 | extends: [ 9 | 'eslint:recommended', 10 | 'plugin:@typescript-eslint/eslint-recommended', 11 | 'plugin:@typescript-eslint/recommended', 12 | 'plugin:o1js/recommended', 13 | ], 14 | parser: '@typescript-eslint/parser', 15 | parserOptions: { 16 | ecmaVersion: 'latest', 17 | }, 18 | plugins: ['@typescript-eslint', 'o1js'], 19 | rules: { 20 | 'no-constant-condition': 'off', 21 | 'prefer-const': 'off', 22 | }, 23 | }; 24 | -------------------------------------------------------------------------------- /examples/zkapps/anonymous-message-board/.gitattributes: -------------------------------------------------------------------------------- 1 | # Use line endings appropriate for the system. This prevents Git from 2 | # complaining about project template line endings when committing on Windows. 3 | * text=auto eol=lf 4 | -------------------------------------------------------------------------------- /examples/zkapps/anonymous-message-board/.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | # 2 | # ci.yml 3 | # 4 | # Run tests for all pushed commits and opened pull requests on Github. 5 | # 6 | 7 | name: CI 8 | on: [push, pull_request] 9 | jobs: 10 | test: 11 | runs-on: ubuntu-latest 12 | timeout-minutes: 10 13 | steps: 14 | - name: Set up NodeJS 15 | uses: actions/setup-node@v4 16 | with: 17 | node-version: '16' 18 | - name: Git checkout 19 | uses: actions/checkout@v4 20 | - name: NPM ci, build, & test 21 | run: | 22 | npm install 23 | npm run build --if-present 24 | npm test 25 | env: 26 | CI: true 27 | -------------------------------------------------------------------------------- /examples/zkapps/anonymous-message-board/.gitignore: -------------------------------------------------------------------------------- 1 | # NodeJS 2 | node_modules 3 | build 4 | coverage 5 | 6 | # Editor 7 | .vscode 8 | 9 | # System 10 | .DS_Store 11 | 12 | # Never commit keys to Git! 13 | keys 14 | -------------------------------------------------------------------------------- /examples/zkapps/anonymous-message-board/.npmignore: -------------------------------------------------------------------------------- 1 | # TypeScript files 2 | src 3 | 4 | # Editor 5 | .vscode 6 | 7 | # System 8 | .DS_Store 9 | 10 | # Never reveal your keys! 11 | keys 12 | -------------------------------------------------------------------------------- /examples/zkapps/anonymous-message-board/.prettierignore: -------------------------------------------------------------------------------- 1 | # NodeJS 2 | node_modules 3 | build 4 | coverage 5 | .husky 6 | 7 | # Editor 8 | .vscode 9 | 10 | # System 11 | .DS_Store 12 | 13 | # Misc 14 | LICENSE 15 | -------------------------------------------------------------------------------- /examples/zkapps/anonymous-message-board/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "semi": true, 3 | "singleQuote": true, 4 | "tabWidth": 2, 5 | "trailingComma": "es5" 6 | } 7 | -------------------------------------------------------------------------------- /examples/zkapps/anonymous-message-board/README.md: -------------------------------------------------------------------------------- 1 | # zkApp: Anonymous Message Board Tutorial 2 | 3 | Build a smart contract that allows users to publish messages semi-anonymously. 4 | 5 | ## Tutorial 6 | 7 | See [Anonymous Message Board Tutorial](https://docs.minaprotocol.com/zkapps/tutorials/recursion). 8 | 9 | ## How to install and run this example project 10 | 11 | 1. Clone the repository: 12 | ```sh 13 | git clone https://github.com/o1-labs/docs2.git 14 | ``` 15 | 2. Change directory to the project location: 16 | ```sh 17 | cd docs2/examples/zkapps/anonymous-message-board 18 | ``` 19 | 3. Install dependencies: 20 | ```sh 21 | npm install 22 | ``` 23 | 24 | 4. Build the project: 25 | ```sh 26 | npm run build 27 | ``` 28 | 29 | 5. Run the compiled code: 30 | ```sh 31 | node build/src/main.js 32 | ``` 33 | To run and build the compiled code with a single command: 34 | ```sh 35 | npm run build && node build/src/main.js 36 | ``` 37 | 38 | ## License 39 | 40 | [Apache-2.0](LICENSE) 41 | -------------------------------------------------------------------------------- /examples/zkapps/anonymous-message-board/babel.config.cjs: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [['@babel/preset-env', { targets: { node: 'current' } }]], 3 | }; 4 | -------------------------------------------------------------------------------- /examples/zkapps/anonymous-message-board/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": 1, 3 | "deployAliases": {} 4 | } 5 | -------------------------------------------------------------------------------- /examples/zkapps/anonymous-message-board/jest-resolver.cjs: -------------------------------------------------------------------------------- 1 | module.exports = (request, options) => { 2 | return options.defaultResolver(request, { 3 | ...options, 4 | packageFilter: (pkg) => { 5 | // When importing o1js, we specify the Node ESM import as Jest by default imports the web version 6 | if (pkg.name === 'o1js') { 7 | return { 8 | ...pkg, 9 | main: pkg.exports.node.import, 10 | }; 11 | } 12 | if (pkg.name === 'node-fetch') { 13 | return { ...pkg, main: pkg.main }; 14 | } 15 | return { 16 | ...pkg, 17 | main: pkg.module || pkg.main, 18 | }; 19 | }, 20 | }); 21 | }; 22 | -------------------------------------------------------------------------------- /examples/zkapps/anonymous-message-board/jest.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('@ts-jest/dist/types').InitialOptionsTsJest} */ 2 | export default { 3 | verbose: true, 4 | preset: 'ts-jest/presets/default-esm', 5 | testEnvironment: 'node', 6 | globals: { 7 | 'ts-jest': { 8 | useESM: true, 9 | }, 10 | }, 11 | testTimeout: 1_000_000, 12 | transform: { 13 | '^.+\\.(t)s$': 'ts-jest', 14 | '^.+\\.(j)s$': 'babel-jest', 15 | }, 16 | resolver: '/jest-resolver.cjs', 17 | transformIgnorePatterns: [ 18 | '/node_modules/(?!(tslib|o1js/node_modules/tslib))', 19 | ], 20 | modulePathIgnorePatterns: ['/build/'], 21 | moduleNameMapper: { 22 | '^(\\.{1,2}/.+)\\.js$': '$1', 23 | }, 24 | }; 25 | -------------------------------------------------------------------------------- /examples/zkapps/anonymous-message-board/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es2020", 4 | "module": "es2022", 5 | "lib": ["dom", "esnext"], 6 | "outDir": "./build", 7 | "rootDir": ".", 8 | "strict": true, 9 | "strictPropertyInitialization": false, // to enable generic constructors, e.g. on CircuitValue 10 | "skipLibCheck": true, 11 | "forceConsistentCasingInFileNames": true, 12 | "esModuleInterop": true, 13 | "moduleResolution": "node", 14 | "experimentalDecorators": true, 15 | "emitDecoratorMetadata": true, 16 | "allowJs": true, 17 | "declaration": true, 18 | "sourceMap": true, 19 | "noFallthroughCasesInSwitch": true, 20 | "allowSyntheticDefaultImports": true 21 | }, 22 | "include": ["./src"] 23 | } 24 | -------------------------------------------------------------------------------- /examples/zkapps/feature-overview/.eslintrc.cjs: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | env: { 4 | browser: true, 5 | node: true, 6 | jest: true, 7 | }, 8 | extends: [ 9 | 'eslint:recommended', 10 | 'plugin:@typescript-eslint/eslint-recommended', 11 | 'plugin:@typescript-eslint/recommended', 12 | 'plugin:o1js/recommended', 13 | ], 14 | parser: '@typescript-eslint/parser', 15 | parserOptions: { 16 | ecmaVersion: 'latest', 17 | }, 18 | plugins: ['@typescript-eslint', 'o1js'], 19 | rules: { 20 | 'no-constant-condition': 'off', 21 | 'prefer-const': 'off', 22 | }, 23 | }; 24 | -------------------------------------------------------------------------------- /examples/zkapps/feature-overview/.prettierignore: -------------------------------------------------------------------------------- 1 | # NodeJS 2 | node_modules 3 | build 4 | coverage 5 | .husky 6 | 7 | # Editor 8 | .vscode 9 | 10 | # System 11 | .DS_Store 12 | 13 | # Misc 14 | LICENSE 15 | -------------------------------------------------------------------------------- /examples/zkapps/feature-overview/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "semi": true, 3 | "singleQuote": true, 4 | "tabWidth": 2, 5 | "trailingComma": "es5" 6 | } 7 | -------------------------------------------------------------------------------- /examples/zkapps/feature-overview/babel.config.cjs: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [['@babel/preset-env', { targets: { node: 'current' } }]], 3 | }; 4 | -------------------------------------------------------------------------------- /examples/zkapps/feature-overview/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": 1, 3 | "deployAliases": {} 4 | } 5 | -------------------------------------------------------------------------------- /examples/zkapps/feature-overview/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module", 3 | "main": "build/src/index.js", 4 | "types": "build/src/index.d.ts", 5 | "scripts": { 6 | "build": "tsc", 7 | "format": "prettier --write --ignore-unknown **/*", 8 | "test": "npm run build && node --experimental-vm-modules build/**/**/*.test.js", 9 | "lint": "npx eslint src/* --fix" 10 | }, 11 | "devDependencies": { 12 | "@babel/preset-env": "^7.16.4", 13 | "@babel/preset-typescript": "^7.16.0", 14 | "@types/node": "^22.7.5", 15 | "@typescript-eslint/eslint-plugin": "^5.5.0", 16 | "@typescript-eslint/parser": "^5.5.0", 17 | "eslint": "^8.7.0", 18 | "eslint-plugin-o1js": "^0.4.0", 19 | "prettier": "^2.3.2", 20 | "typescript": "^5.4.5" 21 | }, 22 | "peerDependencies": { 23 | "o1js": "^1.8.0" 24 | }, 25 | "engines": { 26 | "node": ">=18.14.0" 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /examples/zkapps/feature-overview/src/upgradability/AddV1.ts: -------------------------------------------------------------------------------- 1 | import { Field, SmartContract, state, State, method } from 'o1js'; 2 | 3 | export class AddV1 extends SmartContract { 4 | @state(Field) num = State(); 5 | 6 | init() { 7 | super.init(); 8 | this.num.set(Field(1)); 9 | } 10 | 11 | @method async update() { 12 | const currentState = this.num.getAndRequireEquals(); 13 | const newState = currentState.add(2); 14 | this.num.set(newState); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /examples/zkapps/feature-overview/src/upgradability/AddV2.ts: -------------------------------------------------------------------------------- 1 | import { Field, SmartContract, state, State, method } from 'o1js'; 2 | 3 | export class AddV2 extends SmartContract { 4 | @state(Field) num = State(); 5 | 6 | init() { 7 | super.init(); 8 | this.num.set(Field(1)); 9 | } 10 | 11 | @method async update() { 12 | const currentState = this.num.getAndRequireEquals(); 13 | const newState = currentState.add(4); 14 | this.num.set(newState); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /examples/zkapps/feature-overview/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es2020", 4 | "module": "es2022", 5 | "lib": ["dom", "esnext"], 6 | "outDir": "./build", 7 | "rootDir": ".", 8 | "strict": true, 9 | "strictPropertyInitialization": false, // to enable generic constructors, e.g. on CircuitValue 10 | "skipLibCheck": true, 11 | "forceConsistentCasingInFileNames": true, 12 | "esModuleInterop": true, 13 | "moduleResolution": "node", 14 | "experimentalDecorators": true, 15 | "emitDecoratorMetadata": true, 16 | "allowJs": true, 17 | "declaration": true, 18 | "sourceMap": true, 19 | "noFallthroughCasesInSwitch": true, 20 | "allowSyntheticDefaultImports": true, 21 | "useDefineForClassFields": false, 22 | }, 23 | "include": ["./src"], 24 | } 25 | -------------------------------------------------------------------------------- /examples/zkapps/interacting-with-zkApps-server-side/.eslintrc.cjs: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | env: { 4 | browser: true, 5 | node: true, 6 | jest: true, 7 | }, 8 | extends: [ 9 | 'eslint:recommended', 10 | 'plugin:@typescript-eslint/eslint-recommended', 11 | 'plugin:@typescript-eslint/recommended', 12 | 'plugin:o1js/recommended', 13 | ], 14 | parser: '@typescript-eslint/parser', 15 | parserOptions: { 16 | ecmaVersion: 'latest', 17 | }, 18 | plugins: ['@typescript-eslint', 'o1js'], 19 | rules: { 20 | 'no-constant-condition': 'off', 21 | 'prefer-const': 'off', 22 | }, 23 | }; 24 | -------------------------------------------------------------------------------- /examples/zkapps/interacting-with-zkApps-server-side/.gitattributes: -------------------------------------------------------------------------------- 1 | # Use line endings appropriate for the system. This prevents Git from 2 | # complaining about project template line endings when committing on Windows. 3 | * text=auto eol=lf 4 | -------------------------------------------------------------------------------- /examples/zkapps/interacting-with-zkApps-server-side/.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | # 2 | # ci.yml 3 | # 4 | # Run tests for all pushed commits and opened pull requests on Github. 5 | # 6 | 7 | name: CI 8 | on: [push, pull_request] 9 | jobs: 10 | test: 11 | runs-on: ubuntu-latest 12 | timeout-minutes: 10 13 | steps: 14 | - name: Set up NodeJS 15 | uses: actions/setup-node@v2 16 | with: 17 | node-version: '16' 18 | - name: Git checkout 19 | uses: actions/checkout@v2 20 | - name: NPM ci, build, & test 21 | run: | 22 | npm ci 23 | npm run build --if-present 24 | npm test 25 | env: 26 | CI: true 27 | -------------------------------------------------------------------------------- /examples/zkapps/interacting-with-zkApps-server-side/.gitignore: -------------------------------------------------------------------------------- 1 | # NodeJS 2 | node_modules 3 | build 4 | coverage 5 | 6 | # Editor 7 | .vscode 8 | 9 | # System 10 | .DS_Store 11 | 12 | # Never commit keys to Git! 13 | keys 14 | -------------------------------------------------------------------------------- /examples/zkapps/interacting-with-zkApps-server-side/.husky/pre-commit: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . "$(dirname "$0")/_/husky.sh" 3 | 4 | npx lint-staged 5 | -------------------------------------------------------------------------------- /examples/zkapps/interacting-with-zkApps-server-side/.npmignore: -------------------------------------------------------------------------------- 1 | # TypeScript files 2 | src 3 | 4 | # Editor 5 | .vscode 6 | 7 | # System 8 | .DS_Store 9 | -------------------------------------------------------------------------------- /examples/zkapps/interacting-with-zkApps-server-side/.prettierignore: -------------------------------------------------------------------------------- 1 | # NodeJS 2 | node_modules 3 | build 4 | coverage 5 | .husky 6 | 7 | # Editor 8 | .vscode 9 | 10 | # System 11 | .DS_Store 12 | 13 | # Misc 14 | LICENSE 15 | -------------------------------------------------------------------------------- /examples/zkapps/interacting-with-zkApps-server-side/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "semi": true, 3 | "singleQuote": true, 4 | "tabWidth": 2, 5 | "trailingComma": "es5" 6 | } 7 | -------------------------------------------------------------------------------- /examples/zkapps/interacting-with-zkApps-server-side/README.md: -------------------------------------------------------------------------------- 1 | # zkApp: Interacting with zkApps server-side 2 | 3 | Use a script to initialize the state and interact with it. See [Interacting with zkApps server-side](https://docs.minaprotocol.com/zkapps/tutorials/interacting-with-zkapps-server-side). 4 | 5 | ## How to install and run this example project 6 | 7 | 1. Clone the repository: 8 | ```sh 9 | git clone https://github.com/o1-labs/docs2.git 10 | ``` 11 | 2. Change directory to the project location: 12 | ```sh 13 | cd docs2/examples/zkapps/interacting-with-zkApps-server-side 14 | ``` 15 | 3. Install dependencies: 16 | ```sh 17 | npm install 18 | ``` 19 | 20 | 4. Build the project: 21 | ```sh 22 | npm run build 23 | ``` 24 | 25 | 5. Run the compiled code: 26 | ```sh 27 | node build/src/main.js 28 | ``` 29 | To run and build the compiled code with a single command: 30 | ```sh 31 | npm run build && node build/src/main.js 32 | ``` 33 | 34 | ## License 35 | 36 | [Apache-2.0](LICENSE) -------------------------------------------------------------------------------- /examples/zkapps/interacting-with-zkApps-server-side/babel.config.cjs: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [['@babel/preset-env', { targets: { node: 'current' } }]], 3 | }; 4 | -------------------------------------------------------------------------------- /examples/zkapps/interacting-with-zkApps-server-side/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": 1, 3 | "networks": { 4 | "devnet": { 5 | "url": "https://api.minascan.io/node/devnet/v1/graphql", 6 | "keyPath": "keys/devnet.json", 7 | "fee": "0.1", 8 | "smartContract": "Square" 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /examples/zkapps/interacting-with-zkApps-server-side/jest-resolver.cjs: -------------------------------------------------------------------------------- 1 | module.exports = (request, options) => { 2 | return options.defaultResolver(request, { 3 | ...options, 4 | packageFilter: (pkg) => { 5 | // When importing o1js, we specify the Node ESM import as Jest by default imports the web version 6 | if (pkg.name === 'o1js') { 7 | return { 8 | ...pkg, 9 | main: pkg.exports.node.import, 10 | }; 11 | } 12 | if (pkg.name === 'node-fetch') { 13 | return { ...pkg, main: pkg.main }; 14 | } 15 | return { 16 | ...pkg, 17 | main: pkg.module || pkg.main, 18 | }; 19 | }, 20 | }); 21 | }; 22 | -------------------------------------------------------------------------------- /examples/zkapps/interacting-with-zkApps-server-side/jest.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('@ts-jest/dist/types').InitialOptionsTsJest} */ 2 | export default { 3 | verbose: true, 4 | preset: 'ts-jest/presets/default-esm', 5 | testEnvironment: 'node', 6 | globals: { 7 | 'ts-jest': { 8 | useESM: true, 9 | }, 10 | }, 11 | transform: { 12 | '^.+\\.(t)s$': 'ts-jest', 13 | '^.+\\.(j)s$': 'babel-jest', 14 | }, 15 | resolver: '/jest-resolver.cjs', 16 | transformIgnorePatterns: [ 17 | '/node_modules/(?!o1js/node_modules/tslib)', 18 | ], 19 | }; 20 | -------------------------------------------------------------------------------- /examples/zkapps/interacting-with-zkApps-server-side/run.sh: -------------------------------------------------------------------------------- 1 | npm run build && node build/src/main_cleanup.js EKFY9bKw995zcjirR1tRc4hJQoEE1DSeK3rSiAQw7Ack7QdgD9b6 EKE5mZZYVLK2jFamrcegZdNKekAC65spZVxuaSZRLVRguFrAK7JS 2 | -------------------------------------------------------------------------------- /examples/zkapps/interacting-with-zkApps-server-side/src/Square.ts: -------------------------------------------------------------------------------- 1 | import { Field, SmartContract, state, State, method } from 'o1js'; 2 | 3 | export class Square extends SmartContract { 4 | @state(Field) num = State(); 5 | 6 | init() { 7 | super.init(); 8 | this.num.set(Field(3)); 9 | } 10 | 11 | @method async update(square: Field) { 12 | const currentState = this.num.get(); 13 | this.num.requireEquals(currentState); 14 | square.assertEquals(currentState.mul(currentState)); 15 | this.num.set(square); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /examples/zkapps/interacting-with-zkApps-server-side/src/index.ts: -------------------------------------------------------------------------------- 1 | import { Square } from './Square.js'; 2 | 3 | export { Square }; 4 | 5 | export * as o1js from 'o1js'; 6 | -------------------------------------------------------------------------------- /examples/zkapps/interacting-with-zkApps-server-side/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES2019", 4 | "module": "es2022", 5 | "lib": ["dom", "esnext"], 6 | "outDir": "./build", 7 | "rootDir": ".", 8 | "strict": true, 9 | "strictPropertyInitialization": false, // to enable generic constructors, e.g. on CircuitValue 10 | "skipLibCheck": true, 11 | "forceConsistentCasingInFileNames": true, 12 | "esModuleInterop": true, 13 | "moduleResolution": "node", 14 | "experimentalDecorators": true, 15 | "emitDecoratorMetadata": true, 16 | "allowJs": true, 17 | "declaration": true, 18 | "sourceMap": false, 19 | "noFallthroughCasesInSwitch": true, 20 | "allowSyntheticDefaultImports": true, 21 | "isolatedModules": true 22 | }, 23 | "include": ["./src"], 24 | "exclude": ["./src/**/*.test.ts"] 25 | } 26 | -------------------------------------------------------------------------------- /src/components/common/Button.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | import styles from './Button.module.scss'; 4 | 5 | type Color = 'orange' | 'teal' | 'dark' | 'custom'; 6 | 7 | interface Props { 8 | children: React.ReactNode; 9 | color: Color; 10 | customStyles?: string; 11 | type: string; 12 | } 13 | 14 | export const Button: React.FC = ( 15 | props: React.ComponentPropsWithoutRef<'button'> & Props 16 | ) => { 17 | const { color, customStyles, ...rest } = props; 18 | let stylesColor = undefined; 19 | if (color === 'orange') { 20 | stylesColor = styles.minaButtonOrange; 21 | } else if (color === 'teal') { 22 | stylesColor = styles.minaButtonTeal; 23 | } else if (color === 'dark') { 24 | stylesColor = styles.minaButtonDark; 25 | } else if (color === 'custom' && customStyles) { 26 | stylesColor = customStyles; 27 | } 28 | return ( 29 | 32 | ); 33 | }; 34 | 35 | export default Button; 36 | -------------------------------------------------------------------------------- /src/components/common/ResponsiveVideo.module.scss: -------------------------------------------------------------------------------- 1 | .responsiveVideoWrapper { 2 | position: relative; 3 | width: 100%; 4 | padding-bottom: 56.25%; /* 16:9 Aspect Ratio (divide 9 by 16 = 0.5625 or 56.25%) */ 5 | height: 0; 6 | overflow: hidden; 7 | } 8 | 9 | .responsiveVideo { 10 | position: absolute; 11 | top: 0; 12 | left: 0; 13 | width: 100%; 14 | height: 100%; 15 | border: 0; 16 | } 17 | 18 | @media screen and (min-width: 998px) { 19 | .responsiveVideo { 20 | max-width: 50vw; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/components/common/ResponsiveVideo.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import styles from './ResponsiveVideo.module.scss'; 3 | 4 | const ResponsiveVideo = ({ 5 | src, 6 | title, 7 | ...props 8 | }: React.ComponentPropsWithoutRef<'iframe'>) => { 9 | return ( 10 |
11 |