Tutorial Overview
This tutorial shows how to create a sample cryptocurrency using the Truffle framework. It begins with the development environment, then moves into project creation, smart contract compilation, deployment and testing.
Complete setup
Install the tools required for Ethereum development on Windows.
MetaCoin example
Use Truffle’s built-in MetaCoin project as the sample cryptocurrency.
Smart contract workflow
Compile Solidity contracts and generate JSON artifacts.
Local deployment
Deploy and test the contract inside the Truffle development blockchain.
Development Environment Requirements
Before creating MetaCoin, prepare the development environment with the following tools.
Visual Studio Code
Code editor for Solidity, JavaScript and project files.
Git
Source control and project management tool.
Node.js
JavaScript runtime required for npm and Truffle.
Truffle
Ethereum development, testing and deployment framework.
Why Visual Studio Code?
- Excellent Git integration.
- Works well with Truffle projects.
- Supports Solidity extensions.
- Available on Windows, macOS and Linux.
Installation Process
1. Install Chocolatey
Launch PowerShell as administrator and run the installation command.
Set-ExecutionPolicy Bypass
iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
2. Install Development Tools
choco install visualstudiocode -y
choco install git -y
choco install nodejs -y
3. Install Truffle Framework
npm install -g truffle
Key Technologies Overview
Git
Tracks code changes and helps manage development projects.
Node.js
Runs JavaScript tools and packages required by Ethereum development workflows.
Truffle Framework
Provides project structure, compilation, migration, testing and debugging features.
Solidity
Contract-oriented programming language used to implement Ethereum smart contracts.
Check Your Installation
node -v
npm -v
truffle --version
Configuring VS Code for Blockchain Development
1. Create the Project Directory
mkdir TruffleTest
cd TruffleTest
code .
2. Install Essential Extensions
- Solidity: Smart contract development support.
- Material Icon Theme: Better file and folder visualization.
Creating Your First Blockchain Application
Sample MetaCoin Cryptocurrency
MetaCoin is a sample cryptocurrency project included with Truffle. It is useful because it gives you a ready-made contract structure for learning compilation, deployment and testing.
truffle unbox metacoin
Generated Files
MetaCoin.sol
The main sample cryptocurrency contract.
ConvertLib.sol
A Solidity library used for currency conversion.
What is the EVM?
The Ethereum Virtual Machine is the runtime environment that executes smart contracts. It allows contract code to run in a decentralized and deterministic way across Ethereum nodes.
Compiling Smart Contracts
Compilation converts Solidity source code into artifacts that can be deployed to Ethereum-compatible networks.
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
truffle compile
Compilation Results
After successful compilation, a new build folder appears containing:
- ConvertLib.json — compiled library artifact.
- MetaCoin.json — compiled main contract artifact.
- Migrations.json — deployment script artifact.
Success Indicator
If the JSON files appear in the build folder, the contract has compiled successfully.
Deploying and Testing the Contract
Launch Truffle Development Environment
truffle develop
Truffle Development Environment Features
- 10 pre-configured accounts.
- 100 ETH per account for local development.
- Private keys provided for test accounts.
- A simulated blockchain for safe experimentation.
Deploy the Contract
migrateTest the Contract
testDevelopment Flow
Summary
What You Have Accomplished
Environment Setup
Installed Chocolatey, Visual Studio Code, Git, Node.js and Truffle.
Smart Contract Project
Created the sample MetaCoin cryptocurrency project.
Compilation
Compiled Solidity contracts into deployable JSON artifacts.
Local Deployment
Deployed and tested the contract inside Truffle Develop.
Advanced Topics to Explore Next
- Web3 integration.
- Transaction debugging.
- Multi-network deployment.
- Balance checking.
- Mainnet or testnet deployment.
- Custom token features.