Prerequisites
- Node.js and npm installed — instructions
- MetaMask wallet — install
Step 1: Set Up Your Project
Create a JavaScript project from the menu, follow the prompts and accept the defaults.
Step 2: Write the Contract
Replace the contents ofcontracts/Lock.sol with the following:
Step 3: Configure for IoTeX
Ensure dependencies are installed:hardhat.config.js:
Replace
<YOUR_PRIVATE_KEY> with your MetaMask private key (testnet only!). Never share or commit this key to public code repositories.Step 4: Deploy the Contract
Create a new filescripts/deploy.js:
Part 2: Interact with Your Contract Using JavaScript
In the second tutorial, you’ll build a Node.js application to interact with the deployed contract using Web3.js. Instead of sending IOTX tokens, your application will call the contract’s function to send messages and view events logged on-chain. These tutorials use JavaScript (Node.js), Solidity, MetaMask, and Web3.js — all common tools for Ethereum developers — to provide a smooth onboarding experience for building on IoTeX Layer 1.Continue to Build a client for your contract

