The easiest way to get started with writing smart contracts on COTI is to clone the COTI Hardhat Template. This template is a simple Hardhat project that includes all the configurations and packages needed to connect to the Testnet and integrate COTI's privacy features into your own smart contracts.
Since the local Hardhat network does not include the precompiled contracts needed for computations on private data types, the only way to test contracts that use these features is by running your test scripts on the COTI Testnet.
Before we can continue with exploring the repository, we have to install the dependencies:
npminstall
The repository includes a simple privacy-enabled smart contract (PrivateStorage.sol) which, as the name suggests, accepts encrypted inputs and stores them on-chain using the user's AES encryption key. There is also a short test suite included in the template.
To run the test suite, execute the following command in your terminal:
npxhardhattest
On your first time running the test suite, you will see the following message printed to the console: