Achivements
he ReputationTracker smart contract is a simple yet powerful example of how blockchain technology can be used to store and manage user achievements in a transparent and decentralized way. It is design
説明
🏆 Reputation / Achievement Tracker
A simple Solidity smart contract that tracks user reputation points, achievements, and badges on-chain.
It introduces key Solidity concepts such as mappings, structs, arrays, and events.
📜 Description
The ReputationTracker contract allows users to:
Earn points for actions
Unlock achievements
Receive badges stored on-chain
Retrieve their entire reputation profile anytime
This is a great beginner-to-intermediate Solidity project to understand user data storage and interaction within a contract.
⚙️ Contract Details
Contract Name:
ReputationTrackerSolidity Version:
^0.8.0License: MIT
Contract Address - 0xb4c728e50ffB830F9ab5E01E17cacB9D1B76aE18 0xb4c728e50ffB830F9ab5E01E17cacB9D1B76aE18
💻 Contract Code
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract ReputationTracker {
struct User {
uint points;
uint achievements;
string[] badges;
}
mapping(address => User) public users;
event PointsAdded(address indexed user, uint newPoints);
event AchievementUnlocked(address indexed user, string badgeName);
function addPoints(uint _points) public {
users[msg.sender].points += _points;
emit PointsAdded(msg.sender, users[msg.sender].points);
}
function unlockBadge(string memory _badgeName) public {
users[msg.sender].achievements += 1;
users[msg.sender].badges.push(_badgeName);
emit AchievementUnlocked(msg.sender, _badgeName);
}
function getUser(address _user) public view returns (uint, uint, string[] memory) {
User storage user = users[_user];
return (user.points, user.achievements, user.badges);
}
}
🧠 Key Concepts
Concept | Description |
|---|---|
Struct | Combines multiple related variables (points, achievements, badges) into one type |
Mapping | Associates each user (address) with their |
Event | Emits logs for on-chain actions (like adding points or unlocking badges) |
Dynamic Array | Stores multiple badges for each user |
🚀 How to Use (Remix IDE)
Open Remix IDE
Create a new file named
ReputationTracker.solPaste the contract code above
Compile using Solidity
0.8.xDeploy the contract
Interact with the following functions:
Function | Description |
|---|---|
| Adds points to your account |
| Adds an achievement badge |
| Retrieves full user data (points, achievements, badges) |
🧩 Example Usage
Action | Input | Result |
|---|---|---|
| — |
|
| — |
|
| — | Returns |
🔥 Possible Extensions
Add a function to transfer reputation between users
Add admin-only access for awarding points
Add leaderboard logic for top users
Integrate with a frontend (React + Web3.js) for a gamified UI
ハッカソンの進行状況
Usage of GitHub and Flow
テックスタック
資金調達の状況
na