hackquest logo
  • 学习
  • 课程探索
  • 实战
  • 探索黑客松
  • 往期项目
  • 社区
  • 论坛
  • 全球活动
  • 我的社区
  • 共学营
  • 组织中心
  • 更多
    • 词汇表
    • 博客
    • 水龙头
    • 工作机会
    • 媒体工具包
    • 创始人
hackquest logo

GasLiteBirth

GasLiteBirth — A minimal, gas-optimized Solidity smart contract that records its own creation details on-chain. Every deployment becomes a unique digital “birth certificate.”

技术栈

Web3

描述

# 🪶 GasLiteBirth

GasLiteBirth is a minimal, gas-optimized Solidity smart contract that records its own creation details on-chain.

Each deployment is unique — it stores the deployer’s address, block number, timestamp, and a unique “birth hash” fingerprint.

---

## 💡 Overview

This project demonstrates how a smart contract can self-document its own creation using blockchain metadata — all while remaining extremely gas-efficient.

Every time you deploy GasLiteBirth, it automatically:

- Records who deployed it creator)

- Logs when it was created birthTime)

- Captures which block it was born in birthBlock)

- Generates a unique fingerprint birthHash)

No inputs, no functions, no interaction required — just pure on-chain identity.

---

## ⚙️ Features

- Beginner-Friendly – Simple, readable Solidity.

- Unique Each Deployment – No two contracts have the same hash.

- Gas-Optimized – Uses immutable variables and compact types.

- Instantly Works – No user input or configuration required.

---

## 🧩 Smart Contract

```solidity

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.19;

/// @title GasLiteBirth - Minimal, gas-optimized contract that records its own creation info

/// @notice Demonstrates constructor use, immutables, and block metadata

contract GasLiteBirth {

// immutables use code storage instead of contract storage (cheaper gas)

address public immutable creator;

uint64 public immutable birthTime; // fits in 8 bytes (less gas)

uint64 public immutable birthBlock; // fits in 8 bytes

bytes32 public immutable birthHash; // unique fingerprint

constructor() {

creator = msg.sender;

birthTime = uint64(block.timestamp);

birthBlock = uint64(block.number);

// derive a unique fingerprint from deployer, time, and block number

birthHash = keccak256(

abi.encodePacked(msg.sender, block.timestamp, block.number)

);

}

}

本次黑客松进展

Built first smart contract
队长
CChandril Saha
项目链接
赛道
DAO