From e08fcc7000156f98c534d12bf5e0bde02a75857b Mon Sep 17 00:00:00 2001 From: garwalsh Date: Tue, 21 Nov 2023 15:40:47 -0800 Subject: [PATCH 1/3] Update faq.mdx --- docs/zkapps/faq.mdx | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/docs/zkapps/faq.mdx b/docs/zkapps/faq.mdx index 734faf1e4..bc965efcb 100644 --- a/docs/zkapps/faq.mdx +++ b/docs/zkapps/faq.mdx @@ -111,6 +111,19 @@ 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 only be invoked by a specific address? + +There are a number of ways to accomplish this: +- Provably add a signed child account update. Then, the method can only be invoked with a signature from the predefined address. +```// in your method create empty signed account update +AccountUpdate.createSigned(someAddress);``` + +```// 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 +170,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. From 7f7489bec4490bb9cf9a0ddfb785101759a9a814 Mon Sep 17 00:00:00 2001 From: garwalsh Date: Tue, 21 Nov 2023 15:50:03 -0800 Subject: [PATCH 2/3] Fix code block markdown --- docs/zkapps/faq.mdx | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/docs/zkapps/faq.mdx b/docs/zkapps/faq.mdx index bc965efcb..57bc61a35 100644 --- a/docs/zkapps/faq.mdx +++ b/docs/zkapps/faq.mdx @@ -115,11 +115,15 @@ This ensures that the transaction fails if the value of the field in question ha There are a number of ways to accomplish this: - Provably add a signed child account update. Then, the method can only be invoked with a signature from the predefined address. -```// in your method create empty signed account update -AccountUpdate.createSigned(someAddress);``` +```TypeScript +// in your method create empty signed account update +AccountUpdate.createSigned(someAddress); +``` -```// later, sign the tx -tx.sign([privateKeyOfAddress]);``` +```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. From 90266a316dd386d2e9ec1b139cc07bc0ab3254c6 Mon Sep 17 00:00:00 2001 From: Barrie Byron Date: Mon, 27 Nov 2023 14:02:21 -0500 Subject: [PATCH 3/3] move only in the text --- docs/zkapps/faq.mdx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/zkapps/faq.mdx b/docs/zkapps/faq.mdx index 57bc61a35..64b6e2829 100644 --- a/docs/zkapps/faq.mdx +++ b/docs/zkapps/faq.mdx @@ -111,10 +111,10 @@ 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 only be invoked by a specific address? +### 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 only be invoked with a signature from the predefined address. +- 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); @@ -125,7 +125,7 @@ AccountUpdate.createSigned(someAddress); tx.sign([privateKeyOfAddress]); ``` -- Require a private key as a private input, and check that privateKey.toPublicKey().assertEquals(this.address) +- 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?