Either set a value or keep it the same.
Gettable and settable state that can be checked for equality.
Modification is impossible.
Modification is always permitted
Modification is permitted by zkapp proofs only
Modification is permitted by zkapp proofs or signatures
Modification is permitted by signatures only, using the private key of the zkapp account
Default permissions are: [[ Permissions.editState ]]=[[ Permission.proof ]] [[ Permissions.send ]]=[[ Permission.signature ]] [[ Permissions.receive ]]=[[ Permission.proof ]] [[ Permissions.setDelegate ]]=[[ Permission.signature ]] [[ Permissions.setPermissions ]]=[[ Permission.signature ]] [[ Permissions.setVerificationKey ]]=[[ Permission.signature ]] [[ Permissions.setZkappUri ]]=[[ Permission.signature ]] [[ Permissions.editSequenceState ]]=[[ Permission.proof ]] [[ Permissions.setTokenSymbol ]]=[[ Permission.signature ]]
Modification is impossible.
Modification is always permitted
Modification is permitted by zkapp proofs only
Modification is permitted by zkapp proofs or signatures
Modification is permitted by signatures only, using the private key of the zkapp account
This is the core API of the Pickles
library, exposed from OCaml to JS. It takes a list of circuits --
each in the form of a function which takes a public input { transaction: Field; atParty: Field }
as argument --,
and joins them into one single circuit which can not only provide proofs for any of the sub-circuits, but also
adds the necessary circuit logic to recursively merge in earlier proofs.
After forming that big circuit in the finite field represented by Field
, it gets wrapped in a
recursive circuit in the field represented by Scalar
. Any SmartContract proof will go through both of these circuits,
so that the final proof ends up back in Field
.
The function returns the building blocks needed for SmartContract proving:
provers
- a list of prover functions, on for each input rule
verify
- a function which can verify proofs from any of the proversgetVerificationKeyArtifact
- a function which returns the verification key used in verify
, in base58 format, usable to deploy a zkappA Promise that resolves when SnarkyJS is ready to be used
Gettable and settable state that can be checked for equality.
declareMethods
can be used in place of the @method
decorator
to declare SmartContract methods along with their list of arguments.
It should be placed after the class declaration.
Here is an example of declaring a method update
, which takes a single argument of type Field
:
class MyContract extends SmartContract {
// ...
update(x: Field) {
// ...
}
}
declareMethods(MyContract, { update: [Field] }); // `[Field]` is the list of arguments!
Note that a method of the same name must still be defined on the class, just without the decorator.
declareState
can be used in place of the @state
decorator to declare on-chain state on a SmartContract.
It should be placed after the class declaration.
Here is an example of declaring a state property x
of type Field
.
class MyContract extends SmartContract {
x = State<Field>();
// ...
}
declareState(MyContract, { x: Field });
If you're using pure JS, it's not possible to use the built-in class field syntax, i.e. the following will not work:
// THIS IS WRONG IN JS!
class MyContract extends SmartContract {
x = State();
}
declareState(MyContract, { x: Field });
Instead, add a constructor where you assign the property:
class MyContract extends SmartContract {
constructor(x) {
super();
this.x = State();
}
}
declareState(MyContract, { x: Field });
Gets account information on the specified publicKey by performing a GraphQL query to the specified endpoint. This will call the 'GetAccountInfo' query which fetches zkapp related account information.
If an error is returned by the specified endpoint, an error is thrown. Otherwise, the data is returned.
The specified account to get account information on
The graphql endpoint to fetch from
An object that exposes an additional timeout option
zkapp information on the specified account or an error is thrown
SNARK keypair, as returned by Circuit.generateKeypair
The SRS (structured reference string), needed to reconstruct the keypair later
A decorator to use in a zkapp to mark a method as callable by anyone. You can use inside your zkapp class as:
@method myMethod(someArg: Field) {
// your code here
}
the "structured reference string", a set of precomputed values needed for verifying proofs
string representation of a Circuit verification key
the recovered verification key
the verification key of a Circuit
string representation of the verification key
This function must be called at the end of a nodejs program, otherwise the worker threads will continue running and the program will never terminate. From web applications, this function is a no-op.
Sign all parties of a transaction which belong to the account determined by [[ privateKey
]].
the modified transaction JSON
A decorator to use within a zkapp to indicate what will be stored on-chain.
For example, if you want to store a field element some_state
in a zkapp,
you can use the following in the declaration of your zkapp:
@state(Field) some_state = State<Field>();
Generated using TypeDoc
One specific permission value.
A [[ Permission ]] tells one specific permission for our zkapp how it should behave when presented with requested modifications.
Use static factory methods on this class to use a specific behavior. See documentation on those methods to learn more.