{"id":95615,"date":"2025-02-02T00:52:45","date_gmt":"2025-02-01T21:22:45","guid":{"rendered":"https:\/\/nabfollower.com\/blog\/%d8%b3%d8%a7%d8%ae%d8%aa-%d9%85%db%8c%d9%86%d8%a7-%d8%b1%d8%a7%d9%87%d9%86%d9%85%d8%a7%db%8c-%d9%86%d9%88%d8%b4%d8%aa%d9%86-%d9%82%d8%b1%d8%a7%d8%b1%d8%af%d8%a7%d8%af-%d9%87%d9%88%d8%b4%d9%85%d9%86\/"},"modified":"2025-02-02T00:52:45","modified_gmt":"2025-02-01T21:22:45","slug":"%d8%b3%d8%a7%d8%ae%d8%aa-%d9%85%db%8c%d9%86%d8%a7-%d8%b1%d8%a7%d9%87%d9%86%d9%85%d8%a7%db%8c-%d9%86%d9%88%d8%b4%d8%aa%d9%86-%d9%82%d8%b1%d8%a7%d8%b1%d8%af%d8%a7%d8%af-%d9%87%d9%88%d8%b4%d9%85%d9%86","status":"publish","type":"post","link":"https:\/\/nabfollower.com\/blog\/%d8%b3%d8%a7%d8%ae%d8%aa-%d9%85%db%8c%d9%86%d8%a7-%d8%b1%d8%a7%d9%87%d9%86%d9%85%d8%a7%db%8c-%d9%86%d9%88%d8%b4%d8%aa%d9%86-%d9%82%d8%b1%d8%a7%d8%b1%d8%af%d8%a7%d8%af-%d9%87%d9%88%d8%b4%d9%85%d9%86\/","title":{"rendered":"\u0633\u0627\u062e\u062a \u0645\u06cc\u0646\u0627: \u0631\u0627\u0647\u0646\u0645\u0627\u06cc \u0646\u0648\u0634\u062a\u0646 \u0642\u0631\u0627\u0631\u062f\u0627\u062f \u0647\u0648\u0634\u0645\u0646\u062f \u0627\u062c\u0631\u0627\u06cc \u062f\u0631\u062e\u062a\u0627\u0646 \u0645\u0631\u06a9\u0644 \u0628\u0627 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0627\u0632 01J"},"content":{"rendered":"<div data-article-id=\"2254066\" id=\"article-body\">\n<p>\u062f\u0631 \u0627\u06cc\u0646 \u0645\u0642\u0627\u0644\u0647 \u0628\u0647 \u0628\u0631\u0631\u0633\u06cc \u062f\u0631\u062e\u062a\u0627\u0646 \u0645\u0631\u06a9\u0644 \u062f\u0631 \u0627\u06a9\u0648\u0633\u06cc\u0633\u062a\u0645 \u0645\u06cc\u0646\u0627 \u0645\u06cc \u067e\u0631\u062f\u0627\u0632\u06cc\u0645 \u0648 \u06a9\u0627\u0631\u0628\u0631\u062f \u0639\u0645\u0644\u06cc \u0622\u0646\u0647\u0627 \u0631\u0627 \u0628\u0627 \u0627\u06cc\u062c\u0627\u062f \u06af\u0627\u0645 \u0628\u0647 \u06af\u0627\u0645 \u06cc\u06a9 \u0628\u0631\u0646\u0627\u0645\u0647 ZK \u0631\u0627\u06cc \u062f\u0647\u0646\u062f\u0647 \u0646\u0634\u0627\u0646 \u0645\u06cc \u062f\u0647\u062f.<\/p>\n<h2>\n<p>  \u0645\u0642\u062f\u0645\u0647<br \/>\n<\/h2>\n<p>\u06cc\u06a9 blockchain \u0627\u0632 \u0632\u0646\u062c\u06cc\u0631\u0647 \u0627\u06cc \u0627\u0632 \u0628\u0644\u0648\u06a9 \u0647\u0627 \u062a\u0634\u06a9\u06cc\u0644 \u0634\u062f\u0647 \u0627\u0633\u062a \u06a9\u0647 \u0647\u0631 \u0628\u0644\u0648\u06a9 \u062d\u0627\u0648\u06cc \u06cc\u06a9 \u06cc\u0627 \u0686\u0646\u062f \u0645\u0639\u0627\u0645\u0644\u0627\u062a \u0627\u0633\u062a. \u0647\u0631 \u0628\u0644\u0648\u06a9 \u062a\u0648\u0633\u0637 \u06cc\u06a9 \u0647\u0634 \u0631\u0645\u0632\u0646\u06af\u0627\u0631\u06cc \u06a9\u0647 \u0646\u0645\u0627\u06cc\u0627\u0646\u06af\u0631 \u0645\u062d\u062a\u0648\u0627\u06cc \u0622\u0646 \u060c \u0627\u0632 \u062c\u0645\u0644\u0647 \u0645\u0639\u0627\u0645\u0644\u0627\u062a \u0648 \u0627\u0628\u0631\u062f\u0627\u062f\u0647 \u0647\u0627 \u0627\u0633\u062a \u060c \u0645\u0634\u062e\u0635 \u0645\u06cc \u0634\u0648\u062f.<\/p>\n<p>\u062f\u0631 \u06cc\u06a9 \u0628\u0644\u0648\u06a9 \u060c \u0645\u0639\u0627\u0645\u0644\u0627\u062a \u0628\u0627 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0627\u0632 \u06cc\u06a9 \u062f\u0631\u062e\u062a \u0645\u0631\u06a9\u0644 \u060c \u06a9\u0647 \u062f\u0631 \u0622\u0646 \u0647\u0631 \u0645\u0639\u0627\u0645\u0644\u0647 \u062a\u0648\u0633\u0637 \u06cc\u06a9 \u0647\u0634 \u0646\u0634\u0627\u0646 \u062f\u0627\u062f\u0647 \u0645\u06cc \u0634\u0648\u062f \u060c \u0633\u0627\u062e\u062a\u0627\u0631 \u0645\u06cc \u0634\u0648\u0646\u062f. \u0627\u06cc\u0646 \u0647\u0634\u062f\u0647\u0627\u06cc \u0645\u0639\u0627\u0645\u0644\u0647 \u0628\u0647 \u0639\u0646\u0648\u0627\u0646 \u0628\u0631\u06af\u0647\u0627\u06cc \u062f\u0631\u062e\u062a \u0639\u0645\u0644 \u0645\u06cc \u06a9\u0646\u0646\u062f. \u0647\u0631 \u062c\u0641\u062a \u0645\u0639\u0627\u0645\u0644\u0647 \u0628\u0647 \u0635\u0648\u0631\u062a \u0628\u0627\u0632\u06af\u0634\u062a\u06cc \u0628\u0627 \u0647\u0645 \u062c\u0645\u0639 \u0645\u06cc \u0634\u0648\u0646\u062f \u062a\u0627 \u0632\u0645\u0627\u0646\u06cc \u06a9\u0647 \u06cc\u06a9 \u0647\u0634 \u0631\u06cc\u0634\u0647 \u0627\u06cc \u0628\u0647 \u0646\u0627\u0645 \u0631\u06cc\u0634\u0647 \u0645\u0631\u06a9\u0644 \u0628\u062f\u0633\u062a \u0622\u06cc\u062f. \u0627\u06cc\u0646 \u0631\u06cc\u0634\u0647 Merkle \u060c \u0628\u0647 \u0647\u0645\u0631\u0627\u0647 \u0633\u0627\u06cc\u0631 \u0627\u0628\u0631\u062f\u0627\u062f\u0647 \u0647\u0627\u06cc \u0628\u0644\u0648\u06a9 \u060c \u0633\u067e\u0633 \u062f\u0631 \u0647\u062f\u0631 \u0628\u0644\u0648\u06a9 \u0642\u0631\u0627\u0631 \u0645\u06cc \u06af\u06cc\u0631\u062f \u0648 \u0627\u0632 \u06cc\u06a9\u067e\u0627\u0631\u0686\u06af\u06cc \u062f\u0627\u062f\u0647 \u0647\u0627 \u0648 \u062a\u0623\u06cc\u06cc\u062f \u06a9\u0627\u0631\u0622\u0645\u062f \u0627\u0637\u0645\u06cc\u0646\u0627\u0646 \u0645\u06cc \u062f\u0647\u062f.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/media2.dev.to\/dynamic\/image\/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto\/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmh2ordrxug6plc467py6.png\" alt=\"\u0634\u0631\u062d \u062a\u0635\u0648\u06cc\u0631\" loading=\"lazy\" width=\"800\" height=\"400\" title=\"\"><\/p>\n<p>\u062f\u0631 \u0645\u06cc\u0646\u0627 \u060c \u062d\u0633\u0627\u0628 \u0647\u0627\u06cc ZKAPP \u0641\u0642\u0637 \u0645\u06cc \u062a\u0648\u0627\u0646\u0646\u062f \u0645\u0642\u062f\u0627\u0631 \u0645\u062d\u062f\u0648\u062f\u06cc \u0627\u0632 \u062f\u0627\u062f\u0647 \u0647\u0627 \u0631\u0627 \u0628\u0631\u0627\u06cc \u062c\u0644\u0648\u06af\u06cc\u0631\u06cc \u0627\u0632 \u0646\u0641\u062e \u0630\u062e\u06cc\u0631\u0647 \u06a9\u0646\u0646\u062f. \u0627\u0632 \u0627\u06cc\u0646 \u0631\u0648 \u060c \u0646\u06cc\u0627\u0632 \u0628\u0647 \u06cc\u06a9 \u062f\u0631\u062e\u062a \u0645\u0631\u06a9\u0644 \u060c \u06a9\u0647 \u0627\u0645\u06a9\u0627\u0646 \u0645\u0631\u0627\u062c\u0639\u0647 \u0628\u0647 \u062f\u0627\u062f\u0647 \u0647\u0627\u06cc \u062e\u0627\u0631\u062c \u0627\u0632 \u0632\u0646\u062c\u06cc\u0631\u0647 \u0631\u0627 \u0628\u0627 \u0630\u062e\u06cc\u0631\u0647 \u062a\u0646\u0647\u0627 \u06cc\u06a9 \u0632\u0646\u062c\u06cc\u0631\u0647 \u0647\u0634 \u062f\u0631 \u0647\u0631 \u0632\u0646\u062c\u06cc\u0631\u0647 \u0627\u06cc \u0641\u0631\u0627\u0647\u0645 \u0645\u06cc \u06a9\u0646\u062f \u060c \u0627\u0632 \u0627\u06cc\u0646 \u0637\u0631\u06cc\u0642 \u0645\u06cc\u0646\u0627 \u0631\u0627 \u0642\u0627\u062f\u0631 \u0645\u06cc \u0633\u0627\u0632\u062f \u062a\u0627 \u0645\u0648\u062c\u0632 \u062e\u0648\u062f \u0631\u0627 \u062d\u0641\u0638 \u06a9\u0646\u062f.<\/p>\n<p>\u0631\u06cc\u0634\u0647 \u062f\u0631\u062e\u062a Merkle \u062e\u0644\u0627\u0635\u0647 \u0648 \u062a\u0623\u06cc\u06cc\u062f \u06cc\u06a9 \u0645\u062c\u0645\u0648\u0639\u0647 \u0627\u0632 \u062f\u0627\u062f\u0647 \u0647\u0627 \u0627\u0633\u062a \u0648 \u0628\u0631\u0627\u06cc \u0627\u062b\u0628\u0627\u062a \u0648\u062c\u0648\u062f \u0628\u0631\u062e\u06cc \u0627\u0632 \u062f\u0627\u062f\u0647 \u0647\u0627 \u062f\u0631 \u062f\u0631\u062e\u062a \u0645\u0631\u06a9\u0644 \u0645\u0648\u0631\u062f \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0642\u0631\u0627\u0631 \u0645\u06cc \u06af\u06cc\u0631\u062f \u060c \u0631\u06cc\u0634\u0647 \u06cc\u06a9 \u0646\u0645\u0627\u06cc\u0634 \u062c\u0645\u0639 \u0648 \u062c\u0648\u0631 \u0627\u0632 \u06cc\u06a9 \u0645\u062c\u0645\u0648\u0639\u0647 \u0628\u0632\u0631\u06af \u0627\u0632 \u062f\u0627\u062f\u0647 \u0647\u0627 \u062f\u0631 \u0646\u0638\u0631 \u06af\u0631\u0641\u062a\u0647 \u0645\u06cc \u0634\u0648\u062f \u060c \u0628\u0646\u0627\u0628\u0631\u0627\u06cc\u0646 \u0627\u06cc\u0646 \u0627\u0645\u06a9\u0627\u0646 \u062a\u0623\u06cc\u06cc\u062f \u0648 \u062a\u0623\u06cc\u06cc\u062f \u06a9\u0627\u0631\u0622\u0645\u062f \u0631\u0627 \u0641\u0631\u0627\u0647\u0645 \u0645\u06cc \u06a9\u0646\u062f \u06cc\u06a9\u067e\u0627\u0631\u0686\u06af\u06cc \u062f\u0627\u062f\u0647 \u0647\u0627 \u062f\u0631 \u062f\u0627\u062e\u0644 \u0633\u06cc\u0633\u062a\u0645 blockchain.<\/p>\n<p>\u06cc\u06a9\u06cc \u062f\u06cc\u06af\u0631 \u0627\u0632 \u0645\u0632\u0627\u06cc\u0627\u06cc \u062f\u0631\u062e\u062a\u0627\u0646 \u0645\u0631\u06a9\u0644 \u060c \u0634\u0627\u0647\u062f \u0627\u0633\u062a \u06a9\u0647 \u0628\u0647 \u0639\u0646\u0648\u0627\u0646 \u06cc\u06a9 Merkle Proof \u06cc\u0627 Merkle Path \u0646\u06cc\u0632 \u0634\u0646\u0627\u062e\u062a\u0647 \u0645\u06cc \u0634\u0648\u062f. \u0634\u0627\u0647\u062f \u0645\u0633\u06cc\u0631\u06cc \u0627\u0632 \u06cc\u06a9 \u06af\u0631\u0647 \u0628\u0631\u06af \u062e\u0627\u0635 \u0628\u0647 \u0628\u0627\u0644\u0627\u06cc \u062f\u0631\u062e\u062a \u0627\u0633\u062a \u06a9\u0647 \u0631\u06cc\u0634\u0647 \u0627\u0633\u062a. \u0634\u0627\u0647\u062f\u0627\u0646 \u0645\u0631\u06a9\u0644 \u0627\u062b\u0628\u0627\u062a \u06af\u0646\u062c\u0627\u0646\u062f\u0646 \u0647\u0633\u062a\u0646\u062f \u06a9\u0647 \u062b\u0627\u0628\u062a \u0645\u06cc \u06a9\u0646\u062f \u06cc\u06a9 \u0642\u0637\u0639\u0647 \u062e\u0627\u0635 \u0627\u0632 \u062f\u0627\u062f\u0647 \u0647\u0627<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/media2.dev.to\/dynamic\/image\/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto\/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7vzl5x08vjcltszqear7.gif\" alt=\"\u0634\u0647\u0627\u062f\u062a\" loading=\"lazy\" width=\"480\" height=\"273\" title=\"\"><\/p>\n<p>\u0634\u0645\u0627 \u0645\u06cc \u062a\u0648\u0627\u0646\u06cc\u062f \u0645\u0642\u0627\u062f\u06cc\u0631 \u0632\u06cc\u0627\u062f\u06cc \u0627\u0632 \u062f\u0627\u062f\u0647 \u0647\u0627\u06cc \u062e\u0627\u0631\u062c \u0627\u0632 \u0632\u0646\u062c\u06cc\u0631\u0647 \u0631\u0627 \u0627\u0631\u062c\u0627\u0639 \u062f\u0627\u062f\u0647 \u0648 \u062f\u0631 \u06af\u0646\u062c\u0627\u0646\u062f\u0646 \u0642\u0633\u0645\u062a \u0647\u0627\u06cc \u0628\u0633\u06cc\u0627\u0631 \u062e\u0627\u0635 \u0622\u0646 \u062f\u0627\u062f\u0647 \u0647\u0627 \u0628\u0627 \u062a\u0646\u0647\u0627 \u06cc\u06a9 \u0647\u0634 \u06a9\u0648\u0686\u06a9 &#8211; \u0631\u06cc\u0634\u0647 &#8211; \u0648 \u06cc\u06a9 \u0634\u0627\u0647\u062f \u0627\u062b\u0628\u0627\u062a \u06a9\u0646\u06cc\u062f.<\/p>\n<p>\u0628\u06cc\u0627\u06cc\u06cc\u062f \u0633\u0627\u062e\u062a\u0645\u0627\u0646 \u0631\u0627 \u0634\u0631\u0648\u0639 \u06a9\u0646\u06cc\u0645.<\/p>\n<p>\u0645\u0627 \u0628\u0627 \u0646\u0635\u0628 <code>zkapp-cli<\/code>\u0628\u0634\u0631<\/p>\n<div class=\"highlight js-code-highlight\">\n<pre class=\"highlight plaintext\"><code>npm install -g zkapp-cli\n<\/code><\/pre>\n<div class=\"highlight__panel js-actions-panel\">\n<div class=\"highlight__panel-action js-fullscreen-code-action\">\n    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-on\"><title>\u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0631\u0627 \u0648\u0627\u0631\u062f \u06a9\u0646\u06cc\u062f<\/title>\n    <path d=\"M16 3h6v6h-2V5h-4V3zM2 3h6v2H4v4H2V3zm18 16v-4h2v6h-6v-2h4zM4 19h4v2H2v-6h2v4z\"\/>\n<\/svg><\/p>\n<p>    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-off\"><title>\u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M18 7h4v2h-6V3h2v4zM8 9H2V7h4V3h2v6zm10 8v4h-2v-6h6v2h-4zM8 15v6H6v-4H2v-2h6z\"\/>\n<\/svg><\/p>\n<\/div>\n<\/div>\n<\/div>\n<p>\u0628\u0639\u062f \u0627\u0632 \u0646\u0635\u0628 \u0645\u0627 \u0627\u06cc\u0646 \u062f\u0633\u062a\u0648\u0631 \u0631\u0627 \u0628\u0631\u0627\u06cc \u0627\u06cc\u062c\u0627\u062f \u06cc\u06a9 \u067e\u0631\u0648\u0698\u0647 \u0648\u0627\u0631\u062f \u062e\u0648\u0627\u0647\u06cc\u0645 \u06a9\u0631\u062f<\/p>\n<div class=\"highlight js-code-highlight\">\n<pre class=\"highlight plaintext\"><code>zk project votingNft\n<\/code><\/pre>\n<div class=\"highlight__panel js-actions-panel\">\n<div class=\"highlight__panel-action js-fullscreen-code-action\">\n    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-on\"><title>\u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0631\u0627 \u0648\u0627\u0631\u062f \u06a9\u0646\u06cc\u062f<\/title>\n    <path d=\"M16 3h6v6h-2V5h-4V3zM2 3h6v2H4v4H2V3zm18 16v-4h2v6h-6v-2h4zM4 19h4v2H2v-6h2v4z\"\/>\n<\/svg><\/p>\n<p>    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-off\"><title>\u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M18 7h4v2h-6V3h2v4zM8 9H2V7h4V3h2v6zm10 8v4h-2v-6h6v2h-4zM8 15v6H6v-4H2v-2h6z\"\/>\n<\/svg><\/p>\n<\/div>\n<\/div>\n<\/div>\n<p>\u0645\u0627 \u0627\u06cc\u0646 \u0627\u0646\u062a\u062e\u0627\u0628 \u0631\u0627 \u062e\u0648\u0627\u0647\u06cc\u0645 \u062f\u0627\u0634\u062a \u062a\u0627 \u06cc\u06a9\u06cc \u0627\u0632 \u06af\u0632\u06cc\u0646\u0647 \u0647\u0627\u06cc \u0645\u0648\u062c\u0648\u062f \u062f\u0631 \u062a\u0635\u0648\u06cc\u0631 \u0632\u06cc\u0631 \u0631\u0627 \u0627\u0646\u062a\u062e\u0627\u0628 \u06a9\u0646\u06cc\u0645 \u060c \u06af\u0632\u06cc\u0646\u0647 \u0647\u0627 \u0631\u0627 \u0627\u0646\u062a\u062e\u0627\u0628 \u06a9\u0631\u062f\u0647 \u0648 \u0627\u0646\u062a\u062e\u0627\u0628 \u06a9\u0646\u06cc\u0645 <code>none<\/code><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/media2.dev.to\/dynamic\/image\/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto\/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1jhfc12k49vu9y2djd6x.png\" alt=\"\u0634\u0631\u062d \u062a\u0635\u0648\u06cc\u0631\" loading=\"lazy\" width=\"800\" height=\"100\" title=\"\"><\/p>\n<p>\u067e\u0633 \u0627\u0632 \u0627\u0646\u062a\u062e\u0627\u0628 \u060c \u0627\u06cc\u0646 \u067e\u0631\u0648\u0698\u0647 \u0627\u06cc\u062c\u0627\u062f \u0645\u06cc \u0634\u0648\u062f \u060c \u067e\u0633 \u0627\u0632 \u0627\u062a\u0645\u0627\u0645 \u06a9\u0627\u0631 \u0645\u0627 \u0627\u0632 \u062a\u0631\u0645\u06cc\u0646\u0627\u0644 \u0628\u0627 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0627\u0632 \u062a\u0631\u0645\u06cc\u0646\u0627\u0644 \u062d\u0631\u06a9\u062a \u062e\u0648\u0627\u0647\u06cc\u0645 \u06a9\u0631\u062f<\/p>\n<div class=\"highlight js-code-highlight\">\n<pre class=\"highlight plaintext\"><code>cd votingNft\n<\/code><\/pre>\n<div class=\"highlight__panel js-actions-panel\">\n<div class=\"highlight__panel-action js-fullscreen-code-action\">\n    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-on\"><title>\u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0631\u0627 \u0648\u0627\u0631\u062f \u06a9\u0646\u06cc\u062f<\/title>\n    <path d=\"M16 3h6v6h-2V5h-4V3zM2 3h6v2H4v4H2V3zm18 16v-4h2v6h-6v-2h4zM4 19h4v2H2v-6h2v4z\"\/>\n<\/svg><\/p>\n<p>    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-off\"><title>\u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M18 7h4v2h-6V3h2v4zM8 9H2V7h4V3h2v6zm10 8v4h-2v-6h6v2h-4zM8 15v6H6v-4H2v-2h6z\"\/>\n<\/svg><\/p>\n<\/div>\n<\/div>\n<\/div>\n<p>\u0645\u0627 \u0628\u0627\u06cc\u062f \u0628\u0631\u062e\u06cc \u0627\u0632 \u067e\u0631\u0648\u0646\u062f\u0647 \u0647\u0627\u06cc\u06cc \u0631\u0627 \u06a9\u0647 \u0628\u0647 \u0647\u0645\u0631\u0627\u0647 \u067e\u0631\u0648\u0698\u0647 \u062a\u0648\u0644\u06cc\u062f \u0634\u062f\u0647 \u0627\u0646\u062f \u062d\u0630\u0641 \u06a9\u0646\u06cc\u0645 \u0632\u06cc\u0631\u0627 \u0645\u0627 \u0627\u0632 \u0622\u0646\u0647\u0627 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0646\u062e\u0648\u0627\u0647\u06cc\u0645 \u06a9\u0631\u062f. \u0628\u0627 \u0627\u06cc\u0646 \u062f\u0633\u062a\u0648\u0631 \u060c \u067e\u0631\u0648\u0646\u062f\u0647 \u0647\u0627 \u0631\u0627 \u062d\u0630\u0641 \u062e\u0648\u0627\u0647\u06cc\u0645 \u06a9\u0631\u062f<\/p>\n<div class=\"highlight js-code-highlight\">\n<pre class=\"highlight plaintext\"><code>cd src\nrm Add.test.ts Add.ts interact.ts\n<\/code><\/pre>\n<div class=\"highlight__panel js-actions-panel\">\n<div class=\"highlight__panel-action js-fullscreen-code-action\">\n    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-on\"><title>\u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0631\u0627 \u0648\u0627\u0631\u062f \u06a9\u0646\u06cc\u062f<\/title>\n    <path d=\"M16 3h6v6h-2V5h-4V3zM2 3h6v2H4v4H2V3zm18 16v-4h2v6h-6v-2h4zM4 19h4v2H2v-6h2v4z\"\/>\n<\/svg><\/p>\n<p>    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-off\"><title>\u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M18 7h4v2h-6V3h2v4zM8 9H2V7h4V3h2v6zm10 8v4h-2v-6h6v2h-4zM8 15v6H6v-4H2v-2h6z\"\/>\n<\/svg><\/p>\n<\/div>\n<\/div>\n<\/div>\n<p>\u0633\u067e\u0633 \u062f\u0631 \u062d\u0627\u0644\u06cc \u06a9\u0647 \u0647\u0646\u0648\u0632 \u062f\u0631 <code>src<\/code> \u062f\u0627\u06cc\u0631\u06a9\u062a\u0648\u0631\u06cc \u060c \u0645\u0627 \u0627\u06cc\u0646 \u062f\u0633\u062a\u0648\u0631 \u0631\u0627 \u0627\u062c\u0631\u0627 \u0645\u06cc \u06a9\u0646\u06cc\u0645 \u062a\u0627 \u067e\u0631\u0648\u0646\u062f\u0647 \u0647\u0627\u06cc \u0644\u0627\u0632\u0645 \u0631\u0627 \u06a9\u0647 \u0627\u0632 \u0622\u0646 \u062e\u0627\u0631\u062c \u0645\u06cc \u0634\u0648\u06cc\u0645 \u0627\u06cc\u062c\u0627\u062f \u06a9\u0646\u06cc\u0645 <code>src<\/code> \u0641\u0647\u0631\u0633\u062a \u0631\u0627\u0647\u0646\u0645\u0627<\/p>\n<div class=\"highlight js-code-highlight\">\n<pre class=\"highlight plaintext\"><code>touch Voting.ts Voting.test.ts\n\n\/\/exit the directory\ncd ..\n<\/code><\/pre>\n<div class=\"highlight__panel js-actions-panel\">\n<div class=\"highlight__panel-action js-fullscreen-code-action\">\n    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-on\"><title>\u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0631\u0627 \u0648\u0627\u0631\u062f \u06a9\u0646\u06cc\u062f<\/title>\n    <path d=\"M16 3h6v6h-2V5h-4V3zM2 3h6v2H4v4H2V3zm18 16v-4h2v6h-6v-2h4zM4 19h4v2H2v-6h2v4z\"\/>\n<\/svg><\/p>\n<p>    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-off\"><title>\u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M18 7h4v2h-6V3h2v4zM8 9H2V7h4V3h2v6zm10 8v4h-2v-6h6v2h-4zM8 15v6H6v-4H2v-2h6z\"\/>\n<\/svg><\/p>\n<\/div>\n<\/div>\n<\/div>\n<p>\u0645\u0627 \u0622\u0645\u0627\u062f\u0647 \u0634\u0631\u0648\u0639 \u0628\u0647 \u0633\u0627\u062e\u062a \u0648 \u0633\u0627\u0632 \u0647\u0633\u062a\u06cc\u0645 \u0628\u0646\u0627\u0628\u0631\u0627\u06cc\u0646 \u0628\u06cc\u0627\u06cc\u06cc\u062f \u0628\u0627\u0632 \u06a9\u0646\u06cc\u0645 <code>Voting.ts<\/code> \u067e\u0631\u0648\u0646\u062f\u0647 \u060c \u0645\u0627 \u0628\u0633\u062a\u0647 \u0647\u0627\u06cc \u0644\u0627\u0632\u0645 \u0631\u0627 \u06a9\u0647 \u0628\u0631\u0627\u06cc \u06af\u0631\u0641\u062a\u0646 \u0627\u06cc\u0646 \u062a\u0648\u067e \u0646\u06cc\u0627\u0632 \u062f\u0627\u0631\u06cc\u0645 \u0648\u0627\u0631\u062f \u0645\u06cc \u06a9\u0646\u06cc\u0645<\/p>\n<div class=\"highlight js-code-highlight\">\n<pre class=\"highlight plaintext\"><code>import { Field, SmartContract, state, State, method, Struct, MerkleWitness, Poseidon, Provable } from \"o1js\";\n<\/code><\/pre>\n<div class=\"highlight__panel js-actions-panel\">\n<div class=\"highlight__panel-action js-fullscreen-code-action\">\n    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-on\"><title>\u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0631\u0627 \u0648\u0627\u0631\u062f \u06a9\u0646\u06cc\u062f<\/title>\n    <path d=\"M16 3h6v6h-2V5h-4V3zM2 3h6v2H4v4H2V3zm18 16v-4h2v6h-6v-2h4zM4 19h4v2H2v-6h2v4z\"\/>\n<\/svg><\/p>\n<p>    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-off\"><title>\u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M18 7h4v2h-6V3h2v4zM8 9H2V7h4V3h2v6zm10 8v4h-2v-6h6v2h-4zM8 15v6H6v-4H2v-2h6z\"\/>\n<\/svg><\/p>\n<\/div>\n<\/div>\n<\/div>\n<p>\u0645\u0627 \u0628\u0627\u06cc\u062f \u06cc\u06a9 \u0627\u0631\u062a\u0641\u0627\u0639 \u062f\u0631\u062e\u062a \u0631\u0627 \u062a\u0639\u0631\u06cc\u0641 \u06a9\u0646\u06cc\u0645 \u060c \u0627\u0631\u062a\u0641\u0627\u0639 \u062f\u0631\u062e\u062a \u062a\u0635\u0645\u06cc\u0645 \u0645\u06cc \u06af\u06cc\u0631\u062f \u06a9\u0647 \u0686\u0646\u062f \u0644\u0627\u06cc\u0647 \u0627\u0632 \u06af\u0631\u0648\u0647 \u0628\u0646\u062f\u06cc \u0645\u0648\u0631\u062f \u0646\u06cc\u0627\u0632 \u0627\u0633\u062a \u060c \u0628\u0631 \u0627\u06cc\u0646 \u06a9\u0647 \u062f\u0627\u062f\u0647 \u0647\u0627 \u0628\u0647 \u0633\u0631\u0639\u062a \u0648 \u0628\u0647 \u0631\u0627\u062d\u062a\u06cc \u0642\u0627\u0628\u0644 \u062a\u0623\u06cc\u06cc\u062f \u0627\u0633\u062a \u0648 \u0645\u0627 \u06cc\u06a9 \u06a9\u0644\u0627\u0633 \u0634\u0627\u0647\u062f \u0645\u0631\u06a9\u0644 \u0631\u0627 \u0627\u06cc\u062c\u0627\u062f \u062e\u0648\u0627\u0647\u06cc\u0645 \u06a9\u0631\u062f<\/p>\n<p>\u0627\u0631\u062a\u0641\u0627\u0639 \u0628\u06cc\u0627\u0646 \u0645\u06cc \u06a9\u0646\u062f \u06a9\u0647 \u0647\u0646\u06af\u0627\u0645 \u0645\u0634\u062e\u0635 \u06a9\u0631\u062f\u0646 \u0634\u0627\u0647\u062f \u0686\u0647 \u062a\u0639\u062f\u0627\u062f \u0628\u0631\u06af\u0647\u0627\u06cc\u06cc \u0631\u0627 \u0645\u06cc \u062a\u0648\u0627\u0646\u06cc\u0645 \u062f\u0627\u0634\u062a\u0647 \u0628\u0627\u0634\u06cc\u0645 \u060c \u0645\u0627 \u0647\u0646\u06af\u0627\u0645 \u0646\u06af\u0627\u0647\u06cc \u0628\u0647 \u062f\u0627\u062f\u0647 \u0647\u0627\u06cc \u0645\u0648\u062c\u0648\u062f \u062f\u0631 \u062f\u0631\u062e\u062a \u060c \u0627\u06cc\u0646 \u06a9\u0627\u0631 \u0631\u0627 \u062f\u0631 \u0639\u0645\u0644 \u0645\u0634\u0627\u0647\u062f\u0647 \u062e\u0648\u0627\u0647\u06cc\u0645 \u06a9\u0631\u062f<\/p>\n<div class=\"highlight js-code-highlight\">\n<pre class=\"highlight plaintext\"><code>export const treeHeight = 4\n\nexport class MerkleWitness4 extends MerkleWitness(treeHeight){}\n<\/code><\/pre>\n<div class=\"highlight__panel js-actions-panel\">\n<div class=\"highlight__panel-action js-fullscreen-code-action\">\n    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-on\"><title>\u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0631\u0627 \u0648\u0627\u0631\u062f \u06a9\u0646\u06cc\u062f<\/title>\n    <path d=\"M16 3h6v6h-2V5h-4V3zM2 3h6v2H4v4H2V3zm18 16v-4h2v6h-6v-2h4zM4 19h4v2H2v-6h2v4z\"\/>\n<\/svg><\/p>\n<p>    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-off\"><title>\u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M18 7h4v2h-6V3h2v4zM8 9H2V7h4V3h2v6zm10 8v4h-2v-6h6v2h-4zM8 15v6H6v-4H2v-2h6z\"\/>\n<\/svg><\/p>\n<\/div>\n<\/div>\n<\/div>\n<p>\u062d\u0627\u0644 \u0628\u06cc\u0627\u06cc\u06cc\u062f \u0642\u0631\u0627\u0631\u062f\u0627\u062f \u0627\u0635\u0644\u06cc \u0631\u0623\u06cc \u06af\u06cc\u0631\u06cc \u0627\u0635\u0644\u06cc \u062e\u0648\u062f \u0631\u0627 \u0627\u06cc\u062c\u0627\u062f \u06a9\u0646\u06cc\u0645 \u0648 \u0622\u0646 \u0631\u0627 \u0622\u063a\u0627\u0632 \u06a9\u0646\u06cc\u0645<\/p>\n<div class=\"highlight js-code-highlight\">\n<pre class=\"highlight plaintext\"><code>export class Voting extends SmartContract{\n    \/\/ declare state variables\n    @state(Field) voters = State<field>()\n    @state(Field) winningNft = State<field>()\n    @state(Field) winningVotes = State<field>()\n\n    \/\/ root of the merkle tree\n    @state(Field) treeRoot = State<field>()\n\n    init(){\n      super.init()\n      this.voters.set(Field(1))\n    }\n\n   \/\/ initialize the state on the contract\n       @method async initState(initialRoot: Field){\n     this.treeRoot.set(initialRoot)\n   }\n}\n<\/field><\/field><\/field><\/field><\/code><\/pre>\n<div class=\"highlight__panel js-actions-panel\">\n<div class=\"highlight__panel-action js-fullscreen-code-action\">\n    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-on\"><title>\u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0631\u0627 \u0648\u0627\u0631\u062f \u06a9\u0646\u06cc\u062f<\/title>\n    <path d=\"M16 3h6v6h-2V5h-4V3zM2 3h6v2H4v4H2V3zm18 16v-4h2v6h-6v-2h4zM4 19h4v2H2v-6h2v4z\"\/>\n<\/svg><\/p>\n<p>    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-off\"><title>\u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M18 7h4v2h-6V3h2v4zM8 9H2V7h4V3h2v6zm10 8v4h-2v-6h6v2h-4zM8 15v6H6v-4H2v-2h6z\"\/>\n<\/svg><\/p>\n<\/div>\n<\/div>\n<\/div>\n<p>\u0645\u0627 \u0645\u062a\u063a\u06cc\u0631\u0647\u0627\u06cc \u062d\u0627\u0644\u062a \u0631\u0627 \u0628\u0631\u0627\u06cc \u0646\u06af\u0647 \u062f\u0627\u0634\u062a\u0646 \u062a\u0639\u0631\u06cc\u0641 \u0645\u06cc \u06a9\u0646\u06cc\u0645 <code>voters<\/code>\u0628\u0627 <code>winningNft<\/code>\u0628\u0627 <code>winningVotes<\/code> \u0648 <code>treeRoot<\/code>\u060c \u0633\u067e\u0633 \u0648\u0636\u0639\u06cc\u062a \u0642\u0631\u0627\u0631\u062f\u0627\u062f \u0631\u0627 \u0622\u063a\u0627\u0632 \u0645\u06cc \u06a9\u0646\u06cc\u0645. <\/p>\n<p>\u0642\u0628\u0644 \u0627\u0632 \u0627\u062f\u0627\u0645\u0647 \u060c \u0628\u0627\u06cc\u062f \u0628\u0631\u0627\u06cc NFT \u06a9\u0644\u0627\u0633 \u0627\u06cc\u062c\u0627\u062f \u06a9\u0646\u06cc\u0645 \u0648 \u0631\u0648\u0634\u06cc \u0628\u0631\u0627\u06cc \u0631\u0623\u06cc \u062f\u0627\u062f\u0646 \u0627\u06cc\u062c\u0627\u062f \u06a9\u0646\u06cc\u0645.<\/p>\n<div class=\"highlight js-code-highlight\">\n<pre class=\"highlight plaintext\"><code>export class NFT extends Struct({nftName: Field, nftCreator: Field, nftVotes: Field}){\n\n\/\/method for the vote\nvote(){\n  this.nftVotes = this.nftVotes.add(1)\n }\n}\n<\/code><\/pre>\n<div class=\"highlight__panel js-actions-panel\">\n<div class=\"highlight__panel-action js-fullscreen-code-action\">\n    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-on\"><title>\u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0631\u0627 \u0648\u0627\u0631\u062f \u06a9\u0646\u06cc\u062f<\/title>\n    <path d=\"M16 3h6v6h-2V5h-4V3zM2 3h6v2H4v4H2V3zm18 16v-4h2v6h-6v-2h4zM4 19h4v2H2v-6h2v4z\"\/>\n<\/svg><\/p>\n<p>    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-off\"><title>\u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M18 7h4v2h-6V3h2v4zM8 9H2V7h4V3h2v6zm10 8v4h-2v-6h6v2h-4zM8 15v6H6v-4H2v-2h6z\"\/>\n<\/svg><\/p>\n<\/div>\n<\/div>\n<\/div>\n<p>\u0645\u0627 \u0628\u0627 \u062a\u0623\u06cc\u06cc\u062f \u062d\u0636\u0648\u0631 NFT \u062f\u0631 \u062f\u0631\u062e\u062a \u0645\u0631\u06a9\u0644 \u0634\u0631\u0648\u0639 \u0645\u06cc \u06a9\u0646\u06cc\u0645. \u0627\u06cc\u0646 \u0631\u0648\u0646\u062f \u0631\u0623\u06cc \u062f\u0647\u06cc \u0627\u0633\u062a. \u0633\u0631\u0627\u0646\u062c\u0627\u0645 \u060c \u062f\u0631\u062e\u062a Merkle \u0628\u0647 \u0631\u0648\u0632 \u0645\u06cc \u0634\u0648\u062f \u062a\u0627 \u0647\u0631\u06af\u0648\u0646\u0647 \u062a\u063a\u06cc\u06cc\u0631 \u062f\u0631 NFT \u0631\u0627 \u0645\u0646\u0639\u06a9\u0633 \u06a9\u0646\u062f. \u062f\u0631 \u0642\u0631\u0627\u0631\u062f\u0627\u062f \u0647\u0648\u0634\u0645\u0646\u062f \u0631\u0627\u06cc \u06af\u06cc\u0631\u06cc \u060c \u0645\u0627 \u0631\u0648\u0634 \u0631\u0627 \u0627\u06cc\u062c\u0627\u062f \u0645\u06cc \u06a9\u0646\u06cc\u0645 <code>voteForNft<\/code><\/p>\n<div class=\"highlight js-code-highlight\">\n<pre class=\"highlight plaintext\"><code>export class Voting extends SmartContract{\n  \/\/ declare state variables\n  @state(Field) voters = State<field>()\n  @state(Field) winningNft = State<field>()\n  @state(Field) winningVotes = State<field>()\n\n  \/\/ root of the merkle tree\n  @state(Field) treeRoot = State<field>()\n     init(){\n       super.init()\n       this.voters.set(Field(1))\n     }\n\n  \/\/ initialize the state of the contract\n  @method async initState(initialRoot: Field){\n    this.treeRoot.set(initialRoot)\n   }\n\n \/\/method to vote for the nft\n @method async voteForNft(nft: NFT, witness: MerkleWitness4){\n\n  \/\/Get the tree root and see if the nft is in it\n  const treeRoot = this.treeRoot.getAndRequireEquals()\n\n  \/\/ check to see whether the nft is in the merkle tree, the way we \n  \/\/ check to see if the nft is within the tree is by the witness       \n\n  const nftRoot = witness.calculateRoot(Poseidon.hash(NFT.toFields(nft)))\n\n  \/\/ check if the nft is in the tree, if it is not in the tree, the transaction will fail and the state will not be updated\n\n   nftRoot.assertEquals(treeRoot)\n\n  \/\/if the nft is in the tree then the nft can be voted on\n  nft.vote()\n\n  \/\/update the tree with the new nft hash\n  const newNftRoot = witness.calculateRoot(Poseidon.hash(NFT.toFields(nft)))\n  this.treeRoot.set(newNftRoot)\n\n\/\/we want to increment the number of voters after a vote has been cast      this.voters.set(this.voters.getAndRequireEquals().add(1))\n\n\/\/we are going to check if the nft has more votes than the current winning nft then we will update the winning nft\n\n  const winningNft = this.winningNft.getAndRequireEquals()\n  const winningVotes = this.winningVotes.getAndRequireEquals()\n\n  const newWinningNft = Provable.if(winningVotes.lessThan(nft.nftVotes), nft.nftName, winningNft)\n  const newWinningVotes = Provable.if(winningVotes.lessThan(nft.nftVotes), nft.nftName, winningVotes)\n\nthis.winningNft.set(newWinningNft)\nthis.winningVotes.set(newWinningVotes)\n  }\n}\n<\/field><\/field><\/field><\/field><\/code><\/pre>\n<div class=\"highlight__panel js-actions-panel\">\n<div class=\"highlight__panel-action js-fullscreen-code-action\">\n    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-on\"><title>\u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0631\u0627 \u0648\u0627\u0631\u062f \u06a9\u0646\u06cc\u062f<\/title>\n    <path d=\"M16 3h6v6h-2V5h-4V3zM2 3h6v2H4v4H2V3zm18 16v-4h2v6h-6v-2h4zM4 19h4v2H2v-6h2v4z\"\/>\n<\/svg><\/p>\n<p>    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-off\"><title>\u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M18 7h4v2h-6V3h2v4zM8 9H2V7h4V3h2v6zm10 8v4h-2v-6h6v2h-4zM8 15v6H6v-4H2v-2h6z\"\/>\n<\/svg><\/p>\n<\/div>\n<\/div>\n<\/div>\n<p>\u0627\u06cc\u0646 \u0631\u0648\u0634 NFT \u0628\u0631\u0646\u062f\u0647 \u0628\u0631 \u0631\u0648\u06cc \u062f\u0631\u062e\u062a \u0645\u0631\u06a9\u0644 \u0631\u0627 \u062a\u0623\u06cc\u06cc\u062f \u060c \u0622\u0631\u0627 \u0648 \u0628\u0647 \u0631\u0648\u0632 \u0645\u06cc \u06a9\u0646\u062f.<\/p>\n<ol>\n<li>\u0627\u0648\u0644 \u060c \u0645\u0627 NFT \u0631\u0627 \u062f\u0631 \u062f\u0631\u062e\u062a \u0628\u0627 \u0628\u0627\u0632\u06cc\u0627\u0628\u06cc \u0631\u06cc\u0634\u0647 \u0645\u0631\u06a9\u0644 \u060c \u0647\u0634 \u06a9\u0631\u062f\u0646 \u0628\u0627 Poseidon \u0648 \u0628\u0631\u0631\u0633\u06cc \u0627\u06cc\u0646\u06a9\u0647 \u0622\u06cc\u0627 \u062f\u0631 \u062f\u0631\u062e\u062a \u0627\u0632 \u0637\u0631\u06cc\u0642 \u06cc\u06a9 \u0634\u0627\u0647\u062f \u0645\u0631\u06a9\u0644 \u0648\u062c\u0648\u062f \u062f\u0627\u0631\u062f \u060c \u062a\u0623\u06cc\u06cc\u062f \u0645\u06cc \u06a9\u0646\u06cc\u0645.<\/li>\n<\/ol>\n<p>\u062c\u062f\u06cc\u062f<strong>\u067e\u0648\u0632\u06cc\u062f\u0648\u0646<\/strong>: Poseidon \u06cc\u06a9 \u062a\u0627\u0628\u0639 \u0647\u0634 \u0628\u0631\u0627\u06cc \u0633\u06cc\u0633\u062a\u0645 \u0647\u0627\u06cc \u0636\u062f \u062f\u0627\u0646\u0634 \u0635\u0641\u0631 \u0627\u0633\u062a \u060c \u0645\u0627 \u0627\u0632 \u0622\u0646 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0645\u06cc \u06a9\u0646\u06cc\u0645 \u0632\u06cc\u0631\u0627 \u0641\u0642\u0637 \u0645\u062a\u063a\u06cc\u0631\u0647\u0627\u06cc \u0645\u06cc\u062f\u0627\u0646\u06cc \u0631\u0627 \u0630\u062e\u06cc\u0631\u0647 \u0645\u06cc \u06a9\u0646\u062f \u0627\u0645\u0627 \u0627\u0632 \u0622\u0646\u062c\u0627 \u06a9\u0647 NFT \u06cc\u06a9 \u0627\u0633\u062a <code>struct<\/code> \u0645\u0627 \u0628\u0627\u06cc\u062f \u0622\u0646 \u0631\u0627 \u0628\u0647 \u0639\u0646\u0648\u0627\u0646 \u0632\u0645\u06cc\u0646\u0647 \u0645\u0646\u062a\u0642\u0644 \u06a9\u0646\u06cc\u0645<\/p>\n<ol>\n<li>\n<p>\u0645\u0627 \u062f\u0631\u062e\u062a \u0631\u0627\u06cc \u0648 \u0628\u0647 \u0631\u0648\u0632\u0631\u0633\u0627\u0646\u06cc \u0631\u0627 \u0628\u0627\u0632\u06cc \u0645\u06cc \u06a9\u0646\u06cc\u0645 \u060c \u0627\u06af\u0631 \u0645\u0639\u062a\u0628\u0631 \u0628\u0627\u0634\u062f \u060c \u0628\u0627 \u0645\u0627 \u062a\u0645\u0627\u0633 \u0645\u06cc \u06af\u06cc\u0631\u06cc\u0645 <code>nft.vote()<\/code>\u060c \u0648 \u0631\u06cc\u0634\u0647 Merkle \u0631\u0627 \u0628\u0647 \u0631\u0648\u0632 \u06a9\u0646\u06cc\u062f \u0648 \u0631\u06cc\u0634\u0647 \u062c\u062f\u06cc\u062f\u06cc \u0631\u0627 \u062f\u0631 \u0627\u06cc\u0646. Treeroot \u062a\u0646\u0638\u06cc\u0645 \u06a9\u0646\u06cc\u062f.<\/p>\n<\/li>\n<li>\n<p>\u0645\u0627 \u0628\u0627 \u0627\u0641\u0632\u0627\u06cc\u0634 \u062a\u0639\u062f\u0627\u062f \u0631\u0627\u06cc \u062f\u0647\u0646\u062f\u06af\u0627\u0646 \u0631\u0627 \u0627\u0641\u0632\u0627\u06cc\u0634 \u0645\u06cc \u062f\u0647\u06cc\u0645 <code>voters<\/code> \u0628\u0631\u0627\u06cc \u0631\u062f\u06cc\u0627\u0628\u06cc \u062a\u0639\u062f\u0627\u062f \u0634\u0631\u06a9\u062a \u06a9\u0646\u0646\u062f\u06af\u0627\u0646.<\/p>\n<\/li>\n<li>\n<p>\u0633\u0631\u0627\u0646\u062c\u0627\u0645 \u0645\u0627 NFT \u0628\u0631\u0646\u062f\u0647 \u0631\u0627 \u0628\u0647 \u0631\u0648\u0632 \u0645\u06cc \u06a9\u0646\u06cc\u0645 \u060c \u0628\u0627 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0627\u0632 <code>Provable.if<\/code> \u0628\u0631\u0627\u06cc \u0645\u0642\u0627\u06cc\u0633\u0647 \u0622\u0631\u0627 \u0648 \u0628\u0647 \u0631\u0648\u0632\u0631\u0633\u0627\u0646\u06cc <code>winningNft<\/code> \u0648\u062a <code>winningVotes<\/code>\u060c \u0627\u06af\u0631 NFT \u062c\u062f\u06cc\u062f \u0631\u0627\u06cc \u0628\u06cc\u0634\u062a\u0631\u06cc \u062f\u0627\u0634\u062a\u0647 \u0628\u0627\u0634\u062f.<\/p>\n<\/li>\n<\/ol>\n<p>\u0628\u0627 \u0627\u06cc\u0646 \u06a9\u0627\u0631 \u0645\u0627 \u0642\u0631\u0627\u0631\u062f\u0627\u062f \u0647\u0648\u0634\u0645\u0646\u062f \u062e\u0648\u062f \u0631\u0627 \u0622\u0645\u0627\u062f\u0647 \u06a9\u0631\u062f\u0647 \u0627\u06cc\u0645 \u060c \u0627\u06a9\u0646\u0648\u0646 \u0628\u0627\u06cc\u062f \u0642\u0631\u0627\u0631\u062f\u0627\u062f \u0647\u0648\u0634\u0645\u0646\u062f \u062e\u0648\u062f \u0631\u0627 \u0622\u0632\u0645\u0627\u06cc\u0634 \u06a9\u0646\u06cc\u0645.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/media2.dev.to\/dynamic\/image\/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto\/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fva8o8y5vp8ttn1rv4qyu.gif\" alt=\"\u0628\u06cc\u0627 \u0628\u0631\u06cc\u0645\" loading=\"lazy\" width=\"480\" height=\"270\" title=\"\"><\/p>\n<p>\u0645\u0627 \u0628\u0647 \u0633\u0645\u062a \u062e\u0648\u062f \u062d\u0631\u06a9\u062a \u062e\u0648\u0627\u0647\u06cc\u0645 \u06a9\u0631\u062f <code>Voting.test.ts<\/code> \u067e\u0631\u0648\u0646\u062f\u0647 \u0648 \u0627\u0636\u0627\u0641\u0647 \u06a9\u0631\u062f\u0646 \u0628\u0631\u062e\u06cc \u0627\u0632 \u06a9\u062f \u0647\u0627 \u060c \u0627\u0648\u0644\u06cc\u0646 \u06a9\u0627\u0631\u06cc \u06a9\u0647 \u0628\u0627\u06cc\u062f \u0627\u0646\u062c\u0627\u0645 \u062f\u0647\u06cc\u0645 \u0648\u0627\u0631\u062f \u06a9\u0631\u062f\u0646 \u0628\u0633\u062a\u0647 \u0647\u0627 \u0648 \u067e\u0631\u0648\u0646\u062f\u0647 \u0647\u0627\u06cc \u0644\u0627\u0632\u0645 \u0627\u0633\u062a<\/p>\n<div class=\"highlight js-code-highlight\">\n<pre class=\"highlight plaintext\"><code>import { AccountUpdate, CircuitString, Field, MerkleTree, Mina, Poseidon, PrivateKey, PublicKey } from 'o1js';\nimport { treeHeight, NFT, MerkleWitness4, Voting } from '.\/Voting';\n\n<\/code><\/pre>\n<div class=\"highlight__panel js-actions-panel\">\n<div class=\"highlight__panel-action js-fullscreen-code-action\">\n    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-on\"><title>\u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0631\u0627 \u0648\u0627\u0631\u062f \u06a9\u0646\u06cc\u062f<\/title>\n    <path d=\"M16 3h6v6h-2V5h-4V3zM2 3h6v2H4v4H2V3zm18 16v-4h2v6h-6v-2h4zM4 19h4v2H2v-6h2v4z\"\/>\n<\/svg><\/p>\n<p>    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-off\"><title>\u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M18 7h4v2h-6V3h2v4zM8 9H2V7h4V3h2v6zm10 8v4h-2v-6h6v2h-4zM8 15v6H6v-4H2v-2h6z\"\/>\n<\/svg><\/p>\n<\/div>\n<\/div>\n<\/div>\n<p>\u0633\u067e\u0633 \u0645\u0627 \u0628\u0631\u0627\u06cc \u062a\u0633\u062a \u0647\u0627 \u062a\u0646\u0638\u06cc\u0645 \u06a9\u0631\u062f\u06cc\u0645<\/p>\n<div class=\"highlight js-code-highlight\">\n<pre class=\"highlight plaintext\"><code>let proofsEnabled = false;\n\nfunction createNFT(nftName: string, nftCreator: string) {\n    const nft = new NFT({\n        nftName: Poseidon.hash(CircuitString.toFields(CircuitString.fromString(nftName))),\n        nftCreator: Poseidon.hash(CircuitString.toFields(CircuitString.fromString(nftCreator))),\n        nftVotes: Field(0)\n    });\n    return nft;\n}\n\nfunction createTree(): MerkleTree {\n    const tree = new MerkleTree(treeHeight);\n\n    const nft0 = createNFT(\"nft0\", \"creator0\");\n    const nft1 = createNFT(\"nft1\", \"creator1\");\n    const nft2 = createNFT(\"nft2\", \"creator2\");\n    const nft3 = createNFT(\"nft3\", \"creator3\");\n\n    tree.setLeaf(0n, Poseidon.hash(NFT.toFields(nft0)));\n    tree.setLeaf(1n, Poseidon.hash(NFT.toFields(nft1)));\n    tree.setLeaf(2n, Poseidon.hash(NFT.toFields(nft2)));\n    tree.setLeaf(3n, Poseidon.hash(NFT.toFields(nft3)));\n\n    return tree;\n}\n\n\ndescribe('Voting', () =&gt; {\n    let deployerAccount: Mina.TestPublicKey,\n    deployerKey: PrivateKey,\n    senderAccount: Mina.TestPublicKey,\n    senderKey: PrivateKey,\n    zkAppAddress: PublicKey,\n    zkAppPrivateKey: PrivateKey,\n    zkApp: Voting,\n    tree: MerkleTree;\n\n    beforeAll(async () =&gt; {\n        if (proofsEnabled) await Voting.compile();\n    });\n\n    beforeEach(async () =&gt; {\n        const Local = await Mina.LocalBlockchain({ proofsEnabled });\n        Mina.setActiveInstance(Local);\n        [deployerAccount, senderAccount] = Local.testAccounts;\n        deployerKey = deployerAccount.key;\n        senderKey = senderAccount.key;\n\n        zkAppPrivateKey = PrivateKey.random();\n        zkAppAddress = zkAppPrivateKey.toPublicKey();\n        zkApp = new Voting(zkAppAddress);\n        tree = createTree();\n    });\n\nasync function localDeploy() {\n        const txn = await Mina.transaction(deployerAccount, async () =&gt; {\n            AccountUpdate.fundNewAccount(deployerAccount);\n            await zkApp.deploy();\n            await zkApp.initState(tree.getRoot());\n        });\n        await txn.prove();\n        await txn.sign([deployerKey, zkAppPrivateKey]).send();\n    }\n})\n<\/code><\/pre>\n<div class=\"highlight__panel js-actions-panel\">\n<div class=\"highlight__panel-action js-fullscreen-code-action\">\n    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-on\"><title>\u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0631\u0627 \u0648\u0627\u0631\u062f \u06a9\u0646\u06cc\u062f<\/title>\n    <path d=\"M16 3h6v6h-2V5h-4V3zM2 3h6v2H4v4H2V3zm18 16v-4h2v6h-6v-2h4zM4 19h4v2H2v-6h2v4z\"\/>\n<\/svg><\/p>\n<p>    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-off\"><title>\u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M18 7h4v2h-6V3h2v4zM8 9H2V7h4V3h2v6zm10 8v4h-2v-6h6v2h-4zM8 15v6H6v-4H2v-2h6z\"\/>\n<\/svg><\/p>\n<\/div>\n<\/div>\n<\/div>\n<p>\u06cc\u06a9 \u0645\u0648\u0631\u062f \u06a9\u0647 \u0645\u0627 \u0645\u062a\u0648\u062c\u0647 \u0645\u06cc \u0634\u0648\u06cc\u0645 \u0639\u0645\u0644\u06a9\u0631\u062f\u06cc \u0628\u0631\u0627\u06cc \u0627\u06cc\u062c\u0627\u062f \u06cc\u06a9 \u062f\u0631\u062e\u062a \u0628\u0627 \u0622\u0646 \u0627\u0633\u062a <code>createTree<\/code> \u0639\u0645\u0644\u06a9\u0631\u062f \u060c \u062c\u0627\u06cc\u06cc \u06a9\u0647 \u0645\u0627 \u062f\u0627\u062f\u0647 \u0647\u0627\u06cc \u0633\u0627\u062e\u062a\u06af\u06cc \u0628\u0631\u0627\u06cc NFT \u0647\u0627\u06cc\u06cc \u062f\u0627\u0631\u06cc\u0645 \u06a9\u0647 \u0645\u06cc \u062e\u0648\u0627\u0647\u06cc\u0645 \u0628\u0647 \u0622\u0646\u0647\u0627 \u0631\u0623\u06cc \u062f\u0647\u06cc\u0645.<\/p>\n<p>\u0645\u0627 \u0647\u0645\u0686\u0646\u06cc\u0646 \u06cc\u06a9 <code>localDeploy<\/code> \u062a\u0627\u0628\u0639\u06cc \u06a9\u0647 \u0645\u0627 \u062a\u0645\u0627\u0633 \u0645\u06cc \u06af\u06cc\u0631\u06cc\u0645 <\/p>\n<\/p><\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u062f\u0631 \u0627\u06cc\u0646 \u0645\u0642\u0627\u0644\u0647 \u0628\u0647 \u0628\u0631\u0631\u0633\u06cc \u062f\u0631\u062e\u062a\u0627\u0646 \u0645\u0631\u06a9\u0644 \u062f\u0631 \u0627\u06a9\u0648\u0633\u06cc\u0633\u062a\u0645 \u0645\u06cc\u0646\u0627 \u0645\u06cc \u067e\u0631\u062f\u0627\u0632\u06cc\u0645 \u0648 \u06a9\u0627\u0631\u0628\u0631\u062f \u0639\u0645\u0644\u06cc \u0622\u0646\u0647\u0627 \u0631\u0627 \u0628\u0627 \u0627\u06cc\u062c\u0627\u062f \u06af\u0627\u0645 \u0628\u0647 \u06af\u0627\u0645 \u06cc\u06a9 \u0628\u0631\u0646\u0627\u0645\u0647 ZK \u0631\u0627\u06cc \u062f\u0647\u0646\u062f\u0647 \u0646\u0634\u0627\u0646 \u0645\u06cc \u062f\u0647\u062f. \u0645\u0642\u062f\u0645\u0647 \u06cc\u06a9 blockchain \u0627\u0632 \u0632\u0646\u062c\u06cc\u0631\u0647 \u0627\u06cc \u0627\u0632 \u0628\u0644\u0648\u06a9 \u0647\u0627 \u062a\u0634\u06a9\u06cc\u0644 \u0634\u062f\u0647 \u0627\u0633\u062a \u06a9\u0647 \u0647\u0631 \u0628\u0644\u0648\u06a9 \u062d\u0627\u0648\u06cc \u06cc\u06a9 \u06cc\u0627 \u0686\u0646\u062f \u0645\u0639\u0627\u0645\u0644\u0627\u062a \u0627\u0633\u062a. \u0647\u0631 \u0628\u0644\u0648\u06a9 \u062a\u0648\u0633\u0637 \u06cc\u06a9 &hellip;<\/p>\n","protected":false},"author":2,"featured_media":95616,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"fifu_image_url":"https:\/\/media2.dev.to\/dynamic\/image\/width=1000,height=500,fit=cover,gravity=auto,format=auto\/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyck6106o86l8l41hlqeg.png","fifu_image_alt":"","footnotes":""},"categories":[339],"tags":[],"class_list":["post-95615","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-dev"],"_links":{"self":[{"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/posts\/95615","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/comments?post=95615"}],"version-history":[{"count":0,"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/posts\/95615\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/media\/95616"}],"wp:attachment":[{"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/media?parent=95615"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/categories?post=95615"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/tags?post=95615"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}