Skip to content

Commit

Permalink
docs(06-offchain-storage.mdx): update SnarkyJS version and library li…
Browse files Browse the repository at this point in the history
…nks to reflect recent changes

feat(experimental-offchain-zkapp-storage): bump version to 0.1.1 to reflect changes in the package
  • Loading branch information
MartinMinkov committed Aug 25, 2023
1 parent 9d6c33c commit 58905bc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
18 changes: 9 additions & 9 deletions docs/zkapps/tutorials/06-offchain-storage.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ zkApp programmability is not yet available on the Mina Mainnet. You can get star

:::note

This tutorial was last tested with [SnarkyJS](https://www.npmjs.com/package/snarkyjs) 0.8.0.
This tutorial was last tested with [SnarkyJS](https://www.npmjs.com/package/snarkyjs) 0.12.1.

:::

Expand Down Expand Up @@ -76,7 +76,7 @@ This implementation requires a trust assumption for zkApps using it, that both d

This makes it useful for both prototyping applications that need off-chain storage, and putting applications into production where these trust assumptions are reasonable, but not for zkApps where a trustless solution is needed.

See the library [here](https://github.com/es92/zkApp-offchain-storage) if you'd like to learn more about this implementation and see how it works.
See the library [here](https://github.com/o1-labs/docs2/tree/main/examples/zkapps/06-offchain-storage/experimental-zkapp-offchain-storage) if you'd like to learn more about this implementation and see how it works.

### Further Development of Single-Server Off-Chain Storage

Expand All @@ -92,9 +92,9 @@ Some suggested improvements:

## Implementing a Project Using Off-Chain Storage

As usual, there is sample code for this project, which you can find [here](https://github.com/o1-labs/docs2/tree/main/examples/zkapps/06-offchain-storage/contracts).
As usual, there is sample code for this project, which you can find [here](https://github.com/o1-labs/docs2/tree/main/examples/zkapps/06-offchain-storage/offchain-storage-zkapp/contracts).

We will be writing and discussing the [src/main.ts](https://github.com/o1-labs/docs2/tree/main/examples/zkapps/06-offchain-storage/contracts/src/main.ts) and [src/NumberTreeContract.ts](https://github.com/o1-labs/docs2/tree/main/examples/zkapps/06-offchain-storage/contracts/src/NumberTreeContract.ts) files in this project.
We will be writing and discussing the [src/main.ts](https://github.com/o1-labs/docs2/tree/main/examples/zkapps/06-offchain-storage/offchain-storage-zkapp/contracts/src/main.ts) and [src/NumberTreeContract.ts](https://github.com/o1-labs/docs2/tree/main/examples/zkapps/06-offchain-storage/offchain-storage-zkapp/contracts/src/NumberTreeContract.ts) files in this project.

This project implements a tree, where each leaf is either empty or stores a number, which will be our data. Updates to the tree can update a leaf, if the new number in the leaf is greater than the old number. The root of the tree is stored on chain, while the tree itself is stored on an off-chain storage server.

Expand Down Expand Up @@ -128,7 +128,7 @@ export { NumberTreeContract };
Now, add the library for the off-chain storage server we'll be using:

```sh
$ npm install experimental-zkapp-offchain-storage --save
$ npm install experimental-offchain-zkapp-storage --save
```

Also install `xmlhttprequest-ts`, which we will use to make network requests when running from nodejs, where the browser's XMLHttpRequest is not available by default:
Expand All @@ -152,7 +152,7 @@ This will fail when first run, but once we start adding code to `main.ts` and `N
Also for this project, we will need to run our storage server. To do this, in a new terminal window, change into the root of your project and run:

```sh
$ node node_modules/experimental-zkapp-offchain-storage/build/src/storageServer.js
$ node node_modules/experimental-offchain-zkapp-storage/build/src/storageServer.js
```

This will start a storage server and create a `database.json` file in the current directory to store our data for this tutorial.
Expand Down Expand Up @@ -182,7 +182,7 @@ Start by adding our imports:
16 OffChainStorage,
17 Update,
18 MerkleWitness8,
19 } from 'experimental-zkapp-offchain-storage';
19 } from 'experimental-offchain-zkapp-storage';
...
```

Expand Down Expand Up @@ -294,7 +294,7 @@ That completes the smart contract!
## Implementing `main.ts`
You can find a full copy of this file [here](https://github.com/o1-labs/docs2/blob/main/examples/zkapps/06-offchain-storage/contracts/src/main.ts) for reference.
You can find a full copy of this file [here](https://github.com/o1-labs/docs2/blob/main/examples/zkapps/06-offchain-storage/offchain-storage-zkapp/contracts/src/main.ts) for reference.
We will not be implementing this full file, instead just discussing a few parts of it, since much is repeated from earlier tutorials. So download it from the above link, place it in your src folder, and then open it in your editor.
Expand Down Expand Up @@ -413,7 +413,7 @@ We call our smart contract as follows:
...
```
That completes our review of the code to interact with the off-chain storage server! As mentioned previously, you can find the full copy of this file [here](https://github.com/o1-labs/docs2/tree/main/examples/zkapps/06-offchain-storage/contracts/src/main.ts) for review.
That completes our review of the code to interact with the off-chain storage server! As mentioned previously, you can find the full copy of this file [here](https://github.com/o1-labs/docs2/tree/main/examples/zkapps/06-offchain-storage/offchain-storage-zkapp/contracts/src/main.ts) for review.
## Conclusion
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "experimental-offchain-zkapp-storage",
"version": "0.1.0",
"version": "0.1.1",
"description": "",
"author": "",
"license": "Apache-2.0",
Expand Down

0 comments on commit 58905bc

Please sign in to comment.