{"id":92420,"date":"2025-01-11T08:48:38","date_gmt":"2025-01-11T05:18:38","guid":{"rendered":"https:\/\/nabfollower.com\/blog\/niftyzk-tutorials-3-edwards-curve-digital-signatures-35am\/"},"modified":"2025-01-11T08:48:38","modified_gmt":"2025-01-11T05:18:38","slug":"niftyzk-tutorials-3-edwards-curve-digital-signatures-35am","status":"publish","type":"post","link":"https:\/\/nabfollower.com\/blog\/niftyzk-tutorials-3-edwards-curve-digital-signatures-35am\/","title":{"rendered":"Niftyzk tutorials 3 &#8211; Edwards-curve Digital Signatures"},"content":{"rendered":"<div data-article-id=\"2200040\" id=\"article-body\">\n<p>Niftyzk \u0627\u0632 EdDSA \u06a9\u0647 \u06cc\u06a9 \u0637\u0631\u062d \u0627\u0645\u0636\u0627\u06cc \u062f\u06cc\u062c\u06cc\u062a\u0627\u0644 \u0631\u0645\u0632\u0646\u06af\u0627\u0631\u06cc \u0639\u0645\u0648\u0645\u06cc \u0627\u0633\u062a \u067e\u0634\u062a\u06cc\u0628\u0627\u0646\u06cc \u0645\u06cc \u06a9\u0646\u062f. \u0627\u06cc\u0646 \u0622\u0645\u0648\u0632\u0634 \u062d\u0627\u0648\u06cc \u0627\u0637\u0644\u0627\u0639\u0627\u062a\u06cc \u062f\u0631 \u0645\u0648\u0631\u062f \u06a9\u062f \u062a\u0648\u0644\u06cc\u062f \u0634\u062f\u0647 \u0627\u0633\u062a \u0648 \u0628\u0631\u0627\u06cc \u062f\u0631\u06a9 \u0647\u0645\u0647 \u0686\u06cc\u0632 \u0628\u0627\u06cc\u062f \u0622\u0645\u0648\u0632\u0634 \u0647\u0627\u06cc \u0642\u0628\u0644\u06cc \u0631\u0627 \u0628\u062e\u0648\u0627\u0646\u06cc\u062f.<\/p>\n<p>\u0628\u06cc\u0627\u06cc\u06cc\u062f \u0628\u0627 \u0634\u0631\u0648\u0639 \u06a9\u0646\u06cc\u0645 <code>niftyzk init<\/code><\/p>\n<div class=\"highlight js-code-highlight\">\n<pre class=\"highlight plaintext\"><code>Setting up your current directory\n? What project do you want to scaffold? EdDSA signature verification\n? Choose the hashing algorithm to use:  mimc7\n? Do you wish to add public inputs to sign? (E.g: address,amount) yes\n? Enter the name of the public inputs in a comma separated list (no numbers or special characters):  address,amount\nGenerating circuits\nGenerating javascript\nDone\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>\u0648\u0627\u0631\u062f \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0634\u0648\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\u0646\u0627\u0628\u0631\u0627\u06cc\u0646 \u0645\u0627 EdDSA \u0631\u0627 \u0628\u0627 mimc7 \u0627\u0646\u062a\u062e\u0627\u0628 \u06a9\u0631\u062f\u06cc\u0645 \u0648 \u062a\u0639\u062f\u0627\u062f\u06cc \u0648\u0631\u0648\u062f\u06cc \u0628\u0647 \u0639\u0644\u0627\u0645\u062a\u060c \u0622\u062f\u0631\u0633\u060c \u0645\u0642\u062f\u0627\u0631 \u0627\u0636\u0627\u0641\u0647 \u06a9\u0631\u062f\u06cc\u0645<\/p>\n<p>\u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0627\u0632 \u0647\u0634 MiMC7 \u0628\u0647 \u0627\u06cc\u0646 \u0645\u0639\u0646\u06cc \u0627\u0633\u062a \u06a9\u0647 \u0628\u0627\u06cc\u062f \u0627\u0632 \u06a9\u0644\u06cc\u062f\u06cc \u0628\u0631\u0627\u06cc \u0627\u06cc\u062c\u0627\u062f \u0647\u0634 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u06a9\u0646\u06cc\u0645 \u06a9\u0647 \u0645\u062e\u0641\u06cc \u0646\u06af\u0647 \u062f\u0627\u0634\u062a\u0647 \u0645\u06cc \u0634\u0648\u062f. \u0627\u0645\u0627 \u0628\u0631\u0627\u06cc \u0627\u0645\u0636\u0627\u06cc EdDSA \u0628\u0627 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0627\u0632 MiMC\u060c \u0627\u0632 \u06a9\u0644\u06cc\u062f \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0646\u0645\u06cc \u0634\u0648\u062f. \u0627\u06cc\u0646 \u062a\u0635\u0645\u06cc\u0645 \u0628\u0631\u0627\u06cc \u0639\u062f\u0645 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0627\u0632 \u06a9\u0644\u06cc\u062f \u0628\u0631\u0627\u06cc \u0627\u0645\u0636\u0627 \u062a\u0648\u0633\u0637 \u062a\u0648\u0633\u0639\u0647 \u062f\u0647\u0646\u062f\u06af\u0627\u0646 circomlib \u06af\u0631\u0641\u062a\u0647 \u0634\u062f\u060c \u0632\u06cc\u0631\u0627 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0627\u0632 \u06a9\u0644\u06cc\u062f \u067e\u06cc\u0634 \u0641\u0631\u0636 \u0645\u0634\u06a9\u0644\u06cc \u0646\u06cc\u0633\u062a\u060c \u062f\u0627\u062f\u0647 \u0647\u0627\u06cc \u0627\u0645\u0636\u0627 \u0634\u062f\u0647 \u06cc\u06a9 \u0647\u0634 \u0639\u0645\u0648\u0645\u06cc \u0627\u0633\u062a.<\/p>\n<p>\u0628\u06cc\u0627\u06cc\u06cc\u062f \u0645\u062f\u0627\u0631\u0647\u0627\u06cc \u062a\u0648\u0644\u06cc\u062f \u0634\u062f\u0647 \u0631\u0627 \u0628\u0628\u06cc\u0646\u06cc\u0645\u060c \u0645\u06cc \u0628\u06cc\u0646\u06cc\u062f \u06a9\u0647 \u06cc\u06a9 \u0648\u062c\u0648\u062f \u062f\u0627\u0631\u062f <code>circuit.circom<\/code> \u0641\u0627\u06cc\u0644<\/p>\n<div class=\"highlight js-code-highlight\">\n<pre class=\"highlight plaintext\"><code>pragma circom 2.0.0;\n\ninclude \"..\/node_modules\/circomlib\/circuits\/eddsamimc.circom\";\ninclude \"..\/node_modules\/circomlib\/circuits\/mimc.circom\";\n\ntemplate VerifySignature(){\n    signal input message;\n    signal input address;\n    signal input amount;\n\n    signal input k;\n\n    signal input Ax;\n    signal input Ay;\n    signal input S;\n    signal input R8x;\n    signal input R8y;\n\n    component eddsa = EdDSAMiMCVerifier();\n\n    component mimc7Hash = MultiMiMC7(3, 91);\n    mimc7Hash.k &lt;== k;\n    mimc7Hash.in[0] &lt;== message;\n    mimc7Hash.in[1] &lt;== address;\n    mimc7Hash.in[2] &lt;== amount;\n\n\n    eddsa.enabled &lt;== 1;\n    eddsa.Ax &lt;== Ax;\n    eddsa.Ay &lt;== Ay;\n    eddsa.S &lt;== S;\n    eddsa.R8x &lt;== R8x;\n    eddsa.R8y &lt;== R8y;\n    eddsa.M &lt;== mimc7Hash.out;\n\n    }\n\ncomponent main {public [message,address,amount]}  = VerifySignature(); \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>\u0648\u0627\u0631\u062f \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0634\u0648\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\u0646\u0627\u0628\u0631\u0627\u06cc\u0646 \u0648\u0627\u0628\u0633\u062a\u06af\u06cc \u0647\u0627\u06cc \u0645\u0648\u0631\u062f \u0646\u06cc\u0627\u0632 \u0631\u0627 \u0648\u0627\u0631\u062f \u0645\u06cc \u06a9\u0646\u06cc\u0645\u060c \u0627\u0632 \u0627\u0644\u06af\u0648\u0631\u06cc\u062a\u0645 \u0647\u0634 \u06cc\u06a9\u0633\u0627\u0646\u06cc \u0628\u0631\u0627\u06cc \u0627\u0645\u0636\u0627\u0647\u0627 \u0648 \u0647\u0634 \u067e\u06cc\u0627\u0645 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0645\u06cc \u06a9\u0646\u06cc\u0645.<\/p>\n<p>\u0628\u0646\u0627\u0628\u0631\u0627\u06cc\u0646 \u0645\u0627 \u06cc\u06a9 <code>message<\/code> \u0648\u0631\u0648\u062f\u06cc\u060c <code>address<\/code> \u0648 <code>amount<\/code> \u06a9\u0647 \u0627\u0636\u0627\u0641\u06cc \u0628\u0648\u062f\u0646\u062f \u0648 \u0627\u06cc\u0646 \u0648\u0631\u0648\u062f\u06cc\u200c\u0647\u0627\u06cc \u0639\u0645\u0648\u0645\u06cc \u0645\u0627 \u0647\u0633\u062a\u0646\u062f \u06a9\u0647 \u0628\u0631\u0627\u06cc \u062a\u0623\u06cc\u06cc\u062f \u062f\u0631 \u0632\u0646\u062c\u06cc\u0631\u0647 \u0622\u0634\u06a9\u0627\u0631 \u0645\u06cc\u200c\u0634\u0648\u0646\u062f.<\/p>\n<p><code>k<\/code>  \u0631\u0627\u0632 \u0645\u0648\u0631\u062f \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0628\u0631\u0627\u06cc \u0647\u0634 \u06a9\u0631\u062f\u0646 mimc \u0627\u0633\u062a<\/p>\n<p><code>Ax<\/code>\u060c<code>Ay<\/code> \u0646\u0642\u0627\u0637\u06cc \u0647\u0633\u062a\u0646\u062f \u06a9\u0647 \u0628\u0631\u0627\u06cc \u06a9\u0644\u06cc\u062f \u0639\u0645\u0648\u0645\u06cc \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0645\u06cc \u0634\u0648\u0646\u062f\u060c <code>S<\/code>\u060c <code>R8x<\/code>\u060c<code>R8y<\/code> \u067e\u0627\u0631\u0627\u0645\u062a\u0631\u0647\u0627\u06cc \u0627\u0645\u0636\u0627 \u0647\u0633\u062a\u0646\u062f \u06a9\u0647 \u062a\u0648\u0633\u0637 \u062a\u0627\u0628\u0639 \u0627\u0645\u0636\u0627 \u0628\u0631\u06af\u0631\u062f\u0627\u0646\u062f\u0647 \u0645\u06cc \u0634\u0648\u0646\u062f.<\/p>\n<p>\u0645\u0627 \u06cc\u06a9 \u0647\u0634 MiMC7 \u0631\u0627 \u0628\u0627 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0627\u0632 \u0622\u0646 \u0645\u062d\u0627\u0633\u0628\u0647 \u0645\u06cc \u06a9\u0646\u06cc\u0645 <code>k<\/code> \u0648 \u0633\u067e\u0633 \u0641\u0642\u0637 \u0648\u0631\u0648\u062f\u06cc \u0647\u0627 \u0631\u0627 \u0628\u0647 <code>eddsa<\/code> \u0633\u06cc\u06af\u0646\u0627\u0644 \u0647\u0627\u06cc \u0648\u0631\u0648\u062f\u06cc \u0627\u0644\u06af\u0648 \u0628\u0627 \u0645\u0634\u062e\u0635 \u06a9\u0631\u062f\u0646 <code>eddsa.enabled &lt;== 1;<\/code> \u0645\u0627 \u0627\u062f\u0639\u0627 \u0645\u06cc \u06a9\u0646\u06cc\u0645 \u06a9\u0647 \u0627\u0645\u0636\u0627 \u0628\u0627\u06cc\u062f \u0628\u0631\u0627\u06cc \u0647\u0634 \u0645\u0639\u062a\u0628\u0631 \u0628\u0627\u0634\u062f. \u062d\u0627\u0644 \u0627\u062c\u0627\u0632\u0647 \u062f\u0647\u06cc\u062f \u0628\u0647 \u0628\u0631\u062e\u06cc \u0627\u0632 \u062c\u0627\u0648\u0627 \u0627\u0633\u06a9\u0631\u06cc\u067e\u062a \u0646\u06af\u0627\u0647 \u06a9\u0646\u06cc\u0645<br \/>\u062d\u0633\u0627\u0628 \u0647\u0627 \u0628\u0627 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0627\u0632 EdDSA \u0627\u06cc\u062c\u0627\u062f \u0645\u06cc \u0634\u0648\u0646\u062f:<\/p>\n<div class=\"highlight js-code-highlight\">\n<pre class=\"highlight plaintext\"><code>\/**\n * The signature parameters used for verifying pedersen hash signed EdDSA\n * @typedef {Object} Account\n * @property {Buffer} prvKey - Private key buffer\n * @property {Uint8Array[]} pubKey - Public key is a tuple of 32 bit Uint8Array\n *\/\n\n\/**\n * @param {any} eddsa - The EdDSA object\n * @returns {Account}\n * Generate a new account which composes of a private and public key\n*\/\nexport function generateAccount(eddsa) {\n    const prvKey = rbytes();\n    const pubKey = eddsa.prv2pub(prvKey);\n    return {\n        prvKey,\n        pubKey\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>\u0648\u0627\u0631\u062f \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0634\u0648\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\u0632 32 \u0628\u0627\u06cc\u062a \u0628\u0631\u0627\u06cc \u062d\u0633\u0627\u0628 \u06a9\u0627\u0631\u0628\u0631\u06cc \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0645\u06cc \u06a9\u0646\u06cc\u0645 <code>rbytes()<\/code> \u06cc\u06a9 \u0628\u0627\u0641\u0631 \u062a\u0635\u0627\u062f\u0641\u06cc \u0628\u0631\u0645\u06cc \u06af\u0631\u062f\u0627\u0646\u062f. \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0645\u06cc \u06a9\u0646\u062f <code>crypto.randomBytes(32)<\/code>\u06a9\u0644\u06cc\u062f\u0647\u0627\u06cc \u0639\u0645\u0648\u0645\u06cc \u06cc\u06a9 \u0633\u0631\u06cc Uint8Array \u0647\u0633\u062a\u0646\u062f \u06a9\u0647 \u0647\u0631 \u06a9\u062f\u0627\u0645 32 \u0628\u06cc\u062a \u0627\u0646\u062f\u0627\u0632\u0647 \u062f\u0627\u0631\u0646\u062f.<\/p>\n<div class=\"highlight js-code-highlight\">\n<pre class=\"highlight plaintext\"><code>\/**\n * \n * @param {Array<bigint>} pubKey - Used for computing an address\n * @param {bigin | number} key -The key used for the mimc7 hash\n * @returns \n *\/\n\nexport async function getAddressFromPubkey(pubKey, key) {\n    return mimc7(pubKey, key);\n}\n\n<\/bigint><\/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>\u0648\u0627\u0631\u062f \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0634\u0648\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 &#8220;\u0622\u062f\u0631\u0633 \u0647\u0627&#8221; \u0631\u0627 \u0627\u0632 \u06a9\u0644\u06cc\u062f \u0639\u0645\u0648\u0645\u06cc \u0628\u0627 \u0647\u0634 \u06a9\u0631\u062f\u0646 \u0622\u0646 \u0645\u062d\u0627\u0633\u0628\u0647 \u0645\u06cc \u06a9\u0646\u06cc\u0645. \u0627\u06cc\u0646 \u0622\u062f\u0631\u0633\u200c\u0647\u0627 \u0622\u062f\u0631\u0633\u200c\u0647\u0627\u06cc \u0628\u0644\u0627\u06a9 \u0686\u06cc\u0646 \u0645\u0639\u062a\u0628\u0631 \u0646\u06cc\u0633\u062a\u0646\u062f \u0627\u0645\u0627 \u0628\u0631\u0627\u06cc \u0627\u0646\u062a\u0632\u0627\u0639 \u062d\u0633\u0627\u0628 \u0642\u0627\u0628\u0644 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0647\u0633\u062a\u0646\u062f. \u0634\u0645\u0627 \u0645\u06cc \u062a\u0648\u0627\u0646\u06cc\u062f \u0622\u062f\u0631\u0633 \u0647\u0627 \u0631\u0627 \u0627\u0632 \u06cc\u06a9 \u06a9\u0644\u06cc\u062f \u0639\u0645\u0648\u0645\u06cc \u0628\u0627 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0627\u0632 \u0637\u0631\u062d \u0647\u0627 \u0648 \u0645\u0633\u06cc\u0631\u0647\u0627\u06cc \u0645\u0634\u062a\u0642 \u0645\u062e\u062a\u0644\u0641 \u0627\u0633\u062a\u062e\u0631\u0627\u062c \u06a9\u0646\u06cc\u062f. \u0627\u06cc\u0646 \u0628\u0647 \u0634\u0645\u0627 \u0628\u0633\u062a\u06af\u06cc \u062f\u0627\u0631\u062f \u06a9\u0647 \u0686\u0647 \u0686\u06cc\u0632\u06cc \u0631\u0627 \u0627\u0646\u062a\u062e\u0627\u0628 \u0645\u06cc \u06a9\u0646\u06cc\u062f.<\/p>\n<div class=\"highlight js-code-highlight\">\n<pre class=\"highlight plaintext\"><code>\/**\n * @typedef {Object} Message\n * @property {string | bigint} message\n * @property {string | bigint} address\n * @property {string | bigint} amount\n *\/\n\n\/**\n * \n * @param {Message} data - The data content of the message. The hash of the data object will be signed\n * @param key {number | bigint} - The key used for the mimc7 hash\n * @returns {bigint} Returns a mimc7 hash\n *\/\nexport async function computeMessageHash(data, key) {\n    return await mimc7(\n        [\n            BigInt(data.message),\n            BigInt(data.address),\n            BigInt(data.amount)\n        ], key)\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>\u0648\u0627\u0631\u062f \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0634\u0648\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>\u0647\u0634 \u067e\u06cc\u0627\u0645 \u0628\u0627 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0627\u0632 mimc7 \u0645\u062d\u0627\u0633\u0628\u0647 \u0645\u06cc\u200c\u0634\u0648\u062f\u060c \u0627\u06cc\u0646 \u0647\u0645\u0627\u0646 \u0647\u0634\u200c\u0633\u0627\u0632\u06cc \u0627\u0633\u062a \u06a9\u0647 \u062f\u0631 \u062f\u0627\u062e\u0644 \u0645\u062f\u0627\u0631 \u0628\u0631\u0627\u06cc \u062a\u0623\u06cc\u06cc\u062f \u0627\u0646\u062c\u0627\u0645 \u0645\u06cc\u200c\u0634\u0648\u062f.<\/p>\n<div class=\"highlight js-code-highlight\">\n<pre class=\"highlight plaintext\"><code>\/**\n * @param {any} eddsa - the built EDDSA\n * @param {bigint} messagehash - The poseidon hash of the message\n * @param {Buffer} prvKey - The private key used to sign the message \n * @returns {Signature} signature\n *\/\nexport function signMessage(eddsa, messageHash, prvKey) {\n    const signature = eddsa.signMiMC(prvKey, eddsa.F.e(messageHash));\n    const pubKey = eddsa.prv2pub(prvKey);\n    assert(eddsa.verifyMiMC(eddsa.F.e(messageHash), signature, pubKey))\n\n    return {\n        signature,\n        pubKey\n    }\n}\n\n\/**\n * @typedef {Object} Signature\n * @property {Uint8Array[]} R8\n * @property {bigint} S\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>\u0648\u0627\u0631\u062f \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0634\u0648\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\u0645\u0636\u0627\u06cc \u067e\u06cc\u0627\u0645 \u0627\u0632 \u062a\u0627\u0628\u0639 \u0641\u0648\u0642 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0645\u06cc \u06a9\u0646\u062f. \u0634\u0645\u0627 \u06cc\u06a9 \u0634\u06cc eddsa\u060c \u0647\u0634 \u067e\u06cc\u0627\u0645 \u0645\u062d\u0627\u0633\u0628\u0647 \u0634\u062f\u0647 \u0648 \u06a9\u0644\u06cc\u062f \u062e\u0635\u0648\u0635\u06cc \u0627\u06cc\u062c\u0627\u062f \u0634\u062f\u0647 \u0628\u0631\u0627\u06cc \u062d\u0633\u0627\u0628 \u0634\u0645\u0627 \u0631\u0627 \u0627\u0631\u0633\u0627\u0644 \u0645\u06cc \u06a9\u0646\u06cc\u062f. \u0645\u06cc \u062a\u0648\u0627\u0646\u06cc\u062f \u0646\u0648\u0639 \u0627\u0645\u0636\u0627\u06cc \u062a\u0639\u0631\u06cc\u0641 \u0634\u062f\u0647 \u0628\u0627 JsDoc \u0631\u0627 \u0628\u0628\u06cc\u0646\u06cc\u062f.<\/p>\n<div class=\"highlight js-code-highlight\">\n<pre class=\"highlight plaintext\"><code>\/**\n * @typedef {Object} SignatureParameters\n * @property {bigint} Ax\n * @property {bigint} Ay\n * @property {bigint} R8x\n * @property {bigint} R8y\n * @property {bigint} S\n *\/\n\n\/**\n * @param {any} eddsa\n * @param {Uint8Array[]} pubKey - The public key of the account\n * @param {Signature} signature - The signature of the signed message\n * @returns {SignatureParameters} - The signature parameters are prepared parameters, ready to use for the circuit\n *\/\nexport function getSignatureParameters(eddsa, pubKey, signature) {\n    return {\n        Ax: eddsa.F.toObject(pubKey[0]),\n        Ay: eddsa.F.toObject(pubKey[1]),\n        R8x: eddsa.F.toObject(signature.R8[0]),\n        R8y: eddsa.F.toObject(signature.R8[1]),\n        S: signature.S\n    }\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>\u0648\u0627\u0631\u062f \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0634\u0648\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\u0631\u0627\u06cc \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0627\u0632 \u0627\u06cc\u0646 \u0627\u0645\u0636\u0627 \u062f\u0631 circom\u060c \u0628\u0627\u06cc\u062f \u0622\u0646 \u0631\u0627 \u062a\u0628\u062f\u06cc\u0644 \u06a9\u0646\u06cc\u0645. \u0628\u0646\u0627\u0628\u0631\u0627\u06cc\u0646 \u067e\u0627\u0631\u0627\u0645\u062a\u0631\u0647\u0627\u06cc \u0627\u0645\u0636\u0627 \u0631\u0627 \u0628\u0631\u0627\u06cc \u062a\u0623\u06cc\u06cc\u062f \u0628\u0627 \u062a\u0627\u0628\u0639 \u0628\u0627\u0644\u0627 \u062f\u0631\u06cc\u0627\u0641\u062a \u0645\u06cc \u06a9\u0646\u06cc\u0645. <code>\/test\/input.js<\/code><\/p>\n<div class=\"highlight js-code-highlight\">\n<pre class=\"highlight plaintext\"><code>\/**\n * This is a test input, generated for the starting circuit.\n * If you update the inputs, you need to update this function to match it.\n *\/\nexport async function getInput(){\n\n    await buildHashImplementation()\n    const eddsa = await getEDDSA();\n\n    const account = generateAccount(eddsa);\n    const key = 313; \/\/ just an example key for tests\n    const message = rbigint();\n    const address = rbigint()\n    const amount = rbigint()\n    const messageHash = await computeMessageHash({message,address,amount}, key)\n\n    const signedMessage = signMessage(eddsa, messageHash, account.prvKey);\n\n    const signatureParameters = getSignatureParameters(eddsa, account.pubKey, signedMessage.signature)\n\n    return {\n        Ax: signatureParameters.Ax, \n        Ay: signatureParameters.Ay,\n        S: signatureParameters.S,\n        R8x: signatureParameters.R8x,\n        R8y: signatureParameters.R8y,\n\n        k: key,\n        address,\n        amount,\n        message\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>\u0648\u0627\u0631\u062f \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0634\u0648\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>\u0648 \u062f\u0631 \u0628\u0627\u0644\u0627 \u0645\u06cc \u062a\u0648\u0627\u0646\u06cc\u062f \u0628\u0628\u06cc\u0646\u06cc\u062f \u06a9\u0647 \u0686\u06af\u0648\u0646\u0647 \u0648\u0631\u0648\u062f\u06cc \u0645\u062f\u0627\u0631\u0647\u0627 \u0631\u0627 \u0645\u062d\u0627\u0633\u0628\u0647 \u0645\u06cc \u06a9\u0646\u06cc\u0645. \u0628\u0631\u0627\u06cc \u0628\u0627\u0631\u06af\u0630\u0627\u0631\u06cc \u0645\u062c\u062f\u062f \u062f\u0627\u063a \u0648 \u062a\u0633\u062a \u0647\u0627 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0645\u06cc \u0634\u0648\u062f<\/p>\n<p>\u0627\u06a9\u0646\u0648\u0646 \u0628\u0647 \u0634\u0645\u0627 \u0646\u0634\u0627\u0646 \u062e\u0648\u0627\u0647\u0645 \u062f\u0627\u062f \u06a9\u0647 \u0686\u06af\u0648\u0646\u0647 \u062f\u0631\u062e\u062a\u0627\u0646 \u0645\u0631\u06a9\u0644 \u0628\u0627 EdDSA \u06a9\u0627\u0631 \u0645\u06cc \u06a9\u0646\u0646\u062f<\/p>\n<div class=\"highlight js-code-highlight\">\n<pre class=\"highlight plaintext\"><code>Setting up your current directory\n? What project do you want to scaffold? EdDSA signature verification with Fixed Merkle Tree\n? Choose the hashing algorithm to use:  poseidon\n? Do you wish to add public inputs to sign? (E.g: address,amount) no\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>\u0648\u0627\u0631\u062f \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0634\u0648\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\u0646\u0627\u0628\u0631\u0627\u06cc\u0646 \u0628\u0627 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0627\u0632 \u067e\u0631\u0648\u0698\u0647 \u0628\u0627\u0632\u0633\u0627\u0632\u06cc \u0634\u062f <code>niftyzk init<\/code> \u0648 \u067e\u0627\u0631\u0627\u0645\u062a\u0631\u0647\u0627\u06cc \u0645\u062e\u062a\u0644\u0641 \u0631\u0627 \u0627\u0646\u062a\u062e\u0627\u0628 \u06a9\u0631\u062f. \u0648 \u0627\u06cc\u0646 \u0647\u0645\u0627\u0646 \u0627\u0633\u062a <code>circuit.circom<\/code> \u0627\u06a9\u0646\u0648\u0646 \u0641\u0627\u06cc\u0644 \u06a9\u0646\u06cc\u062f:<\/p>\n<div class=\"highlight js-code-highlight\">\n<pre class=\"highlight plaintext\"><code>pragma circom 2.0.0;\n\ninclude \"..\/node_modules\/circomlib\/circuits\/eddsaposeidon.circom\";\ninclude \"..\/node_modules\/circomlib\/circuits\/poseidon.circom\";\ninclude \".\/merkletree.circom\";\n\n\ntemplate VerifySignature(levels){\n\n    signal input message;\n    signal input root;\n\n    signal input pathIndices[levels];\n    signal input pathElements[levels];\n\n\n    \/\/The parameters for the signature\n    \/\/The Ax and Ay parameters are the public key, Ax = pubKey[0], Ay = pubKey[1]\n    signal input Ax;\n    signal input Ay;\n    signal input S;\n    signal input R8x;\n    signal input R8y;\n    component eddsa = EdDSAPoseidonVerifier();\n\n    component poseidon = Poseidon(1);\n    poseidon.inputs[0] &lt;== message;\n\n    \/\/ Verify the signature on the message hash\n\n    eddsa.enabled &lt;== 1;\n    eddsa.Ax &lt;== Ax;\n    eddsa.Ay &lt;== Ay;\n    eddsa.S &lt;== S;\n    eddsa.R8x &lt;== R8x;\n    eddsa.R8y &lt;== R8y;\n    eddsa.M &lt;== poseidon.out;\n\n    \/\/We compute a public key by hashing Ax and Ay, \n   \/\/ this will be later used with the merkle tree\n   component pubKeyHasher = Poseidon(2);\n   pubKeyHasher.inputs[0] &lt;== Ax;\n   pubKeyHasher.inputs[1] &lt;== Ay;\n\n   \/\/Verify the merkle tree\n   component tree = MerkleTreeChecker(levels);\n\n\n  for (var i = 0; i &lt; levels; i++) {\n      tree.pathElements[i] &lt;== pathElements[i];\n      tree.pathIndices[i] &lt;== pathIndices[i];\n  }\n  tree.root &lt;== root;\n  tree.leaf &lt;== pubKeyHasher.out; \n    }\n\ncomponent main {public [message,root]}  = VerifySignature(20); \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>\u0648\u0627\u0631\u062f \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0634\u0648\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\u0646\u0627\u0628\u0631\u0627\u06cc\u0646 \u0645\u06cc \u062a\u0648\u0627\u0646\u06cc\u062f \u0628\u0628\u06cc\u0646\u06cc\u062f \u06a9\u0647 \u062a\u0641\u0627\u0648\u062a \u0647\u0627\u06cc\u06cc \u0648\u062c\u0648\u062f \u062f\u0627\u0631\u062f. \u0645\u0646 \u0627\u06cc\u0646 \u0628\u0627\u0631 \u067e\u0627\u0631\u0627\u0645\u062a\u0631\u0647\u0627\u06cc \u0627\u0636\u0627\u0641\u06cc \u0628\u06cc\u0634\u062a\u0631\u06cc \u0628\u0631\u0627\u06cc \u0627\u0645\u0636\u0627 \u0627\u0636\u0627\u0641\u0647 \u0646\u06a9\u0631\u062f\u0645\u060c \u0628\u0646\u0627\u0628\u0631\u0627\u06cc\u0646 \u0641\u0642\u0637 \u062f\u0648 \u0648\u0631\u0648\u062f\u06cc \u0639\u0645\u0648\u0645\u06cc \u0648\u062c\u0648\u062f \u062f\u0627\u0631\u062f\u060c <code>message<\/code> \u0648 <code>root<\/code>.<\/p>\n<p>\u0628\u0646\u0627\u0628\u0631\u0627\u06cc\u0646 <code>root<\/code> \u0631\u06cc\u0634\u0647 \u062f\u0631\u062e\u062a \u0645\u0631\u06a9\u0644 \u0627\u0633\u062a \u06a9\u0647 \u0645\u06cc \u062e\u0648\u0627\u0647\u06cc\u0645 \u0628\u0631\u0631\u0633\u06cc \u06a9\u0646\u06cc\u0645 \u06a9\u0647 \u06a9\u0644\u06cc\u062f \u0639\u0645\u0648\u0645\u06cc \u06a9\u0647 \u0627\u06cc\u0646 \u067e\u06cc\u0627\u0645 \u0631\u0627 \u0627\u0645\u0636\u0627 \u06a9\u0631\u062f\u0647 \u0627\u0633\u062a \u062f\u0631 \u062f\u0627\u062e\u0644 \u062f\u0631\u062e\u062a \u0648\u062c\u0648\u062f \u062f\u0627\u0631\u062f. \u0627\u06cc\u0646 \u06cc\u06a9 \u0631\u0648\u0634 \u06a9\u0646\u062a\u0631\u0644 \u062f\u0633\u062a\u0631\u0633\u06cc \u0627\u0633\u062a\u060c \u0628\u0646\u0627\u0628\u0631\u0627\u06cc\u0646 \u0645\u0627 \u0645\u06cc \u062f\u0627\u0646\u06cc\u0645 \u06a9\u0647 \u0627\u0645\u0636\u0627 \u0645\u0639\u062a\u0628\u0631 \u0627\u0633\u062a \u0648 \u06a9\u0644\u06cc\u062f \u0639\u0645\u0648\u0645\u06cc \u0627\u0645\u0636\u0627\u06a9\u0646\u0646\u062f\u0647 \u0645\u062c\u0627\u0632 \u0627\u0633\u062a \u062a\u0623\u06cc\u06cc\u062f \u0631\u0627 \u0627\u0646\u062c\u0627\u0645 \u062f\u0647\u062f \u0632\u06cc\u0631\u0627 \u06a9\u0644\u06cc\u062f \u0627\u0648 \u062f\u0631 \u062f\u0627\u062e\u0644 \u062f\u0631\u062e\u062a \u0627\u0633\u062a.<\/p>\n<p>\u0622\u062f\u0631\u0633 \u0631\u0627 \u0628\u0627 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0627\u0632 <code>pubKeyHasher<\/code> \u0627\u0632 Axe \u0648 Ay\u060c \u0645\u06cc \u062a\u0648\u0627\u0646\u06cc\u062f \u0628\u0628\u06cc\u0646\u06cc\u062f \u06a9\u0647 \u062f\u0642\u06cc\u0642\u0627\u064b \u0647\u0645\u0627\u0646 \u06a9\u062f \u062c\u0627\u0648\u0627 \u0627\u0633\u06a9\u0631\u06cc\u067e\u062a \u0631\u0627 \u06a9\u0647 \u0642\u0628\u0644\u0627\u064b \u0646\u0634\u0627\u0646 \u062f\u0627\u062f\u0645 \u0627\u0646\u062c\u0627\u0645 \u0645\u06cc \u062f\u0647\u062f. \u0631\u0627 <code>MerkleTreeChecker<\/code> \u0635\u062d\u062a \u0631\u0627 \u0627\u062f\u0639\u0627 \u0645\u06cc \u06a9\u0646\u062f \u0648 \u0627\u06af\u0631 \u0628\u0631\u06af \u062f\u0631 \u0631\u06cc\u0634\u0647 \u0646\u0628\u0627\u0634\u062f \u0634\u06a9\u0633\u062a \u062e\u0648\u0627\u0647\u062f \u062e\u0648\u0631\u062f.<\/p>\n<p><code>pathIndices<\/code>  \u0648 <code>pathElements<\/code> \u0627\u062b\u0628\u0627\u062a merkle \u0647\u0633\u062a\u0646\u062f. \u0645\u06cc \u062a\u0648\u0627\u0646\u06cc\u062f \u0645\u062f\u0627\u0631 \u062f\u0631\u062e\u062a \u0645\u0631\u06a9\u0644 \u0631\u0627 \u062f\u0631 \u0641\u0627\u06cc\u0644 \u06a9\u0627\u0648\u0634 \u06a9\u0646\u06cc\u062f <code>merkletree.circom<\/code> \u062f\u0631 \u0622\u0645\u0648\u0632\u0634 \u0642\u0628\u0644\u06cc \u062a\u0648\u0636\u06cc\u062d \u062f\u0627\u062f\u0645.<\/p>\n<p>\u0628\u0646\u0627\u0628\u0631\u0627\u06cc\u0646 \u0628\u0631\u0627\u06cc \u0627\u06cc\u062c\u0627\u062f \u062f\u0633\u062a\u06cc \u062f\u0631\u062e\u062a\u0627\u0646 \u0645\u0631\u06a9\u0644 \u0628\u0627 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0627\u0632 cli\u060c \u0645\u06cc \u062a\u0648\u0627\u0646\u06cc\u0645 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u06a9\u0646\u06cc\u0645 <code>npm run new<\/code> \u06a9\u0647 \u0622\u062f\u0631\u0633 \u0647\u0627 \u0631\u0627 \u062a\u0648\u0644\u06cc\u062f \u0645\u06cc \u06a9\u0646\u062f \u0648 \u062f\u0631\u062e\u062a\u06cc \u0631\u0627 \u0628\u0627 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0627\u0632 \u0622\u0646\u0647\u0627 \u0628\u0647 \u0639\u0646\u0648\u0627\u0646 \u0628\u0631\u06af \u0627\u06cc\u062c\u0627\u062f \u0645\u06cc \u06a9\u0646\u062f.<\/p>\n<div class=\"highlight js-code-highlight\">\n<pre class=\"highlight plaintext\"><code>CREATING A NEW MERKLE TREE\n\nEnter how many accounts would you like to generate:\n4\nGenerating accounts and addresses. Please wait!\nDone\nGenerating merkle tree from addresses!\nDone.Root is 21804813178957116268623645093306988559564490743632413729059072914509024611553 \nSerializing data.\nWriting to file.\nDone\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>\u0648\u0627\u0631\u062f \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0634\u0648\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>\u06a9\u0644\u06cc\u062f\u0647\u0627\u06cc \u062e\u0635\u0648\u0635\u06cc \u0628\u0631\u0627\u06cc \u062d\u0633\u0627\u0628 \u0647\u0627\u06cc \u0645\u0631\u0628\u0648\u0637\u0647 \u062f\u0631 \u0642\u0633\u0645\u062a \u0642\u0631\u0627\u0631 \u0645\u06cc \u06af\u06cc\u0631\u0646\u062f <code>private<\/code> \u062f\u0627\u06cc\u0631\u06a9\u062a\u0648\u0631\u06cc \u062f\u0631 \u062d\u0627\u0644\u06cc \u06a9\u0647 \u0628\u0642\u06cc\u0647 \u062f\u0631 \u0642\u0633\u0645\u062a \u0642\u0631\u0627\u0631 \u0645\u06cc \u06af\u06cc\u0631\u0646\u062f <code>public<\/code> \u062f\u0627\u06cc\u0631\u06a9\u062a\u0648\u0631\u06cc \u0627\u06af\u0631 \u0634\u0645\u0627 \u0627\u0646\u062a\u062e\u0627\u0628 \u06a9\u0631\u062f\u06cc\u062f <code>MiMC7<\/code> \u06cc\u0627 <code>MiMCSponge<\/code> \u0633\u067e\u0633 \u067e\u0627\u0631\u0627\u0645\u062a\u0631 \u06a9\u0644\u06cc\u062f \u062f\u0631 dir \u062e\u0635\u0648\u0635\u06cc \u0630\u062e\u06cc\u0631\u0647 \u0645\u06cc \u0634\u0648\u062f \u0648 \u0628\u0631\u0627\u06cc \u062a\u0623\u06cc\u06cc\u062f \u0645\u0648\u0631\u062f \u0646\u06cc\u0627\u0632 \u0627\u0633\u062a\u060c \u062f\u0631 \u063a\u06cc\u0631 \u0627\u06cc\u0646 \u0635\u0648\u0631\u062a \u0646\u06cc\u0627\u0632\u06cc \u0628\u0647 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0627\u0632 \u062c\u0632\u0626\u06cc\u0627\u062a \u062e\u0635\u0648\u0635\u06cc \u0628\u0631\u0627\u06cc \u0627\u06cc\u062c\u0627\u062f \u06cc\u06a9 \u0627\u062b\u0628\u0627\u062a merkle \u0648 \u062a\u0623\u06cc\u06cc\u062f \u0622\u0646 \u0646\u062f\u0627\u0631\u06cc\u062f.<\/p>\n<p>\u067e\u0633 \u0628\u06cc\u0627\u06cc\u06cc\u062f \u0641\u0631\u0627\u0631 \u06a9\u0646\u06cc\u0645 <code>npm run proof<\/code> \u0648 \u0631\u06cc\u0634\u0647 \u0648 \u0646\u0634\u0627\u0646\u06cc \u0645\u06cc \u062e\u0648\u0627\u0647\u062f \u0648 \u0628\u0631\u0647\u0627\u0646 \u0645\u0631\u06a9\u0644 \u0631\u0627 \u0628\u06cc\u0631\u0648\u0646 \u0645\u06cc \u0627\u0646\u062f\u0627\u0632\u062f<\/p>\n<p>\u0633\u067e\u0633 <code>npm run verify<\/code> \u06cc\u06a9 \u0631\u06cc\u0634\u0647 \u0648 \u0627\u062b\u0628\u0627\u062a \u0645\u06cc \u062e\u0648\u0627\u0647\u062f \u0648 \u0627\u06af\u0631 \u0647\u0645\u0647 \u0686\u06cc\u0632 \u0628\u0647 \u062f\u0631\u0633\u062a\u06cc \u0627\u062c\u0631\u0627 \u0634\u0648\u062f\u060c \u0627\u062b\u0628\u0627\u062a \u0645\u0639\u062a\u0628\u0631 \u062e\u0648\u0627\u0647\u062f \u0628\u0648\u062f.<\/p>\n<p>\u0645\u06cc\u200c\u062a\u0648\u0627\u0646\u06cc\u062f \u0627\u0632 EdDSA \u0628\u0631\u0627\u06cc \u0647\u0648\u06cc\u062a\u060c \u062c\u0645\u0639\u200c\u0628\u0646\u062f\u06cc\u060c \u0645\u0642\u06cc\u0627\u0633\u200c\u0628\u0646\u062f\u06cc\u060c \u0631\u0623\u06cc\u200c\u06af\u06cc\u0631\u06cc \u06cc\u0627 \u0627\u0646\u062a\u0632\u0627\u0639 \u062d\u0633\u0627\u0628 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u06a9\u0646\u06cc\u062f. \u0628\u0633\u062a\u06af\u06cc \u0628\u0647 \u062e\u0648\u062f\u062a \u062f\u0627\u0631\u0647 \ud83d\ude42<\/p>\n<\/p><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Niftyzk \u0627\u0632 EdDSA \u06a9\u0647 \u06cc\u06a9 \u0637\u0631\u062d \u0627\u0645\u0636\u0627\u06cc \u062f\u06cc\u062c\u06cc\u062a\u0627\u0644 \u0631\u0645\u0632\u0646\u06af\u0627\u0631\u06cc \u0639\u0645\u0648\u0645\u06cc \u0627\u0633\u062a \u067e\u0634\u062a\u06cc\u0628\u0627\u0646\u06cc \u0645\u06cc \u06a9\u0646\u062f. \u0627\u06cc\u0646 \u0622\u0645\u0648\u0632\u0634 \u062d\u0627\u0648\u06cc \u0627\u0637\u0644\u0627\u0639\u0627\u062a\u06cc \u062f\u0631 \u0645\u0648\u0631\u062f \u06a9\u062f \u062a\u0648\u0644\u06cc\u062f \u0634\u062f\u0647 \u0627\u0633\u062a \u0648 \u0628\u0631\u0627\u06cc \u062f\u0631\u06a9 \u0647\u0645\u0647 \u0686\u06cc\u0632 \u0628\u0627\u06cc\u062f \u0622\u0645\u0648\u0632\u0634 \u0647\u0627\u06cc \u0642\u0628\u0644\u06cc \u0631\u0627 \u0628\u062e\u0648\u0627\u0646\u06cc\u062f. \u0628\u06cc\u0627\u06cc\u06cc\u062f \u0628\u0627 \u0634\u0631\u0648\u0639 \u06a9\u0646\u06cc\u0645 niftyzk init Setting up your current directory ? What project do you want to scaffold? EdDSA &hellip;<\/p>\n","protected":false},"author":2,"featured_media":92421,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"fifu_image_url":"","fifu_image_alt":"","footnotes":""},"categories":[339],"tags":[],"class_list":["post-92420","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\/92420","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=92420"}],"version-history":[{"count":0,"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/posts\/92420\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/media\/92421"}],"wp:attachment":[{"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/media?parent=92420"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/categories?post=92420"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/tags?post=92420"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}