Hello World Smart Contract on ZKP Testnet
Welcome to your first smart contract deployment on the ZKP Testnet! This simple example will help you understand how to create, deploy, and interact with smart contracts on our blockchain

What We're Building
We'll create a "Hello World" smart contract that:
Stores a greeting message
Allows anyone to read the message
Lets the owner update the message
Keeps track of how many times it's been updated
This is perfect for learning the basics without any complexity!
The Smart Contract Code
Here's our simple smart contract written in Solidity
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract HelloWorld {
// State variables
string public greeting;
address public owner;
uint256 public updateCount;
// Event to log when greeting is updated
event GreetingUpdated(string newGreeting, uint256 updateNumber);
// Constructor - runs when contract is deployed
constructor() {
greeting = "Hello, ZKP World!";
owner = msg.sender;
updateCount = 0;
}
// Function to update the greeting (only owner can do this)
function updateGreeting(string memory _newGreeting) public {
require(msg.sender == owner, "Only owner can update greeting");
greeting = _newGreeting;
updateCount++;
emit GreetingUpdated(_newGreeting, updateCount);
}
// Function to read the greeting (anyone can call this)
function getGreeting() public view returns (string memory) {
return greeting;
}
// Function to get contract info
function getContractInfo() public view returns (string memory, address, uint256) {
return (greeting, owner, updateCount);
}
}Step-by-Step Deployment
Prerequisites
MetaMask wallet connected to ZKP testnet
Some ZKP coins from our faucet
Basic understanding of how to use Remix IDE
Step 1: Open Remix IDE
This is a free, web‑based development environment
No downloads or installations needed!
Step 2: Create Your Contract File
In the file explorer (left panel), click the “+” button
Name your file HelloWorld.sol
Copy and paste the smart contract code above
The file will automatically save
Step 3: Compile Your Contract
Click on the "Solidity Compiler" tab (second icon on the left)
Make sure the compiler version is set to 0.8.0 or higher
Click "Compile HelloWorld.sol"
You should see a green checkmark when compilation succeeds
Step 4: Connect to ZKP Testnet
Make sure MetaMask is connected to ZKP testnet
Click on the "Deploy & Run Transactions" tab (third icon on the left)
In the "Environment" dropdown, select "Injected Web3"
MetaMask should connect automatically
Confirm you see "ZKP Testnet" in the network indicator
Step 5: Deploy Your Contract
Make sure "HelloWorld" is selected in the contract dropdown
Click the orange "Deploy" button
MetaMask will popup asking you to confirm the transaction
Confirm the transaction (it will cost a small amount of ZKP for gas)
Wait for the transaction to be confirmed (usually takes a few seconds)

Step 6: Interact with Your Contract
Once deployed, you’ll see your contract in the "Deployed Contracts" section
Reading Data (Free Operations)
Click greeting to see the current greeting
Click owner to see who owns the contract
Click updateCount to see how many times it's been updated
Click getGreeting to read the greeting via function call
Click getContractInfo to get all info at once
Writing Data (Costs Gas)
Enter a new message in the updateGreeting field
Click the button to update the greeting
Confirm the transaction in MetaMask
Check that updateCount increased by 1
Understanding What Happened
Contract Deployment
When you deployed the contract:
The constructor ran and set the initial greeting
Your wallet address became the owner
The contract was given a unique address on the blockchain
The code is now permanently stored and publicly verifiable
Reading vs Writing
Reading data (view functions) is free and instant
Writing data (state changes) costs gas and requires confirmation
Only the owner can update the greeting (access control)
Anyone can read the greeting (public accessibility)
Events and Logs
When you update the greeting, the contract emits an event that:
Gets permanently recorded on the blockchain
Can be searched and filtered
Provides a history of all updates
Verifying Your Contract
On the Block Explorer
Go to Explorer (Available soon)
Search for your contract address
View the transaction history
See the contract code and interactions
Contract Address
Your contract now has a permanent address like: 0x7424d35Cc6634C0532925a3b8D421B3e8A51F7E6d Anyone can:
Interact with your contract using this address
View its code and transaction history
Call its public functions
Common Issues and Solutions
"Transaction Failed"
Problem
Not enough ZKP for gas fees
Solution
Get more coins from the faucet
"Only Owner Can Update"
Problem
Trying to update from wrong wallet
Solution
Use the same wallet that deployed the contract
"Contract Not Found"
Problem
Wrong network or address
Solution
Double-check you're on ZKP testnet
"Compilation Error"
Problem
Syntax error in the code
Solution
Copy the exact code from this example
Next Steps
Experiment with Your Contract
Try updating the greeting with different messages
Check how the updateCount increases
Share your contract address with friends so they can read your greeting
Learn More
Modify the code to add new features
Try creating a contract that stores multiple messages
Experiment with different data types and functions
Advanced Features
Add more complex logic
Implement multiple owner functionality
Create contracts that interact with each other
Explore ZKP's privacy features
Code Explanation
State Variables
string public greeting; // Stores the greeting message
address public owner; // Stores the contract owner's address
uint256 public updateCount; // Counts how many times greeting was updatedConstructor
constructor() {
greeting = "Hello, ZKP World!"; // Set initial greeting
owner = msg.sender; // Set deployer as owner
updateCount = 0; // Initialize counter
}Access Control
require(msg.sender == owner, "Only owner can update greeting");This line ensures only the person who deployed the contract can update it.
Events
event GreetingUpdated(string newGreeting, uint256 updateNumber);
emit GreetingUpdated(_newGreeting, updateCount);Events create a permanent log of important actions.
Why This Matters
This simple example demonstrates:

Decentralization
No central authority controls your contract
Transparency
All code and transactions are publicly visible
Permanence
Once deployed, your contract lives forever on the blockchain
Accessibility
Anyone can interact with your contract from anywhere
Low Cost
Deployment and interaction costs are minimal

Congratulations!
You've successfully deployed your first smart contract on the ZKP blockchain! You now understand:
How to write basic Solidity code
How to compile and deploy contracts
How to interact with deployed contracts
The difference between reading and writing blockchain data
This is just the beginning. Smart contracts can power everything from simple games to complex financial systems. The ZKP testnet is your playground to experiment and learn without any risk.
Ready to build something more complex? Join our community and start exploring the endless possibilities of decentralized applications!
Buy Zero Knowledge Proof Coin Before It Hits the Market
Join the Auction

