I'm looking at the Merkle Tree tutorial (https://docs.minaprotocol.com/zkapps/tutorials/common-types-and-functions#merkle-trees) , especially the part "code to interact with the smart contract". There are two .sign functions used, both with two different signers. I don't quite understand who should sign transactions and why. Halp?
#Who should be signing transactions?
11 messages · Page 1 of 1 (latest)
Depends what do you update and authorization for each.
When you send a tx you need the signature from the account who pay the fee.
For update accounts it can be the owner of account if you use createSigned.
For smartcontract data update, if you define signature for permission, you need the private key of smartcontract
right.
the first example in the link is for deploying, so I understand why the deployer private key is provided. but why is the app's private key provided?
the second example is an update, so I understand why the sender signs it,but I don't understand what the second signer key even is (what's the difference between basicTreeZkAppPrivateKey and zkAppPrivateKey?) or why it's needed.
deployment on mina works in a way that you update verification key on an account with the signature authorization, so that's why you need the private key
the second should use proof authorization and therefore the key shouldn't be needed, so this might be a mistake
i think because you’re both deploying the app and paying for the deployment with another key
I tried finding info on this from the docs but couldn't find anything 😦
and the full code isn't available (https://github.com/o1-labs/docs2/blob/main/examples/zkapps/05-common-types-and-functions/src/BasicMerkleTreeContract.test.ts)
sorry but I still didn't quite understand why the deployment needs a new (app) private key. Is it just to determine the contract address?
in the second example (update) I don't see why the second key would be needed. the fee payer is senderPublicKey .
In one of my contract I use signature to store merkle proof
GitHub
Contribute to youtpout/zkapp-ui development by creating an account on GitHub.
It's exactly as @deft finch wrote above. First is needed to update the zkapp verification key and permissions, and second is a mistake
@shrewd sonnet the permissions docs should help: https://docs.minaprotocol.com/zkapps/o1js/permissions