Skip to content

CuanAway/Tutorial-Mina-Task-1

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 

Repository files navigation

Tutorial Mina Task 1

Dokumen Official :

Task 1

Task 2

Task 3

Task 4

Task 5

Task 6

Task 7

Task 8

#Setup

First, install the Mina zkApp CLI, if you haven’t already.

##Dependencies

You'll need the following installed to use the zkApp CLI:

  • NodeJS 16+ (or 14 using --experimental-wasm-threads)
  • NPM 6+
  • Git 2+

##Installation

npm install -g zkapp-cli

To confirm it is installed, run:

zk --version

#Create New Project Now that you have the tooling installed, we can start building our application.

First, create a new project using:

zk project 01-hello-world

Let's change into this directory and list the contents to see what it created:

$ cd 01-hello-world
$ ls
LICENSE           build             jest.config.js    package-lock.json tsconfig.json
README.md         config.json       keys              package.json
babel.config.cjs  jest-resolver.cjs node_modules      src

#Preparing the project

First, delete the old files. Run:

rm src/Add.ts
rm src/Add.test.ts
rm src/interact.ts

And generate the new files for our project. Enter:

zk file src/Square
touch src/main.ts
cd
cd /01-hello-world/src/
nano index.ts

Paste this script :

import { Square } from './Square.js';
export { Square };

to save it push 'ctrl' 'x' 'y' and 'enter' and then paste this code :

cd ..

To compile the TypeScript code into JavaScript, and run the JavaScript code, you'll type:

npm run build
node build/src/main.js

You can also combine these together into one line, such as:

npm run build && node build/src/main.js

This will run main if the build is successful.

#Write the zkApp Smart Contract

##Import

First, open src/Square.ts in your editor, then add the following at the top of the file:

cd src
nano Square.ts

and then paste this scripts :

import {
  Field,
  SmartContract,
  state,
  State,
  method,
  DeployArgs,
  Permissions,
} from 'snarkyjs';

push button 'ctrl' 'x' 'y' and 'enter' to save it.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published