# How To Create a ZK Smart Contract

## Creating and verifying zero-knowledge proofs in solidity

Zero Knowledge Proofs enable a *Prover* to demonstrate knowledge of something to a *Verifier* without revealing that knowledge. For example, if we want to prove that we have solved a puzzle without giving away the solution, we can use Zero Knowledge Proofs.

## How does this relate to Smart Contracts?

Imagine a Solidity smart contract called `Sudoku`

, running on an EVM blockchain. It has a public two-dimensional array that represents the board's initial state. It also has a public function that accepts a two-dimensional array, checks it against the initial state and sudoku rules, and mints an NFT if the solution is correct.

`contract Sudoku {`

// Initial board state

uint8[][] public initialState;

function answer(uint[][] memory solution) public {

// Check that `solution` conforms to `initialState`

...

// Check that `solution` conforms to rules of Sudoku

// (1-9 in squares & lines)

...

// Mint an NFT if correct

...

}

}

This works great, but wait, how big is the board? The larger the board, the more loop iterations within the function, and the more expensive the function becomes. This doesn't scale well.