#proper LocalBlockchain proof usage

13 messages · Page 1 of 1 (latest)

twin copper
#

I’m confused on how we should write code to interact with LocalBlockchain with proofs disabled.

specifically when we get to compile and prove. do you have to do something like this?:

if (proofs) {
await txn.prove();
}

I'm finding this errors when proofs are false, as this line txn.prove() doesn’t get hit.
If it’s required, what exactly is it doing when proofs are disabled?

Thanks for the help.

vernal schooner
#

you should always use tx.prove() and your code must work with both proofsEnabled: true/false, what error are you getting?

twin copper
#

Thanks @vernal schooner , that answered my question to some degree. The error was when I did not execute this line.

My follow up question though, if proofs are disabled, what exactly is txn.prove() doing? It still takes me a good 10-15 seconds for the most basic program.

vernal schooner
#

it creates a dummy proof 🙌

craggy horizon
#

15s is quite a long time, actually. The dummy proof is static. I’d have to look into it 🤔

rocky patrol
#

What error are you getting, @twin copper? Could it be that you are trying to execute a transaction that needs proving?

twin copper
rocky patrol
#

The pattern for the proofs flag as I understand is that when it is false, there should be something in your code like this:

So the contract isn't compiled and dummy proofs are used instead

rocky patrol
rocky patrol
#

Nevermind, as @vernal schooner mentioned, it looks like it's not even a matter of a particular kind of transaction, but proving is part of the logic of every transaction, which makes sense, since you probably always want to prove that your transaction is valid 🤔

lofty mist
#

And it's safe to call tx.prove() for every transaction, not because every transaction needs it, but because it only computes the proofs needed by the transaction (if none are needed, prove() does nothing)

#

A proof is needed for every zkapp method that you call