hackquest logo
  • 學習
  • 課程探索
  • 實戰
  • 黑客松探索
  • 往期項目
  • 社區
  • 論壇
  • 全球活動
  • 我的社區
  • 共學營
  • 組織中心
  • 更多
    • 詞彙表
    • 博客
    • 水龍頭
    • 工作機會
    • 媒體工具包
    • 創始人
hackquest logo

InteractionLogger

A simple Solidity smart contract that logs user interactions with blockchain timestamps and the user’s address.

技術堆疊

Web3
Solidity

描述

# 🧾 Interaction Logger Smart Contract

A simple Solidity smart contract that logs user interactions with blockchain timestamps and the user’s address.

It’s lightweight, easy to deploy, and perfect for learning how data logging works on Ethereum.

---

## 📍 Deployed Contract

Network: Remix Local VM / Testnet / Ethereum

Contract Address: 0xACe5E51066800099cEdD494F993E5A9472c26E61

> You can use this address to verify or interact with the deployed contract if it’s on a live testnet.

---

## 📜 Overview

The InteractionLogger contract allows users to store interactions permanently on-chain.

Each interaction includes:

- The user’s wallet address

- A custom message

- The timestamp when the interaction occurred

This is great for activity logs, event tracking, or transparency records on blockchain.

---

## ⚙️ Features

✅ Log interactions with your Ethereum address

✅ Store timestamps directly on-chain block.timestamp)

✅ Retrieve the total number of interactions logged

✅ Fetch specific interactions by index

✅ No imports, no constructor, and easy to deploy

---

## 🧠 Smart Contract Code

File: InteractionLogger.sol

```solidity

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.20;

contract InteractionLogger {

struct Interaction {

address user;

string message;

uint timestamp;

}

Interaction[] public interactions;

// Log an interaction

function logInteraction(string memory message) public {

interactions.push(Interaction({

user: msg.sender,

message: message,

timestamp: block.timestamp

}));

}

// Get total number of interactions

function getInteractionCount() public view returns (uint) {

return interactions.length;

}

// Get a specific interaction by index

function getInteraction(uint index) public view returns (address, string memory, uint) {

require(index < interactions.length, "Invalid index");

Interaction memory i = interactions[index];

return (i.user, i.message, i.timestamp);

}

}

黑客松進展

Stage 1 - Ideation round

籌資狀態

N/A
團隊負責人
AArmaandeep Singh
專案連結
行業
AI