SmartContract
Last updated
Last updated
In the part, you've seen the use of smart contaacts and how to settle some proof to the chain.
Any contract you'll write is an extension of the class.
Properties of smart contracts are explained pretty well in the , hence we don't need to write them all again.
Example above is simple: There is an on-chain state that has Field type. After initialization of contract with init, it is 'initialized' with the value user feeds.
Solve function give checks if the on-chain value of the balance of the zkApp account is same with the environment. Also, current state of the commitment is ensured to be same with the environment. Later, solution is given as a hash and prize is sent to the receiver.
Do you remember that SmartContract based classes are compiled to zkCircuits? This requireEquals
, getAndRequireEquals
functions and functions like that are converted to some constraints that form zk Circuits.
You can see other parts of the .