diff --git a/docs/zkapps/faq.mdx b/docs/zkapps/faq.mdx index 734faf1e4..64b6e2829 100644 --- a/docs/zkapps/faq.mdx +++ b/docs/zkapps/faq.mdx @@ -111,6 +111,23 @@ this.num.assertEquals(currentState); This ensures that the transaction fails if the value of the field in question has changed. +### How do I restrict a provable method so that it can be invoked only by a specific address? + +There are a number of ways to accomplish this: +- Provably add a signed child account update. Then, the method can be invoked only with a signature from the predefined address. +```TypeScript +// in your method create empty signed account update +AccountUpdate.createSigned(someAddress); +``` + +```TypeScript +// later, sign the tx +tx.sign([privateKeyOfAddress]); +``` + +- Require a private key as a private input, and check that `privateKey.toPublicKey().assertEquals(this.address)` +- Require a signature as an input. + ### Can I pass hex values into Fields? Yes, just pass in the appropriate BigInt literal. @@ -157,4 +174,4 @@ Pasta curves (Pallas and Vesta). See [Pasta Curves](https://o1-labs.github.io/pr ### When do I use Provable conditional logic? -Are there situations in which I would not want to use the Provable versions? If the conditional logic is not part of your provable code, you do not need to use Provable conditional statements. \ No newline at end of file +Are there situations in which I would not want to use the Provable versions? If the conditional logic is not part of your provable code, you do not need to use Provable conditional statements.