5. Interacting with the contract
After deploying your first fhEVM contract using Hardhat, this guide shows you how to interact with it using Hardhat tasks.
Prerequisites
Before interacting with your deployed contract, ensure the following:
Deployment completed: You have successfully deployed the
MyConfidentialERC20
contract (see previous section)Contract address: You have saved the deployed contract address
Sepolia ETH: You have some Sepolia ETH in your wallet for transaction fees
Environment setup: Your
.env
file is properly configured with your private key
Step 1: Mint tokens to your account
First, let's mint some confidential tokens to your account:
Once successful, you'll see a transaction confirmation in the terminal that looks like this:
Step 2: Verify total supply
You can check the total supply of tokens to confirm your mint was successful:
Once successful, you'll see a transaction confirmation in the terminal:
Step 3: Check your balance
To verify your account balance:
Note to remind yourself what was are the private keys of the accounts of the MNEMONIC SEED you can always check it by running:
Once successful, you'll see a transaction confirmation in the terminal.
Step 4: Transfer tokens
To transfer confidential tokens to another account:
Once successful, you'll see a transaction confirmation in the terminal.
Step 5: Verify updated balances
After the transfer, you can check both accounts balances:
If both balances have changed accordingly the transaction was successful.
Available Tasks
Here's a complete list of available Hardhat tasks for interacting with your contract:
mint
: Mint new encrypted tokenstransfer
: Transfer encrypted tokens to another addressbalance
: Check encrypted balance of an accounttotalSupply
: Get the total token supply
For detailed help on any task, run:
Next steps
🎉 Congratulations on completing this tutorial! You’ve taken the first step in building confidential smart contracts using fhEVM. It's time now to take the next step and build your own confidential dApps!
1. Resources
To continue your journey and deepen your knowledge, explore the resources below.
Read the white paper: Understand the core technology behind fhEVM, including its cryptographic foundations and use cases.
See more demos and tutorials: Expand your skills with hands-on demos and tutorials crafted to guide you through various real-world scenarios.
Try out AI coding assistant: If you have a ChatGPT plus account, try out our custom ChatGPT model tailored for Solidity and fhEVM developers.
2. Tools
Use out-of-box templates and frameworks designed for developers to build confidential dApps easily.
Smart contract development
Hardhat Template: A developer-friendly starting point for building and testing smart contracts on fhEVM.
fhEVM Contracts Library: Access standardized contracts for encrypted operations.
Frontend development
React.js Template: Quickly develop FHE-compatible dApps using a clean React.js setup.
Next.js Template: Build scalable, server-rendered dApps with FHE integration.
Vue.js Template: Develop responsive and modular dApps with FHE support in Vue.js.
3. Community
Join the community to shape the future of blockchain together with us.
Discord: Join the community to get the latest update, have live discussion with fellow developers and Zama team.
Community Forum: Get support on all technical questions related to fhEVM
Zama Bounty Program: Participate to tackle challenges and earn rewards in cash.
Last updated
Was this helpful?