In this guide, I will show you how to create your own ERC-20 token on the ZkSync Era testnet using Hardhat and the OpenZeppelin smart contract library.
We will have a full-fledged ERC-20 token. It can be added to Metamask and sent to other addresses like any other tokens.
All work will be done in Windows.
You must have a wallet with some ETH balance on the ZkSync Era testnet.
Fund your wallet in faucet https://goerli.portal.zksync.io/faucet or transfer ETH from the Goerli network.
Also, you must have a private key from the wallet, we will use it in the code.
Download and install Node.Js from here https://nodejs.org/en

Check that NodeJs is installed. To do this, open the Windows command prompt (in the Search menu, type cmd and select Command Prompt). At the command promt, enter:
node -v
If Node Js installed normally, the version will be output:

Now install Yarn. To do this, on the command line, enter
npm install --global yarn
Then to check, enter the command:
yarn -v
If Yarn installed normally, the version will be output:
We will take the necessary files from my repository ZkSync contracts examples
Download the archive with files https://github.com/Sr20dem/zksync-contracts-examples/archive/refs/heads/main.zip and unpack.
While in the zksync-contracts-examples-main folder, type cmd in the address bar and hit enter to open a terminal in that folder:

Terminal will open

Initialize:
yarn init -y
Add the required packages:
yarn add -D typescript ts-node @types/node ethers@^5.7.2 zksync-web3 @ethersproject/hash @ethersproject/web hardhat @matterlabs/hardhat-zksync-solc @matterlabs/hardhat-zksync-deploy
Add the OpenZeppelin library:
npm install @openzeppelin/contracts
Do not close the terminal and proceed to edit files.
The contracts folder contains the MyZkSincToken.sol file. This is a solidity file with token parameters. Open it with any text editor and change these 3 values to whatever you need:
ticker MZT
name MyZkSincToken
quantity (1000000)

After that, save the file.
The deploy folder contains the deploy.ts file. This is a file with instructions on how Hardhat will deploy the smart contract. Open it with any text editor and change <WALLET-PRIVATE-KEY> to your wallet private key.

After that save the file.
Return to the terminal and type:
yarn hardhat compile
This command will compile and prepare the MyZkSyncToken.sol file for deployment. The artifacts-zk and cache-zk folders will be created in the main folder
Type in terminal:
yarn hardhat deploy-zksync
The process of deploying the token to the network will begin. Deployment transaction fee will be charged. The commission is usually small, but during a heavy load on the network it can reach 0.03 ETH. If the deployment is successful, a message will appear in the terminal about the successful creation of a smart contract and its address will be displayed:

You can view your token in the explorer by entering the address of the generated token.
You can copy the address of the contract and paste it into Metamask:

Good luck with smart contracts!

